Ticket #13592: 0002-mythmusic-include-discnumber-in-album-sort-order.patch

File 0002-mythmusic-include-discnumber-in-album-sort-order.patch, 1.5 KB (added by ijc, 4 years ago)
  • mythplugins/mythmusic/mythmusic/playlist.cpp

    From b36cc2a39fbd6953663f38696d1375ecbbf746cf Mon Sep 17 00:00:00 2001
    From: Ian Campbell <ijc@hellion.org.uk>
    Date: Sun, 23 Feb 2020 19:06:12 +0800
    Subject: [PATCH 2/2] mythmusic: include discnumber in album sort order
    
    Album sort did not handle disc number correctly, e.g. for a two disc album it
    would sort disc.track-wise as 1.1, 2.1, 1.2, 2.2, etc rather than 1.1, 1.2,
    ..., 2.1, 2.2.
    
    Incorporate the disc number into the album order to correct this. I believe a
    single CD can have at most 99 tracks so use a multiplier of 100. This means a
    10 disc box set would clash with album map order offset of 1000, so bump that
    to 10000 to leave space for up to a 100 disc box set.
    ---
     mythplugins/mythmusic/mythmusic/playlist.cpp | 4 +++-
     1 file changed, 3 insertions(+), 1 deletion(-)
    
    diff --git a/mythplugins/mythmusic/mythmusic/playlist.cpp b/mythplugins/mythmusic/mythmusic/playlist.cpp
    index f0ca201e07..86addc845b 100644
    a b void Playlist::shuffleTracks(MusicPlayer::ShuffleMode shuffleMode) 
    386386                    }
    387387                    else
    388388                    {
    389                         album_order = Ialbum->second * 1000;
     389                        album_order = Ialbum->second * 10000;
    390390                    }
     391                    if (mdata->DiscNumber() != -1)
     392                        album_order += mdata->DiscNumber()*100;
    391393                    album_order += mdata->Track();
    392394
    393395                    songMap.insert(album_order, m_songs.at(x));