Rockbox Technical Forums

Rockbox General => Rockbox General Discussion => Topic started by: chris_s on February 08, 2021, 12:32:09 PM

Title: Adding albums to the play queue (from the database)
Post by: chris_s on February 08, 2021, 12:32:09 PM
Am I misunderstanding the Queue function or is there currently a bug here: After I select "Queue Next" for an album, I would then like to queue up further albums to play after it. Selecting "Queue" for another album, though, will queue up the album after the first track of the album I'd just added instead of after its last track.

I.e. this is my current playlist at the beginning of the process:

<Songs at the beginning of the playlist > < Currently playing song>  < Songs at the end of the playlist>

Select "Queue Next" for album A1:

<Songs at the beginning of the playlist > < Currently playing song> <A1> < Songs at the end of the playlist>

Select "Queue" for album A2:

<Songs at the beginning of the playlist > < Currently playing song> <Song 1 from A1> <A2> <Rest of the Songs from A1> < Songs at the end of the playlist>

(My current workaround is to add the albums in reverse order using "Queue Next". But that requires you to already know at the beginning all of the albums you want to add)
Title: Re: Adding albums to the play queue (from the database)
Post by: chris_s on February 08, 2021, 12:54:08 PM
There's apparently a patch for this. I'll check it out to see if it still works:

https://www.rockbox.org/tracker/task/7898

As far as I can tell from the documentation, the patched behavior would be the expected one (and the most logical one, to me):

Quote
Insert.
Add track(s) immediately after any tracks added via the most recent Insert operation. If no tracks have yet been added via an Insert, new tracks will be added immediately after the current playing track. If playback is stopped a new dynamic playlist will get created with the selected tracks.
Quote
Queue.
Queue is the same as Insert except queued tracks are deleted immediately from the playlist after they have been played. Also, queued tracks are not saved to the playlist file (see section 5.10).
Title: Re: Adding albums to the play queue (from the database)
Post by: chris_s on February 08, 2021, 02:49:19 PM
So the patch (with updated line numbers) does work, but only for adding directories from the files system (where the same issue I've described exists). Still trying to figure out how to apply this to add_track_to_playlist when it is called from the database.
Title: Re: Adding albums to the play queue (from the database)
Post by: chris_s on February 08, 2021, 03:06:55 PM
Applying the same logic that was used in the aforementioned patch , this should do the trick (patch for tagtree.c) ...
Title: Re: Adding albums to the play queue (from the database)
Post by: Frankenpod on February 09, 2021, 05:00:08 AM
I've never encountered this issue as I've never made a playlist by adding entire albums (rather than just adding individual tracks or copying playlists made on the the computer), but is there any reason not to merge this patch with the main release?  Does it have any unfortunate side-effects or drawbacks?

I mean, I struggle to see any logic or benefit to the existing way it works, as described here.

Edit - though could you not get the result you want by using 'insert last'?  Does that not work, as way to build the playlist by adding albums at the end?  Even so, though, the way you say it currently works doesn't make much sense to me.  Is there any argument in favour of it working the way it currently does?  (Becuase as described it sounds like just a bug).
Title: Re: Adding albums to the play queue (from the database)
Post by: chris_s on February 09, 2021, 08:43:43 AM
though could you not get the result you want by using 'insert last'?  Does that not work, as way to build the playlist by adding albums at the end?
yeah, that works except when you’d like to  continue listening to the rest of the existing playlist after the queued up albums have finished playing.
Title: Re: Adding albums to the play queue (from the database)
Post by: chris_s on February 15, 2021, 09:11:19 AM
is there any reason not to merge this patch with the main release?  Does it have any unfortunate side-effects or drawbacks?
Not that I've been able to tell. I've uploaded the bug fix to Gerrit (along with a few other one-liners). Maybe a Rockbox developer/committer could take a look.
Title: Re: Adding albums to the play queue (from the database)
Post by: Frankenpod on February 15, 2021, 12:40:39 PM
Not that I've been able to tell. I've uploaded the bug fix to Gerrit (along with a few other one-liners). Maybe a Rockbox developer/committer could take a look.

What I was wondering was if anyone out there had any argument in favour of the way it currently works (as you describe above).  i.e. is there some justification for it (that I'm failing to see) or is it purely a bug that was never supposed to work that way?  If the latter then seems no reason why your fix shouldn't be 'mainlined'.
Title: Re: Adding albums to the play queue (from the database)
Post by: chris_s on February 16, 2021, 10:13:40 AM
Not that I've been able to tell. I've uploaded the bug fix to Gerrit (along with a few other one-liners). Maybe a Rockbox developer/committer could take a look.

What I was wondering was if anyone out there had any argument in favour of the way it currently works (as you describe above).  i.e. is there some justification for it (that I'm failing to see) or is it purely a bug that was never supposed to work that way?  If the latter then seems no reason why your fix shouldn't be 'mainlined'.
It's hard for me to imagine but I'd welcome others to chime in.

Anything's posssible I guess. I also uploaded a fix for another (imo extremely misguided) behavior that I later noticed actually seems to be by design, since it is documented in the manual (https://download.rockbox.org/daily/manual/rockbox-ipod4g/rockbox-buildch4.html#x7-670004.4.2)):

Quote
If playback is stopped, the Insert and Queue functions can be used as described in 4.4.3 to create a new playlist instead of adding to an existing one. This will erase any dynamic playlist.

 ??? I've accidentally erased my half-listened-to dynamic playlist without a warning many times that way when I just wanted to append items to it, especially after an (automatically initiated) shutdown which will necessarily stop playback but thankfully keep the playlist. You really have to remember to press play first before adding any items.

In fact, in my personal build of Rockbox I’ve actually modified the behavior, so that even after you’ve finished playing a dynamic playlist and playback has stopped, the resume index wraps around to the first item (is reset to 0 instead of -1) . That means you have the option of replaying or saving the dynamic playlist, whereas currently, you instead lose access to it at that point.

Ideally, Rockbox would also save info about whether a dynamic playlist has been modified (e.g. had items inserted or was reshuffled) to disk. Because you only get a warning when selecting a new song to play if you haven’t shut down the player after making modifications to your dynamic playlist.