Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

243 revert enum #248

Merged
merged 3 commits into from
Apr 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 36 additions & 9 deletions tidalapi/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,54 +53,75 @@
from tidalapi.types import JsonObj


class Quality:
class Quality(str, Enum):
low_96k: str = "LOW"
low_320k: str = "HIGH"
high_lossless: str = "LOSSLESS"
hi_res: str = "HI_RES"
hi_res_lossless: str = "HI_RES_LOSSLESS"

def __str__(self) -> str:
return self.value

class VideoQuality:

class VideoQuality(str, Enum):
high: str = "HIGH"
medium: str = "MEDIUM"
low: str = "LOW"
audio_only: str = "AUDIO_ONLY"

def __str__(self) -> str:
return self.value


class AudioMode:
class AudioMode(str, Enum):
stereo: str = "STEREO"
sony_360: str = "SONY_360RA"
dolby_atmos: str = "DOLBY_ATMOS"

def __str__(self) -> str:
return self.value


class MediaMetadataTags:
class MediaMetadataTags(str, Enum):
mqa: str = "MQA"
hires_lossless: str = "HIRES_LOSSLESS"
lossless: str = "LOSSLESS"
sony_360: str = "SONY_360RA"
dolby_atmos: str = "DOLBY_ATMOS"

def __str__(self) -> str:
return self.value

class AudioExtensions:

class AudioExtensions(str, Enum):
FLAC: str = ".flac"
M4A: str = ".m4a"
MP4: str = ".mp4"

def __str__(self) -> str:
return self.value


class VideoExtensions:
class VideoExtensions(str, Enum):
TS: str = ".ts"

def __str__(self) -> str:
return self.value

class ManifestMimeType:

class ManifestMimeType(str, Enum):
# EMU: str = "application/vnd.tidal.emu"
# APPL: str = "application/vnd.apple.mpegurl"
MPD: str = "application/dash+xml"
BTS: str = "application/vnd.tidal.bts"
VIDEO: str = "video/mp2t"

def __str__(self) -> str:
return self.value


class Codec:
class Codec(str, Enum):
MP3: str = "MP3"
AAC: str = "AAC"
M4A: str = "MP4A"
Expand All @@ -113,8 +134,11 @@ class Codec:
PremiumCodecs: [str] = [MQA, Atmos, AC4]
HQCodecs: [str] = PremiumCodecs + [FLAC]

def __str__(self) -> str:
return self.value

class MimeType:

class MimeType(str, Enum):
audio_mpeg = "audio/mpeg"
audio_mp3 = "audio/mp3"
audio_m4a = "audio/m4a"
Expand All @@ -135,6 +159,9 @@ class MimeType:
Codec.AC4: audio_ac4,
}

def __str__(self) -> str:
return self.value

@staticmethod
def from_audio_codec(codec):
return MimeType.audio_map.get(codec, MimeType.audio_m4a)
Expand Down
Loading