added new file format for artist/song info

This commit is contained in:
Kristy Fournier 2025-07-06 13:55:30 -04:00
parent 776ebbbd34
commit 824bbdea45
2 changed files with 10 additions and 3 deletions

View file

@ -69,12 +69,19 @@ for i in songFiles:
title = song['title'][0] title = song['title'][0]
artist = song['artist'][0] artist = song['artist'][0]
except: except:
try: if "_" in i:
# if metadata is missing, try to use file name following title_artist.mp3 # if metadata is missing, try to use file name following title_artist.mp3
song = i.split("_") song = i.split("_")
title = song[0] title = song[0]
artist = song[1].split(".")[0] artist = song[1].split(".")[0]
except: elif "-" in i:
# if there's no underscore, try artist - title.mp3
song = i.split("-")
title = song[1].split(".")[0]
artist = song[0]
title = title.strip()
artist = artist.strip()
else:
#if the file is not formatted with an underscore, the title is the file name #if the file is not formatted with an underscore, the title is the file name
title = i title = i
artist = None artist = None

View file

@ -39,7 +39,7 @@ These are specific details on each section of the app, and how to use them
- `sound/` contains all mp3 files by default - `sound/` contains all mp3 files by default
- `databaseGenerator.py` scans through mp3 files and gets information about them - `databaseGenerator.py` scans through mp3 files and gets information about them
- `Filename, Title, Artist, Art, Length` are all saved - `Filename, Title, Artist, Art, Length` are all saved
- *If the title and artist are not in the mp3 metadata, it looks for a format of* `TITLE_ARTIST.mp3` *and otherwise defaults to the file name as the title, and no artist* - *If the title and artist are not in the mp3 metadata, it looks for a format of* `TITLE_ARTIST.mp3` *then of* `ARTIST - TITLE.mp3` *and otherwise defaults to the file name as the title, and no artist*
- Art is retrieved from LastFM - Art is retrieved from LastFM
- Running with `--mode (update/new)` either updates the current database and adds new songs/removes deleted songs, or recreates the entire database (update is default, and is faster in art mode) - Running with `--mode (update/new)` either updates the current database and adds new songs/removes deleted songs, or recreates the entire database (update is default, and is faster in art mode)
- Running with `--art (True/False)` retrieves art from LastFM or doesn't (True is default) - Running with `--art (True/False)` retrieves art from LastFM or doesn't (True is default)