Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Devices

Notices

Reply
 
Thread Tools Search this Thread
Old 02-21-2023, 10:00 AM   #16
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 577
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by isarl View Post
You're still messing about with a regex that's way more complicated than you need. I have no interest in helping you debug a regex that I don't see as necessary, so unless you have more feedback about how my suggestion was insufficient for your needs, I will be bowing out from further help here.
I beg to differ. It's exactly as complicated as it needs to be to do the job I want it to do. Your suggestion was inadequate for the reasons I stated above.

My solution does what I want, it's fully debugged, and I don't need any help with that. There is no need for you to be offended simply because I choose to do things a different way to you. Maybe you're OK with having authors listed under "Jr" and "II" and "(ed.), but I'm not.
Phssthpok is offline   Reply With Quote
Old 02-21-2023, 11:38 AM   #17
isarl
Addict
isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.
 
Posts: 287
Karma: 2534928
Join Date: Nov 2022
Location: Canada
Device: Kobo Aura 2
Quote:
Originally Posted by Phssthpok View Post
I beg to differ. It's exactly as complicated as it needs to be to do the job I want it to do. Your suggestion was inadequate for the reasons I stated above.

My solution does what I want, it's fully debugged, and I don't need any help with that. There is no need for you to be offended simply because I choose to do things a different way to you. Maybe you're OK with having authors listed under "Jr" and "II" and "(ed.), but I'm not.
Electing not to invest further help in somebody who is perceived as not accepting my help is not taking offense, it's just making sensible use of my time. :P When I had replied beforehand, you had not yet illustrated the problems with those names with suffices. So likewise, there is no need for you to be offended simply because I was having trouble understanding where my previous suggestion failed to meet your needs. Your explanation was exactly what I was after; I can empathize with wanting author names parsed properly by your Kobo even though I don't yet have any Jr's or III's or similar names in my library.

If I test your proposed solution:

Code:
{author_sort:'re(list_re($, '&', '^([^,]*)(,(.*))?$', '\3 \1'),'&',', ')'}
with an author whose name is like, “Joe Schmoe, MD” and whose author_sort is set to “Schmoe, Joe, MD”, then it comes out as: “Joe, MD Schmoe”. While this looks odd I guess it will almost your needs since the last name should be detected properly. However it will still have a spurious comma in there, which will result in splitting your authors where you don't want it to (“Joe, MD Schmoe” will result in two authors: “Joe”, and “MD Schmoe”) – and I think I can help you with this. Simply add an extra re() call to replace commas with something that looks comma-like to you but is treated differently by the software – previously I had used @ as a placeholder, but now that I do a quick search, my first suggestion is Unicode codepoint 0x2e32, “TURNED COMMA”. Here is a turned comma and then a regular comma, for the sake of comparison:
Code:
⸲,
So my refinement to what you've arrived at (which I agree, seems to (very nearly!) capture your desired logic efficiently enough ) is the following:

Code:
{author_sort:'re(re(list_re($, '&', '^([^,]*)(,(.*))?$', '\3 \1'), ',', '⸲'),'&',', ')'}
For a book with authors like “Joe Schmoe, MD & Aesop” (where I have paid attention to tweak Joe's author_sort to be like “Schmoe, Joe, MD”), this template transforms them into: “Joe⸲ MD Schmoe, Aesop” (the first comma is that TURNED COMMA so your Kobo will detect this as two authors: “Joe⸲ MD Schmoe”, and “Aesop”). I've also tested the template on books with single authors and it works fine for them, as well. But I invite you to test it further, given the size of your collection. Edge cases love to sneak in.

Hope that helps more, and good luck!
isarl is offline   Reply With Quote
Advert
Old 02-21-2023, 11:43 AM   #18
isarl
Addict
isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.
 
Posts: 287
Karma: 2534928
Join Date: Nov 2022
Location: Canada
Device: Kobo Aura 2
PS: I also tested it on a book with an author like “Dr. First Last”. I believe Calibre has (some?) such titles built into its logic, so the author sort for this author was already set to “Last, First” without any intervention on my part and the template worked flawlessly. If you have an author like “Title First Last” and the author sort is not set correctly, you may run into issues. But of course I hope you expect to have “Garbage In, Garbage Out” if you know you're dealing with poorly-curated metadata.

PPS: I've also tested with authors with author_sort values like “Fitzgerald, F. Scott”, “Fonseca, Josa da”, “Le Guin, Ursula K.”, “López-Alt, J. Kenji”, and mononyms like “Aesop”; basically all the “strangest” examples I could find in my tag browser, and it seems to work for any and all of them, and for combinations thereof.

Last edited by isarl; 02-21-2023 at 11:54 AM. Reason: adding more formats I've tested with
isarl is offline   Reply With Quote
Old 02-21-2023, 01:55 PM   #19
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 577
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by isarl View Post
“Joe Schmoe, MD” and whose author_sort is set to “Schmoe, Joe, MD”, then it comes out as: “Joe, MD Schmoe”. While this looks odd I guess it will almost your needs since the last name should be detected properly.
Yes, but when I set the author_sort for "special" names like this I set it to "Schmoe, Joe MD" without the extra comma. Since this only affects how it is sorted, and not how it's displayed, it works fine.
Quote:
Simply add an extra re() call to replace commas with something that looks comma-like to you but is treated differently by the software – previously I had used @ as a placeholder, but now that I do a quick search, my first suggestion is Unicode codepoint 0x2e32, “TURNED COMMA”. Here is a turned comma and then a regular comma, for the sake of comparison:
Code:
⸲,
That's a good idea. Not needed at the moment, but I'll bear it in mind.
Quote:
So my refinement to what you've arrived at (which I agree, seems to (very nearly!) capture your desired logic efficiently enough ) is the following:

Code:
{author_sort:'re(re(list_re($, '&', '^([^,]*)(,(.*))?$', '\3 \1'), ',', '⸲'),'&',', ')'}
For a book with authors like “Joe Schmoe, MD & Aesop” (where I have paid attention to tweak Joe's author_sort to be like “Schmoe, Joe, MD”), this template transforms them into: “Joe⸲ MD Schmoe, Aesop” (the first comma is that TURNED COMMA so your Kobo will detect this as two authors: “Joe⸲ MD Schmoe”, and “Aesop”). I've also tested the template on books with single authors and it works fine for them, as well. But I invite you to test it further, given the size of your collection. Edge cases love to sneak in.

Hope that helps more, and good luck!
Thanks!
Phssthpok is offline   Reply With Quote
Old 02-21-2023, 01:58 PM   #20
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 577
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by isarl View Post
PS: I also tested it on a book with an author like “Dr. First Last”. I believe Calibre has (some?) such titles built into its logic, so the author sort for this author was already set to “Last, First” without any intervention on my part and the template worked flawlessly. If you have an author like “Title First Last” and the author sort is not set correctly, you may run into issues. But of course I hope you expect to have “Garbage In, Garbage Out” if you know you're dealing with poorly-curated metadata.

PPS: I've also tested with authors with author_sort values like “Fitzgerald, F. Scott”, “Fonseca, Josa da”, “Le Guin, Ursula K.”, “López-Alt, J. Kenji”, and mononyms like “Aesop”; basically all the “strangest” examples I could find in my tag browser, and it seems to work for any and all of them, and for combinations thereof.
"I always keep my feathers numbered for just such an emergency," to quote Foghorn Leghorn, and I always check author_sort for any new authors.
Phssthpok is offline   Reply With Quote
Advert
Old 02-21-2023, 02:03 PM   #21
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 577
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by Lys View Post
If you don't want to set the reading %, but you just want to set books as "Finished", you just need to select the books, select the "update metadata on device" option, and then flag the set reading status as needed (see image).
Amazing. Select all rating=5 books in Calibre, click on KU, set reading status to finished, set the book filter on the Kobo to "unread", and the job is done. I now have close to 6000 books on the Kobo, all neatly arranged as I desire.

The only thing I'm missing now is a way to go to "authors beginning with M" in the author list, and the search doesn't seem to help much for that. Oh well.

Phssthpok is offline   Reply With Quote
Old 02-21-2023, 03:39 PM   #22
isarl
Addict
isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.
 
Posts: 287
Karma: 2534928
Join Date: Nov 2022
Location: Canada
Device: Kobo Aura 2
Quote:
Originally Posted by Phssthpok View Post
Amazing. Select all rating=5 books in Calibre, click on KU, set reading status to finished, set the book filter on the Kobo to "unread", and the job is done. I now have close to 6000 books on the Kobo, all neatly arranged as I desire.

The only thing I'm missing now is a way to go to "authors beginning with M" in the author list, and the search doesn't seem to help much for that. Oh well.

Awesome, happy to help and glad to hear it's working for you!

For “authors beginning with M”, I'm not sure whether you're talking about in Calibre or on the Kobo. In Calibre, you can right-click Authors in the tag browser, and choose “Change sub-categorization scheme” to “By first letter”. (If you have enabled the tweak to show author names as Last, First in the tag browser, then this will use the first letter of their last name – otherwise, of their first name.) If you are talking about on the Kobo, then in My Books -> Authors, you can choose to sort by First Name, Last Name, and other options as well (mononyms conveniently sort properly regardless of whether you are using First Name or Last Name). If it's just an issue that the list of authors is long, I don't know that you can jump directly to a letter, but you should be able to manipulate the scrollbar directly and jump down e.g. halfway through rather than having to page through authors one page at a time. Not sure if either of these addresses your need. Another way to address it might be the Calibre search query:

Code:
author_sort:="~^M"
which returns only books with an author whose author_sort field starts with M. Or if you wanted only books with an author whose surname (or mononym) starts with M or any following letter, you could use

Code:
author_sort:="~^[M-Z]
The tilde at the start of the search string indicates that it is a regular expression search.

Last edited by isarl; 02-21-2023 at 03:41 PM.
isarl is offline   Reply With Quote
Old 02-21-2023, 03:41 PM   #23
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 46,327
Karma: 169098492
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by Phssthpok View Post
The only thing I'm missing now is a way to go to "authors beginning with M" in the author list, and the search doesn't seem to help much for that. Oh well.
Years back, I seem to remember one person who created collections based on the first letter of the primary author's last name. So a collection called M would have any author with that last name in it.
DNSB is offline   Reply With Quote
Old 02-21-2023, 04:28 PM   #24
Lys
Groupie
Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.
 
Posts: 166
Karma: 727278
Join Date: Dec 2022
Location: Not in an English speaking country
Device: (Too many) Kobo(s)
Quote:
Originally Posted by DNSB View Post
Years back, I seem to remember one person who created collections based on the first letter of the primary author's last name. So a collection called M would have any author with that last name in it.
I think it was @chaley, because I'm pretty sure I ran in his & davidfor examples and discussion on how to use the template functions to create collections.

Indeed, I remember correctly: https://www.mobileread.com/forums/sh...d.php?t=347056
https://www.mobileread.com/forums/sh...d.php?t=346321
Lys is offline   Reply With Quote
Old 02-21-2023, 05:18 PM   #25
isarl
Addict
isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.
 
Posts: 287
Karma: 2534928
Join Date: Nov 2022
Location: Canada
Device: Kobo Aura 2
Quote:
Originally Posted by Lys View Post
I think it was @chaley, because I'm pretty sure I ran in his & davidfor examples and discussion on how to use the template functions to create collections.

Indeed, I remember correctly: https://www.mobileread.com/forums/sh...d.php?t=347056
https://www.mobileread.com/forums/sh...d.php?t=346321
At a quick glance, the examples in these threads are trying to do a bit of extra stuff and so the author abbreviation gets lost in a bit of noise. Here's a template I just came up with which seems to work:

Code:
program:
  result = '';
  for a in 'author_sort' separator '&':
    result = list_join(', ', result, ',', substr(a, 0, 1), ',')
  rof
The for loop's value is the value of the last top expression in it, which for an assignment is the assigned value, in this case the final value of result. This will not return a value with a spurious comma at the end of the list, which I was getting when trying something similar using strcat().
isarl is offline   Reply With Quote
Old 02-22-2023, 06:54 AM   #26
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 577
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by isarl View Post
For “authors beginning with M”, I'm not sure whether you're talking about in Calibre or on the Kobo.
The Kobo -- I know how to do it on Calibre. But I have about 800 authors, and paging through them is a pain if I can't remember the exact name. I suppose I can look the name up on Calibre (if I'm next to my computer) and then use the Kobo search. Can't expect the Kobo to do everythng, I suppose (unlike Calibre, which already does do everything!).
Phssthpok is offline   Reply With Quote
Old 02-22-2023, 07:07 AM   #27
isarl
Addict
isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.
 
Posts: 287
Karma: 2534928
Join Date: Nov 2022
Location: Canada
Device: Kobo Aura 2
Quote:
Originally Posted by Phssthpok View Post
The Kobo -- I know how to do it on Calibre. But I have about 800 authors, and paging through them is a pain if I can't remember the exact name. I suppose I can look the name up on Calibre (if I'm next to my computer) and then use the Kobo search. Can't expect the Kobo to do everythng, I suppose (unlike Calibre, which already does do everything!).
Try the template I shared in my most recent comment in the thread before this one. The KoboTouch drivers have a field where you can supply a template to calculate collections.
isarl is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Plugboard usage for Kobo device: Authors DrChiper Library Management 14 09-29-2022 11:12 AM
Plugboard for series info for Kobo? sweth Devices 2 04-27-2018 02:25 AM
Metadata Plugboard Plugin and Kobo darryl Plugins 14 04-25-2015 10:18 AM
Kobo Aura Calibre plugboard question Calibrefan Kobo Reader 5 07-06-2014 11:34 AM
metadata plugboard not doing anything on kobo touch SonjaD Library Management 2 07-13-2013 11:10 AM


All times are GMT -4. The time now is 03:48 AM.


MobileRead.com is a privately owned, operated and funded community.