feat(playout): replace pytz with zoneinfo (#1969)
This commit is contained in:
parent
8996d4beb4
commit
96af028daa
|
@ -6,11 +6,12 @@ import re
|
||||||
import signal
|
import signal
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
from datetime import timezone
|
||||||
from subprocess import PIPE, Popen
|
from subprocess import PIPE, Popen
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
from zoneinfo import ZoneInfo
|
||||||
|
|
||||||
import mutagen
|
import mutagen
|
||||||
import pytz
|
|
||||||
from libretime_api_client.version1 import AirtimeApiClient as AirtimeApiClientV1
|
from libretime_api_client.version1 import AirtimeApiClient as AirtimeApiClientV1
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
|
@ -277,11 +278,12 @@ class Recorder(Thread):
|
||||||
show_name = self.shows_to_record[start_time][2]
|
show_name = self.shows_to_record[start_time][2]
|
||||||
server_timezone = self.shows_to_record[start_time][3]
|
server_timezone = self.shows_to_record[start_time][3]
|
||||||
|
|
||||||
T = pytz.timezone(server_timezone)
|
server_tz = ZoneInfo(server_timezone)
|
||||||
start_time_on_UTC = getDateTimeObj(start_time)
|
start_time_on_UTC = getDateTimeObj(start_time)
|
||||||
start_time_on_server = start_time_on_UTC.replace(
|
start_time_on_server = start_time_on_UTC.replace(
|
||||||
tzinfo=pytz.utc
|
tzinfo=timezone.utc
|
||||||
).astimezone(T)
|
).astimezone(server_tz)
|
||||||
|
|
||||||
start_time_formatted = (
|
start_time_formatted = (
|
||||||
"%(year)d-%(month)02d-%(day)02d %(hour)02d:%(min)02d:%(sec)02d"
|
"%(year)d-%(month)02d-%(day)02d %(hour)02d:%(min)02d:%(sec)02d"
|
||||||
% {
|
% {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# Please do not edit this file, edit the setup.py file!
|
# Please do not edit this file, edit the setup.py file!
|
||||||
# This file is auto-generated by tools/extract_requirements.py.
|
# This file is auto-generated by tools/extract_requirements.py.
|
||||||
|
backports.zoneinfo>=0.2.1,<0.3;python_version<'3.9'
|
||||||
defusedxml>=0.6.0,<0.8
|
defusedxml>=0.6.0,<0.8
|
||||||
kombu==4.6.11
|
kombu==4.6.11
|
||||||
mutagen>=1.45.1,<1.46
|
mutagen>=1.45.1,<1.46
|
||||||
pytz
|
|
||||||
requests>=2.25.1,<2.29
|
requests>=2.25.1,<2.29
|
||||||
typing-extensions
|
typing-extensions
|
||||||
|
|
|
@ -30,10 +30,10 @@ setup(
|
||||||
},
|
},
|
||||||
python_requires=">=3.6",
|
python_requires=">=3.6",
|
||||||
install_requires=[
|
install_requires=[
|
||||||
|
"backports.zoneinfo>=0.2.1,<0.3;python_version<'3.9'",
|
||||||
"defusedxml>=0.6.0,<0.8",
|
"defusedxml>=0.6.0,<0.8",
|
||||||
"kombu==4.6.11",
|
"kombu==4.6.11",
|
||||||
"mutagen>=1.45.1,<1.46",
|
"mutagen>=1.45.1,<1.46",
|
||||||
"pytz",
|
|
||||||
"requests>=2.25.1,<2.29",
|
"requests>=2.25.1,<2.29",
|
||||||
"typing-extensions",
|
"typing-extensions",
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue