mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Fix update library
Only do the compare when user selects update library, also add a restart service option in the add-on settings > advanced
This commit is contained in:
parent
1174c685e9
commit
66822b6d0a
6 changed files with 28 additions and 11 deletions
|
@ -885,3 +885,11 @@ msgstr ""
|
|||
msgctxt "#33179"
|
||||
msgid "Force transcode"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#33180"
|
||||
msgid "Restart Emby for Kodi"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#33181"
|
||||
msgid "Restarting to apply the patch"
|
||||
msgstr ""
|
||||
|
|
|
@ -87,6 +87,8 @@ class Events(object):
|
|||
browse(params.get('type'), params.get('id'), params.get('folder'), server)
|
||||
elif mode == 'synclib':
|
||||
event('SyncLibrary', {'Id': params.get('id')})
|
||||
elif mode == 'updatelib':
|
||||
event('SyncLibrary', {'Id': params.get('id'), 'Update': True})
|
||||
elif mode == 'repairlib':
|
||||
event('RepairLibrary', {'Id': params.get('id')})
|
||||
elif mode == 'removelib':
|
||||
|
@ -117,6 +119,8 @@ class Events(object):
|
|||
get_themes()
|
||||
elif mode == 'backup':
|
||||
backup()
|
||||
elif mode == 'restartservice':
|
||||
window('emby.restart.bool', True)
|
||||
else:
|
||||
listing()
|
||||
|
||||
|
@ -150,7 +154,7 @@ def listing():
|
|||
|
||||
if view_id and node in ('movies', 'tvshows', 'musicvideos', 'music') and view_id in whitelist:
|
||||
|
||||
context.append((_(33136), "RunPlugin(plugin://plugin.video.emby/?mode=synclib&id=%s)" % view_id))
|
||||
context.append((_(33136), "RunPlugin(plugin://plugin.video.emby/?mode=updatelib&id=%s)" % view_id))
|
||||
context.append((_(33132), "RunPlugin(plugin://plugin.video.emby/?mode=repairlib&id=%s)" % view_id))
|
||||
context.append((_(33133), "RunPlugin(plugin://plugin.video.emby/?mode=removelib&id=%s)" % view_id))
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ class Service(xbmc.Monitor):
|
|||
if not data.get('Id'):
|
||||
return
|
||||
|
||||
self.library_thread.add_library(data['Id'])
|
||||
self.library_thread.add_library(data['Id'], data.get('Update', False))
|
||||
xbmc.executebuiltin("Container.Refresh")
|
||||
|
||||
elif method == 'RepairLibrary':
|
||||
|
|
|
@ -29,11 +29,11 @@ class FullSync(object):
|
|||
|
||||
sync = None
|
||||
|
||||
def __init__(self, library, library_id=None):
|
||||
def __init__(self, library, library_id=None, update=False):
|
||||
|
||||
self.library = library
|
||||
self.direct_path = settings('useDirectPaths') == "1"
|
||||
|
||||
self.update_library = update
|
||||
self.server = Emby()
|
||||
self.sync = get_sync()
|
||||
|
||||
|
@ -253,7 +253,8 @@ class FullSync(object):
|
|||
message=movie['Name'])
|
||||
obj.movie(movie, library=library)
|
||||
|
||||
self.movies_compare(library, obj, embydb)
|
||||
if self.update_library:
|
||||
self.movies_compare(library, obj, embydb)
|
||||
|
||||
def movies_compare(self, library, obj, embydb):
|
||||
|
||||
|
@ -297,7 +298,8 @@ class FullSync(object):
|
|||
dialog.update(percent, message="%s/%s" % (message, episode['Name'][:10]))
|
||||
obj.episode(episode)
|
||||
|
||||
self.tvshows_compare(library, obj, embydb)
|
||||
if self.update_library:
|
||||
self.tvshows_compare(library, obj, embydb)
|
||||
|
||||
def tvshows_compare(self, library, obj, embydb):
|
||||
|
||||
|
@ -337,7 +339,8 @@ class FullSync(object):
|
|||
message=mvideo['Name'])
|
||||
obj.musicvideo(mvideo, library=library)
|
||||
|
||||
self.musicvideos_compare(library, obj, embydb)
|
||||
if self.update_library:
|
||||
self.musicvideos_compare(library, obj, embydb)
|
||||
|
||||
def musicvideos_compare(self, library, obj, embydb):
|
||||
|
||||
|
@ -386,7 +389,8 @@ class FullSync(object):
|
|||
message="%s/%s/%s" % (message, album['Name'][:7], song['Name'][:7]))
|
||||
obj.song(song)
|
||||
|
||||
self.music_compare(library, obj, embydb)
|
||||
if self.update_library:
|
||||
self.music_compare(library, obj, embydb)
|
||||
|
||||
def music_compare(self, library, obj, embydb):
|
||||
|
||||
|
|
|
@ -480,12 +480,12 @@ class Library(threading.Thread):
|
|||
library = libraries[x - 1]
|
||||
selected_libraries.append(library['Id'])
|
||||
|
||||
event(modes[mode], {'Id': ','.join([libraries[x - 1]['Id'] for x in selection])})
|
||||
event(modes[mode], {'Id': ','.join([libraries[x - 1]['Id'] for x in selection]), 'Update': mode == 'SyncLibrarySelection'})
|
||||
|
||||
def add_library(self, library_id):
|
||||
def add_library(self, library_id, update=False):
|
||||
|
||||
try:
|
||||
FullSync(self, library_id)
|
||||
FullSync(self, library_id, update=update)
|
||||
except Exception as error:
|
||||
LOG.exception(error)
|
||||
|
||||
|
|
|
@ -93,6 +93,7 @@
|
|||
<setting label="30239" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=reset)" option="close" />
|
||||
<setting label="30535" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=deviceid)" option="close" />
|
||||
<setting label="33161" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=checkupdate)" option="close" />
|
||||
<setting label="33180" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=restartservice)" option="close" />
|
||||
|
||||
<setting type="sep"/>
|
||||
<setting label="33104" type="lsep"/>
|
||||
|
|
Loading…
Reference in a new issue