Aanok / jftui

Jellyfin Terminal User Interface
The Unlicense
142 stars 7 forks source link

keep original playlist ordering #21

Closed uggedal closed 3 years ago

uggedal commented 3 years ago

Original implementation meant that my music playlists would be ordered wrongly (first all the first tracks of all albums, then all second tracks, and so on).

Aanok commented 3 years ago

Your PR would align jftui with how the web GUI orders playlists, but I'm not sure how the scenario you describe could manifest. sortby parameters shouldn't have any effect on Playlists, so that the order the items are returned by the server is the same you added them to the playlist. Would you mind offering an example?

uggedal commented 3 years ago

In one of my recent playlists I've added several albums after each other. The current playlist listing query parameters (gotten with debug mode) vs without any sortby parameters:

~ jfc() { curl -s "https://myserver.tld${1}&api_key=supersecret" | jq .; }
~ jfc '/users/USERID/items?sortby=isfolder,parentindexnumber,indexnumber,productionyear,sortname&parentid=PLAYLISTID' | grep Album\":
      "Album": "CARNAGE",
      "Album": "Medicine at Midnight",
      "Album": "An Overview on Phenomenal Nature",
      "Album": "Ignorance",
      "Album": "Urban Driftwood",
      "Album": "Ignorance",
      "Album": "Urban Driftwood",
      "Album": "An Overview on Phenomenal Nature",
      "Album": "CARNAGE",
      "Album": "Medicine at Midnight",
      "Album": "CARNAGE",
      "Album": "Medicine at Midnight",
      "Album": "An Overview on Phenomenal Nature",
      "Album": "Urban Driftwood",
      "Album": "Ignorance",
      "Album": "An Overview on Phenomenal Nature",
      "Album": "Urban Driftwood",
      "Album": "Ignorance",
      "Album": "Medicine at Midnight",
      "Album": "CARNAGE",
      "Album": "CARNAGE",
      "Album": "An Overview on Phenomenal Nature",
      "Album": "Ignorance",
      "Album": "Medicine at Midnight",
      "Album": "Urban Driftwood",
      "Album": "Urban Driftwood",
      "Album": "An Overview on Phenomenal Nature",
      "Album": "CARNAGE",
      "Album": "Medicine at Midnight",
      "Album": "Ignorance",
      "Album": "Medicine at Midnight",
      "Album": "CARNAGE",
      "Album": "An Overview on Phenomenal Nature",
      "Album": "Urban Driftwood",
      "Album": "Ignorance",
      "Album": "CARNAGE",
      "Album": "Medicine at Midnight",
      "Album": "Urban Driftwood",
      "Album": "Ignorance",
      "Album": "Ignorance",
      "Album": "Medicine at Midnight",
      "Album": "Urban Driftwood",
      "Album": "Urban Driftwood",
      "Album": "Ignorance",
      "Album": "Beech Street",
      "Album": "Sleppe tak",
      "Album": "Sleppe tak",
      "Album": "Beech Street",
      "Album": "Sleppe tak",
      "Album": "Beech Street",
      "Album": "Beech Street",
      "Album": "Sleppe tak",
      "Album": "Beech Street",
      "Album": "Sleppe tak",
      "Album": "Beech Street",
      "Album": "Sleppe tak",
      "Album": "Beech Street",
      "Album": "Sleppe tak",
      "Album": "Beech Street",
      "Album": "Sleppe tak",
      "Album": "Beech Street",
      "Album": "Sleppe tak",
      "Album": "Beech Street",
      "Album": "Sleppe tak",
      "Album": "Beech Street",
      "Album": "Beech Street",
~ jfc '/users/USERID/items?parentid=PLAYLISTID' | grep Album\":
      "Album": "An Overview on Phenomenal Nature",
      "Album": "An Overview on Phenomenal Nature",
      "Album": "An Overview on Phenomenal Nature",
      "Album": "An Overview on Phenomenal Nature",
      "Album": "An Overview on Phenomenal Nature",
      "Album": "An Overview on Phenomenal Nature",
      "Album": "An Overview on Phenomenal Nature",
      "Album": "Beech Street",
      "Album": "Beech Street",
      "Album": "Beech Street",
      "Album": "Beech Street",
      "Album": "Beech Street",
      "Album": "Beech Street",
      "Album": "Beech Street",
      "Album": "Beech Street",
      "Album": "Beech Street",
      "Album": "Beech Street",
      "Album": "Beech Street",
      "Album": "Beech Street",
      "Album": "Sleppe tak",
      "Album": "Sleppe tak",
      "Album": "Sleppe tak",
      "Album": "Sleppe tak",
      "Album": "Sleppe tak",
      "Album": "Sleppe tak",
      "Album": "Sleppe tak",
      "Album": "Sleppe tak",
      "Album": "Sleppe tak",
      "Album": "Sleppe tak",
      "Album": "Urban Driftwood",
      "Album": "Urban Driftwood",
      "Album": "Urban Driftwood",
      "Album": "Urban Driftwood",
      "Album": "Urban Driftwood",
      "Album": "Urban Driftwood",
      "Album": "Urban Driftwood",
      "Album": "Urban Driftwood",
      "Album": "Urban Driftwood",
      "Album": "Urban Driftwood",
      "Album": "CARNAGE",
      "Album": "CARNAGE",
      "Album": "CARNAGE",
      "Album": "CARNAGE",
      "Album": "CARNAGE",
      "Album": "CARNAGE",
      "Album": "CARNAGE",
      "Album": "CARNAGE",
      "Album": "Ignorance",
      "Album": "Ignorance",
      "Album": "Ignorance",
      "Album": "Ignorance",
      "Album": "Ignorance",
      "Album": "Ignorance",
      "Album": "Ignorance",
      "Album": "Ignorance",
      "Album": "Ignorance",
      "Album": "Ignorance",
      "Album": "Medicine at Midnight",
      "Album": "Medicine at Midnight",
      "Album": "Medicine at Midnight",
      "Album": "Medicine at Midnight",
      "Album": "Medicine at Midnight",
      "Album": "Medicine at Midnight",
      "Album": "Medicine at Midnight",
      "Album": "Medicine at Midnight",
      "Album": "Medicine at Midnight",
uggedal commented 3 years ago

And looking at the lists I see that my original scenario desciption was not correct :slightly_smiling_face: But at least it's not returned in the order as the playlist was described.

Aanok commented 3 years ago

Thank you very much for the follow-up. A "naked" query is probably how it'll end up in the end, but I'll do a little bit more testing on how Playlists interact with sorting before merging.

Aanok commented 3 years ago

Your PR would align jftui with how the web GUI orders playlists

My apologies, this turned out to be wrong. There happens to be a /playlists endpoint, which is what the web client uses and that does list a playlist's contents as they've been ordered manually by the user.

The PR is rejected, but thanks for bringing this up to attention and definitely thanks for the effort of offering a solution! :)