Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore websocket messages for sections that are not being synced #2083

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions resources/lib/library_sync/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ def store_timeline_message(data):
if typus in (v.PLEX_TYPE_CLIP, v.PLEX_TYPE_SET):
# No need to process extras or trailers
continue
if message.get('sectionID') is not None and \
not is_section_synced(message.get('sectionID')):
# The item is in a section that is not being synced to kodi
continue
status = int(message['state'])
if typus == 'playlist' and PLAYLIST_SYNC_ENABLED:
playlists.websocket(plex_id=str(message['itemID']),
Expand Down Expand Up @@ -209,6 +213,10 @@ def store_activity_message(data):
message['Activity']['Context']['refreshed'] == False:
# The item was scanned but not actually refreshed
continue
elif message['Activity']['Context'].get('librarySectionID') is not None and \
not is_section_synced(message['Activity']['Context'].get('librarySectionID')):
# The item is in a section that is not being synced to kodi
continue
plex_id = PF.GetPlexKeyNumber(message['Activity']['Context']['key'])[1]
if not plex_id:
# Likely a Plex id like /library/metadata/3/children
Expand Down Expand Up @@ -372,3 +380,9 @@ def cache_artwork(plex_id, plex_type, kodi_id=None, kodi_type=None):
with kodi_db.KODIDB_FROM_PLEXTYPE[plex_type](lock=False) as kodidb:
for url in kodidb.art_urls(kodi_id, kodi_type):
artwork.cache_url(url)

def is_section_synced(section_id):
"""
Returns true if the specified section is synced to kodi
"""
return next((section for section in app.SYNC.sections if section.sync_to_kodi and section.section_id == int(section_id)), None) is not None