fix starting queue from nth occurrence of a track in playlist starts queue from 1st occurrence, where n > 1 - #1761
Open
HeroBrine1st wants to merge 3 commits into
Open
HeroBrine1st wants to merge 3 commits into
HeroBrine1st wants to merge 3 commits into
Conversation
…queue from 1st occurrence, where n > 1
Flake lock file updates:
• Updated input 'fenix':
'github:nix-community/fenix/a1b770adbc3f6c27485d03b90462ec414d4e1ce5?narHash=sha256-kIRggXyT8RzijtfvyRIzj%2BzIDWM2fnCp8t0X4BkkTVc%3D' (2026-03-14)
→ 'github:nix-community/fenix/9efa138447c5773995d98d9aafa9eba4982aceab?narHash=sha256-ZkvwEHlSa46BkODMEwHCEh9hlUC2igneJ%2BnoEUn9ww4%3D' (2026-09-08)
• Updated input 'fenix/rust-analyzer-src':
'github:rust-lang/rust-analyzer/6254616e97f358e67b70dfc0463687f5f7911c1a?narHash=sha256-tj3piRd9RnnP36HwHmQD4O4XZeowsH/rvMeyp9Pmot0%3D' (2026-03-12)
→ 'github:rust-lang/rust-analyzer/48d839420745124e85140234ce783ccd90dab24e?narHash=sha256-FROpcpM2ELawfxhW8cWuz8m3dp/0EFAFCiK%2BAbNw95w%3D' (2026-09-07)
• Updated input 'nixpkgs':
'github:NixOS/nixpkgs/fe416aaedd397cacb33a610b33d60ff2b431b127?narHash=sha256-b/GV2ysM8mKHhinse2wz%2BuP37epUrSE%2BsAKXy/xvBY4%3D' (2026-03-12)
→ 'github:NixOS/nixpkgs/dc5d91f840324650bac8c379428c7037a416959a?narHash=sha256-VaWGJ6%2BcIYN2erfSecbRV%2B4ljI185Ty2wUrXyvQbgOw%3D' (2026-09-07)
HeroBrine1st
force-pushed
the
fix/multi-instance-tracks
branch
from
September 8, 2026 18:25
e8302a2 to
bc1c3d2
Compare
Contributor
Author
|
okay my CI got new flutter successfully so I tested it on n=2. It now correctly picks second occurence of track when I pick it, and first one is unchanged. I tested multi-disc album too, no issues. |
HeroBrine1st
marked this pull request as ready for review
September 8, 2026 18:26
UnicornsOnLSD
approved these changes
Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
TracksSliverList searches first instance of track in prepared queue, even if user taps later instances, then starts queue there. This means that for a playlist of:
Tapping on item 4 starts queue from item 2, which is not correct.
This PR fixes that by assuming duplicates are only possible in this branch since the other branch is guarded against playlists:
finamp/lib/components/AlbumScreen/album_screen_content.dart
Lines 219 to 227 in e8302a2
Then, due to the fact queueChildren is a sparse sublist of displayChildren, it's possible to count duplicates in displayChildren preceding tapped item; then, assuming tracks with the same id are either all playable or not (i.e. for all tracks it is either playable or not, see law of excluded middle :P), skipping the same number of duplicates in queueChildren means taking a track at exactly the same position. When it's zero (no duplicates, e.g. an album), it's the same behavior, and when current track is not playable it falls back to -1 as a workaround to the fact it is calculated eagerly even for unplayable tracks.
There is another approach: pass concatenated list of previous
queueForLists (which would still be displayChildren for the branch mentioned above and accumulated list for preceding album with discs branch) to be used to calculatedupesBefore. It's only better if albums can have duplicates, too, which isn't possible in Jellyfin I hope.The only problem with all of this elegance is the fact flutter let me down and doesn't build Finamp due to stdlib problems, and I can't update it at the moment. This was planned to be 20-minute adventure which went wrong for more than 1 hour so idk. I hope CI creates android artifact which I can test myself later.
Todo before merging
.where(...).lengthcan possibly be replaced with some kind ofcount(...)but I didn't find anydart format .let me down too. What a day. It changes nothing on my system.