Added reset auth option to settings
This commit is contained in:
parent
3dcfb794c6
commit
1acfd78cdf
3 changed files with 21 additions and 7 deletions
10
default.py
10
default.py
|
@ -44,8 +44,18 @@ if mode == "play" or mode == "playfromaddon":
|
||||||
item = PlaybackUtils().PLAY(result, setup="default")
|
item = PlaybackUtils().PLAY(result, setup="default")
|
||||||
|
|
||||||
elif mode == "reset":
|
elif mode == "reset":
|
||||||
|
# User reset local Kodi db
|
||||||
utils.reset()
|
utils.reset()
|
||||||
|
|
||||||
|
elif mode == "resetauth":
|
||||||
|
# User tried login and failed too many times
|
||||||
|
resp = xbmcgui.Dialog().yesno("Warning", "Emby might lock your account if you fail to log in too many times. Proceed anyway?")
|
||||||
|
if resp == 1:
|
||||||
|
xbmc.log("Reset login attempts.")
|
||||||
|
WINDOW.setProperty("Server_status", "Auth")
|
||||||
|
else:
|
||||||
|
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
|
||||||
|
|
||||||
|
|
||||||
elif mode == "nextup":
|
elif mode == "nextup":
|
||||||
#if the addon is called with nextup parameter, we return the nextepisodes list of the given tagname
|
#if the addon is called with nextup parameter, we return the nextepisodes list of the given tagname
|
||||||
|
|
|
@ -116,7 +116,7 @@ class UserClient(threading.Thread):
|
||||||
|
|
||||||
username = self.getUsername()
|
username = self.getUsername()
|
||||||
w_token = self.WINDOW.getProperty('accessToken%s' % username)
|
w_token = self.WINDOW.getProperty('accessToken%s' % username)
|
||||||
s_token = self.addon.getSetting('accessToken%s' % username)
|
s_token = self.addon.getSetting('accessToken')
|
||||||
|
|
||||||
# Verify the window property
|
# Verify the window property
|
||||||
if (w_token != ""):
|
if (w_token != ""):
|
||||||
|
@ -272,7 +272,7 @@ class UserClient(threading.Thread):
|
||||||
if (result != None and accessToken != None):
|
if (result != None and accessToken != None):
|
||||||
self.currUser = username
|
self.currUser = username
|
||||||
userId = result[u'User'][u'Id']
|
userId = result[u'User'][u'Id']
|
||||||
addon.setSetting("accessToken%s" % username, accessToken)
|
addon.setSetting("accessToken", accessToken)
|
||||||
addon.setSetting("userId%s" % username, userId)
|
addon.setSetting("userId%s" % username, userId)
|
||||||
self.logMsg("User Authenticated: %s" % accessToken)
|
self.logMsg("User Authenticated: %s" % accessToken)
|
||||||
self.loadCurrUser()
|
self.loadCurrUser()
|
||||||
|
@ -281,15 +281,16 @@ class UserClient(threading.Thread):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
self.logMsg("User authentication failed.")
|
self.logMsg("User authentication failed.")
|
||||||
addon.setSetting("accessToken%s" % username, "")
|
addon.setSetting("accessToken", "")
|
||||||
addon.setSetting("userId%s" % username, "")
|
addon.setSetting("userId%s" % username, "")
|
||||||
xbmcgui.Dialog().ok("Error connecting", "Invalid username or password.")
|
xbmcgui.Dialog().ok("Error connecting", "Invalid username or password.")
|
||||||
|
|
||||||
# Give two attempts at entering password
|
# Give two attempts at entering password
|
||||||
self.retry += 1
|
self.retry += 1
|
||||||
if self.retry == 2:
|
if self.retry == 2:
|
||||||
self.logMsg("Too many retries. Please restart Kodi.")
|
self.logMsg("Too many retries. You can retry by selecting the option in the addon settings.")
|
||||||
self.WINDOW.setProperty("Server_status", "Stop")
|
self.WINDOW.setProperty("Server_status", "Stop")
|
||||||
|
xbmcgui.Dialog().ok("Error connecting", "Failed to authenticate too many times. You can retry by selecting the option in the addon settings.")
|
||||||
|
|
||||||
self.auth = False
|
self.auth = False
|
||||||
return
|
return
|
||||||
|
|
|
@ -3,13 +3,16 @@
|
||||||
<category label="30014"> <!-- Emby -->
|
<category label="30014"> <!-- Emby -->
|
||||||
<setting id="ipaddress" type="text" label="30000" default="" visible="true" enable="true" />
|
<setting id="ipaddress" type="text" label="30000" default="" visible="true" enable="true" />
|
||||||
<setting id="port" type="text" label="30030" default="8096" visible="true" enable="true" />
|
<setting id="port" type="text" label="30030" default="8096" visible="true" enable="true" />
|
||||||
<setting id="username" type="text" label="30024" />
|
<setting id="username" type="text" label="30024" default="" />
|
||||||
<setting type="sep" />
|
<setting type="sep" />
|
||||||
<setting id="https" type="bool" label="30243" visible="true" enable="true" default="false" />
|
<setting id="https" type="bool" label="30243" visible="true" enable="true" default="false" />
|
||||||
<setting id="sslverify" type="bool" label="Verify Host SSL Certificate" visible="eq(-1,true)" enable="true" default="false" />
|
<setting id="sslverify" type="bool" label="Verify Host SSL Certificate" visible="eq(-1,true)" enable="true" default="false" />
|
||||||
<setting id="sslcert" type="file" label="Client SSL certificate" visible="eq(-2,true)" enable="true" default="None" />
|
<setting id="sslcert" type="file" label="Client SSL certificate" visible="eq(-2,true)" enable="true" default="None" />
|
||||||
<setting type="sep" />
|
<setting type="sep" />
|
||||||
<setting id="deviceName" type="text" label="30016" default="Kodi" />
|
<setting id="deviceName" type="text" label="30016" default="Kodi" />
|
||||||
|
<setting type="sep" />
|
||||||
|
<setting id="accessToken" type="text" visible="false" default="" />
|
||||||
|
<setting label="[COLOR yellow]Reset login attempts[/COLOR]" type="action" visible="!eq(-1,'') + !eq(-9,)" enable="true" action="RunPlugin(plugin://plugin.video.emby?mode=resetauth)" option="close" />
|
||||||
</category>
|
</category>
|
||||||
<category label="Sync Options">
|
<category label="Sync Options">
|
||||||
<!-- <setting id="syncMovieBoxSets" type="bool" label="30238" default="true" visible="true" enable="true" /> -->
|
<!-- <setting id="syncMovieBoxSets" type="bool" label="30238" default="true" visible="true" enable="true" /> -->
|
||||||
|
@ -21,8 +24,8 @@
|
||||||
<setting id="autoPlaySeason" type="bool" label="30216" default="false" visible="true" enable="true" />
|
<setting id="autoPlaySeason" type="bool" label="30216" default="false" visible="true" enable="true" />
|
||||||
<setting type="sep" />
|
<setting type="sep" />
|
||||||
<setting id="playFromStream" type="bool" label="30002" visible="true" enable="true" default="false" />
|
<setting id="playFromStream" type="bool" label="30002" visible="true" enable="true" default="false" />
|
||||||
<setting id="videoBitRate" type="enum" label="30160" values="664 Kbps SD|996 Kbps HD|1.3 Mbps HD|2.0 Mbps HD|3.2 Mbps HD|4.7 Mbps HD|6.2 Mbps HD|7.7 Mbps HD|9.2 Mbps HD|10.7 Mbps HD|12.2 Mbps HD|13.7 Mbps HD|15.2 Mbps HD|16.7 Mbps HD|18.2 Mbps HD|20.0 Mbps HD|40.0 Mbps HD|100.0 Mbps HD [default]|1000.0 Mbps HD" default="17" />
|
<setting id="videoBitRate" type="enum" label="30160" values="664 Kbps SD|996 Kbps HD|1.3 Mbps HD|2.0 Mbps HD|3.2 Mbps HD|4.7 Mbps HD|6.2 Mbps HD|7.7 Mbps HD|9.2 Mbps HD|10.7 Mbps HD|12.2 Mbps HD|13.7 Mbps HD|15.2 Mbps HD|16.7 Mbps HD|18.2 Mbps HD|20.0 Mbps HD|40.0 Mbps HD|100.0 Mbps HD [default]|1000.0 Mbps HD" visible="eq(-1,true)" default="17" />
|
||||||
<setting id="forceTranscodingCodecs" type="text" label="30245" />
|
<setting id="forceTranscodingCodecs" type="text" label="30245" visible="eq(-2,true)" />
|
||||||
</category>
|
</category>
|
||||||
<category label="Artwork">
|
<category label="Artwork">
|
||||||
<setting id="disableCoverArt" type="bool" label="30157" default="false" visible="true" enable="true" />
|
<setting id="disableCoverArt" type="bool" label="30157" default="false" visible="true" enable="true" />
|
||||||
|
|
Loading…
Reference in a new issue