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

Field to define the expected syntax of filenames #5

Open
m-dp opened this issue Sep 1, 2017 · 2 comments
Open

Field to define the expected syntax of filenames #5

m-dp opened this issue Sep 1, 2017 · 2 comments

Comments

@m-dp
Copy link

m-dp commented Sep 1, 2017

In the list and grid view of the book selection tabs, a heuristic method is used to identify "author (editor, etc.)" and "title (subtitle, etc.)" from the filename, when they are not available as metadata: the space-dash-space, ' - '.

Problem: not all filenames use the "author - title" syntax,
for example 'Book about something, The [Publishing House - Smith, J., 2000]'.
In this case, the "Author" is taken to be 'Book about something, The [Publishing House'
and the "Title" is taken to be 'Smith, J., 2000]'.

Proposal: add a string field with an expression such as
"%a - %t"
The above defaults to what you are doing now. If the user modifies the expression, for example, as
"%t [%a]", then the split would be correct for the example I gave above.

(I mention this issue in another post, but here it is better defined).

@m-dp
Copy link
Author

m-dp commented Sep 1, 2017

Of course, I mean that the editable field for the filename syntax should be added in the preferences.

To be on the safe side, you should also add a button or link "reset to default", which puts again in the editable field the string "%a - %t", in case the user makes some mistake.

Also, you should make the presence of the "%t", the "title" part, mandatory in the validation of the string: all correct filename expression contain one and only one "%t"

@m-dp
Copy link
Author

m-dp commented Sep 3, 2017

For quick reference, now that I know the Librera code a bit better:
I suggest changes to the method
public static Pair<String, String> getTitleAuthorByPath(String name)
of com/foobnix/android/utils/TxtUtils.java
so that the user can specify the syntax commonly used in his collection.

Given that I now see that the heuristics in getTitleAuthorByPath() is more complex than just interpreting the path name as "author - title.extension", I can rephrase the proposal as:
if the content of a "syntax of filenames" string field in the preferences is defined,
then "author" and "title" are taken from the path name according to the expression (for example, '%a - %t', '%t [%a]', '%t', etc.) the user put in such field,
otherwise, the current heuristics of getTitleAuthorByPath() is used.

foobnix pushed a commit that referenced this issue Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant