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"
msgstr ""
msgctxt "#30507"
msgid "Enable notification if update count is greater than"
msgstr ""
msgctxt "#30508"
msgid "Sync empty shows"
msgstr ""
@ -837,3 +841,7 @@ msgstr ""
msgctxt "#33171"
msgid "A-Z"
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']]
"""
try:
updated = []
userdata = []
removed = []
for media in filters:
result = self.server['api'].get_sync_queue(last_sync, ",".join([x for x in filters if x != media]))
self.updated(result['ItemsAdded'])
self.updated(result['ItemsUpdated'])
self.userdata(result['UserDataChanged'])
self.removed(result['ItemsRemoved'])
updated.extend(result['ItemsAdded'])
updated.extend(result['ItemsUpdated'])
userdata.extend(result['UserDataChanged'])
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)

View file

@ -20,6 +20,7 @@
<category label="30506"><!-- Sync Options -->
<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="30511" id="useDirectPaths" type="enum" lvalues="33036|33037" default="1" />