Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort columns in TracksList #62

Closed
1 task done
martpie opened this issue Jan 4, 2016 · 36 comments
Closed
1 task done

Sort columns in TracksList #62

martpie opened this issue Jan 4, 2016 · 36 comments

Comments

@martpie
Copy link
Owner

martpie commented Jan 4, 2016

This is a to-do thing: we must be able to add/remove/rearrange metatags columns. Not the most urgent thing though.

  • asc/desc sort on click

Sorting algorithms

Default: 

const querySort = {
    'loweredMetas.artist': 1,
    'year': 1,
    'loweredMetas.album': 1,
    'disk.no': 1,
    'track.no': 1
};
@martpie martpie changed the title Reorder columns in trackslist Reorder columns in TracksList Jan 4, 2016
@martpie martpie added this to the 0.4 milestone Jan 11, 2016
@martpie martpie modified the milestones: Later, 0.4 Mar 22, 2016
@martpie martpie modified the milestones: 1.0, Later Jul 6, 2016
@martpie martpie mentioned this issue Sep 21, 2016
18 tasks
@dkniffin
Copy link
Collaborator

  • Sort by column on click

@martpie
Copy link
Owner Author

martpie commented Nov 21, 2016

Indeed.

The main difficulty here is sorting. E.g If I filter by year, great, but how tracks with the same year will be sortered then ? Do we need to define how every sorting should behave ?

Like:

Filter by artist: artist -> album -> year -> cd.no
Filter by year: year -> artist -> album -> cd.no

... and so on ...

Another question: should the ASC/DESC sorting be only on the first sort or all the ones after ?

@YurySolovyov Did you encouter these kind of problems with folders/files mix sorting with Eion for example ?

I'm curious about everyone's thoughts here, if everybody can tell me how their favorite music players behave, that'd be great too

@dkniffin
Copy link
Collaborator

We could add a "type" to each column, like date, string, number, time, etc. Then we'd just have a sorting algorithm for each one.

@martpie
Copy link
Owner Author

martpie commented Nov 21, 2016

I think that's indeed the thing to do. We just have to define the sorting algorythm for every column now .__.

@YurySolovyov
Copy link
Collaborator

YurySolovyov commented Nov 21, 2016

@KeitIG there was (and still is) an issue in Eion like "finding a needle in the haystack", where I need to select 1 item in 6k lines and it take a lot fot react to do it.

I'd measured the time it needs to just re-render entire view, which would probably happen on most sorts.

Other things is to try to employ some kind of Virtual Lists that render only the visible items.

@martpie
Copy link
Owner Author

martpie commented Nov 21, 2016

@YurySolovyov You might be interested by: http://blog.atom.io/2015/06/24/rendering-improvements.html

I was more thinking about the sorting algorithms here between rows here

@YurySolovyov
Copy link
Collaborator

YurySolovyov commented Nov 21, 2016

@KeitIG sorting itself is going to be fast compared to the actual rendering. I think. 😄

@martpie
Copy link
Owner Author

martpie commented Nov 21, 2016

I think you don't get what I mean haha. I'm just speaking about sorting files/folders here, imagine you sort by "type", so it sorts all your directory with let say folders first, then files.

Do you have a second sort ? To sort by filename ? Or is it arbitrary ?

@YurySolovyov
Copy link
Collaborator

@KeitIG I went simpler way, though it won't work for museeks:
I split folders and files into 2 arrays, sort them separately, and then .concat them back.
I do this cause I want folders to always be on top regardless of current sorting.

@dkniffin
Copy link
Collaborator

react-datagrid seems to accomplish what we want. Thoughts?

@martpie
Copy link
Owner Author

martpie commented Nov 23, 2016

No, it lacks all the features of the TracksList component

  • dynamic loading & rendering
  • all events
    • click, contextmenu
    • keys...
  • it's not sexy
  • it's fun to reinvent the wheel for this kind of things

@YurySolovyov
Copy link
Collaborator

@KeitIG FWIW last time I looked into TracksList, it was pretty scary

@martpie
Copy link
Owner Author

martpie commented Nov 23, 2016

Well, there's a bit maths inside.

@dkniffin
Copy link
Collaborator

Hmm. I think it does support some of those features, but I looked into it a bit more, and it looks like it's not being very well maintained so I agree we shouldn't use that.

However, are you opposed to using any 3rd party component libraries? It certainly is fun to reinvent sometimes, but it's also a lot of work.

@martpie
Copy link
Owner Author

martpie commented Mar 30, 2017

ok, for this one we can start with sorting. Editable columns is a bonus that can be done later

@YurySolovyov
Copy link
Collaborator

How are we going to store them? in config or db?

@martpie
Copy link
Owner Author

martpie commented Mar 30, 2017

For sorting, there will be a hashmap for each type of column:

Filter by artist: artist -> album -> year -> cd.no
Filter by year: year -> artist -> album -> cd.no
...

So we'll need to agree on these.

Then there will be two options stored in config:

  • sort column
  • asc/dsc

and I think the asc/dsc option should only apply on the first parameter, so for "Filter by artist" and "dsc", only the "artist" key would be sorted dsc. The "sub-keys" would be asc.

Does it look good ?

@martpie
Copy link
Owner Author

martpie commented Apr 4, 2017

Default (current)

{
    'loweredMetas.artist': 1,
    'year': 1,
    'loweredMetas.album': 1,
    'disk.no': 1,
    'track.no': 1,
}

-----

Tracks ASC: 

{
    'loweredMetas.title': 1,
    'loweredMetas.artist': 1,
    'year': 1,
    'loweredMetas.album': 1,
    'disk.no': 1,
    'track.no': 1,
}

Tracks DSC: 

{
    'loweredMetas.title': -1,
    'loweredMetas.artist': 1,
    'year': 1,
    'loweredMetas.album': 1,
    'disk.no': 1,
    'track.no': 1,
}

-----

Duration ASC

{
    'duration': 1,
    'loweredMetas.artist': 1,
    'year': 1,
    'loweredMetas.album': 1,
    'disk.no': 1,
    'track.no': 1,
}

Duration DSC

{
    'duration': -1,
    'loweredMetas.artist': 1,
    'year': 1,
    'loweredMetas.album': 1,
    'disk.no': 1,
    'track.no': 1,
}

and so on...

- put the primary key used for sorting first
- add the default sorting options 
- remove its duplicate if needed

Not sure if there is an easy way to code this or if I'll have to hardcode all posibilities. Those sort options will be shared across views btw.

@martpie martpie modified the milestones: 1.0, 0.9 Apr 10, 2017
@martpie martpie modified the milestones: 0.9, 1.0 May 22, 2017
@martpie martpie changed the title Reorder columns in TracksList Sort columns in TracksList Feb 20, 2018
@martpie
Copy link
Owner Author

martpie commented Feb 20, 2018

This is in progress, last big issue to fix before 0.9 release.

@martpie
Copy link
Owner Author

martpie commented Mar 2, 2018

Going through the whole thing, I do not think it makes any sense to add sorting for playlists.

@YurySolovyov
Copy link
Collaborator

Why not?

@martpie
Copy link
Owner Author

martpie commented Mar 6, 2018

Done in #411

@martpie martpie closed this as completed Mar 6, 2018
@ldexterldesign
Copy link

ldexterldesign commented Feb 6, 2020

Hi,

Thanks for wonderful software (currently best on macOS IMO)

Screen cast: https://www.dropbox.com/s/zm93w28rsqsvj1k/foo.webm?dl=0

Primary sorting by album isn't secondary sorting by track - bug?:

  • If yes then happy to create a new issue
  • If no then makes sense to reopen this issue
  • If related to another TODO then probably best to link it as, like 🦟 to 💩, others will come; and all sort-related roads lead to this issue

Hope to hear back

Cheers

PS files have track # ID3 tags:

Screenshot 2020-02-06 at 03 42 10

@martpie
Copy link
Owner Author

martpie commented Feb 6, 2020

You can see the order here: https://github.com/martpie/museeks/blob/master/src/ui/constants/sort-orders.ts

Feel free to open an issue if you disagree with one :) (possible I made a mistake too)

@ldexterldesign
Copy link

ldexterldesign commented Feb 6, 2020

I see, so it's not a bug, the reason [t]his isn't working is because track numbers aren't implemented (as columns) yet?

Cheers

t:

Primary sorting by album isn't secondary sorting by track (number) - bug?:

@martpie
Copy link
Owner Author

martpie commented Feb 6, 2020

It should: [['loweredMetas.album', parseArtist, 'year', 'disk.no', 'track.no']

Can you open an issue with screenshots and files to reproduce the issue?

@ldexterldesign
Copy link

ldexterldesign commented Mar 4, 2020

Hi @martpie,

FYI will open a new issue in due course if I suffer the same issue with the next batch of imported music

Aside, is there a reason a track number column isn't available?

Tonight, I have an album where a couple of tracks have inconsistent artist tags which throws out the album's natural play order and I'm unable to fix it because there's no track number column:

Screenshot 2020-03-04 at 20 04 10

Hope to hear back

Sincerely

@martpie
Copy link
Owner Author

martpie commented Mar 4, 2020

Tonight I have an album where a couple of tracks have inconsistent artist tags which throws out the album's natural play order and I'm unable to fix it because there's no track number column

Yep, this is a limitation of the current view, hopefully #130 will help fix that :)

Aside, is there a reason a track number column isn't available?

If track number was available, all the tracks "1" would be grouped together, then all the "2", etc. That is why it makes no sense to display (for now) a "tracks number" column

@ldexterldesign
Copy link

Search/filter by album (see screen shot above) then sort by track number would allow me to fix this use case so, if #130 is bottlenecking this then, I would suggest a track number column would make sense now

@martpie
Copy link
Owner Author

martpie commented Mar 4, 2020

Cf #401 then I believe :)

@ldexterldesign
Copy link

Can you open an issue with screenshots and files to reproduce the issue?

I will open a new issue in due course if I suffer the same issue with the next batch of imported music

@martpie still suffering this issue - would you like me to create a new issue or do you think #130 and/or #401 will fix this?

Sincerely

@ldexterldesign
Copy link

BUMP

1 similar comment
@ldexterldesign
Copy link

BUMP

@martpie
Copy link
Owner Author

martpie commented Jan 9, 2023

@ldexterldesign Can you share with me a list of files (my email is on my GH profile), and tell me what should be the expected default order in your opinion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants