1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-23 19:55:38 +01:00

Remove dateutil and make a workaround for <py37

cx_freeze dont include timezone data when it create the .exe
datetime has some issues with timezones in older versions of py
This commit is contained in:
Johan Andersson 2019-09-08 00:11:16 +02:00
parent 32323ee28f
commit 65b97aa5a0
3 changed files with 13 additions and 4 deletions

View File

@ -3,16 +3,17 @@
from __future__ import absolute_import
import copy
import datetime
import hashlib
import json
import logging
import re
import time
from operator import itemgetter
from urllib.parse import parse_qs
from urllib.parse import urljoin
from urllib.parse import urlparse
import dateutil.parser
from svtplay_dl.error import ServiceError
from svtplay_dl.fetcher.dash import dashparse
from svtplay_dl.fetcher.hls import hlsparse
@ -303,7 +304,17 @@ class Svtplay(Service, MetadataThumbMixin):
self.output["tvshow"] = self.output["season"] is not None and self.output["episode"] is not None
if "validFrom" in episode:
self.output["publishing_datetime"] = int(dateutil.parser.parse(episode["validFrom"]).strftime("%s"))
def _fix_broken_timezone_implementation(value):
# cx_freeze cant include .zip file for dateutil and < py37 have issues
if ":" == value[-3:-2]:
value = value[:-3] + value[-2:]
return value
print(_fix_broken_timezone_implementation(episode["validFrom"]))
self.output["publishing_datetime"] = int(
time.mktime(datetime.datetime.strptime(_fix_broken_timezone_implementation(episode["validFrom"]), "%Y-%m-%dT%H:%M:%S%z").timetuple())
)
self.output["title_nice"] = data[data[visibleid]["parent"]["id"]]["name"]

View File

@ -2,4 +2,3 @@ requests
PySocks
cryptography
pyyaml
python-dateutil

View File

@ -22,7 +22,6 @@ deps.append("requests>=2.0.0")
deps.append("PySocks")
deps.append("cryptography")
deps.append("pyyaml")
deps.append("python-dateutil")
setup(
name="svtplay-dl",