Skip to content

Commit 8b0f302

Browse files
committed
Expose 'Watchlist' in per library views too
1 parent b693098 commit 8b0f302

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

default.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def triage(mode, params, path, arguments, itemid):
8787
elif mode == 'watchlater':
8888
entrypoint.watchlater()
8989
elif mode == 'watchlist':
90-
entrypoint.watchlist()
90+
entrypoint.watchlist(section_id=params.get('section_id'))
9191
elif mode == 'channels':
9292
entrypoint.browse_plex(key='/channels/all')
9393
elif mode == 'search':

resources/lib/entrypoint.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def show_listing(xml, plex_type=None, section_id=None, synched=True, key=None):
205205
return
206206
api = API(xml[0])
207207
# Determine content type for Kodi's Container.content
208-
if key == '/hubs/home/continueWatching':
208+
if key == '/hubs/home/continueWatching' or key == 'watchlist':
209209
# Mix of movies and episodes
210210
plex_type = v.PLEX_TYPE_VIDEO
211211
elif key == '/hubs/home/recentlyAdded?type=2':
@@ -257,6 +257,10 @@ def show_listing(xml, plex_type=None, section_id=None, synched=True, key=None):
257257
# filter out items that are not in the kodi db (items that will not be playable)
258258
all_items = [item for item in all_items if item.kodi_id is not None]
259259

260+
# filter out items in the wrong section id when it's specified
261+
if section_id is not None:
262+
all_items = [item for item in all_items if item.section_id == utils.cast(int, section_id)]
263+
260264
all_items = [widgets.generate_item(api) for api in all_items]
261265
all_items = [widgets.prepare_listitem(item) for item in all_items]
262266
# fill that listing...
@@ -475,7 +479,7 @@ def watchlater():
475479
show_listing(xml)
476480

477481

478-
def watchlist():
482+
def watchlist(section_id=None):
479483
"""
480484
Listing for plex.tv Watchlist section (if signed in to plex.tv)
481485
"""
@@ -495,7 +499,7 @@ def watchlist():
495499
except (TypeError, IndexError, AttributeError):
496500
LOG.error('Could not download watch list list from plex.tv')
497501
raise ListingException
498-
show_listing(xml, None, None, False, "watchlist")
502+
show_listing(xml, None, section_id, False, "watchlist")
499503

500504

501505
def browse_plex(key=None, plex_type=None, section_id=None, synched=True,

resources/lib/library_sync/nodes.py

+21
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@
8888
'section_id': '{self.section_id}'
8989
},
9090
v.CONTENT_TYPE_MOVIE),
91+
('watchlist',
92+
utils.lang(39212), # "Watchlist"
93+
{
94+
'mode': 'watchlist',
95+
'key': '/library/sections/{self.section_id}/watchlist',
96+
'section_id': '{self.section_id}'
97+
},
98+
v.CONTENT_TYPE_MOVIE),
9199
('browse',
92100
utils.lang(39702), # "Browse by folder"
93101
{
@@ -175,6 +183,14 @@
175183
'section_id': '{self.section_id}'
176184
},
177185
v.CONTENT_TYPE_EPISODE),
186+
('watchlist',
187+
utils.lang(39212), # "Watchlist"
188+
{
189+
'mode': 'watchlist',
190+
'key': '/library/sections/{self.section_id}/watchlist',
191+
'section_id': '{self.section_id}'
192+
},
193+
v.CONTENT_TYPE_SHOW),
178194
('browse',
179195
utils.lang(39702), # "Browse by folder"
180196
{
@@ -391,3 +407,8 @@ def node_more(section, node_name, args):
391407

392408
def node_plex_sets(section, node_name, args):
393409
return _folder_template(section, node_name, args)
410+
411+
412+
def node_watchlist(section, node_name, args):
413+
return _folder_template(section, node_name, args)
414+

0 commit comments

Comments
 (0)