From 7d38ccf504e1224f83ee3b42219f5c222f329f01 Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 1 Apr 2018 10:18:15 +0200 Subject: [PATCH] Hopefully fix ValueError for datetime.utcnow() - Should fix #448 --- resources/lib/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lib/utils.py b/resources/lib/utils.py index 3c3ac8b6..8a8319b3 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -13,7 +13,6 @@ from time import localtime, strftime from unicodedata import normalize import xml.etree.ElementTree as etree from functools import wraps, partial -from calendar import timegm from os.path import join from os import remove, walk, makedirs from shutil import rmtree @@ -33,6 +32,7 @@ LOG = getLogger("PLEX." + __name__) WINDOW = xbmcgui.Window(10000) ADDON = xbmcaddon.Addon(id='plugin.video.plexkodiconnect') +EPOCH = datetime.utcfromtimestamp(0) ############################################################################### # Main methods @@ -331,7 +331,7 @@ def unix_timestamp(seconds_into_the_future=None): future = datetime.utcnow() + timedelta(seconds=seconds_into_the_future) else: future = datetime.utcnow() - return timegm(future.timetuple()) + return int((future - EPOCH).total_seconds()) def kodi_sql(media_type=None):