improvement: no media number if only one

This commit is contained in:
2025-09-15 14:01:52 +02:00
parent ca2c7ae3c5
commit f7e22805f8
3 changed files with 85 additions and 19 deletions

View File

@@ -19,12 +19,13 @@
# The input to this awk program is a sequence of lines containing the following fields:
# Field 1: The MusicBrainz ID of the release this track belongs to
# Field 2: MusicBrainz ID of this track
# Field 3: Medium number of this track within the release
# Field 4: Track number of this track within the medium
# Field 5: Duration of this track in miliseconds
# Field 6: Title of this track
# Field 7: Artist of this track
# Field 8: Path to decoratoin file of this release
# Field 3: Number of media of theis release
# Field 4: Medium number of this track within the release
# Field 5: Track number of this track within the medium
# Field 6: Duration of this track in miliseconds
# Field 7: Title of this track
# Field 8: Artist of this track
# Field 9: Path to decoratoin file of this release
#
# The output is a sequence of tab-delimited lines containing the following fields:
# Field 1: Sort value (to sort the track within the release)
@@ -47,12 +48,13 @@ BEGIN {
{
parentid = $1
id = $2
med = $3
nr = $4
dur = $5
title = $6
artist = $7
deco = local_recordings[id] ? $8 : ""
medtot = $3
med = $4
nr = $5
dur = $6
title = $7
artist = $8
deco = local_recordings[id] ? $9 : ""
gsub("&", "\\\\&", title)
gsub("&", "\\\\&", artist)
# Parse duration
@@ -69,7 +71,10 @@ BEGIN {
dur = "??:??"
}
line = format
sub("<<med>>", med, line)
if (medtot == 1)
sub("<<med>>", "", line)
else
sub("<<med>>", med, line)
sub("<<nr>>", nr, line)
sub("<<title>>", title, line)
sub("<<artist>>", artist, line)