Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
Do not raise an exception when disc number is missing, defaults to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
zas committed Jan 10, 2024
1 parent 8ab77dd commit e4d5817
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lb_content_resolver/formats/flac.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def read(file):
mdata["release_name"] = get_tag_value(tags, "album")
mdata["recording_name"] = get_tag_value(tags, "title")
mdata["track_num"] = extract_track_number(get_tag_value(tags, "tracknumber"))
mdata["disc_num"] = int(get_tag_value(tags, "discnumber"))
mdata["disc_num"] = int(get_tag_value(tags, "discnumber") or 1)
mdata["artist_mbid"] = get_tag_value(tags, "musicbrainz_artistid")
mdata["recording_mbid"] = get_tag_value(tags, "musicbrainz_trackid")
mdata["release_mbid"] = get_tag_value(tags, "musicbrainz_albumid")
Expand Down
2 changes: 1 addition & 1 deletion lb_content_resolver/formats/mp3.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def read(file):
if "TPOS" in tags:
mdata["disc_num"] = extract_track_number(str(tags["TPOS"]))
else:
mdata["disc_num"] = 0
mdata["disc_num"] = 1

if "TXXX:MusicBrainz Artist Id" in tags:
id = str(tags["TXXX:MusicBrainz Artist Id"])
Expand Down
2 changes: 1 addition & 1 deletion lb_content_resolver/formats/ogg_opus.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def read(file):
mdata["release_name"] = get_tag_value(tags, "album")
mdata["recording_name"] = get_tag_value(tags, "title")
mdata["track_num"] = extract_track_number(get_tag_value(tags, "tracknumber"))
mdata["disc_num"] = int(get_tag_value(tags, "discnumber"))
mdata["disc_num"] = int(get_tag_value(tags, "discnumber") or 1)
mdata["artist_mbid"] = get_tag_value(tags, "musicbrainz_artistid", "")
mdata["recording_mbid"] = get_tag_value(tags, "musicbrainz_trackid", "")
mdata["release_mbid"] = get_tag_value(tags, "musicbrainz_albumid", "")
Expand Down
2 changes: 1 addition & 1 deletion lb_content_resolver/formats/ogg_vorbis.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def read(file):
mdata["release_name"] = get_tag_value(tags, "album")
mdata["recording_name"] = get_tag_value(tags, "title")
mdata["track_num"] = extract_track_number(get_tag_value(tags, "tracknumber"))
mdata["disc_num"] = int(get_tag_value(tags, "discnumber"))
mdata["disc_num"] = int(get_tag_value(tags, "discnumber") or 1)
mdata["artist_mbid"] = get_tag_value(tags, "musicbrainz_artistid", "")
mdata["recording_mbid"] = get_tag_value(tags, "musicbrainz_trackid", "")
mdata["release_mbid"] = get_tag_value(tags, "musicbrainz_albumid", "")
Expand Down
2 changes: 1 addition & 1 deletion lb_content_resolver/formats/wma.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def read(file):
mdata["release_name"] = str(get_tag_value(tags, "WM/AlbumTitle"))
mdata["recording_name"] = str(get_tag_value(tags, "Title"))
mdata["track_num"] = extract_track_number(str(get_tag_value(tags, "WM/TrackNumber")))
mdata["disc_num"] = int(get_tag_value(tags, "WM/SetSubTitle"))
mdata["disc_num"] = int(get_tag_value(tags, "WM/SetSubTitle") or 1)
mdata["artist_mbid"] = str(get_tag_value(tags, "MusicBrainz/Artist Id"))
mdata["recording_mbid"] = str(get_tag_value(tags, "MusicBrainz/Release Track Id"))
mdata["release_mbid"] = str(get_tag_value(tags, "MusicBrainz/Album Id"))
Expand Down

0 comments on commit e4d5817

Please sign in to comment.