You are here: Home » Topic » "top … order by" Syntax for smart playlists

"top … order by" Syntax for smart playlists

This topic contains 4 replies, has 4 voices, and was last updated by  fizze 11 years, 4 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1431

    Goenk
    Participant

    I think it would be really useful to be able to limit a smart-playlist to the top n entries, based on some kind of ordering (could be just a single column and a direction).

    The combination of sort and top makes it useful, even if the songs are returned in a different order: with it, i could make smart playlists like the following:
    – “get the 20 newest songs”
    – “get the 100 best rated punk-rock songs”
    – “get the 25 least played songs”
    – etc., etc.

    Actually, I believe that this would satisfy quite a lot of the request I’ve seen on this forum.

    I do realize that SQLite does not have a “top” operator, but I’m guessing that truncating the result-list could be done rather easily in code, and i checked that is has got the “order by” functionality that is needed for this to work efficiently.[/list]

    #10930

    rpedde
    Participant

    @goenk wrote:

    I think it would be really useful to be able to limit a smart-playlist to the top n entries, based on some kind of ordering (could be just a single column and a direction).

    The combination of sort and top makes it useful, even if the songs are returned in a different order: with it, i could make smart playlists like the following:
    – “get the 20 newest songs”
    – “get the 100 best rated punk-rock songs”
    – “get the 25 least played songs”
    – etc., etc.

    Actually, I believe that this would satisfy quite a lot of the request I’ve seen on this forum.

    I do realize that SQLite does not have a “top” operator, but I’m guessing that truncating the result-list could be done rather easily in code, and i checked that is has got the “order by” functionality that is needed for this to work efficiently.[/list]

    Yup. This is far and away the biggest request. I want to not do it using sql, though — I have to have a way to do it for non-sql backends as well, which sort of complicates it, but yeah, that’s something I want too..

    — Ron

    #10931

    fizze
    Participant

    Well, this isnt easy to code then, especially since every “limit by” case would have to be coded specifically.
    Maybe just remove this feature for non-sql backends (there arent any, so far, anyhow). But then I haven’t seen gdbm on a NSLU2, which is supposedly faster and scales better *shrug*

    Still I’d say that recoding this part is not for the faint of heart.
    0.02€

    #10932

    mpoly
    Participant

    There are lots of requests on playlists, many of which are quite hard to implement because they require Ron to expand and parse more complicated expressions.

    Here’s an idea: Allow smart playlist expressions in the format:

    SQL:

    Where sqlstatement is any SQL that returns a list of Ids from the database. This could be an expert-only feature, with disclaimers:

      This is not officially supported
      There is no syntax checking
      Portability and compatibility with future versions is not guaranteed
      If you accidentally type in DROP TABLE, its your problem.

    For those who know basic SQL (and those who know how to ask questions nicely in the forums), this will open many new possibilities.

    ?

    #10933

    fizze
    Participant

    nice idea, doesnt even have to be syntax checked or parsed at all.
    Just blatantly insert and execute that statement 😉

    keep it simple, stupid 🙂

Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘Feature Requests’ is closed to new topics and replies.