Closed Porco-Rosso closed 1 year ago
This seems to be because:
playlistIndex
I think I see how to fix this ideally (make playlist item a many to many relationship between playlist and track, with ordering), but it'll be very annoying and requires another schema change.
If we do treat playlist indices as volatile, then it does actually come out to be pretty simple:
diff --git a/Submariner/SBSubsonicParsingOperation.m b/Submariner/SBSubsonicParsingOperation.m
index c876ede..5ea7bf1 100644
--- a/Submariner/SBSubsonicParsingOperation.m
+++ b/Submariner/SBSubsonicParsingOperation.m
@@ -503,6 +503,7 @@ NSString *SBSubsonicPodcastsUpdatedNotification = @"SBSubsonicPodcastsUp
exists = YES;
}
}
+ track.playlistIndex = [NSNumber numberWithInteger: playlistIndex++];
if(!exists) {
[currentPlaylist addTracksObject:track];
@@ -512,6 +513,7 @@ NSString *SBSubsonicPodcastsUpdatedNotification = @"SBSubsonicPodcastsUp
} else {
// create it
track = [self createTrackWithAttribute:attributeDict];
+ track.playlistIndex = [NSNumber numberWithInteger: playlistIndex++];
[currentPlaylist addTracksObject:track];
[track setServer:server];
[track setPlaylist:currentPlaylist];
...though persisting the changes is another problem - I think just call createPlaylist
with the full body (since updatePlaylist
only does adds/deletes, not reordering).
Seems to work otherwise though. You may need to reload the playlist for it to correct when the change is made though.
Hi, I've noticed that when streaming from Navidrome to Submariner, the songs inside playlists are in a seemingly random order. Since track order are an important part of playlists, I'm hoping song order can be implemented. PS: thanks for fixing the playlist sidebar order!