You are here: Home » Topic » Smart playlist help!

Smart playlist help!

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #2376
    Anonymous
    Inactive

    Hi,

    I want to create a playlist that contain my 30 most played songs. How do I do that? can’t figure that out with help from the wizard. Please help me…

    #16818
    sonichouse
    Participant

    @Dimi wrote:

    Hi,

    I want to create a playlist that contain my 30 most played songs. How do I do that? can’t figure that out with help from the wizard. Please help me…

    Not sure if this is possible with the wizard, but you could create a static playlist using some script, and update regularly.

    The SQL would look something like

    select path,fname, play_count, datetime(time_played, 'unixepoch', 'localtime')
    from songs
    where play_count > 0 and artist''
    group by 1,2,3,4
    order by 3 desc,4 desc,1,2 asc
    limit 30;

    Then you could create a m3u file with the results.

    #16819
    Anonymous
    Inactive

    Thanks mate, for such a quick reply!

    I will tell you how things went as soon as i
    a) figured out how to run scripts in debian.
    b) figured out how to create a m3u file that contains the information from SQL that previously were created with the script.

    But hey I love the challange!

    Thanks.

    #16820
    sonichouse
    Participant

    @Dimi wrote:

    Thanks mate, for such a quick reply!

    I will tell you how things went as soon as i
    a) figured out how to run scripts in debian.
    b) figured out how to create a m3u file that contains the information from SQL that previously were created with the script.

    But hey I love the challange!

    Thanks.

    A basic m3u file only needs the file listed whether that be fully qualified or relative diretory references.

    You should have sqlite or sqlite3 installed to issue the query.

    Pipe the results through to your m3u file.

    I created test.sql as

    select path
    from songs
    where play_count > 0 and artist''
    order by play_count desc, time_played desc, 1 asc
    limit 30;

    and then ran

    sqlite3 /opt/var/mt-daapd/test.db test.m3u
    #16821
    fizze
    Participant

    That actually sounds like an elegant way to get such a feature. 🙂
    I guess I’ll enhance my cron jobs a little.

    #16822
    sonichouse
    Participant

    @fizze wrote:

    That actually sounds like an elegant way to get such a feature. 🙂
    I guess I’ll enhance my cron jobs a little.

    When and if Ron returns to here I hope that he can implement the order and limit stuff in playlists.

    Far better to be able to use the smart playlists than hack sql.

    #16823
    fizze
    Participant

    Hehe, I hack SQL for a living, so there’s no pain in a little more.

    Well, Ron wants to keep the smart playlist stuff backend-independent. So that could take quite a while.

    #16824
    sonichouse
    Participant

    @fizze wrote:

    Hehe, I hack SQL for a living, so there’s no pain in a little more.

    Me too, but it is always fun when you try and switch between oracle, teradata, sqlite, access etc …

    @fizze wrote:

    Well, Ron wants to keep the smart playlist stuff backend-independent. So that could take quite a while.

    Pity, there are plenty of options when in the database. makes it easier for extracting info.

    #16825
    fizze
    Participant

    @sonichouse wrote:

    .., access etc …

    You poor sod! My heart is with you 😉

    Well, I played with the thought of doing a fork and just improving the smart playlists so they would play nice with sqlite2/3 at least. You know.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.