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

@ -67,7 +67,7 @@ class Main(object):
if mode == 'settings':
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
elif mode in ('manualsync', 'fastsync', 'repair'):
elif mode in ('manualsync', 'fastsync', 'repair', 'refreshboxsets'):
self._library_sync(mode)
elif mode == 'texturecache':
@ -76,6 +76,10 @@ class Main(object):
else:
entrypoint.doMainListing()
try:
xbmcplugin.endOfDirectory(int(sys.argv[1]))
except Exception: pass
@classmethod
def _modes(cls, mode, params):
import utils
@ -153,6 +157,8 @@ class Main(object):
librarysync.ManualSync().sync()
elif mode == 'fastsync':
library_sync.startSync()
elif mode == 'refreshboxsets':
librarysync.ManualSync().sync('boxsets')
else:
library_sync.fullSync(repair=True)
else:

View file

@ -356,4 +356,5 @@
<string id="33095">Failed to retrieve latest updates using fast sync, using full sync.</string>
<string id="33096">Limit video resolution to screen resolution</string>
<string id="33097">Important, cleanonupdate was removed in your advanced settings to prevent conflict with Emby for Kodi. Kodi will restart now.</string>
<string id="33098">Refresh boxsets</string>
</strings>

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")

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):
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')