diff --git a/src/swingmusic/lib/taglib.py b/src/swingmusic/lib/taglib.py index 85e5fccc..d626527b 100644 --- a/src/swingmusic/lib/taglib.py +++ b/src/swingmusic/lib/taglib.py @@ -182,6 +182,10 @@ def get_tags(filepath: str, config: UserConfig) -> dict: else: other = {} + date = parse_date(tags.year or "") + if date is None: + date = int(last_mod) + metadata: dict[str, Any] = { "album": tags.album, "albumartists": tags.albumartist, @@ -197,7 +201,7 @@ def get_tags(filepath: str, config: UserConfig) -> dict: "genres": tags.genre, "copyright": " ".join(other.get("copyright", [])), # INFO: Extract copyright from extra data "extra": {}, - "date": parse_date(tags.year or "") or int(last_mod) + "date": date }