From e8ab89cd7f70c5685d0e107b21a65e0ffb46f525 Mon Sep 17 00:00:00 2001 From: Lev Plyusnin Date: Sun, 24 Nov 2024 15:55:01 +0700 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D0=BE=D0=B2=D0=BC=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=B8=D0=BC=D0=BE=D1=81=D1=82=D0=B8=20=D1=81=20python=20?= =?UTF-8?q?<3.11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 5 +++-- requirements.txt | 1 + ymd/core.py | 24 +++++------------------- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bd4da91..06c3ff8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,13 +7,14 @@ build-backend = "setuptools.build_meta" [project] name = "yandex-music-downloader" -version = "3.2.1b0" +version = "3.2.1b1" description = "Загрузчик музыки с сервиса Яндекс.Музыка" requires-python = ">=3.9" readme = "README.md" dependencies = [ "yandex-music", - "mutagen" + "mutagen", + "StrEnum" ] [project.scripts] diff --git a/requirements.txt b/requirements.txt index 440848e..16446f7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ yandex-music mutagen +StrEnum diff --git a/ymd/core.py b/ymd/core.py index b6c3244..3b93842 100644 --- a/ymd/core.py +++ b/ymd/core.py @@ -2,11 +2,9 @@ import datetime as dt import random import re import typing -from collections.abc import Iterable from dataclasses import dataclass -from enum import Enum, StrEnum, auto from pathlib import Path -from typing import Optional, Type, TypeVar, Union +from typing import Optional, Union import mutagen from mutagen.flac import FLAC, Picture @@ -25,6 +23,7 @@ from mutagen.id3._frames import ( from mutagen.id3._specs import ID3TimeStamp, PictureType from mutagen.mp3 import MP3 from mutagen.mp4 import MP4, MP4Cover +from strenum import StrEnum from yandex_music import Client, DownloadInfo, Track, YandexMusicObject from ymd.api import get_lossless_info @@ -41,23 +40,10 @@ MAX_COMPATIBILITY_LEVEL = 1 AUDIO_FILE_SUFFIXES = {".mp3", ".flac", ".m4a"} -_E = TypeVar("_E", bound=Enum) - - -class ParameterEnum(StrEnum): - @classmethod - def available_keys(cls) -> Iterable[str]: - return cls.__members__.keys() - - @classmethod - def from_str(cls: Type[_E], arg: str) -> _E: - return cls[arg.lower()] - - class LyricsFormat(StrEnum): - NONE = auto() - TEXT = auto() - LRC = auto() + NONE = "none" + TEXT = "text" + LRC = "lrc" @dataclass