![]() |
#976 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,268
Karma: 7955525
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
If I understand the question, you want to rename books already on the device by changing the template. This isn't possible with calibre. You must manually delete the old copy then send the new one. Annotations and similar associated information will probably be lost.
|
![]() |
![]() |
![]() |
#977 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 179
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
I would like to automatically add books from a specific publisher to a Kobo collection, but only for certain publishers, not all. So I am trying to make a plugboard rule that says "if publisher is X then add book to collection Y" (and if publisher is not X then do nothing). I have made a custom column for the Kobo collections which is called #kobo. I have been looking in the user manual and I think this is possible using advanced formatting, based on the example given for series, but I cannot figure out how to do it...
Any help much appreciated (including confirmation it is not actually possible, so I can stop trying to figure out how. ![]() |
![]() |
![]() |
Advert | |
|
![]() |
#978 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,268
Karma: 7955525
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
The right approach is to use a custom "column built from other columns" where the template computes the collection name. You don't say whether the collection value is a constant, the name of the publisher, or something else. If it is the name of the publisher then a template like this could work: Code:
program: str_in_list('Baen, Daw, Orbit, Tom Doherty Associates', ',', $publisher, $publisher, '') Last edited by chaley; 05-03-2024 at 02:17 PM. |
|
![]() |
![]() |
![]() |
#979 | ||
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 179
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
![]() Quote:
If it's easiest, I could use the publisher name for the collection and change the books I have marked manually, but I would like to keep the collections I already was using if I can. One publisher name is "BEL Editions" and the collection name is "BEL", and another one is "Bibebook" and the collection is "dp". Would the template look like this? Code:
program: str_in_list('BEL Editions, Bibebook', ',', $BEL, $dp, '') Code:
program: str_in_list('BEL Editions', ',', $BEL, '') str_in_list('Bibebook', ',', $dp, '') |
||
![]() |
![]() |
![]() |
#980 | ||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,268
Karma: 7955525
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
Code:
program: switch_if( $publisher == 'BEL Editions', 'BEL', $publisher == 'Bibebook', 'dp', $publisher == 'Baen', 'Baen', $publisher == 'Tom Doherty Associates', 'TOR', '')
|
||
![]() |
![]() |
Advert | |
|
![]() |
#981 | |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 179
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#982 |
Member
![]() Posts: 14
Karma: 10
Join Date: Apr 2022
Location: Missouri, USA
Device: Kobo Sage & Kindle Paperwhite 4
|
I currently have the Kobo driver set up so anything in the default "tags" column becomes a collection which works fine for the most part but my Kobo takes like 2 minutes to load the Collections page cause I have 5000+ tags (I know, I need to go through and fix things)
I was wondering if there was anyway to use a template to read the item count of the tags so it would only create a collection if a tag has been used like at least ~5+ times and ignore tags below that, that should eliminate a good chunk of the 5000+ and keep the most important ones. |
![]() |
![]() |
![]() |
#983 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,268
Karma: 7955525
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Pontificating aside, one can do what you want with a template-language template but with 5,000 tags it would be excruciatingly slow. This python template doesn't have that problem. Code:
python: def evaluate(book, context): field = 'tags' # Get the previously computed set of acceptable items, if it exists all_names_over_count = context.globals.get('all_names_over_count') if all_names_over_count is None: db = context.db.new_api all_names_over_count = set() counts_by_item = db.get_usage_count_by_id(field) for item,count in counts_by_item.items(): if count > 5: all_names_over_count.add(db.get_item_name(field, item)) context.globals['all_names_over_count'] = all_names_over_count # Check if the current book has any of the acceptable items item_names_in_book = [] for name in book.get(field): if name in all_names_over_count: item_names_in_book.append(name) return ':@:'.join(item_names_in_book) |
|
![]() |
![]() |
![]() |
#984 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,771
Karma: 59473090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Everything Chaley said
![]() Searching on either term will find members. No need for alternate tags (like in that old card file) You need a PLAN, then fix what you have. Standardize tags. Many of the variation were holdover mentality fro days past where there was a card catalog in the room. ![]() ![]() ![]() AFAIK this does NOT affect downloaded metadata <hint hint: option to use ![]() Another Fix I do is reset Plurals to a singular (Detectives -> Detective ). I also separate double groups: Science Fiction & Fantasy becomes Science Fiction, Fantasy (or I drop the one Manually when it does not really apply ) Even with all this, I have way too many tags ![]() ![]() |
![]() |
![]() |
![]() |
#985 |
Member
![]() Posts: 14
Karma: 10
Join Date: Apr 2022
Location: Missouri, USA
Device: Kobo Sage & Kindle Paperwhite 4
|
I know having "proper" tags would be better but this is basically just a stop gap to actually have a usable Kobo until I can get time to go through all like 3000+ books I have
![]() Sites I download with that plugin have a lot of crazy tags that are super niche and might only be on one single book in my library but they also often have tags that are more common appearing on many books and often said tags might imply the same thing the rare niche tag did (just more generalized). And then of course, there's the authors that use tags basically for an author note with tags that are like a whole sentence long and I definitely don't need at all. Hence why I figured "only making collections for tags with over X stories" would help out a ton since it would basically eliminate like 80% of the collections yet books would most likely still appear in a similar collection meaning the same thing. Last edited by BrandonGiesing; 05-07-2024 at 04:32 PM. |
![]() |
![]() |
![]() |
#986 | ||
Member
![]() Posts: 14
Karma: 10
Join Date: Apr 2022
Location: Missouri, USA
Device: Kobo Sage & Kindle Paperwhite 4
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#987 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,268
Karma: 7955525
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Use this:
Code:
python: def evaluate(book, context): field = 'tags' # Get the previously computed set of acceptable items, if it exists all_names_over_count = context.globals.get('all_names_over_count') if all_names_over_count is None: from calibre.gui2.ui import get_gui db = get_gui().current_db.new_api all_names_over_count = set() counts_by_item = db.get_usage_count_by_id(field) for item,count in counts_by_item.items(): if count > 5: all_names_over_count.add(db.get_item_name(field, item)) context.globals['all_names_over_count'] = all_names_over_count # Check if the current book has any of the acceptable items item_names_in_book = [] for name in book.get(field): if name in all_names_over_count: item_names_in_book.append(name) return ':@:'.join(item_names_in_book) |
![]() |
![]() |
![]() |
#988 |
Member
![]() Posts: 14
Karma: 10
Join Date: Apr 2022
Location: Missouri, USA
Device: Kobo Sage & Kindle Paperwhite 4
|
Yep that worked, had to manually edit the Database first though with a SQLite editor to remove all the old entries (Couldn't find any other way to delete all existing collections since Calibre seems to only remove empty ones when you delete books off your device)
Once I did that though, it worked just fine, only tags with 5+ books now have a collection and my device no longer hangs for like 2 minutes loading the collections page. Still takes a solid ~20 seconds but WAY better than before. Should be useable enough while I work to trim down my tags in the meantime. |
![]() |
![]() |
![]() |
#989 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,771
Karma: 59473090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
You can Manage the collections column: the (multi)select the collection name: click the delete icon
|
![]() |
![]() |
![]() |
#990 | |
Member
![]() Posts: 14
Karma: 10
Join Date: Apr 2022
Location: Missouri, USA
Device: Kobo Sage & Kindle Paperwhite 4
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
Tags |
custom column, tag, tags |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
custom column i need a little help | shinken | Calibre | 3 | 09-15-2010 03:41 AM |
Using Custom Metadata in Save Template | EJvdH | Calibre | 1 | 07-02-2010 06:06 AM |
Accessories Decalgirl Kindle 2 custom skin template | srmalloy | Amazon Kindle | 6 | 04-09-2010 09:55 PM |
Donations for Custom Recipes | ddavtian | Calibre | 5 | 01-23-2010 04:54 PM |
Help understanding custom recipes | andersent | Calibre | 0 | 12-17-2009 02:37 PM |