Skip to content

File browser: sort by metadata#13437

Merged
hius07 merged 19 commits into
koreader:masterfrom
hius07:sort-by-metadata
Mar 24, 2025
Merged

File browser: sort by metadata#13437
hius07 merged 19 commits into
koreader:masterfrom
hius07:sort-by-metadata

Conversation

@hius07

@hius07 hius07 commented Mar 20, 2025

Copy link
Copy Markdown
Member

1

2

Closes #3864. Closes #7875. Closes #10957.


This change is Reviewable

@hius07

hius07 commented Mar 20, 2025

Copy link
Copy Markdown
Member Author

Books' props are not cached. Can be added if we feel that requesting CoverBrowser database is not fast enough for folders with many files.

@hius07 hius07 mentioned this pull request Mar 21, 2025
@poire-z

poire-z commented Mar 21, 2025

Copy link
Copy Markdown
Contributor

Not familiar with sorting, and it's all a lot of refactoring, so trusting you :)

(We may have complain by users saying authors and keywords are lists - so sorting/filtering is a bit tedious. May be the title should say "by first keyword", "by first author" - but this is a bit ugly.)

@hius07

hius07 commented Mar 21, 2025

Copy link
Copy Markdown
Member Author

Yes, mostly refactoring based on our flexible collate system.

To get document props, collate item_func needs FM/Reader instance passed through FileChooser.
Similar to Collections I named it _manager, but now I see that it's our usual ui, so renaming.

@hius07

hius07 commented Mar 21, 2025

Copy link
Copy Markdown
Member Author

file_chooser is now init-ed after all plugins, i.e. after CoverBrowser's patching done.

@hius07 hius07 merged commit 93ee0a1 into koreader:master Mar 24, 2025
@hius07 hius07 deleted the sort-by-metadata branch March 24, 2025 17:12
@hius07 hius07 added this to the 2025.03 milestone Mar 24, 2025
@ichnilatis-gr

Copy link
Copy Markdown
Contributor

Usually the author's name is in the form "first name-surname". If we sort the files by "Authors", I think it would make more sense to sort by surname. So I think the last name in the author's name order should be used for classification.

@hius07

hius07 commented Mar 26, 2025

Copy link
Copy Markdown
Member Author

Author field is not separated, just a string "John Smith".
Sometimes "Smith, John", sometimes "John W. Smith".
How can we get the surname? In other languages?

@ichnilatis-gr

Copy link
Copy Markdown
Contributor

I see that this is done in the Pocketbook library when books are sorted by author's name and I assumed that there was a way to set the "last word" in the Author field as a sorting factor. If that's not possible, no problem.

@mergen3107

Copy link
Copy Markdown
Contributor

@hius07
A user on reddit says Search is missing in FM.

https://www.reddit.com/r/koreader/comments/1jkghai/file_search_in_browser_missing/

Haven't tested myself yet, can help later

@hius07

hius07 commented Mar 27, 2025

Copy link
Copy Markdown
Member Author

Thanks, shall fix today.

@hius07

hius07 commented Mar 27, 2025

Copy link
Copy Markdown
Member Author

@ichnilatis-gr if you want to test sorting by author's last name, here is the userpatch:

2-sort-by-author-last-name.lua.txt

@ichnilatis-gr

ichnilatis-gr commented Mar 28, 2025

Copy link
Copy Markdown
Contributor

@ichnilatis-gr if you want to test sorting by author's last name, here is the userpatch:

2-sort-by-author-last-name.lua.txt

Thank you! It's not bad. It even struck me that sometimes, even though the surname is first (surname; first name), it is sometimes correctly classified according to the surname... Will it be merged?
The other option is to put surname first in the file name and sort files by name, which is what I usually do...
... or to have two choices for sorting by name, one by first name and one by surname... :-)

@hius07

hius07 commented Mar 28, 2025

Copy link
Copy Markdown
Member Author

Maybe. If you meet an author that produces incorrect surname, please send this string to me.

@ichnilatis-gr

Copy link
Copy Markdown
Contributor

@ichnilatis-gr if you want to test sorting by author's last name, here is the userpatch:

2-sort-by-author-last-name.lua.txt

Is this a different file? I see that it has a different name from the booklist.lua you gave me a few days ago. Has something changed? I can save it in the same folder?
Thanks!

@hius07

hius07 commented Apr 6, 2025

Copy link
Copy Markdown
Member Author

booklist.lua is a program module, it will be overwritten by updates.
2-sort-by-author-last-name.lua is a userpatch.

@ichnilatis-gr

Copy link
Copy Markdown
Contributor

2-sort-by-author-last-name.lua is a userpatch.

Which means what? :-)

@hius07

hius07 commented Apr 6, 2025

Copy link
Copy Markdown
Member Author

@ichnilatis-gr

Copy link
Copy Markdown
Contributor

So, Can I make a folder koreader\patches and it put the file there? In this case does it function despite the booklist.lua?

@ichnilatis-gr

Copy link
Copy Markdown
Contributor

Dear @hius07, did I understand correctly about the patches? I am sorry for my ignorance and constant annoyance.

@NiLuJe

NiLuJe commented Apr 8, 2025

Copy link
Copy Markdown
Member

Yep.

@ichnilatis-gr

ichnilatis-gr commented Apr 9, 2025

Copy link
Copy Markdown
Contributor

Yep.

I was thinking of deleting my perhaps silly questions today after seeing the patches work in practice, but you beat me to it. :-)
Thanks!

0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

5 participants