def getAutoSource():
# If the VPN has changed, then reset all the numbers
addon = xbmcaddon.Addon("service.vpn.manager")
last_vpn = addon.getSetting("ip_service_last_vpn")
current_vpn = addon.getSetting("vpn_provider_validated")
if (not last_vpn == current_vpn):
addon.setSetting("ip_service_last_vpn", current_vpn)
resetIPServices()
# Get the last source we tried to use from the home window or use the first if this is first time through
source = xbmcgui.Window(10000).getProperty("VPN_Manager_Last_IP_Service")
if source == "":
# Record that we're using the first one
xbmcgui.Window(10000).setProperty("VPN_Manager_Last_IP_Service", ip_sources[1])
return ip_sources[1]
else:
index = ip_sources.index(source)
if index > 1:
if getWorkingValue(index) >= getErrorValue(index - 1):
setWorkingValue(index, 0)
index = index - 1
return ip_sources[index]
评论列表
文章目录