diff --git a/default.py b/default.py
index aa042b6c..695c6d63 100644
--- a/default.py
+++ b/default.py
@@ -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:
diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml
index 4ab2fe0b..5510dfaf 100644
--- a/resources/language/English/strings.xml
+++ b/resources/language/English/strings.xml
@@ -356,4 +356,5 @@
Failed to retrieve latest updates using fast sync, using full sync.
Limit video resolution to screen resolution
Important, cleanonupdate was removed in your advanced settings to prevent conflict with Emby for Kodi. Kodi will restart now.
+ Refresh boxsets
\ No newline at end of file
diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py
index 5f8e5ee8..3675f718 100644
--- a/resources/lib/entrypoint.py
+++ b/resources/lib/entrypoint.py
@@ -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]))
\ No newline at end of file
+ xbmcplugin.endOfDirectory(int(sys.argv[1]))
diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py
index 97470035..8f6d92ff 100644
--- a/resources/lib/librarysync.py
+++ b/resources/lib/librarysync.py
@@ -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()
diff --git a/resources/lib/objects/movies.py b/resources/lib/objects/movies.py
index 3be163f0..a469a103 100644
--- a/resources/lib/objects/movies.py
+++ b/resources/lib/objects/movies.py
@@ -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')