mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16: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"
|
msgctxt "#33179"
|
||||||
msgid "Force transcode"
|
msgid "Force transcode"
|
||||||
msgstr ""
|
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)
|
browse(params.get('type'), params.get('id'), params.get('folder'), server)
|
||||||
elif mode == 'synclib':
|
elif mode == 'synclib':
|
||||||
event('SyncLibrary', {'Id': params.get('id')})
|
event('SyncLibrary', {'Id': params.get('id')})
|
||||||
|
elif mode == 'updatelib':
|
||||||
|
event('SyncLibrary', {'Id': params.get('id'), 'Update': True})
|
||||||
elif mode == 'repairlib':
|
elif mode == 'repairlib':
|
||||||
event('RepairLibrary', {'Id': params.get('id')})
|
event('RepairLibrary', {'Id': params.get('id')})
|
||||||
elif mode == 'removelib':
|
elif mode == 'removelib':
|
||||||
|
@ -117,6 +119,8 @@ class Events(object):
|
||||||
get_themes()
|
get_themes()
|
||||||
elif mode == 'backup':
|
elif mode == 'backup':
|
||||||
backup()
|
backup()
|
||||||
|
elif mode == 'restartservice':
|
||||||
|
window('emby.restart.bool', True)
|
||||||
else:
|
else:
|
||||||
listing()
|
listing()
|
||||||
|
|
||||||
|
@ -150,7 +154,7 @@ def listing():
|
||||||
|
|
||||||
if view_id and node in ('movies', 'tvshows', 'musicvideos', 'music') and view_id in whitelist:
|
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((_(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))
|
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'):
|
if not data.get('Id'):
|
||||||
return
|
return
|
||||||
|
|
||||||
self.library_thread.add_library(data['Id'])
|
self.library_thread.add_library(data['Id'], data.get('Update', False))
|
||||||
xbmc.executebuiltin("Container.Refresh")
|
xbmc.executebuiltin("Container.Refresh")
|
||||||
|
|
||||||
elif method == 'RepairLibrary':
|
elif method == 'RepairLibrary':
|
||||||
|
|
|
@ -29,11 +29,11 @@ class FullSync(object):
|
||||||
|
|
||||||
sync = None
|
sync = None
|
||||||
|
|
||||||
def __init__(self, library, library_id=None):
|
def __init__(self, library, library_id=None, update=False):
|
||||||
|
|
||||||
self.library = library
|
self.library = library
|
||||||
self.direct_path = settings('useDirectPaths') == "1"
|
self.direct_path = settings('useDirectPaths') == "1"
|
||||||
|
self.update_library = update
|
||||||
self.server = Emby()
|
self.server = Emby()
|
||||||
self.sync = get_sync()
|
self.sync = get_sync()
|
||||||
|
|
||||||
|
@ -253,6 +253,7 @@ class FullSync(object):
|
||||||
message=movie['Name'])
|
message=movie['Name'])
|
||||||
obj.movie(movie, library=library)
|
obj.movie(movie, library=library)
|
||||||
|
|
||||||
|
if self.update_library:
|
||||||
self.movies_compare(library, obj, embydb)
|
self.movies_compare(library, obj, embydb)
|
||||||
|
|
||||||
def movies_compare(self, library, obj, embydb):
|
def movies_compare(self, library, obj, embydb):
|
||||||
|
@ -297,6 +298,7 @@ class FullSync(object):
|
||||||
dialog.update(percent, message="%s/%s" % (message, episode['Name'][:10]))
|
dialog.update(percent, message="%s/%s" % (message, episode['Name'][:10]))
|
||||||
obj.episode(episode)
|
obj.episode(episode)
|
||||||
|
|
||||||
|
if self.update_library:
|
||||||
self.tvshows_compare(library, obj, embydb)
|
self.tvshows_compare(library, obj, embydb)
|
||||||
|
|
||||||
def tvshows_compare(self, library, obj, embydb):
|
def tvshows_compare(self, library, obj, embydb):
|
||||||
|
@ -337,6 +339,7 @@ class FullSync(object):
|
||||||
message=mvideo['Name'])
|
message=mvideo['Name'])
|
||||||
obj.musicvideo(mvideo, library=library)
|
obj.musicvideo(mvideo, library=library)
|
||||||
|
|
||||||
|
if self.update_library:
|
||||||
self.musicvideos_compare(library, obj, embydb)
|
self.musicvideos_compare(library, obj, embydb)
|
||||||
|
|
||||||
def musicvideos_compare(self, library, obj, embydb):
|
def musicvideos_compare(self, library, obj, embydb):
|
||||||
|
@ -386,6 +389,7 @@ class FullSync(object):
|
||||||
message="%s/%s/%s" % (message, album['Name'][:7], song['Name'][:7]))
|
message="%s/%s/%s" % (message, album['Name'][:7], song['Name'][:7]))
|
||||||
obj.song(song)
|
obj.song(song)
|
||||||
|
|
||||||
|
if self.update_library:
|
||||||
self.music_compare(library, obj, embydb)
|
self.music_compare(library, obj, embydb)
|
||||||
|
|
||||||
def music_compare(self, library, obj, embydb):
|
def music_compare(self, library, obj, embydb):
|
||||||
|
|
|
@ -480,12 +480,12 @@ class Library(threading.Thread):
|
||||||
library = libraries[x - 1]
|
library = libraries[x - 1]
|
||||||
selected_libraries.append(library['Id'])
|
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:
|
try:
|
||||||
FullSync(self, library_id)
|
FullSync(self, library_id, update=update)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
LOG.exception(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="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="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="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 type="sep"/>
|
||||||
<setting label="33104" type="lsep"/>
|
<setting label="33104" type="lsep"/>
|
||||||
|
|
Loading…
Reference in a new issue