replace ciso8601 with python datetime

This commit is contained in:
Rafael Moraes 2024-10-27 12:32:38 -03:00
parent 1ee8e2aa13
commit 2d3b2b6b1f

View File

@ -1,6 +1,7 @@
from __future__ import annotations from __future__ import annotations
import base64 import base64
import datetime
import functools import functools
import io import io
import re import re
@ -9,7 +10,6 @@ import subprocess
import typing import typing
from pathlib import Path from pathlib import Path
import ciso8601
import requests import requests
from InquirerPy import inquirer from InquirerPy import inquirer
from InquirerPy.base.control import Choice from InquirerPy.base.control import Choice
@ -306,13 +306,12 @@ class Downloader:
playlist_file.writelines(playlist_file_lines) playlist_file.writelines(playlist_file_lines)
@staticmethod @staticmethod
def millis_to_min_sec(millis): def millis_to_min_sec(millis) -> str:
minutes, seconds = divmod(millis // 1000, 60) minutes, seconds = divmod(millis // 1000, 60)
return f"{minutes:02d}:{seconds:02d}" return f"{minutes:02d}:{seconds:02d}"
def sanitize_date(self, date: str): def sanitize_date(self, date: str) -> datetime.datetime:
datetime_obj = ciso8601.parse_datetime(date) return datetime.datetime.fromisoformat(date).strftime(self.template_date)
return datetime_obj.strftime(self.template_date)
def get_decryption_key(self, pssh: str, track_id: str) -> str: def get_decryption_key(self, pssh: str, track_id: str) -> str:
try: try: