Skip to content

Commit

Permalink
Compatibility for Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Croneter committed Dec 19, 2020
1 parent 8326833 commit 569f901
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions default.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# We need this in order to use add-on paths like
# 'plugin://plugin.video.plexkodiconnect.MOVIES' in the Kodi video database
###############################################################################
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger
import sys
import os
Expand All @@ -14,12 +13,11 @@

# Import from the main pkc add-on
__addon__ = xbmcaddon.Addon(id='plugin.video.plexkodiconnect')
__temp_path__ = os.path.join(__addon__.getAddonInfo('path').decode('utf-8'), 'resources', 'lib')
__base__ = xbmc.translatePath(__temp_path__.encode('utf-8')).decode('utf-8')
__temp_path__ = os.path.join(__addon__.getAddonInfo('path'), 'resources', 'lib')
__base__ = xbmc.translatePath(__temp_path__.encode('utf-8'))
sys.path.append(__base__)

import transfer, loghandler
from tools import unicode_paths

###############################################################################
loghandler.config()
Expand All @@ -41,12 +39,12 @@ def play():
xbmcplugin.setResolvedUrl(HANDLE, False, xbmcgui.ListItem())
return
else:
request = '%s&handle=%s' % (unicode_paths.decode(sys.argv[2]), HANDLE)
if b'resume:true' in sys.argv:
request = f'{sys.argv[2]}&handle={HANDLE}'
if 'resume:true' in sys.argv:
request += '&resume=1'
elif b'resume:false' in sys.argv:
elif 'resume:false' in sys.argv:
request += '&resume=0'
transfer.plex_command('PLAY-%s' % request)
transfer.plex_command(f'PLAY-{request}')
if HANDLE == -1:
# Handle -1 received, not waiting for main thread
return
Expand Down

0 comments on commit 569f901

Please sign in to comment.