Notify user of large updates

Give option to back out if the user wants to manually update the libraries
This commit is contained in:
angelblue05 2018-09-22 01:09:57 -05:00
parent cc5c60e356
commit 3880c39177
3 changed files with 30 additions and 4 deletions

View file

@ -230,6 +230,10 @@ msgctxt "#30506"
msgid "Sync" msgid "Sync"
msgstr "" msgstr ""
msgctxt "#30507"
msgid "Enable notification if update count is greater than"
msgstr ""
msgctxt "#30508" msgctxt "#30508"
msgid "Sync empty shows" msgid "Sync empty shows"
msgstr "" msgstr ""
@ -837,3 +841,7 @@ msgstr ""
msgctxt "#33171" msgctxt "#33171"
msgid "A-Z" msgid "A-Z"
msgstr "" msgstr ""
msgctxt "#33172"
msgid "You have {number} updates pending. This may take a little while before seeing new content. It might be faster to update your libraries via launching the Emby add-on > update libraries. Proceed anyway?"
msgstr ""

View file

@ -264,12 +264,29 @@ class Library(threading.Thread):
[self.updated_output[query['Type']].put(query) for query in data['Items']] [self.updated_output[query['Type']].put(query) for query in data['Items']]
""" """
try: try:
updated = []
userdata = []
removed = []
for media in filters: for media in filters:
result = self.server['api'].get_sync_queue(last_sync, ",".join([x for x in filters if x != media])) result = self.server['api'].get_sync_queue(last_sync, ",".join([x for x in filters if x != media]))
self.updated(result['ItemsAdded']) updated.extend(result['ItemsAdded'])
self.updated(result['ItemsUpdated']) updated.extend(result['ItemsUpdated'])
self.userdata(result['UserDataChanged']) userdata.extend(result['UserDataChanged'])
self.removed(result['ItemsRemoved']) removed.extend(result['ItemsRemoved'])
total = len(updated) + len(userdata)
if total > int(settings('incSyncIndicator') or 99):
if not dialog("yesno", heading="{emby}", line1=_(33172).replace('{number}', str(total))):
LOG.warn("Large updates skipped.")
return True
self.updated(updated)
self.userdata(userdata)
self.removed(removed)
""" """
result = self.server['api'].get_sync_queue(last_sync) result = self.server['api'].get_sync_queue(last_sync)

View file

@ -20,6 +20,7 @@
<category label="30506"><!-- Sync Options --> <category label="30506"><!-- Sync Options -->
<setting label="33137" id="kodiCompanion" type="bool" default="true" /> <setting label="33137" id="kodiCompanion" type="bool" default="true" />
<setting label="30507" id="incSyncIndicator" type="number" default="99" visible="eq(-1,true)" subsetting="true"/>
<setting label="33111" type="lsep" /> <setting label="33111" type="lsep" />
<setting label="30511" id="useDirectPaths" type="enum" lvalues="33036|33037" default="1" /> <setting label="30511" id="useDirectPaths" type="enum" lvalues="33036|33037" default="1" />