From f9ab077e7dc4879f8d0c0de52b5a39bb31c854cf Mon Sep 17 00:00:00 2001 From: Rafael Moraes <50295204+glomatico@users.noreply.github.com> Date: Fri, 13 Mar 2026 12:23:36 -0300 Subject: [PATCH] Add format_name property to AudioQuality --- votify/interface/constants.py | 9 +++++++++ votify/interface/enums.py | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/votify/interface/constants.py b/votify/interface/constants.py index 933438b..9f84eaa 100644 --- a/votify/interface/constants.py +++ b/votify/interface/constants.py @@ -47,6 +47,15 @@ FORMAT_ID_MAP = { "flac": "17", } +FORMAT_NAME_MAP = { + "aac-high": "MP4_256", + "aac-medium": "MP4_128", + "vorbis-low": "OGG_VORBIS_96", + "vorbis-medium": "OGG_VORBIS_160", + "vorbis-high": "OGG_VORBIS_320", + "flac": "FLAC", +} + MP4_AUDIO_QUALITIES = {"aac-high", "aac-medium", "flac"} VORBIS_AUDIO_QUALITIES = {"vorbis-high", "vorbis-medium", "vorbis-low"} PREMIUM_AUDIO_QUALITIES = {"aac-high", "vorbis-high", "flac"} diff --git a/votify/interface/enums.py b/votify/interface/enums.py index 8dc741d..83083d9 100644 --- a/votify/interface/enums.py +++ b/votify/interface/enums.py @@ -9,6 +9,7 @@ from .constants import ( MP4_AUDIO_QUALITIES, PREMIUM_AUDIO_QUALITIES, VORBIS_AUDIO_QUALITIES, + FORMAT_NAME_MAP, ) @@ -84,6 +85,10 @@ class AudioQuality(Enum): def format_id(self) -> str | None: return FORMAT_ID_MAP.get(self.value) + @property + def format_name(self) -> str | None: + return FORMAT_NAME_MAP.get(self.value) + @property def previous_quality(self) -> "AudioQuality" | None: if not self.mp4: