Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Jul 2010
    Location
    Sollentuna, Sweden
    Posts
    22

    Random songs with random artists from TrackStats Most Played Artists

    Hi,

    I have been trying to achieve this in various ways. I have also tried to search the forum as I assume someone else have struggled with the same, but no success so far.

    What I want to do is to have a sql playlist that with use of TrackStat can play random songs from the say 20 most played artists (then prio 2 is to do a second list that does the same for top rated artists). But trying to use the predefined random for most played artist does only result in a random list of songs from the same single artist. When I run it again I may get another artist but only songs from that artist. The artists are the most played ones, but I cannot figure out how to get random artist from the most played ones. I have tried to alter the sql, the parameters for the playlist etc. No success. Also just tried to play around with custom skip, but cant figure out if that can help me. Still get the same result.

    Any hints and tips are appreciated.

  2. #2
    Senior Member lrossouw's Avatar
    Join Date
    Jan 2006
    Location
    Cape Town, South Africa
    Posts
    1,034
    Very broadly speaking, first select the top 20 artists. Then select randome songs from those artists.

    This is done using a sub-query. This will select 10 random songs from all the top 20 artists.

    Broadly this might look like the following though of course the queries will be more complex:

    select top 10 tracks

    from tracks
    inner join
    (select top 20 artist.*
    from artists
    order by playcount desc) as top20 on track.artist=top20.artist

    order by rand
    Louis
    Last.fm

  3. #3
    Junior Member
    Join Date
    Jul 2010
    Location
    Sollentuna, Sweden
    Posts
    22
    Yes, I was actually having that broad view on this, and got a bit frustrated when I couldn't get it right.

    Now I done some more work and currently at a point where I got a query that does random songs (any) from my 20 most played artists.


    select url from tracks, contributor_track
    where contributor in (
    select contributor from (
    select c1.contributor, sum(ifnull(ts1.playCount,0)) as sumcount
    from tracks t1, track_statistics ts1, contributor_track c1
    where t1.url = ts1.url
    and t1.id = c1.track
    and c1.role in (6)
    and t1.audio=1
    group by c1.contributor
    order by sumcount desc
    limit 20
    )
    ) and tracks.id = contributor_track.track and contributor_track.role = 6
    order by random()
    limit 10

    I am not a SQL expert so it may very well have room for improvement and optmization.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •