Fix TypeError

This commit is contained in:
croneter 2019-05-21 18:08:09 +02:00
parent 7725af5a6f
commit 9d79f78190

View file

@ -103,16 +103,15 @@ class PlexCompanion(backgroundthread.KillableThread):
raise PL.PlaylistError() raise PL.PlaylistError()
playqueue = PQ.get_playqueue_from_type( playqueue = PQ.get_playqueue_from_type(
v.KODI_PLAYLIST_TYPE_FROM_PLEX_TYPE[api.plex_type()]) v.KODI_PLAYLIST_TYPE_FROM_PLEX_TYPE[api.plex_type()])
if data.get('offset') not in ('0', None): offset = utils.cast(float, data.get('offset')) or None
offset = float(data['offset']) / 1000.0 if offset:
else: offset = offset / 1000.0
offset = None
playqueue.init_from_xml(xml, playqueue.init_from_xml(xml,
offset=offset, offset=offset,
transient_token=data.get('token')) transient_token=data.get('token'))
else: else:
app.CONN.plex_transient_token = data.get('token') app.CONN.plex_transient_token = data.get('token')
if data.get('offset') not in (None, '0'): if utils.cast(float, data.get('offset')):
app.PLAYSTATE.resume_playback = True app.PLAYSTATE.resume_playback = True
path = ('http://127.0.0.1:%s/plex/play/file.strm?plex_id=%s' path = ('http://127.0.0.1:%s/plex/play/file.strm?plex_id=%s'
% (v.WEBSERVICE_PORT, api.plex_id())) % (v.WEBSERVICE_PORT, api.plex_id()))
@ -155,7 +154,7 @@ class PlexCompanion(backgroundthread.KillableThread):
update_playqueue_from_PMS(playqueue, update_playqueue_from_PMS(playqueue,
playqueue_id=container_key, playqueue_id=container_key,
repeat=query.get('repeat'), repeat=query.get('repeat'),
offset=data.get('offset'), offset=utils.cast(float, data.get('offset')) or None,
transient_token=data.get('token')) transient_token=data.get('token'))
@staticmethod @staticmethod