Merge commit 'a4673b03777322ebed8acf665b399c8219276544'
This commit is contained in:
commit
e7349f5c12
13 changed files with 152 additions and 80 deletions
|
@ -145,14 +145,14 @@
|
||||||
|
|
||||||
<!-- Video nodes -->
|
<!-- Video nodes -->
|
||||||
<string id="30170">Recently Added TV Shows</string><!-- Verified -->
|
<string id="30170">Recently Added TV Shows</string><!-- Verified -->
|
||||||
<string id="30171">On Deck TV Shows</string><!-- Verified -->
|
<string id="30171">In Progress TV Shows</string><!-- Verified -->
|
||||||
<string id="30172">All Music</string>
|
<string id="30172">All Music</string>
|
||||||
<string id="30173">Channels</string><!-- Verified -->
|
<string id="30173">Channels</string><!-- Verified -->
|
||||||
<string id="30174">Recently Added Movies</string><!-- Verified -->
|
<string id="30174">Recently Added Movies</string><!-- Verified -->
|
||||||
<string id="30175">Recently Added Episodes</string><!-- Verified -->
|
<string id="30175">Recently Added Episodes</string><!-- Verified -->
|
||||||
<string id="30176">Recently Added Albums</string>
|
<string id="30176">Recently Added Albums</string>
|
||||||
<string id="30177">On Deck Movies</string><!-- Verified -->
|
<string id="30177">In Progress Movies</string><!-- Verified -->
|
||||||
<string id="30178">On Deck Episodes</string><!-- Verified -->
|
<string id="30178">In Progress Episodes</string><!-- Verified -->
|
||||||
<string id="30179">Next Episodes</string><!-- Verified -->
|
<string id="30179">Next Episodes</string><!-- Verified -->
|
||||||
<string id="30180">Favorite Movies</string><!-- Verified -->
|
<string id="30180">Favorite Movies</string><!-- Verified -->
|
||||||
<string id="30181">Favorite Shows</string><!-- Verified -->
|
<string id="30181">Favorite Shows</string><!-- Verified -->
|
||||||
|
@ -277,7 +277,7 @@
|
||||||
<string id="30512">Force artwork caching</string>
|
<string id="30512">Force artwork caching</string>
|
||||||
<string id="30513">Limit artwork cache threads (recommended for rpi)</string>
|
<string id="30513">Limit artwork cache threads (recommended for rpi)</string>
|
||||||
<string id="30514">Enable fast startup (requires server plugin)</string>
|
<string id="30514">Enable fast startup (requires server plugin)</string>
|
||||||
<string id="30515">Maximum items to request from the server at once</string>
|
<string id="30515">Maximum items to request from the server at once (restart!)</string>
|
||||||
<string id="30516">Playback</string>
|
<string id="30516">Playback</string>
|
||||||
<string id="30517">[COLOR yellow]Enter network credentials[/COLOR]</string>
|
<string id="30517">[COLOR yellow]Enter network credentials[/COLOR]</string>
|
||||||
<string id="30518">Enable Plex Trailers (Plexpass is needed)</string>
|
<string id="30518">Enable Plex Trailers (Plexpass is needed)</string>
|
||||||
|
@ -379,6 +379,7 @@
|
||||||
<string id="39207">Reseting PMS connections, please wait</string>
|
<string id="39207">Reseting PMS connections, please wait</string>
|
||||||
<string id="39208">Failed to reset PMS and plex.tv connects. Try to restart Kodi.</string>
|
<string id="39208">Failed to reset PMS and plex.tv connects. Try to restart Kodi.</string>
|
||||||
<string id="39209">[COLOR yellow]Log-in to plex.tv[/COLOR]</string>
|
<string id="39209">[COLOR yellow]Log-in to plex.tv[/COLOR]</string>
|
||||||
|
<string id="39210">Not yet connected to Plex Server</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- Plex Artwork.py -->
|
<!-- Plex Artwork.py -->
|
||||||
|
@ -408,6 +409,6 @@
|
||||||
<string id="39405">Plex playlists/nodes refreshed</string>
|
<string id="39405">Plex playlists/nodes refreshed</string>
|
||||||
<string id="39406">Plex playlists/nodes refresh failed</string>
|
<string id="39406">Plex playlists/nodes refresh failed</string>
|
||||||
<string id="39407">Full library sync finished</string>
|
<string id="39407">Full library sync finished</string>
|
||||||
<string id="39408">Sync had to skip some items because they could not be processed. Please post your Kodi logs to the Plex forum.</string>
|
<string id="39408">Sync had to skip some items because they could not be processed. Kodi may be instable now!! Please post your Kodi logs to the Plex forum.</string>
|
||||||
|
|
||||||
</strings>
|
</strings>
|
||||||
|
|
|
@ -173,14 +173,14 @@
|
||||||
<string id="30169">Addresse : </string>
|
<string id="30169">Addresse : </string>
|
||||||
|
|
||||||
<string id="30170">Zuletzt hinzugefügte Serien</string>
|
<string id="30170">Zuletzt hinzugefügte Serien</string>
|
||||||
<string id="30171">Aktuell Serien</string>
|
<string id="30171">Begonnene Serien</string>
|
||||||
<string id="30172">Alles an Musik</string>
|
<string id="30172">Alles an Musik</string>
|
||||||
<string id="30173">Kanäle</string>
|
<string id="30173">Kanäle</string>
|
||||||
<string id="30174">Zuletzt hinzugefügte Filme</string>
|
<string id="30174">Zuletzt hinzugefügte Filme</string>
|
||||||
<string id="30175">Zuletzt hinzugefügte Episoden</string>
|
<string id="30175">Zuletzt hinzugefügte Episoden</string>
|
||||||
<string id="30176">Zuletzt hinzugefügte Alben</string>
|
<string id="30176">Zuletzt hinzugefügte Alben</string>
|
||||||
<string id="30177">Aktuelle Filme</string>
|
<string id="30177">Begonnene Filme</string>
|
||||||
<string id="30178">Aktuelle Episoden</string>
|
<string id="30178">Begonnene Episoden</string>
|
||||||
<string id="30179">Nächste Episoden</string>
|
<string id="30179">Nächste Episoden</string>
|
||||||
<string id="30180">Favorisierte Filme</string>
|
<string id="30180">Favorisierte Filme</string>
|
||||||
<string id="30181">Favorisierte Serien</string>
|
<string id="30181">Favorisierte Serien</string>
|
||||||
|
@ -252,6 +252,8 @@
|
||||||
<string id="30249">Unterdrücke Server-Verbindungsmeldungen beim Starten</string>
|
<string id="30249">Unterdrücke Server-Verbindungsmeldungen beim Starten</string>
|
||||||
<string id="30250">Benutze lokale Pfade anstelle von Addon-Umleitungen beim Abspielen</string>
|
<string id="30250">Benutze lokale Pfade anstelle von Addon-Umleitungen beim Abspielen</string>
|
||||||
|
|
||||||
|
<string id="30515">Max. Anzahl gleichzeitig nachgefragter PMS Einträge (Neustart!)</string>
|
||||||
|
|
||||||
<string id="33010">Plex Media Server Authorisierung ist zu häufig fehlgeschlagen. In den Einstellungen können die Anzahl erfolgloser Versuche zurückgesetzt werden.</string>
|
<string id="33010">Plex Media Server Authorisierung ist zu häufig fehlgeschlagen. In den Einstellungen können die Anzahl erfolgloser Versuche zurückgesetzt werden.</string>
|
||||||
|
|
||||||
<!-- Default views -->
|
<!-- Default views -->
|
||||||
|
@ -310,8 +312,7 @@
|
||||||
<string id="39207">PMS Verbindungen werden zurückgesetzt</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>
|
<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>
|
||||||
<string id="39209">[COLOR yellow]Bei plex.tv einloggen[/COLOR]</string>
|
<string id="39209">[COLOR yellow]Bei plex.tv einloggen[/COLOR]</string>
|
||||||
|
<string id="39210">Noch nicht mit Plex Server verbunden</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>
|
||||||
|
@ -340,6 +341,6 @@
|
||||||
<string id="39405">Plex Playlisten/Nodes aktualisiert</string>
|
<string id="39405">Plex Playlisten/Nodes aktualisiert</string>
|
||||||
<string id="39406">Plex Playlisten/Nodes Aktualisierung fehlgeschlagen</string>
|
<string id="39406">Plex Playlisten/Nodes Aktualisierung fehlgeschlagen</string>
|
||||||
<string id="39407">Plex Bibliotheken aktualisiert</string>
|
<string id="39407">Plex Bibliotheken aktualisiert</string>
|
||||||
<string id="39408">Einige Plex Einträge mussten übersprungen werden, da sie nicht verarbeitet werden konnten. Bitte teilen Sie Ihr Kodi log im Plex Forum.</string>
|
<string id="39408">Einige Plex Einträge mussten übersprungen werden, da sie nicht verarbeitet werden konnten. Kodi ist nun möglicherweise instabil!! Bitte teilen Sie Ihr Kodi log im Plex Forum.</string>
|
||||||
|
|
||||||
</strings>
|
</strings>
|
||||||
|
|
|
@ -1056,8 +1056,6 @@ class PlexAPI():
|
||||||
self.logMsg("No URL for user avatar.", 1)
|
self.logMsg("No URL for user avatar.", 1)
|
||||||
return False
|
return False
|
||||||
for user in users:
|
for user in users:
|
||||||
self.logMsg('type user: %s, type username: %s'
|
|
||||||
% (type(user['title']), type(username)))
|
|
||||||
if username in user['title']:
|
if username in user['title']:
|
||||||
url = user['thumb']
|
url = user['thumb']
|
||||||
self.logMsg("Avatar url for user %s is: %s" % (username, url), 1)
|
self.logMsg("Avatar url for user %s is: %s" % (username, url), 1)
|
||||||
|
@ -2092,7 +2090,7 @@ class API():
|
||||||
allartworks['Backdrop'].append(background)
|
allartworks['Backdrop'].append(background)
|
||||||
|
|
||||||
if not allartworks['Primary']:
|
if not allartworks['Primary']:
|
||||||
primary = item['parentThumb']
|
primary = item.get('parentThumb')
|
||||||
if primary:
|
if primary:
|
||||||
primary = "%s%s" % (self.server, primary)
|
primary = "%s%s" % (self.server, primary)
|
||||||
primary = self.addPlexCredentialsToUrl(primary)
|
primary = self.addPlexCredentialsToUrl(primary)
|
||||||
|
|
|
@ -84,12 +84,12 @@ class PlexCompanion(threading.Thread):
|
||||||
self.logMsg("Client is still registered", 1)
|
self.logMsg("Client is still registered", 1)
|
||||||
else:
|
else:
|
||||||
self.logMsg("Client is no longer registered", 1)
|
self.logMsg("Client is no longer registered", 1)
|
||||||
self.logMsg("PlexBMC Helper still running on port %s"
|
self.logMsg("Plex Companion still running on port %s"
|
||||||
% self.port, 1)
|
% self.port, 1)
|
||||||
message_count = 0
|
message_count = 0
|
||||||
|
|
||||||
if not is_running:
|
if not is_running:
|
||||||
self.logMsg("PleXBMC Helper has started", 0)
|
self.logMsg("Plex Companion has started", 0)
|
||||||
is_running = True
|
is_running = True
|
||||||
|
|
||||||
subscribers.subMgr.notify()
|
subscribers.subMgr.notify()
|
||||||
|
@ -106,4 +106,4 @@ class PlexCompanion(threading.Thread):
|
||||||
finally:
|
finally:
|
||||||
httpd.socket.close()
|
httpd.socket.close()
|
||||||
requests.dumpConnections()
|
requests.dumpConnections()
|
||||||
self.logMsg("----===## STOP PlexBMC Helper ##===----", 0)
|
self.logMsg("----===## STOP Plex Companion ##===----", 0)
|
||||||
|
|
|
@ -3,7 +3,7 @@ from urllib import urlencode
|
||||||
from ast import literal_eval
|
from ast import literal_eval
|
||||||
from urlparse import urlparse, parse_qs
|
from urlparse import urlparse, parse_qs
|
||||||
import re
|
import re
|
||||||
import time
|
from copy import deepcopy
|
||||||
|
|
||||||
from xbmcaddon import Addon
|
from xbmcaddon import Addon
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ def GetPlexMetadata(key):
|
||||||
return xml
|
return xml
|
||||||
|
|
||||||
|
|
||||||
def GetAllPlexChildren(key):
|
def GetAllPlexChildren(key, containerSize=None):
|
||||||
"""
|
"""
|
||||||
Returns a list (raw xml API dump) of all Plex children for the key.
|
Returns a list (raw xml API dump) of all Plex children for the key.
|
||||||
(e.g. /library/metadata/194853/children pointing to a season)
|
(e.g. /library/metadata/194853/children pointing to a season)
|
||||||
|
@ -193,18 +193,11 @@ def GetAllPlexChildren(key):
|
||||||
Input:
|
Input:
|
||||||
key Key to a Plex item, e.g. 12345
|
key Key to a Plex item, e.g. 12345
|
||||||
"""
|
"""
|
||||||
xml = downloadutils.DownloadUtils().downloadUrl(
|
url = "{server}/library/metadata/%s/children?" % key
|
||||||
"{server}/library/metadata/%s/children" % key)
|
return DownloadChunks(url, containerSize)
|
||||||
try:
|
|
||||||
xml.attrib
|
|
||||||
except AttributeError:
|
|
||||||
logMsg(
|
|
||||||
title, "Error retrieving all children for Plex item %s" % key, -1)
|
|
||||||
xml = None
|
|
||||||
return xml
|
|
||||||
|
|
||||||
|
|
||||||
def GetPlexSectionResults(viewId, args=None):
|
def GetPlexSectionResults(viewId, args=None, containerSize=None):
|
||||||
"""
|
"""
|
||||||
Returns a list (XML API dump) of all Plex items in the Plex
|
Returns a list (XML API dump) of all Plex items in the Plex
|
||||||
section with key = viewId.
|
section with key = viewId.
|
||||||
|
@ -214,26 +207,76 @@ def GetPlexSectionResults(viewId, args=None):
|
||||||
|
|
||||||
Returns None if something went wrong
|
Returns None if something went wrong
|
||||||
"""
|
"""
|
||||||
result = []
|
url = "{server}/library/sections/%s/all?" % viewId
|
||||||
url = "{server}/library/sections/%s/all" % viewId
|
|
||||||
if args:
|
if args:
|
||||||
url += "?" + urlencode(args)
|
url += urlencode(args) + '&'
|
||||||
|
return DownloadChunks(url, containerSize)
|
||||||
result = downloadutils.DownloadUtils().downloadUrl(url)
|
|
||||||
|
|
||||||
try:
|
|
||||||
result.tag
|
|
||||||
# Nope, not an XML, abort
|
|
||||||
except AttributeError:
|
|
||||||
logMsg(title,
|
|
||||||
"Error retrieving all items for Plex section %s"
|
|
||||||
% viewId, -1)
|
|
||||||
result = None
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def GetAllPlexLeaves(viewId, lastViewedAt=None, updatedAt=None):
|
def DownloadChunks(url, containerSize):
|
||||||
|
"""
|
||||||
|
Downloads PMS url in chunks of containerSize (int).
|
||||||
|
If containerSize is None: ONE xml is fetched directly
|
||||||
|
|
||||||
|
url MUST end with '?' (if no other url encoded args are present) or '&'
|
||||||
|
|
||||||
|
Returns a stitched-together xml or None.
|
||||||
|
"""
|
||||||
|
if containerSize is None:
|
||||||
|
# Get rid of '?' or '&' at the end of url
|
||||||
|
xml = downloadutils.DownloadUtils().downloadUrl(url[:-1])
|
||||||
|
try:
|
||||||
|
xml.attrib
|
||||||
|
except AttributeError:
|
||||||
|
# Nope, not an XML, abort
|
||||||
|
logMsg(title, "Error getting url %s" % url[:-1], -1)
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return xml
|
||||||
|
|
||||||
|
xml = None
|
||||||
|
pos = 0
|
||||||
|
errorCounter = 0
|
||||||
|
while errorCounter < 10:
|
||||||
|
args = {
|
||||||
|
'X-Plex-Container-Size': containerSize,
|
||||||
|
'X-Plex-Container-Start': pos
|
||||||
|
}
|
||||||
|
xmlpart = downloadutils.DownloadUtils().downloadUrl(
|
||||||
|
url + urlencode(args))
|
||||||
|
# If something went wrong - skip in the hope that it works next time
|
||||||
|
try:
|
||||||
|
xmlpart.attrib
|
||||||
|
except AttributeError:
|
||||||
|
logMsg(title, 'Error while downloading chunks: %s'
|
||||||
|
% (url + urlencode(args)), -1)
|
||||||
|
pos += containerSize
|
||||||
|
errorCounter += 1
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Very first run: starting xml (to retain data in xml's root!)
|
||||||
|
if xml is None:
|
||||||
|
xml = deepcopy(xmlpart)
|
||||||
|
if len(xmlpart) < containerSize:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
pos += containerSize
|
||||||
|
continue
|
||||||
|
# Build answer xml - containing the entire library
|
||||||
|
for child in xmlpart:
|
||||||
|
xml.append(child)
|
||||||
|
# Done as soon as we don't receive a full complement of items
|
||||||
|
if len(xmlpart) < containerSize:
|
||||||
|
break
|
||||||
|
pos += containerSize
|
||||||
|
if errorCounter == 10:
|
||||||
|
logMsg(title, 'Fatal error while downloading chunks for %s' % url, -1)
|
||||||
|
return None
|
||||||
|
return xml
|
||||||
|
|
||||||
|
|
||||||
|
def GetAllPlexLeaves(viewId, lastViewedAt=None, updatedAt=None,
|
||||||
|
containerSize=None):
|
||||||
"""
|
"""
|
||||||
Returns a list (raw XML API dump) of all Plex subitems for the key.
|
Returns a list (raw XML API dump) of all Plex subitems for the key.
|
||||||
(e.g. /library/sections/2/allLeaves pointing to all TV shows)
|
(e.g. /library/sections/2/allLeaves pointing to all TV shows)
|
||||||
|
@ -244,6 +287,7 @@ def GetAllPlexLeaves(viewId, lastViewedAt=None, updatedAt=None):
|
||||||
since that point of time until now.
|
since that point of time until now.
|
||||||
updatedAt Unix timestamp; only retrieves PMS items updated
|
updatedAt Unix timestamp; only retrieves PMS items updated
|
||||||
by the PMS since that point of time until now.
|
by the PMS since that point of time until now.
|
||||||
|
containerSize Number of items simultaneously fetched from PMS
|
||||||
|
|
||||||
If lastViewedAt and updatedAt=None, ALL PMS items are returned.
|
If lastViewedAt and updatedAt=None, ALL PMS items are returned.
|
||||||
|
|
||||||
|
@ -260,19 +304,11 @@ def GetAllPlexLeaves(viewId, lastViewedAt=None, updatedAt=None):
|
||||||
if updatedAt:
|
if updatedAt:
|
||||||
args.append('updatedAt>=%s' % updatedAt)
|
args.append('updatedAt>=%s' % updatedAt)
|
||||||
if args:
|
if args:
|
||||||
url += '?' + '&'.join(args)
|
url += '?' + '&'.join(args) + '&'
|
||||||
|
else:
|
||||||
|
url += '?'
|
||||||
|
|
||||||
xml = downloadutils.DownloadUtils().downloadUrl(url)
|
return DownloadChunks(url, containerSize)
|
||||||
|
|
||||||
try:
|
|
||||||
xml.attrib
|
|
||||||
# Nope, not an XML, abort
|
|
||||||
except AttributeError:
|
|
||||||
logMsg(title,
|
|
||||||
"Error retrieving all leaves for Plex section %s"
|
|
||||||
% viewId, -1)
|
|
||||||
xml = None
|
|
||||||
return xml
|
|
||||||
|
|
||||||
|
|
||||||
def GetPlexCollections(mediatype):
|
def GetPlexCollections(mediatype):
|
||||||
|
|
|
@ -421,7 +421,7 @@ class Artwork():
|
||||||
cursor.execute(query, (imageUrl, kodiId, mediaType, imageType))
|
cursor.execute(query, (imageUrl, kodiId, mediaType, imageType))
|
||||||
|
|
||||||
# Cache fanart and poster in Kodi texture cache
|
# Cache fanart and poster in Kodi texture cache
|
||||||
if cacheimage and imageType in ("fanart", "poster"):
|
if cacheimage and imageType in ("fanart", "poster", "thumb"):
|
||||||
self.CacheTexture(imageUrl)
|
self.CacheTexture(imageUrl)
|
||||||
|
|
||||||
def deleteArtwork(self, kodiid, mediatype, cursor):
|
def deleteArtwork(self, kodiid, mediatype, cursor):
|
||||||
|
|
|
@ -159,6 +159,18 @@ def doPlayback(itemid, dbid):
|
||||||
"""
|
"""
|
||||||
Called only for a SINGLE element, not playQueues
|
Called only for a SINGLE element, not playQueues
|
||||||
"""
|
"""
|
||||||
|
if utils.window('plex_authenticated') != "true":
|
||||||
|
utils.logMsg('doPlayback', 'Not yet authenticated for a PMS, abort '
|
||||||
|
'starting playback', -1)
|
||||||
|
string = xbmcaddon.Addon().getLocalizedString
|
||||||
|
# Not yet connected to a PMS server
|
||||||
|
xbmcgui.Dialog().notification(
|
||||||
|
heading=addonName,
|
||||||
|
message=string(39210),
|
||||||
|
icon=xbmcgui.NOTIFICATION_ERROR,
|
||||||
|
time=7000,
|
||||||
|
sound=True)
|
||||||
|
return False
|
||||||
|
|
||||||
item = PlexFunctions.GetPlexMetadata(itemid)
|
item = PlexFunctions.GetPlexMetadata(itemid)
|
||||||
if item is None:
|
if item is None:
|
||||||
|
|
|
@ -43,6 +43,8 @@ class Items(object):
|
||||||
|
|
||||||
self.artwork = artwork.Artwork()
|
self.artwork = artwork.Artwork()
|
||||||
self.emby = embyserver.Read_EmbyServer()
|
self.emby = embyserver.Read_EmbyServer()
|
||||||
|
self.userid = utils.window('currUserId')
|
||||||
|
self.server = utils.window('pms_server')
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
"""
|
"""
|
||||||
|
@ -1445,8 +1447,21 @@ class TVShows(Items):
|
||||||
people = API.getPeopleList()
|
people = API.getPeopleList()
|
||||||
kodi_db.addPeople(episodeid, people, "episode")
|
kodi_db.addPeople(episodeid, people, "episode")
|
||||||
# Process artwork
|
# Process artwork
|
||||||
allartworks = API.getAllArtwork()
|
# Wide "screenshot" of particular episode
|
||||||
artwork.addArtwork(allartworks, episodeid, "episode", kodicursor)
|
poster = item.attrib.get('thumb')
|
||||||
|
if poster:
|
||||||
|
poster = API.addPlexCredentialsToUrl(
|
||||||
|
"%s%s" % (self.server, poster))
|
||||||
|
artwork.addOrUpdateArt(
|
||||||
|
poster, episodeid, "episode", "thumb", kodicursor)
|
||||||
|
# poster of TV show itself
|
||||||
|
# poster = item.attrib.get('grandparentThumb')
|
||||||
|
# if poster:
|
||||||
|
# poster = API.addPlexCredentialsToUrl(
|
||||||
|
# "%s%s" % (self.server, poster))
|
||||||
|
# artwork.addOrUpdateArt(
|
||||||
|
# poster, episodeid, "episode", "poster", kodicursor)
|
||||||
|
|
||||||
# Process stream details
|
# Process stream details
|
||||||
streams = API.getMediaStreams()
|
streams = API.getMediaStreams()
|
||||||
kodi_db.addStreams(fileid, streams, runtime)
|
kodi_db.addStreams(fileid, streams, runtime)
|
||||||
|
@ -1609,8 +1624,6 @@ class Music(Items):
|
||||||
self.enableimportsongrating = utils.settings('enableImportSongRating') == "true"
|
self.enableimportsongrating = utils.settings('enableImportSongRating') == "true"
|
||||||
self.enableexportsongrating = utils.settings('enableExportSongRating') == "true"
|
self.enableexportsongrating = utils.settings('enableExportSongRating') == "true"
|
||||||
self.enableupdatesongrating = utils.settings('enableUpdateSongRating') == "true"
|
self.enableupdatesongrating = utils.settings('enableUpdateSongRating') == "true"
|
||||||
self.userid = utils.window('currUserId')
|
|
||||||
self.server = utils.window('pms_server')
|
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -237,6 +237,7 @@ class LibrarySync(Thread):
|
||||||
else False
|
else False
|
||||||
self.enableBackgroundSync = True if utils.settings(
|
self.enableBackgroundSync = True if utils.settings(
|
||||||
'enableBackgroundSync') == "true" else False
|
'enableBackgroundSync') == "true" else False
|
||||||
|
self.limitindex = int(utils.settings('limitindex'))
|
||||||
|
|
||||||
# Time offset between Kodi and PMS in seconds (=Koditime - PMStime)
|
# Time offset between Kodi and PMS in seconds (=Koditime - PMStime)
|
||||||
self.timeoffset = 0
|
self.timeoffset = 0
|
||||||
|
@ -340,7 +341,8 @@ class LibrarySync(Thread):
|
||||||
xbmc.sleep(2000)
|
xbmc.sleep(2000)
|
||||||
# Get all PMS items to find the item we changed
|
# Get all PMS items to find the item we changed
|
||||||
items = PlexFunctions.GetAllPlexLeaves(libraryId,
|
items = PlexFunctions.GetAllPlexLeaves(libraryId,
|
||||||
lastViewedAt=timestamp)
|
lastViewedAt=timestamp,
|
||||||
|
containerSize=self.limitindex)
|
||||||
# Toggle watched state back
|
# Toggle watched state back
|
||||||
PlexFunctions.scrobble(plexId, 'unwatched')
|
PlexFunctions.scrobble(plexId, 'unwatched')
|
||||||
# Get server timestamp for this change
|
# Get server timestamp for this change
|
||||||
|
@ -482,7 +484,9 @@ class LibrarySync(Thread):
|
||||||
self.updatelist = []
|
self.updatelist = []
|
||||||
# Get items per view
|
# Get items per view
|
||||||
items = PlexFunctions.GetAllPlexLeaves(
|
items = PlexFunctions.GetAllPlexLeaves(
|
||||||
view['id'], updatedAt=self.getPMSfromKodiTime(lastSync))
|
view['id'],
|
||||||
|
updatedAt=self.getPMSfromKodiTime(lastSync),
|
||||||
|
containerSize=self.limitindex)
|
||||||
# Just skip if something went wrong
|
# Just skip if something went wrong
|
||||||
if not items:
|
if not items:
|
||||||
continue
|
continue
|
||||||
|
@ -516,7 +520,9 @@ class LibrarySync(Thread):
|
||||||
songupdate = False
|
songupdate = False
|
||||||
for view in self.views:
|
for view in self.views:
|
||||||
items = PlexFunctions.GetAllPlexLeaves(
|
items = PlexFunctions.GetAllPlexLeaves(
|
||||||
view['id'], lastViewedAt=self.getPMSfromKodiTime(lastSync))
|
view['id'],
|
||||||
|
lastViewedAt=self.getPMSfromKodiTime(lastSync),
|
||||||
|
containerSize=self.limitindex)
|
||||||
for item in items:
|
for item in items:
|
||||||
itemId = item.attrib.get('ratingKey')
|
itemId = item.attrib.get('ratingKey')
|
||||||
# Skipping items 'title=All episodes' without a 'ratingKey'
|
# Skipping items 'title=All episodes' without a 'ratingKey'
|
||||||
|
@ -1070,7 +1076,8 @@ class LibrarySync(Thread):
|
||||||
# Get items per view
|
# Get items per view
|
||||||
viewId = view['id']
|
viewId = view['id']
|
||||||
viewName = view['name']
|
viewName = view['name']
|
||||||
all_plexmovies = PlexFunctions.GetPlexSectionResults(viewId)
|
all_plexmovies = PlexFunctions.GetPlexSectionResults(
|
||||||
|
viewId, args=None, containerSize=self.limitindex)
|
||||||
if not all_plexmovies:
|
if not all_plexmovies:
|
||||||
self.logMsg("Couldnt get section items, aborting for view.", 1)
|
self.logMsg("Couldnt get section items, aborting for view.", 1)
|
||||||
continue
|
continue
|
||||||
|
@ -1107,7 +1114,8 @@ class LibrarySync(Thread):
|
||||||
"""
|
"""
|
||||||
xml = PlexFunctions.GetAllPlexLeaves(viewId,
|
xml = PlexFunctions.GetAllPlexLeaves(viewId,
|
||||||
lastViewedAt=lastViewedAt,
|
lastViewedAt=lastViewedAt,
|
||||||
updatedAt=updatedAt)
|
updatedAt=updatedAt,
|
||||||
|
containerSize=self.limitindex)
|
||||||
# Return if there are no items in PMS reply - it's faster
|
# Return if there are no items in PMS reply - it's faster
|
||||||
try:
|
try:
|
||||||
xml[0].attrib
|
xml[0].attrib
|
||||||
|
@ -1202,7 +1210,8 @@ class LibrarySync(Thread):
|
||||||
# Get items per view
|
# Get items per view
|
||||||
viewId = view['id']
|
viewId = view['id']
|
||||||
viewName = view['name']
|
viewName = view['name']
|
||||||
allPlexTvShows = PlexFunctions.GetPlexSectionResults(viewId)
|
allPlexTvShows = PlexFunctions.GetPlexSectionResults(
|
||||||
|
viewId, containerSize=self.limitindex)
|
||||||
if not allPlexTvShows:
|
if not allPlexTvShows:
|
||||||
self.logMsg(
|
self.logMsg(
|
||||||
"Error downloading show view xml for view %s" % viewId, -1)
|
"Error downloading show view xml for view %s" % viewId, -1)
|
||||||
|
@ -1228,7 +1237,8 @@ class LibrarySync(Thread):
|
||||||
if self.threadStopped():
|
if self.threadStopped():
|
||||||
return False
|
return False
|
||||||
# Grab all seasons to tvshow from PMS
|
# Grab all seasons to tvshow from PMS
|
||||||
seasons = PlexFunctions.GetAllPlexChildren(tvShowId)
|
seasons = PlexFunctions.GetAllPlexChildren(
|
||||||
|
tvShowId, containerSize=self.limitindex)
|
||||||
if not seasons:
|
if not seasons:
|
||||||
self.logMsg(
|
self.logMsg(
|
||||||
"Error downloading season xml for show %s" % tvShowId, -1)
|
"Error downloading season xml for show %s" % tvShowId, -1)
|
||||||
|
@ -1252,7 +1262,8 @@ class LibrarySync(Thread):
|
||||||
if self.threadStopped():
|
if self.threadStopped():
|
||||||
return False
|
return False
|
||||||
# Grab all episodes to tvshow from PMS
|
# Grab all episodes to tvshow from PMS
|
||||||
episodes = PlexFunctions.GetAllPlexLeaves(view['id'])
|
episodes = PlexFunctions.GetAllPlexLeaves(
|
||||||
|
view['id'], containerSize=self.limitindex)
|
||||||
if not episodes:
|
if not episodes:
|
||||||
self.logMsg(
|
self.logMsg(
|
||||||
"Error downloading episod xml for view %s"
|
"Error downloading episod xml for view %s"
|
||||||
|
@ -1265,7 +1276,7 @@ class LibrarySync(Thread):
|
||||||
None,
|
None,
|
||||||
None)
|
None)
|
||||||
self.logMsg("Analyzed all episodes of TV show with Plex Id %s"
|
self.logMsg("Analyzed all episodes of TV show with Plex Id %s"
|
||||||
% tvShowId, 1)
|
% view['id'], 1)
|
||||||
|
|
||||||
# Process self.updatelist
|
# Process self.updatelist
|
||||||
self.GetAndProcessXMLs(itemType)
|
self.GetAndProcessXMLs(itemType)
|
||||||
|
@ -1350,7 +1361,7 @@ class LibrarySync(Thread):
|
||||||
viewId = view['id']
|
viewId = view['id']
|
||||||
viewName = view['name']
|
viewName = view['name']
|
||||||
itemsXML = PlexFunctions.GetPlexSectionResults(
|
itemsXML = PlexFunctions.GetPlexSectionResults(
|
||||||
viewId, args=urlArgs)
|
viewId, args=urlArgs, containerSize=self.limitindex)
|
||||||
if not itemsXML:
|
if not itemsXML:
|
||||||
self.logMsg("Error downloading xml for view %s"
|
self.logMsg("Error downloading xml for view %s"
|
||||||
% viewId, -1)
|
% viewId, -1)
|
||||||
|
|
|
@ -155,7 +155,7 @@ class SubscriptionManager:
|
||||||
serv = getServerByHost(self.server)
|
serv = getServerByHost(self.server)
|
||||||
url = serv.get('protocol', 'http') + '://' \
|
url = serv.get('protocol', 'http') + '://' \
|
||||||
+ serv.get('server', 'localhost') + ':' \
|
+ serv.get('server', 'localhost') + ':' \
|
||||||
+ serv.get('port', 32400) + "/:/timeline"
|
+ serv.get('port', '32400') + "/:/timeline"
|
||||||
self.download.downloadUrl(url, type="GET", parameters=params)
|
self.download.downloadUrl(url, type="GET", parameters=params)
|
||||||
# requests.getwithparams(serv.get('server', 'localhost'), serv.get('port', 32400), "/:/timeline", params, getPlexHeaders(), serv.get('protocol', 'http'))
|
# requests.getwithparams(serv.get('server', 'localhost'), serv.get('port', 32400), "/:/timeline", params, getPlexHeaders(), serv.get('protocol', 'http'))
|
||||||
printDebug("params: %s" % params)
|
printDebug("params: %s" % params)
|
||||||
|
|
|
@ -179,9 +179,6 @@ class UserClient(threading.Thread):
|
||||||
|
|
||||||
if authenticated is False:
|
if authenticated is False:
|
||||||
self.logMsg('Testing validity of current token', 0)
|
self.logMsg('Testing validity of current token', 0)
|
||||||
window('currUserId', value=userId)
|
|
||||||
window('plex_username', value=username)
|
|
||||||
window('pms_token', value=self.currToken)
|
|
||||||
res = PlexAPI.PlexAPI().CheckConnection(
|
res = PlexAPI.PlexAPI().CheckConnection(
|
||||||
self.currServer, self.currToken)
|
self.currServer, self.currToken)
|
||||||
if res is False:
|
if res is False:
|
||||||
|
@ -205,6 +202,7 @@ class UserClient(threading.Thread):
|
||||||
window('pms_server', value=self.currServer)
|
window('pms_server', value=self.currServer)
|
||||||
window('plex_machineIdentifier', value=self.machineIdentifier)
|
window('plex_machineIdentifier', value=self.machineIdentifier)
|
||||||
window('plex_servername', value=self.servername)
|
window('plex_servername', value=self.servername)
|
||||||
|
window('plex_authenticated', value='true')
|
||||||
|
|
||||||
# Set DownloadUtils values
|
# Set DownloadUtils values
|
||||||
doUtils.setUsername(username)
|
doUtils.setUsername(username)
|
||||||
|
@ -331,6 +329,7 @@ class UserClient(threading.Thread):
|
||||||
settings = utils.settings
|
settings = utils.settings
|
||||||
window = utils.window
|
window = utils.window
|
||||||
|
|
||||||
|
window('plex_authenticated', clear=True)
|
||||||
window('pms_token', clear=True)
|
window('pms_token', clear=True)
|
||||||
window('plex_token', clear=True)
|
window('plex_token', clear=True)
|
||||||
window('pms_server', clear=True)
|
window('pms_server', clear=True)
|
||||||
|
@ -410,7 +409,7 @@ class UserClient(threading.Thread):
|
||||||
self.auth = True
|
self.auth = True
|
||||||
|
|
||||||
# Minimize CPU load
|
# Minimize CPU load
|
||||||
xbmc.sleep(500)
|
xbmc.sleep(100)
|
||||||
|
|
||||||
self.doUtils.stopSession()
|
self.doUtils.stopSession()
|
||||||
log("##===---- UserClient Stopped ----===##", 0)
|
log("##===---- UserClient Stopped ----===##", 0)
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
<setting id="serverSync" type="bool" label="30514" default="true" visible="false"/><!-- Enable fast startup (requires server plugin) -->
|
<setting id="serverSync" type="bool" label="30514" default="true" visible="false"/><!-- Enable fast startup (requires server plugin) -->
|
||||||
<setting id="dbSyncIndicator" label="30507" type="bool" default="true" />
|
<setting id="dbSyncIndicator" label="30507" type="bool" default="true" />
|
||||||
<setting type="sep" /><!-- show syncing progress -->
|
<setting type="sep" /><!-- show syncing progress -->
|
||||||
<setting id="limitindex" type="number" label="30515" default="200" option="int" visible="false"/><!-- Maximum items to request from the server at once -->
|
<setting id="limitindex" type="number" label="30515" default="200" option="int" /><!-- Maximum items to request from the server at once -->
|
||||||
<setting id="enableTextureCache" label="30512" type="bool" default="true" /> <!-- Force Artwork Caching -->
|
<setting id="enableTextureCache" label="30512" type="bool" default="true" /> <!-- Force Artwork Caching -->
|
||||||
<setting id="imageCacheLimit" type="enum" label="30513" values="Disabled|5|10|15|20|25" default="5" visible="eq(-1,true)" subsetting="true" /> <!-- Limit artwork cache threads -->
|
<setting id="imageCacheLimit" type="enum" label="30513" values="Disabled|5|10|15|20|25" default="5" visible="eq(-1,true)" subsetting="true" /> <!-- Limit artwork cache threads -->
|
||||||
<setting id="syncThreadNumber" type="slider" label="39003" default="5" option="int" range="1,1,20"/>
|
<setting id="syncThreadNumber" type="slider" label="39003" default="5" option="int" range="1,1,20"/>
|
||||||
|
|
|
@ -78,7 +78,8 @@ class Service():
|
||||||
"emby_shouldStop", "currUserId", "emby_dbScan", "emby_sessionId",
|
"emby_shouldStop", "currUserId", "emby_dbScan", "emby_sessionId",
|
||||||
"emby_initialScan", "emby_customplaylist", "emby_playbackProps",
|
"emby_initialScan", "emby_customplaylist", "emby_playbackProps",
|
||||||
"plex_runLibScan", "plex_username", "pms_token", "plex_token",
|
"plex_runLibScan", "plex_username", "pms_token", "plex_token",
|
||||||
"pms_server", "plex_machineIdentifier", "plex_servername"
|
"pms_server", "plex_machineIdentifier", "plex_servername",
|
||||||
|
"plex_authenticated"
|
||||||
]
|
]
|
||||||
for prop in properties:
|
for prop in properties:
|
||||||
window(prop, clear=True)
|
window(prop, clear=True)
|
||||||
|
|
Loading…
Reference in a new issue