music-assistant-server

1 KBPY
constants.py
1 KB41 lines • python
1"""Constants for the Internet Archive provider."""
2
3from __future__ import annotations
4
5# Internet Archive API endpoints
6IA_SEARCH_URL = "https://archive.org/advancedsearch.php"
7IA_METADATA_URL = "https://archive.org/metadata"
8IA_DETAILS_URL = "https://archive.org/details"
9IA_DOWNLOAD_URL = "https://archive.org/download"
10IA_SERVE_URL = "https://archive.org/serve"
11
12# Audio file formats supported by IA (normalized to lowercase for consistent comparison)
13# IA API returns formats in inconsistent casing, so we normalize to lowercase internally
14SUPPORTED_AUDIO_FORMATS = {
15    "vbr mp3",
16    "mp3",
17    "128kbps mp3",
18    "64kbps mp3",
19    "flac",
20    "ogg vorbis",
21    "ogg",
22    "aac",
23    "m4a",
24    "wav",
25    "aiff",
26}
27
28# Preferred format order for audio quality (normalized to lowercase)
29# Ordered from highest to lowest quality preference
30PREFERRED_AUDIO_FORMATS = [
31    "flac",
32    "vbr mp3",
33    "ogg vorbis",
34    "mp3",
35    "128kbps mp3",
36    "64kbps mp3",
37]
38
39# Collections that should be treated as audiobooks (verified)
40AUDIOBOOK_COLLECTIONS = {"librivoxaudio"}
41