diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index 9dcd9bf4..cf6d6a26 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -49,7 +49,7 @@ import clientinfo import downloadutils from utils import window, settings, language as lang, tryDecode, tryEncode, \ DateToKodi -from PlexFunctions import PlexToKodiTimefactor, PMSHttpsEnabled +from PlexFunctions import PLEX_TO_KODI_TIMEFACTOR, PMSHttpsEnabled import embydb_functions as embydb ############################################################################### @@ -1528,8 +1528,8 @@ class API(): except (KeyError, ValueError): resume = 0.0 - runtime = int(runtime * PlexToKodiTimefactor()) - resume = int(resume * PlexToKodiTimefactor()) + runtime = int(runtime * PLEX_TO_KODI_TIMEFACTOR) + resume = int(resume * PLEX_TO_KODI_TIMEFACTOR) return resume, runtime def getMpaa(self): @@ -1749,7 +1749,7 @@ class API(): 'key': key, 'title': title, 'thumb': thumb, - 'duration': int(duration * PlexToKodiTimefactor()), + 'duration': int(duration * PLEX_TO_KODI_TIMEFACTOR), 'extraType': extraType, 'originallyAvailableAt': originallyAvailableAt, 'year': year diff --git a/resources/lib/PlexFunctions.py b/resources/lib/PlexFunctions.py index 132e8b63..7a3b3c46 100644 --- a/resources/lib/PlexFunctions.py +++ b/resources/lib/PlexFunctions.py @@ -17,12 +17,7 @@ addonName = 'PlexKodiConnect' ############################################################################### - -def PlexToKodiTimefactor(): - """ - Kodi measures time in seconds, but Plex in milliseconds - """ - return 1.0 / 1000.0 +PLEX_TO_KODI_TIMEFACTOR = 1.0 / 1000.0 def ConvertPlexToKodiTime(plexTime): @@ -31,7 +26,7 @@ def ConvertPlexToKodiTime(plexTime): """ if plexTime is None: return None - return int(float(plexTime) * PlexToKodiTimefactor()) + return int(float(plexTime) * PLEX_TO_KODI_TIMEFACTOR) def GetItemClassFromType(itemType): diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index 9d01481c..75fcd2d5 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -171,7 +171,7 @@ def playWatchLater(itemid, viewOffset): int(sys.argv[1]), False, xbmcgui.ListItem()) if viewOffset != '0': try: - viewOffset = int(PlexFunctions.PlexToKodiTimefactor() * + viewOffset = int(PlexFunctions.PLEX_TO_KODI_TIMEFACTOR * float(viewOffset)) except: pass