Skip to content

Commit

Permalink
Try to fix #114
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellowlol committed Jan 1, 2020
1 parent 864e2a2 commit d2ce7ed
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions bw_plex/plex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1246,28 +1246,32 @@ def check(data):
metadata_state = timeline.get('metadataState')

if (metadata_type in (1, 4) and state == 0 and
metadata_state == 'created' and
identifier == 'com.plexapp.plugins.library'):

metadata_state == 'created' and identifier == 'com.plexapp.plugins.library'):
LOG.debug('%s was added to %s', title, PMS.friendlyName)

# Youtubedl can fail if we batch add loads of eps at the same time if there is no
# theme.
if (metadata_type == 1 and not CONFIG['movie'].get('process_recently_added') or
metadata_state == 4 and not CONFIG['tv'].get('process_recently_added')):
metadata_type == 4 and not CONFIG['tv'].get('process_recently_added')):
LOG.debug("Didn't start to process %s is process_recently_added is disabled", title)
return

if ratingkey not in IN_PROG:
IN_PROG.append(ratingkey)
ep = PMS.fetchItem(int(ratingkey))
try:
ep = PMS.fetchItem(int(ratingkey))
except plexapi.exceptions.BadRequest:
# See https://github.com/Hellowlol/bw_plex/issues/114
LOG.exception("Didn't start to process %s", ratingkey)
return
ret = POOL.apply_async(process_to_db, args=(ep,))
return ret

elif (metadata_type in (1, 4) and state == 9 and
metadata_state == 'deleted'):

if (metadata_type == 1 and not CONFIG['movie'].get('process_deleted') or
metadata_state == 4 and not CONFIG['tv'].get('process_deleted')):
metadata_type == 4 and not CONFIG['tv'].get('process_deleted')):
LOG.debug("Didn't start to process %s is process_deleted is disabled for", title)
return

Expand Down

0 comments on commit d2ce7ed

Please sign in to comment.