diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2012-08-22 19:17:54 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2012-08-22 19:17:54 +0200 |
commit | baf66899f53f176378fa7dfe7ff78f676e627307 (patch) | |
tree | 95b7f0f1abe847e7e59bd2e4f3c04e990b06bc98 /organizemusic.cpp | |
parent | Add library display tool. (diff) | |
download | music-file-organizer-baf66899f53f176378fa7dfe7ff78f676e627307.tar.xz music-file-organizer-baf66899f53f176378fa7dfe7ff78f676e627307.zip |
Extract disc total and utilize that too.
Diffstat (limited to 'organizemusic.cpp')
-rw-r--r-- | organizemusic.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/organizemusic.cpp b/organizemusic.cpp index 58612c0..9381485 100644 --- a/organizemusic.cpp +++ b/organizemusic.cpp @@ -59,9 +59,9 @@ string strip_slash(const string &name) } /* {disc}-{0-padded track}{space} with reasonable fallbacks. */ -void disc_track(unsigned int disc, unsigned int track, ostringstream &path) +void disc_track(unsigned int disc, unsigned int discTotal, unsigned int track, ostringstream &path) { - if (disc > 0) { + if (discTotal != 1 && disc > 0) { path << disc; if (track > 0) path << '-'; @@ -86,7 +86,7 @@ string generate_path(const AudioFile &audio) path << "Unknown Album/"; else path << strip_slash(audio.album()) << '/'; - disc_track(audio.disc(), audio.track(), path); + disc_track(audio.disc(), audio.discTotal(), audio.track(), path); if (audio.artist().length() > 0) path << strip_slash(audio.artist()) << " - "; path << strip_slash(audio.title()); @@ -97,7 +97,7 @@ string generate_path(const AudioFile &audio) path << strip_slash(audio.artist()) << '/'; if (audio.album().length() > 0) path << strip_slash(audio.album()) << '/'; - disc_track(audio.disc(), audio.track(), path); + disc_track(audio.disc(), audio.discTotal(), audio.track(), path); path << strip_slash(audio.title()); } return transliterated(path.str()); |