Devin Dixon
Devin Dixon

Reputation: 12373

kodi python mac address returns busy

Weird issue, I am on my mac trying to get my mac address but when I print it out, it says "Busy". My code is as follows:

import sys
from urllib import urlencode
from urlparse import parse_qsl
import xbmcaddon
import xbmcgui
import xbmcplugin
import xbmc
import requests

addon       = xbmcaddon.Addon()
addonname   = addon.getAddonInfo('name')
mac_address = xbmc.getInfoLabel("network.macaddress")

print(mac_address)

Should I be getting my mac address a different way?

Upvotes: 0

Views: 673

Answers (1)

Aqib Bangash
Aqib Bangash

Reputation: 961

KODI takes a few seconds to read the MAC Address. You may notice, when you view Network Settings, it will show Busy for until the MAC Address has been received. I ran a scheduler and which checks the MAC again & again until it is not equal to 'Busy'

repeatGap = 5
scheduler = sched.scheduler(time.time, time.sleep)

def checkMac(sc):
    mac_address = xbmc.getInfoLabel("network.macaddress")

    if mac_address!="Busy":
        LOGIN(mac_address,True)
    else:
        scheduler.enter(repeatGap, 1, checkMac, (sc,))

scheduler.enter(0, 1, checkMac, (s,))
scheduler.run()

Upvotes: 0

Related Questions