Revert "Attempt to fix Kodi overwriting paths in Kodi DB"

This reverts commit 8cd9deef40.
This commit is contained in:
croneter 2018-02-17 13:48:57 +01:00
parent 8cd9deef40
commit a1eb926dc3
3 changed files with 4 additions and 22 deletions

View file

@ -36,9 +36,6 @@ def playback_triage(plex_id=None, plex_type=None, path=None, resolve=True):
Hit this function for addon path playback, Plex trailers, etc. Hit this function for addon path playback, Plex trailers, etc.
Will setup playback first, then on second call complete playback. Will setup playback first, then on second call complete playback.
path: either the complete plugin://plugin.video.plexkodiconnect path
OR just the query '?plex_id=458160&mode=play&plex_type=movie'
Will set Playback_Successful() with potentially a PKC_ListItem() attached Will set Playback_Successful() with potentially a PKC_ListItem() attached
(to be consumed by setResolvedURL in default.py) (to be consumed by setResolvedURL in default.py)
@ -68,7 +65,7 @@ def playback_triage(plex_id=None, plex_type=None, path=None, resolve=True):
LOG.debug('playQueue position: %s for %s', pos, playqueue) LOG.debug('playQueue position: %s for %s', pos, playqueue)
# Have we already initiated playback? # Have we already initiated playback?
try: try:
item = playqueue.items[pos] playqueue.items[pos]
except IndexError: except IndexError:
# Release our default.py before starting our own Kodi player instance # Release our default.py before starting our own Kodi player instance
if resolve is True: if resolve is True:
@ -78,20 +75,8 @@ def playback_triage(plex_id=None, plex_type=None, path=None, resolve=True):
pickle_me(result) pickle_me(result)
playback_init(plex_id, plex_type, playqueue) playback_init(plex_id, plex_type, playqueue)
else: else:
if item.playback_init is False: # kick off playback on second pass
# Hack: we need to use setResolvedUrl twice. Otherwise, Kodi conclude_playback(playqueue, pos)
# overwrites the path in the Kodi database (addon-path) with the
# result of the first setResolvedUrl
item.playback_init = True
if not path.startswith('plugin://'):
path = 'plugin://%s%s' % (v.ADDON_ID, path)
LOG.debug('Initializing playback for one item using path %s', path)
result = Playback_Successful()
result.listitem = PKC_ListItem(path=path)
pickle_me(result)
else:
# kick off playback on second pass
conclude_playback(playqueue, pos)
def playback_init(plex_id, plex_type, playqueue): def playback_init(plex_id, plex_type, playqueue):

View file

@ -28,7 +28,7 @@ class Playback_Starter(Thread):
if mode == 'play': if mode == 'play':
playback.playback_triage(plex_id=params.get('plex_id'), playback.playback_triage(plex_id=params.get('plex_id'),
plex_type=params.get('plex_type'), plex_type=params.get('plex_type'),
path=item) path=params.get('path'))
elif mode == 'plex_node': elif mode == 'plex_node':
playback.process_indirect(params['key'], params['offset']) playback.process_indirect(params['key'], params['offset'])
elif mode == 'context_menu': elif mode == 'context_menu':

View file

@ -138,8 +138,6 @@ class Playlist_Item(object):
offset = None [int] the item's view offset UPON START in Plex time offset = None [int] the item's view offset UPON START in Plex time
part = 0 [int] part number if Plex video consists of mult. parts part = 0 [int] part number if Plex video consists of mult. parts
force_transcode [bool] defaults to False force_transcode [bool] defaults to False
playback_init [bool] Hack to use setResolvedUrl twice (and thus only
"correctly") if playback_init is set to True
""" """
def __init__(self): def __init__(self):
self.id = None self.id = None
@ -158,7 +156,6 @@ class Playlist_Item(object):
# If Plex video consists of several parts; part number # If Plex video consists of several parts; part number
self.part = 0 self.part = 0
self.force_transcode = False self.force_transcode = False
self.playback_init = False
def __repr__(self): def __repr__(self):
""" """