Fixes
This commit is contained in:
parent
ce6a9ca926
commit
43765a6675
2 changed files with 45 additions and 61 deletions
|
@ -1233,64 +1233,33 @@ class PlexAPI():
|
||||||
})
|
})
|
||||||
return serverlist
|
return serverlist
|
||||||
|
|
||||||
|
def GetPlexCollections(self, type):
|
||||||
|
# Build a list of the user views
|
||||||
|
collections = []
|
||||||
|
|
||||||
# Guess this stuff is not yet working
|
url = "{server}/library/sections"
|
||||||
if __name__ == '__main__':
|
jsondata = self.doUtils.downloadUrl(url)
|
||||||
testPlexGDM = 0
|
try:
|
||||||
testLocalPMS = 0
|
result = jsondata['_children']
|
||||||
testSectionXML = 1
|
except:
|
||||||
testMyPlexXML = 0
|
pass
|
||||||
testMyPlexSignIn = 0
|
|
||||||
testMyPlexSignOut = 0
|
|
||||||
|
|
||||||
username = 'abc'
|
|
||||||
password = 'def'
|
|
||||||
token = 'xyz'
|
|
||||||
|
|
||||||
|
|
||||||
# test PlexGDM
|
|
||||||
if testPlexGDM:
|
|
||||||
dprint('', 0, "*** PlexGDM")
|
|
||||||
PMS_list = PlexGDM()
|
|
||||||
dprint('', 0, PMS_list)
|
|
||||||
|
|
||||||
|
|
||||||
# test XML from local PMS
|
|
||||||
if testLocalPMS:
|
|
||||||
dprint('', 0, "*** XML from local PMS")
|
|
||||||
XML = getXMLFromPMS('http://127.0.0.1:32400', '/library/sections')
|
|
||||||
|
|
||||||
|
|
||||||
# test local Server/Sections
|
|
||||||
if testSectionXML:
|
|
||||||
dprint('', 0, "*** local Server/Sections")
|
|
||||||
PMS_list = PlexGDM()
|
|
||||||
XML = getSectionXML(PMS_list, {}, '')
|
|
||||||
|
|
||||||
|
|
||||||
# test XML from MyPlex
|
|
||||||
if testMyPlexXML:
|
|
||||||
dprint('', 0, "*** XML from MyPlex")
|
|
||||||
XML = getXMLFromPMS('https://plex.tv', '/pms/servers', None, token)
|
|
||||||
XML = getXMLFromPMS('https://plex.tv', '/pms/system/library/sections', None, token)
|
|
||||||
|
|
||||||
|
|
||||||
# test MyPlex Sign In
|
|
||||||
if testMyPlexSignIn:
|
|
||||||
dprint('', 0, "*** MyPlex Sign In")
|
|
||||||
options = {'PlexConnectUDID':'007'}
|
|
||||||
|
|
||||||
(user, token) = MyPlexSignIn(username, password, options)
|
|
||||||
if user=='' and token=='':
|
|
||||||
dprint('', 0, "Authentication failed")
|
|
||||||
else:
|
else:
|
||||||
dprint('', 0, "logged in: {0}, {1}", user, token)
|
for item in result:
|
||||||
|
|
||||||
|
# name = item['Name']
|
||||||
|
name = item['title']
|
||||||
|
# contentType = item['Type']
|
||||||
|
contentType = item['type']
|
||||||
|
itemtype = contentType
|
||||||
|
content = itemtype
|
||||||
|
contentID = item['key']
|
||||||
|
|
||||||
# test MyPlex Sign out
|
if itemtype == type and name not in ("Collections", "Trailers"):
|
||||||
if testMyPlexSignOut:
|
collections.append({
|
||||||
dprint('', 0, "*** MyPlex Sign Out")
|
|
||||||
MyPlexSignOut(token)
|
|
||||||
dprint('', 0, "logged out")
|
|
||||||
|
|
||||||
# test transcoder
|
'title': name,
|
||||||
|
'type': itemtype,
|
||||||
|
'id': contentID,
|
||||||
|
'content': content
|
||||||
|
})
|
||||||
|
return collections
|
||||||
|
|
|
@ -222,8 +222,8 @@ class LibrarySync(threading.Thread):
|
||||||
starttotal = datetime.now()
|
starttotal = datetime.now()
|
||||||
|
|
||||||
# Set views
|
# Set views
|
||||||
self.maintainViews(embycursor, kodicursor)
|
# self.maintainViews(embycursor, kodicursor)
|
||||||
embyconn.commit()
|
# embyconn.commit()
|
||||||
|
|
||||||
# Sync video library
|
# Sync video library
|
||||||
process = {
|
process = {
|
||||||
|
@ -233,6 +233,10 @@ class LibrarySync(threading.Thread):
|
||||||
'tvshows': self.tvshows,
|
'tvshows': self.tvshows,
|
||||||
'homevideos': self.homevideos
|
'homevideos': self.homevideos
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process = {
|
||||||
|
'movies': self.movies,
|
||||||
|
}
|
||||||
for itemtype in process:
|
for itemtype in process:
|
||||||
startTime = datetime.now()
|
startTime = datetime.now()
|
||||||
completed = process[itemtype](embycursor, kodicursor, pDialog, compare=manualrun)
|
completed = process[itemtype](embycursor, kodicursor, pDialog, compare=manualrun)
|
||||||
|
@ -320,6 +324,17 @@ class LibrarySync(threading.Thread):
|
||||||
embycursor.close()
|
embycursor.close()
|
||||||
|
|
||||||
def maintainViews(self, embycursor, kodicursor):
|
def maintainViews(self, embycursor, kodicursor):
|
||||||
|
"""
|
||||||
|
Reverse engineering:
|
||||||
|
|
||||||
|
Input:
|
||||||
|
embycursor
|
||||||
|
kodicursor
|
||||||
|
Output:
|
||||||
|
vnodes.viewNode(totalnodes, foldername, mediatype, viewtype)
|
||||||
|
kodi_db.createTag(foldername)
|
||||||
|
kodi_db.updateTag(current_tagid, tagid, item[0],Current_viewtype[:-1])
|
||||||
|
"""
|
||||||
# Compare the views to emby
|
# Compare the views to emby
|
||||||
emby_db = embydb.Embydb_Functions(embycursor)
|
emby_db = embydb.Embydb_Functions(embycursor)
|
||||||
kodi_db = kodidb.Kodidb_Functions(kodicursor)
|
kodi_db = kodidb.Kodidb_Functions(kodicursor)
|
||||||
|
|
Loading…
Reference in a new issue