feat: add FLAC lossless format support and refactor quality pickers (while staying backward compatible)
- Add `FLAC_FLAC` (16), `FLAC_FLAC_24BIT` (22) format codes (based on librespot-org/librespot#796, librespot-org/librespot#1424) - Regenerate Metadata_pb2.py with protoc 3.20.1 - Add enums: `SuperAudioFormat.FLAC`, `AudioQuality.LOSSLESS` - Refactor to generic DRY `FormatOnlyAudioQuality` base class while maintaining existing `VorbisOnlyAudioQuality` as wrapper - Remove `AAC_24_NORM` (replaced by `FLAC_FLAC` at code 16)
This commit is contained in:
@@ -6,6 +6,7 @@ class SuperAudioFormat(enum.Enum):
|
||||
MP3 = 0x00
|
||||
VORBIS = 0x01
|
||||
AAC = 0x02
|
||||
FLAC = 0x03
|
||||
|
||||
@staticmethod
|
||||
def get(audio_format: Metadata.AudioFile.Format):
|
||||
@@ -26,7 +27,11 @@ class SuperAudioFormat(enum.Enum):
|
||||
if audio_format in [
|
||||
Metadata.AudioFile.Format.AAC_24,
|
||||
Metadata.AudioFile.Format.AAC_48,
|
||||
Metadata.AudioFile.Format.AAC_24_NORM,
|
||||
]:
|
||||
return SuperAudioFormat.AAC
|
||||
if audio_format in [
|
||||
Metadata.AudioFile.Format.FLAC_FLAC,
|
||||
Metadata.AudioFile.Format.FLAC_FLAC_24BIT,
|
||||
]:
|
||||
return SuperAudioFormat.FLAC
|
||||
raise RuntimeError("Unknown audio format: {}".format(audio_format))
|
||||
|
||||
Reference in New Issue
Block a user