Page 1 of 1

Top tracks and featuring

PostPosted: Fri Nov 30, 2012 9:49 am
by obcd
Hi,

I have noticed that when I use the "play top tracks" feature, it will not play the tracks where another artist is featured (ABC feat. DEF). Some of such tracks are big hits. I think it would make sense to have them in the top tracks.

Re: Top tracks and featuring

PostPosted: Fri Nov 30, 2012 10:12 am
by hakko
Can you give an example? I wonder if they are returned from last.fm at all in a way that would make it possible to identify them locally.

Re: Top tracks and featuring

PostPosted: Fri Nov 30, 2012 10:18 am
by obcd
Easy example: Pitbull - Planet Pit (2011)
I have it tagged with Musicbrainz.
Last.fm: http://www.last.fm/music/Pitbull/Planet ... xe+Version)

When I use the top tracks feature, it will only add tracks where there isn't a featured artist.

Re: Top tracks and featuring

PostPosted: Fri Nov 30, 2012 11:07 am
by hakko
I don't see that song returned in the top tracks from last.fm...

http://ws.audioscrobbler.com/2.0/?metho ... 97517b179e

The "ABC feat DEF" is a general problem as it's not really possible to tag properly. Ideally, you'd want to tag such a track as "artist ABC", "featured artist DEF" but right now it becomes a completely new artist instead. Unless you change the song title instead to "artist ABC - track GHI (feat. DEF)" but that's just a variation of a bad solution. I wish there was a widely accepted way of tagging this...

Re: Top tracks and featuring

PostPosted: Fri Nov 30, 2012 3:24 pm
by obcd
"Pitbull - Planet Pit (2011)" was just the name of the album so it is not in the list.

From what I understand, the problem is that last.fm says that the artist is "ABC" while in reality it is "ABC feat. DEF". If the album is correctly tagged, the artist of the album will be ABC. I don't really know how your software works, but I guess that you check if the song on the top tracks list is locally in the library. What about checking it with the albumartist tag and not with the artist of the track? It should solve the problem, no?

Re: Top tracks and featuring

PostPosted: Sat Dec 01, 2012 10:06 pm
by hakko
If you feel like helping out experimenting, you could try this:

Play top tracks of an artist (I used Frank Ocean as an example). Note that no tracks with Frank Ocean feat somebody else appear in the playlist.

Run this SQL command in Postgres (just once! it'll say INSERT 0 NNN if successful):

Code: Select all
insert into library.artisttoptrackplaycount (track_id, artist_id, rank, play_count)
select distinct on (lt.track_id) lt.id, aat.artist_id, att.rank, coalesce(tpc.play_count, 0) from library.filetag ft
inner join music.track at on ft.track_id = at.id
inner join music.track aat on ft.album_artist_id = aat.artist_id and at.track_name = aat.track_name
inner join library.track lt on lt.file_id = ft.file_id
inner join music.artisttoptrack att on att.track_id = aat.id and att.artist_id = aat.artist_id
left outer join library.trackplaycount tpc on tpc.track_id = at.id
where ft.artist_id <> ft.album_artist_id;


Play top tracks again. Frank Ocean feat XX now appears in the playlist, if you have Frank Ocean entered as Album Artist. And in artist radio playlists. Correct?

This change will be rolled back on every library scan. I'll try it myself for a while and build some test cases, if it works out well, I'll include it in the next release.

(it could take a little while to run, the database is not really optimized to look for tracks that way. but for now I'm only interested in whether this technique solves your problem)

Re: Top tracks and featuring

PostPosted: Sun Dec 02, 2012 8:48 pm
by obcd
My knowledge about SQL is near 0. I logged in as "postgres", entered "psql", then I ran the command. The output:
Code: Select all
ERROR:  schema "library" does not exist
LINE 1: insert into library.artisttoptrackplaycount (track_id, artis...
                    ^

Re: Top tracks and featuring

PostPosted: Sun Dec 02, 2012 8:51 pm
by hakko
Run psql -d musiccabinet to tell which database to operate on. (sorry.. maybe I shouldn't assume everyone enjoys psql)

Re: Top tracks and featuring

PostPosted: Mon Dec 03, 2012 9:43 am
by obcd
It works! Awesome!

Re: Top tracks and featuring

PostPosted: Mon Dec 03, 2012 1:09 pm
by hakko
Nice! Note that the change will disappear when you scan your library. So until I've built a new release that does this automatically, you'll have to turn off nightly scanning or do the insert once every morning (with cron).

Re: Top tracks and featuring

PostPosted: Sun Dec 09, 2012 11:19 am
by hakko