diff --git a/backend/.env.example b/backend/.env.example index e3bcb80..5429564 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -1,3 +1,8 @@ LYRIA_API_KEY=your-api-key-here LYRIA_DEFAULT_MODEL=lyria-3-clip-preview -TZ=America/New_York \ No newline at end of file +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 \ No newline at end of file diff --git a/backend/src/main.py b/backend/src/main.py index 7334f47..a08f1c5 100644 --- a/backend/src/main.py +++ b/backend/src/main.py @@ -177,13 +177,15 @@ async def download_clip(clip_id: str): if clip.get("title"): audio.tags["TIT2"] = TIT2(encoding=3, text=clip["title"]) - # Artist - if clip.get("artist"): - audio.tags["TPE1"] = TPE1(encoding=3, text=clip["artist"]) + # Artist (clip field > env default) + artist = clip.get("artist") or os.environ.get("DEFAULT_ID3_ARTIST") + if artist: + audio.tags["TPE1"] = TPE1(encoding=3, text=artist) - # Album - if clip.get("album"): - audio.tags["TALB"] = TALB(encoding=3, text=clip["album"]) + # Album (clip field > env default) + album = clip.get("album") or os.environ.get("DEFAULT_ID3_ALBUM") + if album: + audio.tags["TALB"] = TALB(encoding=3, text=album) # Comment if clip.get("comment"): @@ -197,9 +199,10 @@ async def download_clip(clip_id: str): if clip.get("key"): audio.tags["TKEY"] = TKEY(encoding=3, text=clip["key"]) - # Genre - if clip.get("genre"): - audio.tags["TCON"] = TCON(encoding=3, text=clip["genre"]) + # Genre (clip field > env default) + genre = clip.get("genre") or os.environ.get("DEFAULT_ID3_GENRE") + if genre: + audio.tags["TCON"] = TCON(encoding=3, text=genre) # Album art if clip.get("artwork_filename"):