Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 11-06-2020, 05:10 PM   #901
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,993
Karma: 62040409
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Thank you!
ownedbycats is offline   Reply With Quote
Old 12-12-2020, 05:09 PM   #902
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,993
Karma: 62040409
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Question: I'm converting my fanfic column icon rules to a single advanced rule.

Code:
program: 
   f = field('#fanficcat');
   strcat
   (
    contains(f, "Dragon Age: Origins", 'dragonageorigins.png', ''), 
    contains(f, "Half-Life", 'halflife.png', ''), 
    contains(f, "Mass Effect", 'masseffect.png', ''), 
    contains(f, "The Elder Scrolls", 'theelderscrolls.png', ''), 
    contains(f, "Pokémon", 'pokemon.png', ''), 
    contains(f, "Portal", 'portal.png', ''), 
   )
It works except for when there's multiple values (#fanficcat is a tag-like). Clicking on one of the crossovers in the book list and opening the template editor shows "masseffect.pngpokemon.png".

What should I do?

Last edited by ownedbycats; 12-12-2020 at 05:42 PM.
ownedbycats is offline   Reply With Quote
Advert
Old 12-12-2020, 05:56 PM   #903
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,993
Karma: 62040409
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Adding a colon to the end of each filename (e.g. halflife.png:) worked. I'm not sure if that's the proper solution though.
ownedbycats is offline   Reply With Quote
Old 12-12-2020, 06:30 PM   #904
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,857
Karma: 7036057
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Adding a colon to the end of each filename (e.g. halflife.png:) worked. I'm not sure if that's the proper solution though.
It is correct if you want multiple icons per rule. The colon is used to separate multiple icons for a rule. If you want only one icon then use first_non_empty to pick the first 'contains' that returns a value.

That said, checking the code I note that an empty icon file name, as in your example, isn't handled very efficiently. I will fix that.
chaley is offline   Reply With Quote
Old 12-13-2020, 02:41 PM   #905
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,993
Karma: 62040409
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by chaley View Post
It is correct if you want multiple icons per rule. The colon is used to separate multiple icons for a rule. If you want only one icon then use first_non_empty to pick the first 'contains' that returns a value.

That said, checking the code I note that an empty icon file name, as in your example, isn't handled very efficiently. I will fix that.
Yes, I wanted multiple icons per column.
ownedbycats is offline   Reply With Quote
Advert
Old 01-16-2021, 08:45 PM   #906
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,993
Karma: 62040409
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
For fanfiction readers who read on Kobo:

If you have FanFicFare set up with both a Fandom and Status column (or just do it manually), putting this into the Subtitle template (Customize KoboTouchExtended > Metadata, on device & advanced tab) will display the info as a subtitle on Kobo.

Code:
program:
	if field('#yourfandomcolumn') then
		template('{#yourfandomcolumn} | {#yourstatuscolumn}')
	fi
If there's multiple entries in a taglike Fandom column, this will just display the first one (thanks chaley!):

Code:
program:
	if field('#yourfandomcolumn') then
		template('{#yourfandomcolumn:sublist(0,1,\,)} | {#yourstatuscolumn}')
	fi

Last edited by ownedbycats; 01-16-2021 at 09:03 PM.
ownedbycats is offline   Reply With Quote
Old 04-04-2021, 04:50 AM   #907
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,993
Karma: 62040409
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
If you have columns for them, putting this in the template tester will let you see the average number of pages per chapter.

Code:
program:
	chapters = $$#chaptercount;
	pages = $$#pagecount;

	if chapters>#0 then divide(pages, chapters)
	fi
ownedbycats is offline   Reply With Quote
Old 07-26-2021, 05:12 PM   #908
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 741
Karma: 308700
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
Hi, someone still uses the thread settings
https://www.mobileread.com/forums/sh...&postcount=137
https://www.mobileread.com/forums/sh...&postcount=172
Rereading the previous post you will find beautiful jewels but for some reason they have stopped working.
I leave you a screenshot, in case the one who made the mistake is the one between the chair and the keyboard.
Thank you very much as always.
Attached Thumbnails
Click image for larger version

Name:	1.png
Views:	312
Size:	400.7 KB
ID:	188356   Click image for larger version

Name:	2.png
Views:	288
Size:	84.5 KB
ID:	188357   Click image for larger version

Name:	3.png
Views:	274
Size:	45.7 KB
ID:	188358  
dunhill is offline   Reply With Quote
Old 07-26-2021, 05:20 PM   #909
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,857
Karma: 7036057
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by dunhill View Post
Hi, someone still uses the thread settings
https://www.mobileread.com/forums/sh...&postcount=137
https://www.mobileread.com/forums/sh...&postcount=172
Rereading the previous post you will find beautiful jewels but for some reason they have stopped working.
I leave you a screenshot, in case the one who made the mistake is the one between the chair and the keyboard.
Thank you very much as always.
The function in the first post has 4 arguments. The function in the second post has 5 arguments. It appears that you are using the function in the second post (5 arguments) with the "number of arguments" from the first post (4 arguments).

Try following the instructions *exactly* from one or the other of the posts, including setting the number of arguments box to the correct value.
chaley is offline   Reply With Quote
Old 07-27-2021, 05:24 PM   #910
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 741
Karma: 308700
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
Quote:
Originally Posted by chaley View Post
The function in the first post has 4 arguments. The function in the second post has 5 arguments. It appears that you are using the function in the second post (5 arguments) with the "number of arguments" from the first post (4 arguments).

Try following the instructions *exactly* from one or the other of the posts, including setting the number of arguments box to the correct value.
Thank you very much, I had not realized, as the second link was a modification of the first. That is where I went wrong.
dunhill is offline   Reply With Quote
Old 08-31-2021, 05:31 PM   #911
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 741
Karma: 308700
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
Quote:
Originally Posted by dcmarquardt View Post
I just wanted to share this here because I spent the last few hours trying to narrow down how to accomplish this...

Background: I recently converted my entire audiobook (multi-mp3 per book) collection into M4B's so that I could manage them with calibre following the "One File Per Book" pattern. (If anyone is interested in a decent way to batch-process that, feel free to PM me)... Once I loaded all of my M4B files into calibre, fixed up all the metadata, etc... it occurred to me that I would create a virtual library called "Audiobooks"... The search expression I used for that is: format:M4B. Easy enough. Now, some of the newly loaded audiobooks that I have, also have various e-book formats (epub, pdf, etc...) that I added to their calibre records for convenience.

Problem: I have a virtual library that shows me all of my audiobooks... that's great, but what if I'm browsing through them and want a specific one to read on my tablet? So I decided to add a custom column that would be called "Audio Only"... basically if the book has only a single format, and that format is equal to "M4B" in my case, then it would show yes, otherwise if there were additional formats available it would show no... or a check/x-mark as it ended up. I'm a software dev, so writing some code isn't anything new, but I was surprised that I couldn't find something out here already to have a simple if... this and this are true ... then 'yes' else 'no' ...

Solution:
I created a custom column template that displays a green check if the book is "Audio Only", and a red X if it has non-audio formats attached to it. Here's how:

Preferences -> Add your own columns -> Add

Lookup Name: onlyaudio
Column Heading: Audio Only
Column Type: Column built from other columns
Show checkmarks: Checked
Template:
Code:
program:cmp(count(template('[[format]]'), ','), 1, 'no', in_list(template('[[format]]'), ',', 'M4B', 'yes', 'no'), 'no')

---

This can be adapted to give you a yes/no column if the book contains only one specific format and no others... just paste that in there and replace the M4B with whatever format you want to single out... if it is the ONLY one present, the column will have a value of yes, otherwise no... you can swap those around as needed also to gain the desired result.

One possible improvement I may work on is in the event I someday store more than a single audio format inside calibre, in which case I would need to go through all of the formats and check them... at that point it becomes more complex because I could potentially have >1 formats but have them all be audio... I'll leave that one for another day.


It is possible that the template could recognize more than one format ?

program:cmp(count(template('[[format]]'), ','), 1, 'no', in_list(template('[[format]]'), ',', 'Ogg', 'Si', 'no', ',', 'M3u', 'Si', 'no', ',', 'M4a', 'Si', 'no', ',', 'Mp3', 'Si', 'no'), 'no')

Last edited by dunhill; 08-31-2021 at 06:39 PM.
dunhill is offline   Reply With Quote
Old 08-31-2021, 06:00 PM   #912
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,128
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by dunhill View Post
It is possible that the template could recognize more than one format ?
Code:
program:
	my_formats = 'm4b,epub,fb2';
	if list_intersection(lowercase($formats), my_formats, ',') then
		'yes'
	else
		'no'
	fi
capink is offline   Reply With Quote
Old 08-31-2021, 08:41 PM   #913
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 741
Karma: 308700
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
Quote:
Originally Posted by capink View Post
Code:
program:
	my_formats = 'm4b,epub,fb2';
	if list_intersection(lowercase($formats), my_formats, ',') then
		'yes'
	else
		'no'
	fi

Thank you. Otherwise my syntax was going to be eternal
dunhill is offline   Reply With Quote
Old 10-16-2021, 04:03 PM   #914
buffygurl
Junior Member
buffygurl began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Dec 2017
Device: android tablet
where is this quoted from. I have been trying to use calibre for audio forever!! I finally went and tried alpa.
anyway I'm constantly lurking here to see if i can come back.
Can you point me to the original post. This is probably above my tech level, but i can get by sometimes with complete concise directions. Plus this will be a clean install so i wont be so afraid of wrecking my library
I do have about 10500 audiobooks. Is this doable?
buffygurl is offline   Reply With Quote
Old 10-16-2021, 05:41 PM   #915
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,770
Karma: 27405072
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Find More Posts by buffygurl
BetterRed is online now   Reply With Quote
Reply

Tags
custom column, tag, tags

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 05:50 AM.


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