New Setting to reset all PMS and the plex.tv connection

This commit is contained in:
tomkat83 2016-03-08 09:20:06 +01:00
parent fdc8f53131
commit 8e9b355473
5 changed files with 44 additions and 8 deletions

View file

@ -66,7 +66,7 @@ class Main:
'companion': entrypoint.plexCompanion, 'companion': entrypoint.plexCompanion,
'switchuser': entrypoint.switchPlexUser, 'switchuser': entrypoint.switchPlexUser,
'deviceid': entrypoint.resetDeviceId, 'deviceid': entrypoint.resetDeviceId,
'doPlexTvLogin': entrypoint.doPlexTvLogin 'reConnect': entrypoint.reConnect
} }
if "/extrafanart" in sys.argv[0]: if "/extrafanart" in sys.argv[0]:

View file

@ -362,7 +362,7 @@
<string id="39021">[COLOR yellow]Sync Emby Theme Media to Kodi[/COLOR]</string> <string id="39021">[COLOR yellow]Sync Emby Theme Media to Kodi[/COLOR]</string>
<string id="39022"> (local)</string> <string id="39022"> (local)</string>
<string id="39023">Failed to authenticate. Did you login to plex.tv?</string> <string id="39023">Failed to authenticate. Did you login to plex.tv?</string>
<string id="39024">[COLOR yellow]Log into plex.tv[/COLOR]</string> <string id="39024">[COLOR yellow]Reset PMS and plex.tv connections to re-login[/COLOR]</string>
<string id="39025">Automatically log into plex.tv on startup</string> <string id="39025">Automatically log into plex.tv on startup</string>
<string id="39026">Enable constant background sync (restart Kodi!)</string> <string id="39026">Enable constant background sync (restart Kodi!)</string>
@ -375,6 +375,8 @@
<string id="39204">Perform manual library sync</string> <string id="39204">Perform manual library sync</string>
<string id="39205">Unable to run the sync, the add-on is not connected to a Plex server.</string> <string id="39205">Unable to run the sync, the add-on is not connected to a Plex server.</string>
<string id="39206">Plex might lock your account if you fail to log in too many times. Proceed anyway?</string> <string id="39206">Plex might lock your account if you fail to log in too many times. Proceed anyway?</string>
<string id="39207">Reseting PMS connections, please wait. Test: עޥ</string>
<string id="39208">Failed to reset PMS and plex.tv connects. Try to restart Kodi.</string>
<!-- Plex Artwork.py --> <!-- Plex Artwork.py -->

View file

@ -293,7 +293,7 @@
<string id="39021">[COLOR yellow]Plex Themes zu Kodi synchronisieren[/COLOR]</string> <string id="39021">[COLOR yellow]Plex Themes zu Kodi synchronisieren[/COLOR]</string>
<string id="39022"> (lokal)</string> <string id="39022"> (lokal)</string>
<string id="39023">Plex Media Server Authentifizierung fehlgeschlagen. Haben Sie sich bei plex.tv eingeloggt?</string> <string id="39023">Plex Media Server Authentifizierung fehlgeschlagen. Haben Sie sich bei plex.tv eingeloggt?</string>
<string id="39024">[COLOR yellow]Bei plex.tv einloggen[/COLOR]</string> <string id="39024">[COLOR yellow]PMS und plex.tv Verbindungen zurücksetzen für erneuten Login[/COLOR]</string>
<string id="39025">Automatisch beim Starten bei plex.tv einloggen</string> <string id="39025">Automatisch beim Starten bei plex.tv einloggen</string>
<string id="39026">Laufende Synchronisierung im Hintergrund aktivieren (Neustart!)</string> <string id="39026">Laufende Synchronisierung im Hintergrund aktivieren (Neustart!)</string>
@ -305,6 +305,10 @@
<string id="39204">Manuellen Scan der Plex Bibliotheken starten</string> <string id="39204">Manuellen Scan der Plex Bibliotheken starten</string>
<string id="39205">Plex Bibliothek kann nicht gescannt werden, da keine Verbindung mit einem Plex Server besteht.</string> <string id="39205">Plex Bibliothek kann nicht gescannt werden, da keine Verbindung mit einem Plex Server besteht.</string>
<string id="39206">Plex könnte möglicherweise Ihren Account sperren, wenn Sie zu oft versuchen, sich erfolglos anzumelden. Trotzdem fortfahren?</string> <string id="39206">Plex könnte möglicherweise Ihren Account sperren, wenn Sie zu oft versuchen, sich erfolglos anzumelden. Trotzdem fortfahren?</string>
<string id="39207">PMS Verbindungen werden zurückgesetzt</string>
<string id="39208">PMS und plex.tv Verbindungen konnten nicht zurückgesetzt werden. Bitte versuchen Sie, Kodi neu zu starten, um das Problem zu beheben.</string>
<!-- Plex Artwork.py --> <!-- Plex Artwork.py -->
<string id="39250">Alle Plex Bilder in Kodi zwischenzuspeichern kann sehr lange dauern. Möchten Sie wirklich fortfahren?</string> <string id="39250">Alle Plex Bilder in Kodi zwischenzuspeichern kann sehr lange dauern. Möchten Sie wirklich fortfahren?</string>

View file

@ -72,18 +72,48 @@ def plexCompanion(fullurl, params):
title, "Not knowing what to do for now - no playQueue sent", -1) title, "Not knowing what to do for now - no playQueue sent", -1)
def doPlexTvLogin(): def reConnect():
""" """
Triggers login to plex.tv Triggers login to plex.tv and re-authorization
""" """
string = xbmcaddon.Addon().getLocalizedString
utils.logMsg("entrypoint reConnect",
"Connection resets requested", 0)
# Pause library sync thread - user needs to be auth in order to sync
utils.window('suspend_LibraryThread', value='true')
# Suspend the user client during procedure # Suspend the user client during procedure
utils.window('suspend_Userclient', value='true') utils.window('suspend_Userclient', value='true')
dialog = xbmcgui.Dialog()
dialog.notification(
heading=addonName,
message=string(39207),
icon="special://home/addons/plugin.video.plexkodiconnect/icon.png",
sound=False)
# Wait max for 20 seconds for all lib scans to finish
counter = 0
while utils.window('emby_dbScan') == 'true':
xbmc.sleep(1000)
counter += 1
if counter > 20:
dialog.ok(
heading=addonName,
message=string(39208).encode('utf-8'),
)
# Resuming threads, just in case
utils.window('suspend_LibraryThread', clear=True)
utils.window('suspend_Userclient', clear=True)
# Abort reConnection
return
import initialsetup import initialsetup
initialsetup.InitialSetup().setup(forcePlexTV=True) initialsetup.InitialSetup().setup(forcePlexTV=True)
utils.logMsg("PLEX", "Reset login attempts.", 1) # Log out currently signed in user:
utils.window('emby_serverStatus', value="Auth") utils.window('emby_serverStatus', value="401")
# Restart user client # Restart user client
utils.window('suspend_Userclient', clear=True) utils.window('suspend_Userclient', clear=True)
# Request lib sync to get user view data (e.g. watched/unwatched)
utils.window('plex_runLibScan', value='full')
def PassPlaylist(xml, resume=None): def PassPlaylist(xml, resume=None):

View file

@ -21,12 +21,12 @@
<setting label="30517" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect?mode=passwords)" option="close" /><!-- Network credentials --> <setting label="30517" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect?mode=passwords)" option="close" /><!-- Network credentials -->
<setting id="accessToken" type="text" visible="false" default="" /> <setting id="accessToken" type="text" visible="false" default="" />
<setting id="pathsub" type="bool" visible="false" default="false" /> <setting id="pathsub" type="bool" visible="false" default="false" />
<setting id="reConnect" label="39024" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect?mode=reConnect)" option="close" />
</category> </category>
<category label="plex.tv"><!-- plex.tv --> <category label="plex.tv"><!-- plex.tv -->
<!-- Primary address --> <!-- Primary address -->
<setting id="myplexlogin" label="39025" type="bool" default="true" /> <!-- Log into plex.tv on startup --> <setting id="myplexlogin" label="39025" type="bool" default="true" /> <!-- Log into plex.tv on startup -->
<setting id="doPlexTvLogin" label="39024" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect?mode=doPlexTvLogin)" option="close" />
<setting id="plexLogin" label="plex.tv username" type="text" default="" visible="false" /> <setting id="plexLogin" label="plex.tv username" type="text" default="" visible="false" />
<setting id="plexhome" label="Plex home in use" type="bool" default="" visible="false" /> <setting id="plexhome" label="Plex home in use" type="bool" default="" visible="false" />