[PR #316] [MERGED] feat: add FLAC lossless format support #318

Closed
opened 2026-02-27 08:12:43 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kokarare1212/librespot-python/pull/316
Author: @akbad
Created: 10/11/2025
Status: Merged
Merged: 10/11/2025
Merged by: @kokarare1212

Base: mainHead: feat/add-flac


📝 Commits (2)

  • ee2c110 fix(audio/decoders): use audio_format in unknown-format error
  • e909cfd feat: add FLAC lossless format support and refactor quality pickers (while staying backward compatible)

📊 Changes

4 files changed (+144 additions, -3707 deletions)

View changed files

📝 librespot/audio/decoders.py (+62 -21)
📝 librespot/audio/format.py (+6 -1)
📝 librespot/proto/Metadata_pb2.py (+74 -3684)
📝 proto/metadata.proto (+2 -1)

📄 Description

Summary

  • Adds FLAC lossless audio format support to librespot-python based on format codes in librespot upstream
  • Refactors quality picker classes for DRYness while maintaining backward compatibility

Details

  • Add FLAC_FLAC (16) and FLAC_FLAC_24BIT (22) format codes to metadata.proto

  • Add enum values for FLAC:

    • SuperAudioFormat.FLAC maps FLAC formats to FLAC container type
    • AudioQuality.LOSSLESS maps FLAC formats to lossless quality tier
  • Refactor to generic DRY FormatOnlyAudioQuality base class, while maintaining 100% backward compatibility via:

    • Maintaining existing VorbisOnlyAudioQuality as a wrapper
    • Adding new LosslessOnlyAudioQuality wrapper for FLAC file selection
  • Also fixes minor bug within unknown-format error in decoders.py


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kokarare1212/librespot-python/pull/316 **Author:** [@akbad](https://github.com/akbad) **Created:** 10/11/2025 **Status:** ✅ Merged **Merged:** 10/11/2025 **Merged by:** [@kokarare1212](https://github.com/kokarare1212) **Base:** `main` ← **Head:** `feat/add-flac` --- ### 📝 Commits (2) - [`ee2c110`](https://github.com/kokarare1212/librespot-python/commit/ee2c1107f676f94cb951c7c5a646c7f5fbfe5c13) fix(audio/decoders): use audio_format in unknown-format error - [`e909cfd`](https://github.com/kokarare1212/librespot-python/commit/e909cfdc76aadea28f3cdd3ca885f1ec163cd1b2) feat: add FLAC lossless format support and refactor quality pickers (while staying backward compatible) ### 📊 Changes **4 files changed** (+144 additions, -3707 deletions) <details> <summary>View changed files</summary> 📝 `librespot/audio/decoders.py` (+62 -21) 📝 `librespot/audio/format.py` (+6 -1) 📝 `librespot/proto/Metadata_pb2.py` (+74 -3684) 📝 `proto/metadata.proto` (+2 -1) </details> ### 📄 Description ## Summary - Adds **FLAC lossless audio format support** to librespot-python based on [format codes in librespot upstream](https://github.com/librespot-org/librespot/blob/61f517bfff27c8cdb209cd36ffefc682285b540d/protocol/proto/metadata.proto#L309-L313) - Refactors quality picker classes for DRYness while maintaining backward compatibility ## Details - Add `FLAC_FLAC` (16) and `FLAC_FLAC_24BIT` (22) format codes to `metadata.proto` - Added upstream by librespot-org/librespot#796 and librespot-org/librespot#1424 - Regenerated `Metadata_pb2.py` with protoc 3.20.1 (as in requirements) - Removed obsolete `AAC_24_NORM` as done upstream (format that previously occupied code 16) - Add enum values for FLAC: - `SuperAudioFormat.FLAC` maps FLAC formats to FLAC container type - `AudioQuality.LOSSLESS` maps FLAC formats to lossless quality tier - Refactor to generic DRY `FormatOnlyAudioQuality` base class, while maintaining 100% backward compatibility via: - Maintaining existing `VorbisOnlyAudioQuality` as a wrapper - Adding new `LosslessOnlyAudioQuality` wrapper for FLAC file selection - Also fixes minor bug within unknown-format error in decoders.py --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 08:12:43 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot-python-kokarare1212#318
No description provided.