mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-07 10:33:38 +00:00
Change notify enabled Emby, Kodi, and Plex clients to update on deleted.
This commit is contained in:
parent
f213cd9ccc
commit
ae6289695f
2 changed files with 19 additions and 4 deletions
|
@ -113,6 +113,7 @@
|
||||||
* Change removed NZBGet 'remote' PostProcess guidance until it is verified to work
|
* Change removed NZBGet 'remote' PostProcess guidance until it is verified to work
|
||||||
* Fix Trakt, recommended and watchlist (send_oauth is now sent)
|
* Fix Trakt, recommended and watchlist (send_oauth is now sent)
|
||||||
* Change some log messages from info to debug type
|
* Change some log messages from info to debug type
|
||||||
|
* Change notify enabled Emby, Kodi, and Plex clients to update deleted
|
||||||
|
|
||||||
|
|
||||||
### 0.14.9 (2018-03-19 13:10:00 UTC)
|
### 0.14.9 (2018-03-19 13:10:00 UTC)
|
||||||
|
|
|
@ -5474,13 +5474,13 @@ class History(MainHandler):
|
||||||
row_show_ids.update({int(rowid): {int(tvid): int(shoid)}})
|
row_show_ids.update({int(rowid): {int(tvid): int(shoid)}})
|
||||||
|
|
||||||
sql_results = my_db.select(
|
sql_results = my_db.select(
|
||||||
'SELECT rowid, label, location'
|
'SELECT rowid, tvep_id, label, location'
|
||||||
' FROM [tv_episodes_watched] WHERE `rowid` in (%s)' % ','.join([str(k) for k in row_show_ids.keys()])
|
' FROM [tv_episodes_watched] WHERE `rowid` in (%s)' % ','.join([str(k) for k in row_show_ids.keys()])
|
||||||
)
|
)
|
||||||
|
|
||||||
h_records = []
|
h_records = []
|
||||||
removed = []
|
removed = []
|
||||||
deleted = []
|
deleted = {}
|
||||||
attempted = []
|
attempted = []
|
||||||
refresh = []
|
refresh = []
|
||||||
for r in sql_results:
|
for r in sql_results:
|
||||||
|
@ -5500,7 +5500,7 @@ class History(MainHandler):
|
||||||
if not ek.ek(os.path.isfile, r['location']):
|
if not ek.ek(os.path.isfile, r['location']):
|
||||||
logger.log(u'Deleted file %s' % r['location'])
|
logger.log(u'Deleted file %s' % r['location'])
|
||||||
|
|
||||||
deleted += [r['location']]
|
deleted.update({r['tvep_id']: row_show_ids[r['rowid']]})
|
||||||
if row_show_ids[r['rowid']] not in refresh:
|
if row_show_ids[r['rowid']] not in refresh:
|
||||||
# schedule a show for one refresh after deleting an arbitrary number of locations
|
# schedule a show for one refresh after deleting an arbitrary number of locations
|
||||||
refresh += [row_show_ids[r['rowid']]]
|
refresh += [row_show_ids[r['rowid']]]
|
||||||
|
@ -5515,6 +5515,20 @@ class History(MainHandler):
|
||||||
if 1 == r_del.rowcount:
|
if 1 == r_del.rowcount:
|
||||||
removed += ['%s-%s-%s' % (r['rowid'], k, v) for k, v in row_show_ids[r['rowid']].iteritems()]
|
removed += ['%s-%s-%s' % (r['rowid'], k, v) for k, v in row_show_ids[r['rowid']].iteritems()]
|
||||||
|
|
||||||
|
updating = False
|
||||||
|
for epid, tvid_shoid_dict in deleted.iteritems():
|
||||||
|
sql_results = my_db.select('SELECT season, episode FROM [tv_episodes] WHERE `episode_id` = %s' % epid)
|
||||||
|
for r in sql_results:
|
||||||
|
show = helpers.find_show_by_id(sickbeard.showList, tvid_shoid_dict)
|
||||||
|
ep_obj = show.getEpisode(r['season'], r['episode'])
|
||||||
|
for n in filter(lambda x: x.name.lower() in ('emby', 'kodi', 'plex'),
|
||||||
|
notifiers.NotifierFactory().get_enabled()):
|
||||||
|
if 'PLEX' == n.name:
|
||||||
|
if updating:
|
||||||
|
continue
|
||||||
|
updating = True
|
||||||
|
n.update_library(show=show, show_name=show.name, ep_obj=ep_obj)
|
||||||
|
|
||||||
for tvid_shoid_dict in refresh:
|
for tvid_shoid_dict in refresh:
|
||||||
try:
|
try:
|
||||||
sickbeard.showQueueScheduler.action.refreshShow(
|
sickbeard.showQueueScheduler.action.refreshShow(
|
||||||
|
@ -5523,7 +5537,7 @@ class History(MainHandler):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if not any([removed, h_records, len(deleted)]):
|
if not any([removed, h_records, len(deleted)]):
|
||||||
msg = 'No items removed, removed, or files deleted'
|
msg = 'No items removed and no files deleted'
|
||||||
else:
|
else:
|
||||||
msg = []
|
msg = []
|
||||||
if deleted:
|
if deleted:
|
||||||
|
|
Loading…
Reference in a new issue