feat: env-configurable default ID3 tags for artist, album, genre
DEFAULT_ID3_ARTIST, DEFAULT_ID3_ALBUM, DEFAULT_ID3_GENRE in .env. Clip-level metadata always takes priority. Env defaults fill in blanks. Current defaults: Kagamine Rin / Kithara Studio / Hardcore Techno. Also updated .env.example with all three new vars (commented out).
This commit is contained in:
1 parent
bef707f9a4
commit
6ec5cf4b1b
2 files changed
+17
-9
No files matched your search
@@ -1,3 +1,8 @@
|
|||||||
LYRIA_API_KEY=your-api-key-here
|
LYRIA_API_KEY=your-api-key-here
|
||||||
LYRIA_DEFAULT_MODEL=lyria-3-clip-preview
|
LYRIA_DEFAULT_MODEL=lyria-3-clip-preview
|
||||||
TZ=America/New_York
|
TZ=America/New_York
|
||||||
|
|
||||||
|
# Optional: Default ID3 tag values applied on download when track metadata is empty
|
||||||
|
# DEFAULT_ID3_ARTIST=Kithara Studio
|
||||||
|
# DEFAULT_ID3_ALBUM=Kithara Studio Collection
|
||||||
|
# DEFAULT_ID3_GENRE=Hardcore Techno
|
||||||
+12
-9
@@ -177,13 +177,15 @@ async def download_clip(clip_id: str):
|
|||||||
if clip.get("title"):
|
if clip.get("title"):
|
||||||
audio.tags["TIT2"] = TIT2(encoding=3, text=clip["title"])
|
audio.tags["TIT2"] = TIT2(encoding=3, text=clip["title"])
|
||||||
|
|
||||||
# Artist
|
# Artist (clip field > env default)
|
||||||
if clip.get("artist"):
|
artist = clip.get("artist") or os.environ.get("DEFAULT_ID3_ARTIST")
|
||||||
audio.tags["TPE1"] = TPE1(encoding=3, text=clip["artist"])
|
if artist:
|
||||||
|
audio.tags["TPE1"] = TPE1(encoding=3, text=artist)
|
||||||
|
|
||||||
# Album
|
# Album (clip field > env default)
|
||||||
if clip.get("album"):
|
album = clip.get("album") or os.environ.get("DEFAULT_ID3_ALBUM")
|
||||||
audio.tags["TALB"] = TALB(encoding=3, text=clip["album"])
|
if album:
|
||||||
|
audio.tags["TALB"] = TALB(encoding=3, text=album)
|
||||||
|
|
||||||
# Comment
|
# Comment
|
||||||
if clip.get("comment"):
|
if clip.get("comment"):
|
||||||
@@ -197,9 +199,10 @@ async def download_clip(clip_id: str):
|
|||||||
if clip.get("key"):
|
if clip.get("key"):
|
||||||
audio.tags["TKEY"] = TKEY(encoding=3, text=clip["key"])
|
audio.tags["TKEY"] = TKEY(encoding=3, text=clip["key"])
|
||||||
|
|
||||||
# Genre
|
# Genre (clip field > env default)
|
||||||
if clip.get("genre"):
|
genre = clip.get("genre") or os.environ.get("DEFAULT_ID3_GENRE")
|
||||||
audio.tags["TCON"] = TCON(encoding=3, text=clip["genre"])
|
if genre:
|
||||||
|
audio.tags["TCON"] = TCON(encoding=3, text=genre)
|
||||||
|
|
||||||
# Album art
|
# Album art
|
||||||
if clip.get("artwork_filename"):
|
if clip.get("artwork_filename"):
|
||||||
|
|||||||
Reference in new issue
Block a user