Playlist sorting issues: Random order resets & song addition problems

Issue description:

Full title: The playlist’s sorting order is randomly forgotten & songs cannot be added to the playlist in the correct order

(I have uploaded the debug log using my forum nickname)

I imported a playlist from the server and set it to “Online first”. I prefer to sort my playlists by “Added order” in descending order, so I can easily play my recently added songs at the top of the playlist. However, I’ve noticed that Symfonium frequently forgets my sorting preferences randomly

Logs:

Upload description: tanghaowen

Additional information:

 

 

Reproduction steps:

 

  1. I sort a playlist by “Added order” in descending order, and everything looks fine at first (newest songs on top, older ones at the bottom, just like image1)

  2. Then I go to the album view or somewhere else and paly some musics

  3. After a while, when I went back to the playlist view, the sorting icon stayed the same, but the actual song order had flipped to ascending order (oldest songs at the top and newest ones at the bottom) - I haven’t touched any settings at all.

  4. And if I try adding new songs at this point, they get dumped in as if they’re the oldest tracks, showing up even before the earliest additions.You can see this in Image2 that I’ve attached.
     

Media provider:

Subsonic

Screenshots:

 

    

When connected to a server the added order is the order that the playlist data is returned by the server.

Since they are online first they are synced when you browse them and there’s changes.

In the logs you provided the last data returned by the server is the order you see (in the opposite) so what you see is what the server send.

@deluan Is there a reason the order of the playlist is returned in a different order ? (The call is a simplehttps://xxx/rest/getPlaylist.view?id=3f5838e4-3317-4f77-a2d2-d3f5ac547811&u=REDACTED&t=REDACTED&s=REDACTED&v=1.13.0&c=Symfonium&f=json)

Or do you use the created field in the answer as the date the media is added to the playlist ?

Or do you use the created field in the answer as the date the media is added to the playlist ?

No, the created field is the child created value, the time the file was created in the FS (or when it was added to the library if the FS does not support birth time)

Is there a reason the order of the playlist is returned in a different order ? (The call is a simplehttps://xxx/rest/getPlaylist.view?id=3f5838e4-3317-4f77-a2d2-d3f5ac547811&u=REDACTED&t=REDACTED&s=REDACTED&v=1.13.0&c=Symfonium&f=json)

The only thing I can think of is if the playlists is a Navidrome Smart Playlist (a .NSP)

Thanks.

So @tanghaowen is this a NSP?

If not we’ll probably need to try from scratch to see. Create a 2 song playlist in Navidrome, sync it, change it on Navidrome then sync it again to see if there’s changes or not.

Do you edit the playlist from inside Symfonium?

Hello, thank you for your reply.

is this a NSP?

No,It’s a normal playlist

Create a 2 song playlist in Navidrome, sync it, change it on Navidrome then sync it again to see if there’s changes or not.

After async, the changes from Navidrome synced to app

Do you edit the playlist from inside Symfonium?

Yes, because Navidrome’s webpage is not user-friendly, so I don’t use Navidrome at all and only use Symfonium regularly


I took some time to dig into the logs for more insights. Unfortunately, I found that Symfonium’s debug mode only outputs the server’s response body and doesn’t output the API request payload.

To better identify the issue, I used a proxy server to capture Symfonium’s requests, and I seem to have found the cause of the problem. Looks like this isn’t a Navidrom issue - it’s probably an internal Symfonium issue.

(I have just uploaded the request content I captured. Description is my nickname)

During this capture, I added songs to the playlist, and Symfonium made requests to the server in the following order:

  1. GET /rest/getPlaylist.view
  2. POST /rest/updatePlaylist.view
  3. POST /rest/updatePlaylist.view
  4. GET /rest/getPlaylist.view

It appears that Symfonium’s principle for adding songs to a playlist is to first remove all songs from the playlist and then add them back, so each song addition is accompanied by two /updatePlaylist.view API call

The response from request no.1 shows song ID 2a2fb402e129050ded8d99ebe74f87bc is at the top of the array, while 83884acae231aa67d82803af7e768243 is at the bottom.

{
    "subsonic-response": {
        "status": "ok",
        // ......
        "playlist": {
            "id": "3f5838e4-3317-4f77-a2d2-d3f5ac547811",
            "name": "常听",
            "songCount": 446,
            "duration": 120889,
            "entry": [
                {
                    "id": "2a2fb402e129050ded8d99ebe74f87bc",
                    // ......
                },
                // ......
                {
                    "id": "83884acae231aa67d82803af7e768243",
                    // .......
                }
            ]
        }
    }
}

Request no.2 removes all songs from the playlist, and then request no.3 adds all songs back to the playlist. The issue occurs in request no.3. Here’s the payload of request no.3

POST /rest/updatePlaylist.view

playlistId=3f5838e4-3317-4f77-a2d2-d3f5ac547811
&name=%E5%B8%B8%E5%90%AC
&songIdToAdd=276866a1ad1e69cea5e476f9c74477a7 (this is the new song I added to my playlist)
&songIdToAdd=83884acae231aa67d82803af7e768243&
// ......
&songIdToAdd=2a2fb402e129050ded8d99ebe74f87bc

You’ll notice that Symfonium flips the entire playlist upside down: Songs that were at the bottom of the array in no.1 are now at the top, while songs that were at the top are now at the bottom. My newly added songs were placed in front of the earliest added songs.

Because no.3 re-added the songs in reverse order, the playlist returned in no.4 shows this reversed order, and newly added songs at the top.

I am not sure what conditions will trigger this issue, it seems quite random to me. And when it happens again, Symfonium reverses the playlist order again, thus restoring my playlist to its original order. This explains why I feel this issue appears randomly and why the playlist order changes seem so puzzling.

Hope the information I provided can be helpful.

Yes subsonic API is very limited for playlist handling, so since Symfonium allows offline reordering there’s no real other choices to ensure consistency to drop all add in the wanted order.

But if you edit on Symfonium then it’s probably a Symfonium issue yes, that’s good news as we know where to look.

The bad news is that I often reorder and sync and it works so I’ll need to figure out what order of things you do to reach to this :frowning:

Was the playlist initially created on Navidrome or Symfonium?

@Tolriq

I initially created a normmal playlist on Navidrome and added several songs to it. However, after using it for a while, I found Navidrome’s web interface is not very good. Someone recommended Symfonium, and in the following months, I rarely used Navidrome’s web client.

When importing the playlist to symfonium, I selected the “Online first” mode, so I rarely use manual sync. During the period when Symfonium experienced sorting issues, I never used Navidrome.

Oh, by the way, I added a playlist button to the Main navigation so I could directly switch to the playlist view by clicking the playlist button (you can verify this in the screenshot I provided).

By these steps:

  1. I open a playlist to enter the playlist details view
  2. then click other interface buttons at the bottom to switch to other view (such as the media library interface)
  3. and then return to the playlist details view by clicking the playlist button at the bottom

I notice that Symfonium sometimes reverses the list

under this operation sequence, Symfonium will not reload playlist detail view but directly displays the list (which may be means that Symfonium hasn’t requested the /getPlaylist API during this flow? just guessing)

I don’t know if those information above is helpful, hope it can be used for you

@Tolriq

Hello, I just fully reproduced this issue and recorded it. I’ve uploaded the complete video.
The video is 9 minutes long, so I’ve summarized the key points:

  1. In this video, I first launched Symfonium from the launcher
  2. Then at 00:00:05 I opened the playlist. Remember the first song “0.vers”, which was the earliest added to the playlist
  3. To display recently added songs at the top of the playlist, I adjusted the sort order at 00:00:15, so “0.vers” appeared at the bottom and recently added songs appeared at the top
  4. Then I switched to the album list interface to browse and play songs
  5. During this time, I switched back to the playlist interface several times (like at 00:01:45, 00:05:43), and the playlist maintained the correct order without issues

Key points:
6. At 00:06:28, I added a song to the playlist, and you can notice it was added to the end of the playlist, after “0.vers”
7. At 00:06:53, I added several more songs to the playlist. And like step 6, the songs were added to the end of the playlist
8. At 00:07:09, I adjusted the sort order as reverse, to show “0.vers” at the top for easier data viewing, and you can see the music from steps 6 and 7 are all before “0.vers”
9. At 00:07:16, I added more songs to the playlist, and like steps 6 and 7, all songs were added before “0.vers”

Steps 6-9’s issues might be due to Navidrome returning the playlist with reversed song order for unknown reasons, making Symfonium think “0.vers” was the most recently added song, so these behaviors seemed reasonable to Symfonium. However, next steps proved it wasn’t that simple.

  1. At 00:08:08, I readjusted the playlist order to show “0.vers” at the bottom of the playlist. Then I switched to other interfaces to browse information
  2. At 00:08:45, I added a song “J’y Suis Jamais Alle” to the playlist. After adding successfully, I switched to the playlist interface, and you’ll notice the playlist order somehow reversed, with “0.vers” showing at the top again.The newly added song was added to the end of the playlist. If the behavior in steps 6-9 was correct, “J’y Suis Jamais Alle” should have continued to be added before “0.vers”.

It’s strange that adding songs in steps 6-9 did not cause the playlist to reverse, but in steps 10, adding songs caused the playlist to reverse, and the songs were not correctly added. The specific conditions for this occurrence are unclear - it seems random to me.

Logs matching the video would have been perfect to understand everything. Just the video will just be an help to try to reproduce here.

Will try to allocate time for this soon.

@Tolriq

I am sorry, I performed another reproduction and recorded both the process and debug logs. This time reproduction the issue more quickly.

I have uploaded the relevant files again.

  1. First, I started the app and entered the settings interface, and enabled the debug logs.

  2. Then at 00:12, I entered the playlist, and the song “0.vers” appeared at the top of the playlist.

  3. At 01:18, I added a song and then checked the playlist. This time the song was normally added to the end of the playlist, rather than before “0.vers”. To make it easier to find the newly added song, I adjusted the playlist sorting, making “0.vers” appear at the bottom and the newly added song at the top. And then At 01:45, I added another song to the playlist, and the result was the same as in step 3.

  4. At 02:07, I selected several songs and added them to the playlist. This time the problem occurred. After adding the songs and returning to the playlist, I found that “0.vers” somehow appeared at the top of the playlist, the entire playlist inexplicably reversed, and my newly added songs were added before “0.vers”.

Ok thanks, so there was a case where Symfonium pushed the data based on the display order of the playlist and not the actual playlist order.

Will be fixed in next release.