Merge pull request #1514 from croneter/fix-continue-watching

Add an additional Plex Hub "PKC Continue Watching" that merges the Plex Continue Watching with On Deck
This commit is contained in:
croneter 2021-06-05 15:49:43 +02:00 committed by GitHub
commit f877c37e76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,7 @@ e.g. plugin://... calls. Hence be careful to only rely on window variables.
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger
import sys
import copy
import xbmc
import xbmcplugin
@ -423,6 +424,7 @@ def hub(content_type):
# We need to make sure that only entries that WORK are displayed
# WARNING: using xml.remove(child) in for-loop requires traversing from
# the end!
pkc_cont_watching = None
for entry in reversed(xml):
api = API(entry)
append = False
@ -439,6 +441,21 @@ def hub(content_type):
append = True
if not append:
xml.remove(entry)
# HACK ##################
# Merge Plex's "Continue watching" with "On deck"
if entry.get('key') == '/hubs/home/continueWatching':
pkc_cont_watching = copy.deepcopy(entry)
pkc_cont_watching.set('key', '/hubs/continueWatching')
title = pkc_cont_watching.get('title') or 'Continue Watching'
pkc_cont_watching.set('title', 'PKC %s' % title)
if pkc_cont_watching:
for i, entry in enumerate(xml):
if entry.get('key') == '/hubs/home/continueWatching':
xml.insert(i + 1, pkc_cont_watching)
break
# END HACK ##################
show_listing(xml)