Albums -> Sort By most played using total number of tracks listened to

I’m definitively a newcomer to Roon, but the way that sort “By most played” works for the Albums left me baffled, until I made some research and discovered that the “ranking” is based on the total time in seconds that I listened to the album.

So, if I have an album that last 60 min and another one that last 30 min, and I listen to the first one 1 time and to the second one 2 times, they will be at the same “ranking” even though I effectively listened to the second definitively more than to the first one.

I like to listen to tracks in random order during the day while I’m working; at evening/night, I sit down and enjoy an album end-to-end. I like to keep track of “what album I didn’t listen to in a long time”? Hence the sort “By most played” in reverse order. It’s a workaround, I agree, but it works perfectly for me.

Now, you know what happens: short albums like EP or singles, with few tracks, stay always on top even if I effectively have listen them more time that a double album of Bach sonatas.

What I intend with “album played” is an album played start-to-finish, regardless of how many tracks it has or how long it is. So, a single played 1 time and a double LP played 1 time should be at exactly the same level: “listened 1 time”.

I though about it and would like to propose the following algorithm to calculate the “played” factor:

given an album:

Option 1

  1. get the track the was played the less (min) and use that number as the “played” for the album. Reason is that I never listened “THE ALBUM” until I listen to ALL its tracks
    Pros: fast to calculate
    Cons: not very precise

Option 2

  1. get the track the was played the less (min) and the one that was played most (max). You have this number, because tracks can be ordered that way already.
  2. if (min==max) than that is the number we are searching for: played=min
  3. else
    3.1) get the number of tracks that were played (min) times. Let’s call this number “tot_min”
    3.2) get the total number of tracks in the album “tot_tracks”
    3.3) played = min + ((tot_tracks - tot_min)/tot_tracks)
    3.4) [Optional] Round to 2 decimals, multiply by 100 and use the integer part as “played” so you can avoid working with floats

With Option n. 2 we are effectively checking the percentage of the album I’ve already listened to (regardless of how many more times I played a single track. That’s why I’m using “min” and not “max”).
Pros: precise
Cons: require a query to the database to get the data needed, but I do not expect that to be more taxing than recover the time played as you do now


Album n. 1 - 10 tracks - duration 60 min
I’ve listen to 5 tracks already at least 1 time
min=0; tot_min=5 ; tot_tracks=10; played=0+(10-5)/10=0,5 ==> 50

Same Album, but completely listened 1 time and then listened again 2 tracks
played = 1,2 ==> 120

Album n. 2:
3 tracks - duration 30 min
1 track listened - 2 to listen
min = 0; tot_min=2; tot_tracks=3
played = 0 + (3 -2)/3 = 0,33 ==> 33

Same album, listened at least once:
played = 133

Thanks for sharing. I was wondering this as well because I like to explore my albums by different ways of ordering them. And I agree that this is not the best approach because of different lengths of albums.