Added tags for TV collections
This commit is contained in:
parent
b880555829
commit
b5e2e0948e
4 changed files with 386 additions and 369 deletions
|
@ -287,156 +287,253 @@ class LibrarySync():
|
||||||
totalItemsAdded = 0
|
totalItemsAdded = 0
|
||||||
totalItemsUpdated = 0
|
totalItemsUpdated = 0
|
||||||
totalItemsDeleted = 0
|
totalItemsDeleted = 0
|
||||||
|
allTVShows = list()
|
||||||
|
allMB3EpisodeIds = list() #for use with deletions
|
||||||
|
|
||||||
progressTitle = "Sync DB : Processing Episodes"
|
views = ReadEmbyDB().getCollections("tvshows")
|
||||||
|
viewCount = len(views)
|
||||||
# incremental sync --> new episodes only
|
viewCurrent = 1
|
||||||
if not fullsync:
|
progressTitle = ""
|
||||||
|
|
||||||
latestMBEpisodes = ReadEmbyDB().getLatestEpisodes(fullinfo = True, itemList = itemList)
|
|
||||||
utils.logMsg("Sync TV", "Inc Sync Started on : " + str(len(latestMBEpisodes)) + " : " + str(itemList), 1)
|
|
||||||
|
|
||||||
if latestMBEpisodes != None:
|
|
||||||
allKodiTvShowsIds = set(ReadKodiDB().getKodiTvShowsIds(True))
|
|
||||||
|
|
||||||
if(pDialog != None):
|
|
||||||
pDialog.update(0, progressTitle)
|
|
||||||
total = len(latestMBEpisodes) + 1
|
|
||||||
count = 1
|
|
||||||
|
|
||||||
# process new episodes
|
|
||||||
for episode in latestMBEpisodes:
|
|
||||||
if episode["SeriesId"] in allKodiTvShowsIds:
|
|
||||||
#only process tvshows that already exist in the db at incremental updates
|
|
||||||
allKodiTVShows = ReadKodiDB().getKodiTvShows(False)
|
|
||||||
kodishow = allKodiTVShows.get(episode["SeriesId"],None)
|
|
||||||
kodiEpisodes = ReadKodiDB().getKodiEpisodes(kodishow["tvshowid"],True,True)
|
|
||||||
|
|
||||||
if(self.ShouldStop(pDialog)):
|
|
||||||
return False
|
|
||||||
|
|
||||||
#we have to compare the lists somehow
|
for view in views:
|
||||||
comparestring1 = str(episode.get("ParentIndexNumber")) + "-" + str(episode.get("IndexNumber"))
|
|
||||||
matchFound = False
|
|
||||||
if kodiEpisodes != None:
|
progressTitle = "Sync DB : Processing " + view.get('title') + " " + str(viewCurrent) + " of " + str(viewCount)
|
||||||
KodiItem = kodiEpisodes.get(comparestring1, None)
|
|
||||||
if(KodiItem != None):
|
# incremental sync --> new episodes only
|
||||||
matchFound = True
|
if not fullsync:
|
||||||
|
|
||||||
progressAction = "Checking"
|
latestMBEpisodes = ReadEmbyDB().getLatestEpisodes(fullinfo = True, itemList = itemList)
|
||||||
if not matchFound:
|
utils.logMsg("Sync TV", "Inc Sync Started on : " + str(len(latestMBEpisodes)) + " : " + str(itemList), 1)
|
||||||
#no match so we have to create it
|
|
||||||
print "creating episode in incremental sync!"
|
if latestMBEpisodes != None:
|
||||||
WriteKodiDB().addEpisodeToKodiLibrary(episode,connection, cursor)
|
allKodiTvShowsIds = set(ReadKodiDB().getKodiTvShowsIds(True))
|
||||||
progressAction = "Adding"
|
|
||||||
|
if(pDialog != None):
|
||||||
|
pDialog.update(0, progressTitle)
|
||||||
|
total = len(latestMBEpisodes) + 1
|
||||||
|
count = 1
|
||||||
|
|
||||||
|
# process new episodes
|
||||||
|
for episode in latestMBEpisodes:
|
||||||
|
if episode["SeriesId"] in allKodiTvShowsIds:
|
||||||
|
#only process tvshows that already exist in the db at incremental updates
|
||||||
|
allKodiTVShows = ReadKodiDB().getKodiTvShows(False)
|
||||||
|
kodishow = allKodiTVShows.get(episode["SeriesId"],None)
|
||||||
|
kodiEpisodes = ReadKodiDB().getKodiEpisodes(kodishow["tvshowid"],True,True)
|
||||||
|
|
||||||
|
if(self.ShouldStop(pDialog)):
|
||||||
|
return False
|
||||||
|
|
||||||
|
#we have to compare the lists somehow
|
||||||
|
comparestring1 = str(episode.get("ParentIndexNumber")) + "-" + str(episode.get("IndexNumber"))
|
||||||
|
matchFound = False
|
||||||
|
if kodiEpisodes != None:
|
||||||
|
KodiItem = kodiEpisodes.get(comparestring1, None)
|
||||||
|
if(KodiItem != None):
|
||||||
|
matchFound = True
|
||||||
|
|
||||||
|
progressAction = "Checking"
|
||||||
|
if not matchFound:
|
||||||
|
#no match so we have to create it
|
||||||
|
WriteKodiDB().addEpisodeToKodiLibrary(episode,connection, cursor)
|
||||||
|
progressAction = "Adding"
|
||||||
|
totalItemsAdded += 1
|
||||||
|
|
||||||
|
if(self.ShouldStop(pDialog)):
|
||||||
|
return False
|
||||||
|
|
||||||
|
# update progress bar
|
||||||
|
if(pDialog != None):
|
||||||
|
percentage = int(((float(count) / float(total)) * 100))
|
||||||
|
pDialog.update(percentage, progressTitle, progressAction + " Episode: " + str(count))
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
#process updates
|
||||||
|
if(pDialog != None):
|
||||||
|
progressTitle = "Sync DB : Processing Episodes"
|
||||||
|
pDialog.update(0, progressTitle)
|
||||||
|
total = len(latestMBEpisodes) + 1
|
||||||
|
count = 1
|
||||||
|
|
||||||
|
for episode in latestMBEpisodes:
|
||||||
|
if episode["SeriesId"] in allKodiTvShowsIds:
|
||||||
|
#only process tvshows that already exist in the db at incremental updates
|
||||||
|
allKodiTVShows = ReadKodiDB().getKodiTvShows(False)
|
||||||
|
kodishow = allKodiTVShows.get(episode["SeriesId"],None)
|
||||||
|
kodiEpisodes = ReadKodiDB().getKodiEpisodes(kodishow["tvshowid"],True,True)
|
||||||
|
|
||||||
|
if(self.ShouldStop(pDialog)):
|
||||||
|
return False
|
||||||
|
|
||||||
|
userData = API().getUserData(episode)
|
||||||
|
WINDOW.setProperty("EmbyUserKey" + userData.get("Key"), episode.get('Id') + ";;" + episode.get("Type"))
|
||||||
|
|
||||||
|
#we have to compare the lists somehow
|
||||||
|
comparestring1 = str(episode.get("ParentIndexNumber")) + "-" + str(episode.get("IndexNumber"))
|
||||||
|
|
||||||
|
if kodiEpisodes != None:
|
||||||
|
KodiItem = kodiEpisodes.get(comparestring1, None)
|
||||||
|
if(KodiItem != None):
|
||||||
|
WriteKodiDB().updateEpisodeToKodiLibrary(episode, KodiItem, connection, cursor)
|
||||||
|
|
||||||
|
if(self.ShouldStop(pDialog)):
|
||||||
|
return False
|
||||||
|
|
||||||
|
# update progress bar
|
||||||
|
if(pDialog != None):
|
||||||
|
percentage = int(((float(count) / float(total)) * 100))
|
||||||
|
pDialog.update(percentage, progressTitle, "Updating Episode: " + str(count))
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
|
||||||
|
# full sync --> Tv shows and Episodes
|
||||||
|
if fullsync:
|
||||||
|
allKodiEpisodeIds = [] # for use with deletions
|
||||||
|
viewTVShows = list()
|
||||||
|
tvShowData = ReadEmbyDB().getTVShows(id = view.get('id') , fullinfo = True, fullSync = True)
|
||||||
|
allKodiIds = set(ReadKodiDB().getKodiTvShowsIds(True))
|
||||||
|
|
||||||
|
if(self.ShouldStop(pDialog)):
|
||||||
|
return False
|
||||||
|
|
||||||
|
if (tvShowData == None):
|
||||||
|
return False
|
||||||
|
|
||||||
|
if(pDialog != None):
|
||||||
|
progressTitle = "Sync DB : Processing TV Shows"
|
||||||
|
pDialog.update(0, progressTitle)
|
||||||
|
total = len(tvShowData) + 1
|
||||||
|
count = 1
|
||||||
|
|
||||||
|
for item in tvShowData:
|
||||||
|
if item.get('IsFolder'):
|
||||||
|
allTVShows.append(item["Id"])
|
||||||
|
viewTVShows.append(item["Id"])
|
||||||
|
item['Tag'] = []
|
||||||
|
item['Tag'].append(view.get('title'))
|
||||||
|
progMessage = "Processing"
|
||||||
|
if item["Id"] not in allKodiIds:
|
||||||
|
WriteKodiDB().addTVShowToKodiLibrary(item,connection, cursor)
|
||||||
totalItemsAdded += 1
|
totalItemsAdded += 1
|
||||||
|
|
||||||
if(self.ShouldStop(pDialog)):
|
if(self.ShouldStop(pDialog)):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# update progress bar
|
|
||||||
if(pDialog != None):
|
|
||||||
percentage = int(((float(count) / float(total)) * 100))
|
|
||||||
pDialog.update(percentage, progressTitle, progressAction + " Episode: " + str(count))
|
|
||||||
count += 1
|
|
||||||
|
|
||||||
#process updates
|
|
||||||
if(pDialog != None):
|
|
||||||
progressTitle = "Sync DB : Processing Episodes"
|
|
||||||
pDialog.update(0, progressTitle)
|
|
||||||
total = len(latestMBEpisodes) + 1
|
|
||||||
count = 1
|
|
||||||
|
|
||||||
for episode in latestMBEpisodes:
|
|
||||||
if episode["SeriesId"] in allKodiTvShowsIds:
|
|
||||||
#only process tvshows that already exist in the db at incremental updates
|
|
||||||
allKodiTVShows = ReadKodiDB().getKodiTvShows(False)
|
|
||||||
kodishow = allKodiTVShows.get(episode["SeriesId"],None)
|
|
||||||
kodiEpisodes = ReadKodiDB().getKodiEpisodes(kodishow["tvshowid"],True,True)
|
|
||||||
|
|
||||||
if(self.ShouldStop(pDialog)):
|
|
||||||
return False
|
|
||||||
|
|
||||||
userData = API().getUserData(episode)
|
|
||||||
WINDOW.setProperty("EmbyUserKey" + userData.get("Key"), episode.get('Id') + ";;" + episode.get("Type"))
|
|
||||||
|
|
||||||
#we have to compare the lists somehow
|
|
||||||
comparestring1 = str(episode.get("ParentIndexNumber")) + "-" + str(episode.get("IndexNumber"))
|
|
||||||
|
|
||||||
if kodiEpisodes != None:
|
|
||||||
KodiItem = kodiEpisodes.get(comparestring1, None)
|
|
||||||
if(KodiItem != None):
|
|
||||||
WriteKodiDB().updateEpisodeToKodiLibrary(episode, KodiItem, connection, cursor)
|
|
||||||
|
|
||||||
if(self.ShouldStop(pDialog)):
|
|
||||||
return False
|
|
||||||
|
|
||||||
# update progress bar
|
# update progress bar
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
percentage = int(((float(count) / float(total)) * 100))
|
percentage = int(((float(count) / float(total)) * 100))
|
||||||
pDialog.update(percentage, progressTitle, "Updating Episode: " + str(count))
|
pDialog.update(percentage, progressTitle, "Adding Tv Show: " + str(count))
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
|
|
||||||
# full sync --> Tv shows and Episodes
|
|
||||||
if fullsync:
|
|
||||||
allTVShows = list()
|
|
||||||
allMB3EpisodeIds = list() #for use with deletions
|
|
||||||
allKodiEpisodeIds = [] # for use with deletions
|
|
||||||
|
|
||||||
tvShowData = ReadEmbyDB().getTVShows(True,True)
|
|
||||||
allKodiIds = set(ReadKodiDB().getKodiTvShowsIds(True))
|
|
||||||
|
|
||||||
if(self.ShouldStop(pDialog)):
|
|
||||||
return False
|
|
||||||
|
|
||||||
if (tvShowData == None):
|
|
||||||
return False
|
|
||||||
|
|
||||||
if(pDialog != None):
|
|
||||||
progressTitle = "Sync DB : Processing TV Shows"
|
|
||||||
pDialog.update(0, progressTitle)
|
|
||||||
total = len(tvShowData) + 1
|
|
||||||
count = 1
|
|
||||||
|
|
||||||
for item in tvShowData:
|
|
||||||
if item.get('IsFolder'):
|
|
||||||
allTVShows.append(item["Id"])
|
|
||||||
progMessage = "Processing"
|
|
||||||
if item["Id"] not in allKodiIds:
|
|
||||||
WriteKodiDB().addTVShowToKodiLibrary(item,connection, cursor)
|
|
||||||
totalItemsAdded += 1
|
|
||||||
|
|
||||||
if(self.ShouldStop(pDialog)):
|
#process episodes first before updating tvshows
|
||||||
return False
|
allEpisodes = list()
|
||||||
|
|
||||||
# update progress bar
|
showTotal = len(viewTVShows)
|
||||||
if(pDialog != None):
|
showCurrent = 1
|
||||||
percentage = int(((float(count) / float(total)) * 100))
|
|
||||||
pDialog.update(percentage, progressTitle, "Adding Tv Show: " + str(count))
|
# do episode adds
|
||||||
count += 1
|
for tvshow in viewTVShows:
|
||||||
|
|
||||||
#process episodes first before updating tvshows
|
episodeData = ReadEmbyDB().getEpisodes(tvshow,True)
|
||||||
allEpisodes = list()
|
allKodiTVShows = ReadKodiDB().getKodiTvShows(False)
|
||||||
|
if allKodiTVShows != None:
|
||||||
showTotal = len(allTVShows)
|
kodishow = allKodiTVShows.get(tvshow,None)
|
||||||
showCurrent = 1
|
if kodishow != None:
|
||||||
|
kodiEpisodes = ReadKodiDB().getKodiEpisodes(kodishow["tvshowid"],True,True)
|
||||||
# do episode adds
|
else:
|
||||||
for tvshow in allTVShows:
|
kodiEpisodes = None
|
||||||
|
|
||||||
episodeData = ReadEmbyDB().getEpisodes(tvshow,True)
|
|
||||||
allKodiTVShows = ReadKodiDB().getKodiTvShows(False)
|
|
||||||
if allKodiTVShows != None:
|
|
||||||
kodishow = allKodiTVShows.get(tvshow,None)
|
|
||||||
if kodishow != None:
|
|
||||||
kodiEpisodes = ReadKodiDB().getKodiEpisodes(kodishow["tvshowid"],True,True)
|
|
||||||
else:
|
else:
|
||||||
kodiEpisodes = None
|
kodiEpisodes = None
|
||||||
else:
|
|
||||||
kodiEpisodes = None
|
if episodeData != None:
|
||||||
|
|
||||||
|
if(self.ShouldStop(pDialog)):
|
||||||
|
return False
|
||||||
|
|
||||||
|
if(pDialog != None):
|
||||||
|
progressTitle = "Sync DB : Processing Tv Show " + str(showCurrent) + " of " + str(showTotal)
|
||||||
|
pDialog.update(0, progressTitle)
|
||||||
|
total = len(episodeData) + 1
|
||||||
|
count = 0
|
||||||
|
|
||||||
|
#we have to compare the lists somehow
|
||||||
|
# TODO --> instead of matching by season and episode number we can use the uniqueid
|
||||||
|
for item in episodeData:
|
||||||
|
if(installFirstRun):
|
||||||
|
progressAction = "Adding"
|
||||||
|
WriteKodiDB().addEpisodeToKodiLibrary(item, connection, cursor)
|
||||||
|
else:
|
||||||
|
comparestring1 = str(item.get("ParentIndexNumber")) + "-" + str(item.get("IndexNumber"))
|
||||||
|
matchFound = False
|
||||||
|
if kodiEpisodes != None:
|
||||||
|
KodiItem = kodiEpisodes.get(comparestring1, None)
|
||||||
|
if(KodiItem != None):
|
||||||
|
matchFound = True
|
||||||
|
|
||||||
|
progressAction = "Checking"
|
||||||
|
if not matchFound:
|
||||||
|
#double check the item it might me added delayed by the Kodi scanner
|
||||||
|
if ReadKodiDB().getKodiEpisodeByMbItem(item["Id"],tvshow) == None:
|
||||||
|
#no match so we have to create it
|
||||||
|
WriteKodiDB().addEpisodeToKodiLibrary(item)
|
||||||
|
progressAction = "Adding"
|
||||||
|
totalItemsAdded += 1
|
||||||
|
|
||||||
|
if(self.ShouldStop(pDialog)):
|
||||||
|
return False
|
||||||
|
|
||||||
|
# update progress bar
|
||||||
|
if(pDialog != None):
|
||||||
|
percentage = int(((float(count) / float(total)) * 100))
|
||||||
|
pDialog.update(percentage, progressTitle, progressAction + " Episode: " + str(count))
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
showCurrent += 1
|
||||||
|
|
||||||
|
|
||||||
|
if(pDialog != None):
|
||||||
|
progressTitle = "Sync DB : Processing TV Shows"
|
||||||
|
pDialog.update(0, progressTitle, "")
|
||||||
|
total = len(viewTVShows) + 1
|
||||||
|
count = 1
|
||||||
|
|
||||||
if episodeData != None:
|
#process updates at TV Show level
|
||||||
|
allKodiTVShows = ReadKodiDB().getKodiTvShows(True)
|
||||||
|
for item in tvShowData:
|
||||||
|
if item.get('IsFolder'):
|
||||||
|
item['Tag'] = []
|
||||||
|
item['Tag'].append(view.get('title'))
|
||||||
|
if allKodiTVShows != None:
|
||||||
|
kodishow = allKodiTVShows.get(item["Id"],None)
|
||||||
|
else:
|
||||||
|
kodishow = None
|
||||||
|
|
||||||
|
if(kodishow != None):
|
||||||
|
updated = WriteKodiDB().updateTVShowToKodiLibrary(item,kodishow,connection, cursor)
|
||||||
|
if(updated):
|
||||||
|
totalItemsUpdated += 1
|
||||||
|
|
||||||
|
if(self.ShouldStop(pDialog)):
|
||||||
|
return False
|
||||||
|
|
||||||
|
# update progress bar
|
||||||
|
if(pDialog != None):
|
||||||
|
percentage = int(((float(count) / float(total)) * 100))
|
||||||
|
pDialog.update(percentage, progressTitle, "Updating Tv Show: " + str(count))
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
# do episode updates
|
||||||
|
showCurrent = 1
|
||||||
|
for tvshow in viewTVShows:
|
||||||
|
episodeData = ReadEmbyDB().getEpisodes(tvshow,True)
|
||||||
|
|
||||||
|
kodiEpisodes = None
|
||||||
|
allKodiTVShows = ReadKodiDB().getKodiTvShows(False)
|
||||||
|
if allKodiTVShows != None:
|
||||||
|
kodishow = allKodiTVShows.get(tvshow,None)
|
||||||
|
if kodishow != None:
|
||||||
|
kodiEpisodes = ReadKodiDB().getKodiEpisodes(kodishow["tvshowid"],True,True)
|
||||||
|
|
||||||
if(self.ShouldStop(pDialog)):
|
if(self.ShouldStop(pDialog)):
|
||||||
return False
|
return False
|
||||||
|
@ -446,181 +543,95 @@ class LibrarySync():
|
||||||
pDialog.update(0, progressTitle)
|
pDialog.update(0, progressTitle)
|
||||||
total = len(episodeData) + 1
|
total = len(episodeData) + 1
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
#we have to compare the lists somehow
|
|
||||||
# TODO --> instead of matching by season and episode number we can use the uniqueid
|
|
||||||
for item in episodeData:
|
|
||||||
if(installFirstRun):
|
|
||||||
progressAction = "Adding"
|
|
||||||
WriteKodiDB().addEpisodeToKodiLibrary(item, connection, cursor)
|
|
||||||
else:
|
|
||||||
comparestring1 = str(item.get("ParentIndexNumber")) + "-" + str(item.get("IndexNumber"))
|
|
||||||
matchFound = False
|
|
||||||
if kodiEpisodes != None:
|
|
||||||
KodiItem = kodiEpisodes.get(comparestring1, None)
|
|
||||||
if(KodiItem != None):
|
|
||||||
matchFound = True
|
|
||||||
|
|
||||||
progressAction = "Checking"
|
#we have to compare the lists somehow
|
||||||
if not matchFound:
|
for item in episodeData:
|
||||||
#double check the item it might me added delayed by the Kodi scanner
|
#add episodeId to the list of all episodes for use later on the deletes
|
||||||
if ReadKodiDB().getKodiEpisodeByMbItem(item["Id"],tvshow) == None:
|
allMB3EpisodeIds.append(item["Id"])
|
||||||
#no match so we have to create it
|
|
||||||
WriteKodiDB().addEpisodeToKodiLibrary(item)
|
comparestring1 = str(item.get("ParentIndexNumber")) + "-" + str(item.get("IndexNumber"))
|
||||||
progressAction = "Adding"
|
matchFound = False
|
||||||
totalItemsAdded += 1
|
|
||||||
|
userData = API().getUserData(item)
|
||||||
if(self.ShouldStop(pDialog)):
|
WINDOW.setProperty("EmbyUserKey" + userData.get("Key"), item.get('Id') + ";;" + item.get("Type"))
|
||||||
return False
|
|
||||||
|
if kodiEpisodes != None:
|
||||||
|
KodiItem = kodiEpisodes.get(comparestring1, None)
|
||||||
|
if(KodiItem != None):
|
||||||
|
updated = WriteKodiDB().updateEpisodeToKodiLibrary(item, KodiItem, connection, cursor)
|
||||||
|
if(updated):
|
||||||
|
totalItemsUpdated += 1
|
||||||
|
|
||||||
|
if(self.ShouldStop(pDialog)):
|
||||||
|
return False
|
||||||
|
|
||||||
# update progress bar
|
# update progress bar
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
percentage = int(((float(count) / float(total)) * 100))
|
percentage = int(((float(count) / float(total)) * 100))
|
||||||
pDialog.update(percentage, progressTitle, progressAction + " Episode: " + str(count))
|
pDialog.update(percentage, progressTitle, "Updating Episode: " + str(count))
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
showCurrent += 1
|
|
||||||
|
|
||||||
|
|
||||||
if(pDialog != None):
|
|
||||||
progressTitle = "Sync DB : Processing TV Shows"
|
|
||||||
pDialog.update(0, progressTitle, "")
|
|
||||||
total = len(allTVShows) + 1
|
|
||||||
count = 1
|
|
||||||
|
|
||||||
#process updates at TV Show level
|
|
||||||
allKodiTVShows = ReadKodiDB().getKodiTvShows(True)
|
|
||||||
for item in tvShowData:
|
|
||||||
if item.get('IsFolder'):
|
|
||||||
|
|
||||||
if allKodiTVShows != None:
|
|
||||||
kodishow = allKodiTVShows.get(item["Id"],None)
|
|
||||||
else:
|
|
||||||
kodishow = None
|
|
||||||
|
|
||||||
if(kodishow != None):
|
#add all kodi episodes to a list with episodes for use later on to delete episodes
|
||||||
updated = WriteKodiDB().updateTVShowToKodiLibrary(item,kodishow,connection, cursor)
|
#the mediabrowser ID is set as uniqueID in the NFO... for some reason this has key 'unknown' in the json response
|
||||||
if(updated):
|
|
||||||
totalItemsUpdated += 1
|
|
||||||
|
|
||||||
if(self.ShouldStop(pDialog)):
|
|
||||||
return False
|
|
||||||
|
|
||||||
# update progress bar
|
|
||||||
if(pDialog != None):
|
|
||||||
percentage = int(((float(count) / float(total)) * 100))
|
|
||||||
pDialog.update(percentage, progressTitle, "Updating Tv Show: " + str(count))
|
|
||||||
count += 1
|
|
||||||
|
|
||||||
# do episode updates
|
|
||||||
showCurrent = 1
|
|
||||||
for tvshow in allTVShows:
|
|
||||||
episodeData = ReadEmbyDB().getEpisodes(tvshow,True)
|
|
||||||
|
|
||||||
kodiEpisodes = None
|
|
||||||
allKodiTVShows = ReadKodiDB().getKodiTvShows(False)
|
|
||||||
if allKodiTVShows != None:
|
|
||||||
kodishow = allKodiTVShows.get(tvshow,None)
|
|
||||||
if kodishow != None:
|
if kodishow != None:
|
||||||
kodiEpisodes = ReadKodiDB().getKodiEpisodes(kodishow["tvshowid"],True,True)
|
show = ReadKodiDB().getKodiEpisodes(kodishow["tvshowid"],False,False)
|
||||||
|
if show != None:
|
||||||
if(self.ShouldStop(pDialog)):
|
for episode in show:
|
||||||
return False
|
dict = {'episodeid': str(episode["uniqueid"]["unknown"]),'tvshowid': tvshow}
|
||||||
|
allKodiEpisodeIds.append(dict)
|
||||||
|
|
||||||
|
showCurrent += 1
|
||||||
|
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
progressTitle = "Sync DB : Processing Tv Show " + str(showCurrent) + " of " + str(showTotal)
|
progressTitle = "Removing Deleted Items"
|
||||||
pDialog.update(0, progressTitle)
|
pDialog.update(0, progressTitle)
|
||||||
total = len(episodeData) + 1
|
|
||||||
count = 0
|
|
||||||
|
|
||||||
#we have to compare the lists somehow
|
|
||||||
for item in episodeData:
|
|
||||||
#add episodeId to the list of all episodes for use later on the deletes
|
|
||||||
allMB3EpisodeIds.append(item["Id"])
|
|
||||||
|
|
||||||
comparestring1 = str(item.get("ParentIndexNumber")) + "-" + str(item.get("IndexNumber"))
|
|
||||||
matchFound = False
|
|
||||||
|
|
||||||
userData = API().getUserData(item)
|
|
||||||
WINDOW.setProperty("EmbyUserKey" + userData.get("Key"), item.get('Id') + ";;" + item.get("Type"))
|
|
||||||
|
|
||||||
if kodiEpisodes != None:
|
|
||||||
KodiItem = kodiEpisodes.get(comparestring1, None)
|
|
||||||
if(KodiItem != None):
|
|
||||||
updated = WriteKodiDB().updateEpisodeToKodiLibrary(item, KodiItem, connection, cursor)
|
|
||||||
if(updated):
|
|
||||||
totalItemsUpdated += 1
|
|
||||||
|
|
||||||
if(self.ShouldStop(pDialog)):
|
|
||||||
return False
|
|
||||||
|
|
||||||
# update progress bar
|
|
||||||
if(pDialog != None):
|
|
||||||
percentage = int(((float(count) / float(total)) * 100))
|
|
||||||
pDialog.update(percentage, progressTitle, "Updating Episode: " + str(count))
|
|
||||||
count += 1
|
|
||||||
|
|
||||||
|
if(self.ShouldStop(pDialog)):
|
||||||
|
return False
|
||||||
|
|
||||||
#add all kodi episodes to a list with episodes for use later on to delete episodes
|
# DELETES -- EPISODES
|
||||||
#the mediabrowser ID is set as uniqueID in the NFO... for some reason this has key 'unknown' in the json response
|
# process any deletes only at fullsync
|
||||||
if kodishow != None:
|
allMB3EpisodeIdsSet = set(allMB3EpisodeIds)
|
||||||
show = ReadKodiDB().getKodiEpisodes(kodishow["tvshowid"],False,False)
|
for episode in allKodiEpisodeIds:
|
||||||
if show != None:
|
if episode.get('episodeid') not in allMB3EpisodeIdsSet:
|
||||||
for episode in show:
|
WINDOW.setProperty("embyid" + str(episode.get('episodeid')),"deleted")
|
||||||
dict = {'episodeid': str(episode["uniqueid"]["unknown"]),'tvshowid': tvshow}
|
WriteKodiDB().deleteEpisodeFromKodiLibrary(episode.get('episodeid'),episode.get('tvshowid'))
|
||||||
allKodiEpisodeIds.append(dict)
|
|
||||||
|
|
||||||
showCurrent += 1
|
|
||||||
|
|
||||||
if(pDialog != None):
|
|
||||||
progressTitle = "Removing Deleted Items"
|
|
||||||
pDialog.update(0, progressTitle)
|
|
||||||
|
|
||||||
if(self.ShouldStop(pDialog)):
|
|
||||||
return False
|
|
||||||
|
|
||||||
# DELETES -- EPISODES
|
|
||||||
# process any deletes only at fullsync
|
|
||||||
allMB3EpisodeIds = set(allMB3EpisodeIds)
|
|
||||||
for episode in allKodiEpisodeIds:
|
|
||||||
if episode.get('episodeid') not in allMB3EpisodeIds:
|
|
||||||
WINDOW.setProperty("embyid" + str(episode.get('episodeid')),"deleted")
|
|
||||||
WriteKodiDB().deleteEpisodeFromKodiLibrary(episode.get('episodeid'),episode.get('tvshowid'))
|
|
||||||
totalItemsDeleted += 1
|
|
||||||
|
|
||||||
# DELETES -- TV SHOWS
|
|
||||||
if fullsync:
|
|
||||||
allKodiShows = ReadKodiDB().getKodiTvShowsIds(True)
|
|
||||||
allMB3TVShows = set(allTVShows)
|
|
||||||
for show in allKodiShows:
|
|
||||||
if not show in allMB3TVShows:
|
|
||||||
WriteKodiDB().deleteTVShowFromKodiLibrary(show)
|
|
||||||
totalItemsDeleted += 1
|
totalItemsDeleted += 1
|
||||||
|
|
||||||
if(self.ShouldStop(pDialog)):
|
# DELETES -- TV SHOWS
|
||||||
return False
|
if fullsync:
|
||||||
|
allKodiShows = ReadKodiDB().getKodiTvShowsIds(True)
|
||||||
# display notification if set up
|
allMB3TVShows = set(allTVShows)
|
||||||
notificationString = ""
|
for show in allKodiShows:
|
||||||
if(totalItemsAdded > 0):
|
if not show in allMB3TVShows:
|
||||||
notificationString += "Added:" + str(totalItemsAdded) + " "
|
WriteKodiDB().deleteTVShowFromKodiLibrary(show)
|
||||||
if(totalItemsUpdated > 0):
|
totalItemsDeleted += 1
|
||||||
notificationString += "Updated:" + str(totalItemsUpdated) + " "
|
|
||||||
if(totalItemsDeleted > 0):
|
|
||||||
notificationString += "Deleted:" + str(totalItemsDeleted) + " "
|
|
||||||
|
|
||||||
timeTaken = datetime.today() - startedSync
|
if(self.ShouldStop(pDialog)):
|
||||||
timeTakenString = str(int(timeTaken.seconds / 60)) + ":" + str(timeTaken.seconds % 60)
|
return False
|
||||||
utils.logMsg("Sync Episodes", "Finished " + timeTakenString + " " + notificationString, 0)
|
|
||||||
|
# display notification if set up
|
||||||
if(dbSyncIndication == "Notify OnChange" and notificationString != ""):
|
notificationString = ""
|
||||||
notificationString = "(" + timeTakenString + ") " + notificationString
|
if(totalItemsAdded > 0):
|
||||||
xbmc.executebuiltin("XBMC.Notification(Episode Sync: " + notificationString + ",)")
|
notificationString += "Added:" + str(totalItemsAdded) + " "
|
||||||
elif(dbSyncIndication == "Notify OnFinish"):
|
if(totalItemsUpdated > 0):
|
||||||
if(notificationString == ""):
|
notificationString += "Updated:" + str(totalItemsUpdated) + " "
|
||||||
notificationString = "Done"
|
if(totalItemsDeleted > 0):
|
||||||
notificationString = "(" + timeTakenString + ") " + notificationString
|
notificationString += "Deleted:" + str(totalItemsDeleted) + " "
|
||||||
xbmc.executebuiltin("XBMC.Notification(Episode Sync: " + notificationString + ",)")
|
|
||||||
|
timeTaken = datetime.today() - startedSync
|
||||||
|
timeTakenString = str(int(timeTaken.seconds / 60)) + ":" + str(timeTaken.seconds % 60)
|
||||||
|
utils.logMsg("Sync Episodes", "Finished " + timeTakenString + " " + notificationString, 0)
|
||||||
|
|
||||||
|
if(dbSyncIndication == "Notify OnChange" and notificationString != ""):
|
||||||
|
notificationString = "(" + timeTakenString + ") " + notificationString
|
||||||
|
xbmc.executebuiltin("XBMC.Notification(Episode Sync: " + notificationString + ",)")
|
||||||
|
elif(dbSyncIndication == "Notify OnFinish"):
|
||||||
|
if(notificationString == ""):
|
||||||
|
notificationString = "Done"
|
||||||
|
notificationString = "(" + timeTakenString + ") " + notificationString
|
||||||
|
xbmc.executebuiltin("XBMC.Notification(Episode Sync: " + notificationString + ",)")
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
|
@ -834,72 +845,77 @@ class LibrarySync():
|
||||||
if processTvShows:
|
if processTvShows:
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
pDialog.update(0, "Processing TV Episodes", "")
|
pDialog.update(0, "Processing TV Episodes", "")
|
||||||
|
views = ReadEmbyDB().getCollections("tvshows")
|
||||||
|
viewCount = len(views)
|
||||||
|
viewCurrent = 1
|
||||||
|
progressTitle = ""
|
||||||
|
for view in views:
|
||||||
|
|
||||||
|
tvshowData = ReadEmbyDB().getTVShows(id = view.get('id'), fullinfo = False, fullSync = True)
|
||||||
|
|
||||||
|
if(self.ShouldStop(pDialog)):
|
||||||
|
return False
|
||||||
|
|
||||||
tvshowData = ReadEmbyDB().getTVShows(fullinfo = False, fullSync = True)
|
if (tvshowData != None):
|
||||||
|
|
||||||
if(self.ShouldStop(pDialog)):
|
showTotal = len(tvshowData)
|
||||||
return False
|
showCurrent = 1
|
||||||
|
|
||||||
|
for item in tvshowData:
|
||||||
|
|
||||||
if (tvshowData != None):
|
episodeData = ReadEmbyDB().getEpisodes(item["Id"], False)
|
||||||
|
allKodiTVShows = ReadKodiDB().getKodiTvShows(False)
|
||||||
showTotal = len(tvshowData)
|
kodishow = allKodiTVShows.get(item["Id"],None)
|
||||||
showCurrent = 1
|
if kodishow != None:
|
||||||
|
kodiEpisodes = ReadKodiDB().getKodiEpisodes(kodishow["tvshowid"],False,True)
|
||||||
for item in tvshowData:
|
else:
|
||||||
|
kodiEpisodes = None
|
||||||
episodeData = ReadEmbyDB().getEpisodes(item["Id"], False)
|
|
||||||
allKodiTVShows = ReadKodiDB().getKodiTvShows(False)
|
if (episodeData != None):
|
||||||
kodishow = allKodiTVShows.get(item["Id"],None)
|
|
||||||
if kodishow != None:
|
|
||||||
kodiEpisodes = ReadKodiDB().getKodiEpisodes(kodishow["tvshowid"],False,True)
|
|
||||||
else:
|
|
||||||
kodiEpisodes = None
|
|
||||||
|
|
||||||
if (episodeData != None):
|
|
||||||
if(pDialog != None):
|
|
||||||
progressTitle = "Sync PlayCounts: Processing TV Show " + str(showCurrent) + " of " + str(showTotal)
|
|
||||||
pDialog.update(0, progressTitle)
|
|
||||||
totalCount = len(episodeData) + 1
|
|
||||||
count = 1
|
|
||||||
|
|
||||||
for episode in episodeData:
|
|
||||||
|
|
||||||
kodiItem = None
|
|
||||||
comparestring1 = str(episode.get("ParentIndexNumber")) + "-" + str(episode.get("IndexNumber"))
|
|
||||||
matchFound = False
|
|
||||||
if kodiEpisodes != None:
|
|
||||||
kodiItem = kodiEpisodes.get(comparestring1, None)
|
|
||||||
|
|
||||||
userData=API().getUserData(episode)
|
|
||||||
timeInfo = API().getTimeInfo(episode)
|
|
||||||
|
|
||||||
WINDOW.setProperty("EmbyUserKey" + userData.get("Key"), episode.get('Id') + ";;" + episode.get("Type"))
|
|
||||||
|
|
||||||
if kodiItem != None:
|
|
||||||
WINDOW = xbmcgui.Window( 10000 )
|
|
||||||
WINDOW.setProperty("episodeid" + str(kodiItem['episodeid']), episode.get('Name') + ";;" + episode.get('Id'))
|
|
||||||
kodiresume = int(round(kodiItem['resume'].get("position")))
|
|
||||||
resume = int(round(float(timeInfo.get("ResumeTime"))))*60
|
|
||||||
total = int(round(float(timeInfo.get("TotalTime"))))*60
|
|
||||||
if kodiresume != resume:
|
|
||||||
WriteKodiDB().setKodiResumePoint(kodiItem['episodeid'],resume,total,"episode")
|
|
||||||
totalPositionsUpdated += 1
|
|
||||||
|
|
||||||
updated = WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")),"episode")
|
|
||||||
updated |= WriteKodiDB().updateProperty(kodiItem,"lastplayed",userData.get("LastPlayedDate"), "episode")
|
|
||||||
if(updated):
|
|
||||||
totalCountsUpdated += 1
|
|
||||||
|
|
||||||
if(self.ShouldStop(pDialog)):
|
|
||||||
return False
|
|
||||||
|
|
||||||
# update progress bar
|
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
percentage = int(((float(count) / float(totalCount)) * 100))
|
progressTitle = "Sync PlayCounts: Processing TV Show " + str(showCurrent) + " of " + str(showTotal)
|
||||||
pDialog.update(percentage, progressTitle, "Updating Episode: " + str(count))
|
pDialog.update(0, progressTitle)
|
||||||
count += 1
|
totalCount = len(episodeData) + 1
|
||||||
|
count = 1
|
||||||
|
|
||||||
|
for episode in episodeData:
|
||||||
|
|
||||||
|
kodiItem = None
|
||||||
|
comparestring1 = str(episode.get("ParentIndexNumber")) + "-" + str(episode.get("IndexNumber"))
|
||||||
|
matchFound = False
|
||||||
|
if kodiEpisodes != None:
|
||||||
|
kodiItem = kodiEpisodes.get(comparestring1, None)
|
||||||
|
|
||||||
|
userData=API().getUserData(episode)
|
||||||
|
timeInfo = API().getTimeInfo(episode)
|
||||||
|
|
||||||
showCurrent += 1
|
WINDOW.setProperty("EmbyUserKey" + userData.get("Key"), episode.get('Id') + ";;" + episode.get("Type"))
|
||||||
|
|
||||||
|
if kodiItem != None:
|
||||||
|
WINDOW = xbmcgui.Window( 10000 )
|
||||||
|
WINDOW.setProperty("episodeid" + str(kodiItem['episodeid']), episode.get('Name') + ";;" + episode.get('Id'))
|
||||||
|
kodiresume = int(round(kodiItem['resume'].get("position")))
|
||||||
|
resume = int(round(float(timeInfo.get("ResumeTime"))))*60
|
||||||
|
total = int(round(float(timeInfo.get("TotalTime"))))*60
|
||||||
|
if kodiresume != resume:
|
||||||
|
WriteKodiDB().setKodiResumePoint(kodiItem['episodeid'],resume,total,"episode")
|
||||||
|
totalPositionsUpdated += 1
|
||||||
|
|
||||||
|
updated = WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")),"episode")
|
||||||
|
updated |= WriteKodiDB().updateProperty(kodiItem,"lastplayed",userData.get("LastPlayedDate"), "episode")
|
||||||
|
if(updated):
|
||||||
|
totalCountsUpdated += 1
|
||||||
|
|
||||||
|
if(self.ShouldStop(pDialog)):
|
||||||
|
return False
|
||||||
|
|
||||||
|
# update progress bar
|
||||||
|
if(pDialog != None):
|
||||||
|
percentage = int(((float(count) / float(totalCount)) * 100))
|
||||||
|
pDialog.update(percentage, progressTitle, "Updating Episode: " + str(count))
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
showCurrent += 1
|
||||||
|
|
||||||
if(playCountSyncFirstRun != "true"):
|
if(playCountSyncFirstRun != "true"):
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
|
|
|
@ -116,7 +116,7 @@ class ReadEmbyDB():
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def getTVShows(self, fullinfo = False, fullSync = False):
|
def getTVShows(self, id, fullinfo = False, fullSync = False):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
|
@ -134,9 +134,9 @@ class ReadEmbyDB():
|
||||||
|
|
||||||
|
|
||||||
if fullinfo:
|
if fullinfo:
|
||||||
url = server + '/mediabrowser/Users/' + userid + '/Items?' + sortstring + '&Fields=Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&SortOrder=Descending&IncludeItemTypes=Series&format=json&ImageTypeLimit=1'
|
url = server + '/mediabrowser/Users/' + userid + '/Items?ParentId=' + id + sortstring + '&Fields=Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&SortOrder=Descending&IncludeItemTypes=Series&format=json&ImageTypeLimit=1'
|
||||||
else:
|
else:
|
||||||
url = server + '/mediabrowser/Users/' + userid + '/Items?' + sortstring + '&Fields=CumulativeRunTimeTicks&Recursive=true&SortOrder=Descending&IncludeItemTypes=Series&format=json&ImageTypeLimit=1'
|
url = server + '/mediabrowser/Users/' + userid + '/Items?ParentId=' + id + sortstring + '&Fields=CumulativeRunTimeTicks&Recursive=true&SortOrder=Descending&IncludeItemTypes=Series&format=json&ImageTypeLimit=1'
|
||||||
|
|
||||||
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
||||||
if jsonData != None and jsonData != "":
|
if jsonData != None and jsonData != "":
|
||||||
|
@ -257,12 +257,12 @@ class ReadEmbyDB():
|
||||||
Temp = item.get("Name")
|
Temp = item.get("Name")
|
||||||
Name = Temp.encode('utf-8')
|
Name = Temp.encode('utf-8')
|
||||||
section = item.get("CollectionType")
|
section = item.get("CollectionType")
|
||||||
type = item.get("CollectionType")
|
itemtype = item.get("CollectionType")
|
||||||
if type == None:
|
if itemtype == None:
|
||||||
type = "None" # User may not have declared the type
|
itemtype = "None" # User may not have declared the type
|
||||||
if type == type and item.get("Name") != "Collections":
|
if itemtype == type and item.get("Name") != "Collections":
|
||||||
collections.append( {'title' : item.get("Name"),
|
collections.append( {'title' : item.get("Name"),
|
||||||
'type' : type,
|
'type' : itemtype,
|
||||||
'id' : item.get("Id")})
|
'id' : item.get("Id")})
|
||||||
return collections
|
return collections
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ class ReadKodiDB():
|
||||||
#returns all tvshows in Kodi db inserted by MB
|
#returns all tvshows in Kodi db inserted by MB
|
||||||
xbmc.sleep(sleepVal)
|
xbmc.sleep(sleepVal)
|
||||||
if fullInfo:
|
if fullInfo:
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "properties": ["art", "genre", "plot", "mpaa", "cast", "studio", "sorttitle", "title", "originaltitle", "imdbnumber", "year", "premiered", "rating", "thumbnail", "playcount", "lastplayed", "file", "fanart"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "properties": ["art", "genre", "plot", "mpaa", "cast", "studio", "sorttitle", "title", "originaltitle", "imdbnumber", "year", "premiered", "rating", "thumbnail", "playcount", "lastplayed", "file", "fanart", "tag"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
||||||
else:
|
else:
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "properties": ["sorttitle", "title", "playcount", "lastplayed", "imdbnumber", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "properties": ["sorttitle", "title", "playcount", "lastplayed", "imdbnumber", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
||||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||||
|
@ -158,7 +158,7 @@ class ReadKodiDB():
|
||||||
|
|
||||||
def getKodiTVShow(self, id):
|
def getKodiTVShow(self, id):
|
||||||
xbmc.sleep(sleepVal)
|
xbmc.sleep(sleepVal)
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "properties": ["art", "genre", "plot", "mpaa", "cast", "studio", "sorttitle", "title", "originaltitle", "imdbnumber", "year", "lastplayed", "premiered", "rating", "thumbnail", "playcount", "file", "fanart"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "properties": ["art", "genre", "plot", "mpaa", "cast", "studio", "sorttitle", "title", "originaltitle", "imdbnumber", "year", "lastplayed", "premiered", "rating", "thumbnail", "playcount", "file", "fanart", "tag"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
||||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||||
tvshow = None
|
tvshow = None
|
||||||
if(jsonobject.has_key('result')):
|
if(jsonobject.has_key('result')):
|
||||||
|
|
|
@ -313,7 +313,8 @@ class WriteKodiDB():
|
||||||
premieredatelist = (MBitem.get("PremiereDate")).split("T")
|
premieredatelist = (MBitem.get("PremiereDate")).split("T")
|
||||||
premieredate = premieredatelist[0]
|
premieredate = premieredatelist[0]
|
||||||
changes |= self.updateProperty(KodiItem,"premiered",premieredate,"tvshow")
|
changes |= self.updateProperty(KodiItem,"premiered",premieredate,"tvshow")
|
||||||
|
|
||||||
|
changes |= self.updatePropertyArray(KodiItem,"tag",MBitem.get("Tag"),"tvshow")
|
||||||
changes |= self.updateProperty(KodiItem,"mpaa",MBitem.get("OfficialRating"),"tvshow")
|
changes |= self.updateProperty(KodiItem,"mpaa",MBitem.get("OfficialRating"),"tvshow")
|
||||||
changes |= self.updateProperty(KodiItem,"lastplayed",MBitem.get("LastPlayedDate"),"tvshow")
|
changes |= self.updateProperty(KodiItem,"lastplayed",MBitem.get("LastPlayedDate"),"tvshow")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue