Merge pull request #1513 from croneter/py3-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:
commit
9b9f1cc1a8
1 changed files with 17 additions and 0 deletions
|
@ -6,6 +6,7 @@ e.g. plugin://... calls. Hence be careful to only rely on window variables.
|
||||||
"""
|
"""
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
import sys
|
import sys
|
||||||
|
import copy
|
||||||
|
|
||||||
import xbmc
|
import xbmc
|
||||||
import xbmcplugin
|
import xbmcplugin
|
||||||
|
@ -416,6 +417,7 @@ def hub(content_type):
|
||||||
# We need to make sure that only entries that WORK are displayed
|
# We need to make sure that only entries that WORK are displayed
|
||||||
# WARNING: using xml.remove(child) in for-loop requires traversing from
|
# WARNING: using xml.remove(child) in for-loop requires traversing from
|
||||||
# the end!
|
# the end!
|
||||||
|
pkc_cont_watching = None
|
||||||
for entry in reversed(xml):
|
for entry in reversed(xml):
|
||||||
api = API(entry)
|
api = API(entry)
|
||||||
append = False
|
append = False
|
||||||
|
@ -432,6 +434,21 @@ def hub(content_type):
|
||||||
append = True
|
append = True
|
||||||
if not append:
|
if not append:
|
||||||
xml.remove(entry)
|
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)
|
show_listing(xml)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue