feat(playout): replace pytz with zoneinfo (#1969)

This commit is contained in:
Jonas L 2022-07-17 22:59:49 +02:00 committed by GitHub
parent 8996d4beb4
commit 96af028daa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -6,11 +6,12 @@ import re
import signal
import time
import traceback
from datetime import timezone
from subprocess import PIPE, Popen
from threading import Thread
from zoneinfo import ZoneInfo
import mutagen
import pytz
from libretime_api_client.version1 import AirtimeApiClient as AirtimeApiClientV1
from loguru import logger
@ -277,11 +278,12 @@ class Recorder(Thread):
show_name = self.shows_to_record[start_time][2]
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_server = start_time_on_UTC.replace(
tzinfo=pytz.utc
).astimezone(T)
tzinfo=timezone.utc
).astimezone(server_tz)
start_time_formatted = (
"%(year)d-%(month)02d-%(day)02d %(hour)02d:%(min)02d:%(sec)02d"
% {

View File

@ -1,8 +1,8 @@
# Please do not edit this file, edit the setup.py file!
# 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
kombu==4.6.11
mutagen>=1.45.1,<1.46
pytz
requests>=2.25.1,<2.29
typing-extensions

View File

@ -30,10 +30,10 @@ setup(
},
python_requires=">=3.6",
install_requires=[
"backports.zoneinfo>=0.2.1,<0.3;python_version<'3.9'",
"defusedxml>=0.6.0,<0.8",
"kombu==4.6.11",
"mutagen>=1.45.1,<1.46",
"pytz",
"requests>=2.25.1,<2.29",
"typing-extensions",
],