Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Mar 2017
    Posts
    1,128

    Play All / Add All track order

    The default web UI, and Material, allow you to specify the sort-order when displaying albums from an artist. However, when using play/add on 'All Songs' in the default UI, or Material's Play All / Add All buttons, songs are always added by album-title, disc, and track num.

    slim/control/Commands.pm has the following code which enforces this order:

    Code:
            my $albumSort
                    = $sqlHelperClass->append0("album.titlesort") . " $collate"
                    . ', me.disc, me.tracknum, '
                    . $sqlHelperClass->append0("me.titlesort") . " $collate";
    Seeing as my Perl is pretty poor, I'm not sure how to modify this. I would like to be able to pass (e.g.) sort:yearalbum to the play all / add all commands - e.g. ["playlistcontrol", "cmd:add", "artist_id:1234", "sort:yearalbum"] This would then (optionally) set $albumSort to "album.year, album.titlesort, me.disc, me.tracknum"

    I'm happy to experiment and provide a pull request to implement this, I'm just not sure how to modify that line above.

  2. #2
    Senior Member
    Join Date
    Mar 2017
    Posts
    1,128
    OK, I spoke too soon! Or rather, I should have experimented more before posting! Anyway, the following seems to work for year order first - I assum its correct?

    Code:
    	my $albumSort 
    		= $sqlHelperClass->append0("album.year") . ", " . $sqlHelperClass->append0("album.titlesort") . " $collate"
    		. ', me.disc, me.tracknum, '
    		. $sqlHelperClass->append0("me.titlesort") . " $collate";
    I'll work on adding the optional parameter and then think about a pull request.

  3. #3
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,326

    Play All / Add All track order

    > OK, I spoke too soon! Or rather, I should have experimented more before
    > posting! Anyway, the following seems to work for year order first - I
    > assum its correct?
    >
    >
    > Code:
    > --------------------
    >
    > my $albumSort
    > = $sqlHelperClass->append0("album.year") . ", " . $sqlHelperClass->append0("album.titlesort") . " $collate"
    > . ', me.disc, me.tracknum, '
    > . $sqlHelperClass->append0("me.titlesort") . " $collate";
    >
    > --------------------


    That's pretty much what I came up with in a quick test, too.

    If you go further down the code around line 3400 you'll see that it's
    parsing parameters, among which a "sort" key is expected. You could use
    this to overwrite the sort order depending on the sort value.

    If you want to know how the list is created when querying, then open
    Queries.pm around line 440 where the $order_by is defined, depending on
    the sort order requested. You could use this as the reference.

    --

    Michael

Posting Permissions

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