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
+18
-10
No files matched your search
+12
-9
@@ -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"):
|
||||
|
||||
Reference in new issue
Block a user