Add refresh boxsets option

This commit is contained in:
angelblue05 2017-11-02 22:34:41 -05:00
parent b130f7646a
commit a4e12da8fe
5 changed files with 53 additions and 6 deletions

View file

@ -111,6 +111,7 @@ def doMainListing():
addDirectoryItem(lang(33053), "plugin://plugin.video.emby/?mode=settings")
addDirectoryItem(lang(33054), "plugin://plugin.video.emby/?mode=adduser")
addDirectoryItem(lang(33055), "plugin://plugin.video.emby/?mode=refreshplaylist")
addDirectoryItem(lang(33098), "plugin://plugin.video.emby/?mode=refreshboxsets")
addDirectoryItem(lang(33056), "plugin://plugin.video.emby/?mode=manualsync")
addDirectoryItem(lang(33057), "plugin://plugin.video.emby/?mode=repair")
addDirectoryItem(lang(33058), "plugin://plugin.video.emby/?mode=reset")
@ -1215,4 +1216,4 @@ def getExtraFanArt(embyId,embyPath):
log.error("Error getting extrafanart: %s" % e)
# Always do endofdirectory to prevent errors in the logs
xbmcplugin.endOfDirectory(int(sys.argv[1]))
xbmcplugin.endOfDirectory(int(sys.argv[1]))

View file

@ -288,6 +288,7 @@ class LibrarySync(threading.Thread):
process = {
'movies': self.movies,
'boxsets': self.boxsets,
'musicvideos': self.musicvideos,
'tvshows': self.tvshows
}
@ -404,15 +405,19 @@ class LibrarySync(threading.Thread):
movies.add_all("Movie", all_movies, view)
log.debug("Movies finished.")
return True
def boxsets(self, embycursor, kodicursor, pdialog):
movies = Movies(embycursor, kodicursor, pdialog)
##### PROCESS BOXSETS #####
if pdialog:
pdialog.update(heading=lang(29999), message=lang(33018))
boxsets = self.emby.getBoxset(dialog=pdialog)
movies.add_all("BoxSet", boxsets)
log.debug("Boxsets finished.")
log.debug("Boxsets finished.")
return True
def musicvideos(self, embycursor, kodicursor, pdialog):
@ -775,12 +780,35 @@ class ManualSync(LibrarySync):
def __init__(self):
LibrarySync.__init__(self)
def sync(self):
return self.fullSync(manualrun=True)
def sync(self, mediatype=None):
if mediatype in ('movies', 'boxsets', 'musicvideos', 'tvshows'):
with database.DatabaseConn('emby') as cursor_emby:
with database.DatabaseConn('video') as cursor_video:
pDialog = self.progressDialog("Manual Sync: %s" % mediatype)
if mediatype == 'movies':
return self.movies(cursor_emby, cursor_video, pDialog)
elif mediatype == "boxsets":
return self.boxsets(cursor_emby, cursor_video, pDialog)
elif mediatype =='musicvideos':
return self.musicvideos(cursor_emby, cursor_video, pDialog)
elif mediatype == 'tvshows':
return self.tvshows(cursor_emby, cursor_video, pDialog)
elif mediatype == 'music':
with database.DatabaseConn('emby') as cursor_emby:
with database.DatabaseConn('music') as cursor_music:
pDialog = self.progressDialog("Manual Sync: %s" % mediatype)
return self.music(cursor_emby, cursor_music, pDialog)
else:
return self.fullSync(manualrun=True)
def movies(self, embycursor, kodicursor, pdialog):
return Movies(embycursor, kodicursor, pdialog).compare_all()
def boxsets(self, embycursor, kodicursor, pdialog):
return Movies(embycursor, kodicursor, pdialog).force_refresh_boxsets()
def musicvideos(self, embycursor, kodicursor, pdialog):
return MusicVideos(embycursor, kodicursor, pdialog).compare_all()

View file

@ -54,6 +54,17 @@ class Movies(Items):
return actions.get(action)
def force_refresh_boxsets(self):
if self.pdialog:
self.pdialog.update(heading=lang(29999), message=lang(33018))
boxsets = self.emby.getBoxset(dialog=self.pdialog)
self.add_all("BoxSet", boxsets)
log.debug("Boxsets finished.")
return True
def compare_all(self):
# Pull the list of movies and boxsets in Kodi
views = self.emby_db.getView_byType('movies')