jellyfin / mopidy-jellyfin

Jellyfin Extension for Mopidy
https://jellyfin.org
Apache License 2.0
93 stars 16 forks source link

Playlists created in ncmpcpp save in the incorrect order #111

Open sseneca opened 3 years ago

sseneca commented 3 years ago

One thing I've noticed is that the order they get saved in is not random -- if I save the same playlist twice it gets saved in the same "wrong" order twice.

mcarlton00 commented 3 years ago

I'm not sure what you mean. Can you be more specific?

sseneca commented 3 years ago

In ncmpcpp, I have the following playlist (a small one for demonstration):

Human Sadness
QYURRYUS
Pink Ocean
Think Before You Drink

I add them to the playlist test. When I view test from the Jellyfin web app, or if I restart mopidy and load the playlist test, they're in the wrong order:

Human Sadness
Pink Ocean
Think Before You Drink
QYURRYUS

This is consistent, in that if I save that initial playlist again under a different name, it'll be created in the same wrong order again.

Hopefully that's more clear?

mcarlton00 commented 3 years ago

I can't replicate this. I've added the following tracks to a playlist from ncmpcpp in this order, and they show up in the same order in the web UI and after restarting mopidy.

2021-07-04-111746_248x179_scrot

2021-07-04-111812_564x583_scrot

dragonchaser commented 2 years ago

I think this is the same error I am hving with mpdel:

  Kreator - Apocalypticon        1      Gods of Violence                          
  Kreator - Fallen Brother       9      Gods of Violence                          
  Kreator - Gods Of Violence     5      Gods of Violence                          
  Kreator - Hail To The Hordes   7      Gods of Violence                          
  Kreator - Lion With Eagle Wings 8      Gods of Violence                          
  Kreator - Satan Is Real        3      Gods of Violence                          
  Kreator - Side By Side         10     Gods of Violence                          
  Kreator - Totalitarian Terror  4      Gods of Violence                          
  Kreator - World War Now        2      Gods of Violence                          
  Kreator - Death Becomes My Light 10     Gods of Violence                          
  Kreator - Army of Storms       6      Gods of Violence 

Also this might be a duplicate of #84

PTwr commented 2 years ago

It appears Jellyfin API does not support sorting by things like Track/Episode Id (internally named IndexNumber). Currently available sorting fields are stated as "Album, AlbumArtist, Artist, Budget, CommunityRating, CriticRating, DateCreated, DatePlayed, PlayCount, PremiereDate, ProductionYear, SortName, Random, Revenue, Runtime", and sorting implementations can be found in https://github.com/jellyfin/jellyfin/tree/master/Emby.Server.Implementations/Sorting Only harcoded fields are supported, there is no dynamic query on whatever field you want: https://github.com/jellyfin/jellyfin/blob/a1246ba3a080cc20ff1c8e64b39a501065cc39b0/Emby.Server.Implementations/Library/LibraryManager.cs#L1739 (Comparer not found => null => sort ignored)

End effect is seemingly random, yet unchanging, order unless supported sort is specified.

As Jellyfin stands now, its up to mopidy plugin to apply sort after fetching data. Once I'll get some more free time I'll look into extending Jellyfin API to support more fields, but to make it and then get it into release might take few days.

PTwr commented 2 years ago

It appears that SortBy SortName does sort by IndexNumber, for whatever reason... So mopidy plugin would just have to include SortOrder = Ascending SortBy = SortName in query and everything should be fine.

sseneca commented 1 year ago

121 did not fix this