Page 1 of 1

[feature request] Top tracks: use track from oldest album

PostPosted: Thu Nov 01, 2012 5:56 pm
by maxxh
Currently the situation is the following:
AC/DC -> top tracks: the first track is 'Back in Black'.
I have this track in 2 albums: Back in Black (1980) and Live (1992).
Currently the song from the Live album is used for the top tracks list.

Request:
Use the first (=oldest) matching track, if multiple tracks with the same name are available.

Re: [feature request] Top tracks: use track from oldest albu

PostPosted: Thu Nov 01, 2012 9:17 pm
by hakko
That's a good idea!

Re: [feature request] Top tracks: use track from oldest albu

PostPosted: Fri Nov 02, 2012 11:35 am
by vollbr0t
This would be really helpful!!!

Re: [feature request] Top tracks: use track from oldest albu

PostPosted: Sun Dec 02, 2012 6:14 pm
by hakko
I think tracks from official albums should be preferred over EPs/singles/live albums/unknown releases, what do you think?

I just ran this:

Code: Select all
truncate library.artisttoptrackplaycount;

insert into library.artisttoptrackplaycount (track_id, artist_id, rank, play_count)
select distinct on (lt.track_id) lt.id, att.artist_id, att.rank, coalesce(tpc.play_count, 0) from music.artisttoptrack att
inner join library.track lt on lt.track_id = att.track_id
inner join library.album la on la.album_id = lt.album_id
left outer join music.mb_album mba on mba.album_id = lt.album_id
left outer join library.trackplaycount tpc on tpc.track_id = lt.track_id
order by lt.track_id, coalesce(la.year, 32767) - coalesce(mba.type_id, -1);


.. waited for it to finish, and now my Metallica top tracks are taken from their original albums, not S&M.

Re: [feature request] Top tracks: use track from oldest albu

PostPosted: Sun Dec 02, 2012 8:54 pm
by maxxh
hakko wrote:I think tracks from official albums should be preferred over EPs/singles/live albums/unknown releases, what do you think?

That would be great!

I guess including the release type is now possible due to the MusicBrainz integration?

Re: [feature request] Top tracks: use track from oldest albu

PostPosted: Sun Dec 02, 2012 9:04 pm
by hakko
Yes, exactly.

Code: Select all
order by lt.track_id, coalesce(la.year, 32767) - coalesce(mba.type_id, -1);


this isn't super pretty but mba.type_id will be 2 for album, 1 for EP and 0 for single (if that has been fetched from MusicBrainz, otherwise -1). So basically, we're subtracting that from the release year to make sure albums get preferred over EPs etc, if released the same year. I'm not sure if it ever happens that a live album gets released first, followed by a real album years later and which version should take precedence in such a case. Is year or album type the most important factor? it basically just a matter of writing

Code: Select all
order by lt.track_id, coalesce(la.year, 32767), coalesce(mba.type_id, -1) desc
vs
Code: Select all
order by lt.track_id, coalesce(mba.type_id, -1) desc, coalesce(la.year, 32767)

Re: [feature request] Top tracks: use track from oldest albu

PostPosted: Sun Dec 02, 2012 9:36 pm
by maxxh
Studio albums usually have better sound quality than live,demo,bootleg,...-recordings, so I'd go for the latter one (album type first).

Re: [feature request] Top tracks: use track from oldest albu

PostPosted: Mon Dec 03, 2012 3:44 pm
by Ultraviolet
+1 for this request, however, ideally I would love to toggle it now that there is MusicBrainz integration. What if default was oldest albums and mba.type_id = 2, but we had the ability to make the same top tracks mix with mba.type_id = 1 and 0? That could be a lot of fun for people (me) that like a particular group and have all the studio albums as well as a boat load of other stuff released by the same group.

One question: how would the above proposal work with bootleg albums that are neither EPs or Singles? Just speculating, but if MusicBrainz didn't have the bootleg, then there wouldn't be an associated mba.type_id so could we include bootleg tracks in a mix by changing the default oldest album selection to newest or random or ...? I am so not a programmer...just thinking out loud but I think there's some pretty powerful functionality in here to create mixes.

Re: [feature request] Top tracks: use track from oldest albu

PostPosted: Mon Dec 03, 2012 4:11 pm
by hakko
I think the advanced ways of calculating top tracks with various parameters will remain a database option, not an interface option...

Try this, it'll create a playlist with top tracks for artist Beach House, with all songs found in your library, sorted on track popularity, then album type, then release year (you have to paste the output into a .m3u file).

For those who happen to be on a Mac/*ix system, replace '\' with '/'.

Code: Select all
select d.path || '\' || f.filename from music.artisttoptrack att
inner join music.artist a on a.id = att.artist_id
inner join library.filetag ft on ft.track_id = att.track_id
inner join library.file f on ft.file_id = f.id
inner join library.directory d on f.directory_id = d.id
inner join library.album la on ft.album_id = la.album_id
left outer join music.mb_album mba on mba.album_id = la.album_id
where a.artist_name = upper('Beach House')
order by att.rank, coalesce(mba.type_id, -1) desc, coalesce(la.year, 32767);


Currently, only singles/EPs/albums are fetched from MusicBrainz, so spoken word/bootleg/demo/compilation albums etc will all have type_id = null on a left outer join (changed to -1 with coalesce).

Re: [feature request] Top tracks: use track from oldest albu

PostPosted: Sun Dec 09, 2012 11:20 am
by hakko
This feature request has been implemented in 0.7.16. viewtopic.php?f=4&t=9777&p=49943#p49943