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 10-20-2021, 12:16 AM   #916
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,545
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
For those who read fanfics on a Kobo, here's something you can put in a composite column to show how many chapters you've read of a fic as of the last time you connected the device. Note that this relies on using Kobo Utilities and FanFicFare; read the comments for more details.

Click image for larger version

Name:	2021-10-20 01_48_45-Window.png
Views:	223
Size:	5.3 KB
ID:	189720

Code:
program:
# 'Current reading location' stored by Kobo Utilities. 
input = $#kobobookmark;
# These last three are saved by FanFicFare. 
fandom = $#fanficcat;
status = $#fanficstatus;
ccount = $$#chaptercount;

	if 
		fandom
	then

		if	
# Note that this is FanFicFare's file structure. If you download with a different tool, it may not work.	
				substr(input, 0, 10) == 'OEBPS/file'
			&& 	
# Anthologies have a different file structure, so we should ignore those.
				!status inlist 'Anthology'
		then		
# Since I pause at the beginning of chapters, I subtract by one. 
			strcat(format_number(re(input, '.*\/file(\d+).*', '\1') - 1, '{0:,d}'), '/',ccount)
		else
# Showing a regular chapter count for everything else.
			ccount
		fi
	fi
Thanks to those who helped me figure this out a while back.

Last edited by ownedbycats; 10-20-2021 at 12:58 AM.
ownedbycats is online now   Reply With Quote
Old 02-03-2022, 05:47 PM   #917
qqukdbx
Junior Member
qqukdbx began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Feb 2022
Device: Kindle2 (KB)
Explain me the plugboard

Hi, is there any regex guru who can help me to understand plugboard template "Show author name as Initial and Surname (Kindle) (inspired by brewjono)"? Im afraid i dont fully understand the syntax:
Code:
{author_sort:re(\, (.).*?( &|$),\, \1\2)}
When input from author_sort is for example "Goyal, Kovid" regex above produces "K Goyal".
How the regex matches the string and how replaces the field?
qqukdbx is offline   Reply With Quote
Advert
Old 02-03-2022, 06:10 PM   #918
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,733
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by qqukdbx View Post
Hi, is there any regex guru who can help me to understand plugboard template "Show author name as Initial and Surname (Kindle) (inspired by brewjono)"? Im afraid i dont fully understand the syntax:
Code:
{author_sort:re(\, (.).*?( &|$),\, \1\2)}
When input from author_sort is for example "Goyal, Kovid" regex above produces "K Goyal".
How the regex matches the string and how replaces the field?
As shown by the attached screenshot, it doesn't produce "K Goyal" but instead produces "Goyal, K", which is what I would expect from the regex.

Where are you seeing the result you say you get? If it is on a device then the device is changing it. Nothing the plugboard can do about that. Workarounds might be available but you should ask in the devices forum, naming your device.
Attached Thumbnails
Click image for larger version

Name:	Clipboard01.jpg
Views:	168
Size:	44.9 KB
ID:	192103  
chaley is offline   Reply With Quote
Old 02-19-2022, 02:59 PM   #919
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: 720
Karma: 228142
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
Hello people
I have this configuration to save to disk.
{title} ({#id}) - {authors}
But the ID comes out with decimals, how could I fix it so that it is a whole number
example:
Title (10017301.0) - author.epub
dunhill is offline   Reply With Quote
Old 02-19-2022, 03:16 PM   #920
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,733
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by dunhill View Post
Hello people
I have this configuration to save to disk.
{title} ({#id}) - {authors}
But the ID comes out with decimals, how could I fix it so that it is a whole number
example:
Title (10017301.0) - author.epub
What kind of column is #id? If it is a "column built from other columns" then what is its template?

My guess is that {title} ({id}) - {authors} will work.
chaley is offline   Reply With Quote
Advert
Old 02-19-2022, 03:24 PM   #921
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: 720
Karma: 228142
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
Quote:
Originally Posted by chaley View Post
What kind of column is #id? If it is a "column built from other columns" then what is its template?

My guess is that {title} ({id}) - {authors} will work.
It is a custom column, because the id is a personal number, not a calibre number.
For that reason #



My mistake, for not seeing.
Sorry
Attached Thumbnails
Click image for larger version

Name:	1.png
Views:	179
Size:	29.3 KB
ID:	192380  

Last edited by dunhill; 02-19-2022 at 03:33 PM.
dunhill is offline   Reply With Quote
Old 02-19-2022, 03:32 PM   #922
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,733
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by dunhill View Post
It is a custom column, because the id is a personal number, not a calibre number.
For that reason #
It is probably a float-type column, which is why it has the decimal point. It seems that it should be an int-type column.
chaley is offline   Reply With Quote
Old 02-19-2022, 04:30 PM   #923
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,733
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by dunhill View Post
Hello people
I have this configuration to save to disk.
{title} ({#id}) - {authors}
But the ID comes out with decimals, how could I fix it so that it is a whole number
Try
Code:
{title} ({#id:15.15g}) - {authors}
The 15 is arbitrary. It must be larger than the maximum number of digits in any #id.
chaley is offline   Reply With Quote
Old 02-19-2022, 09:24 PM   #924
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: 720
Karma: 228142
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
Quote:
Originally Posted by chaley View Post
Try
Code:
{title} ({#id:15.15g}) - {authors}
The 15 is arbitrary. It must be larger than the maximum number of digits in any #id.
Great !! Now it works, thank you very much
dunhill is offline   Reply With Quote
Old 02-20-2022, 01:51 PM   #925
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: 720
Karma: 228142
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
I have a question about the id.
Let's suppose that I have an id that by order is added 100000000
Example:
Original id 043579 + added 100043579
Question by means of a disk saving template could I get back the original id or a personal column by means of program: ?
Example:
id 100043579 - added 100000000 = id Original 043579

Last edited by dunhill; 02-20-2022 at 01:54 PM.
dunhill is offline   Reply With Quote
Old 02-20-2022, 03:45 PM   #926
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,733
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by dunhill View Post
I have a question about the id.
Let's suppose that I have an id that by order is added 100000000
Example:
Original id 043579 + added 100043579
Question by means of a disk saving template could I get back the original id or a personal column by means of program: ?
Example:
id 100043579 - added 100000000 = id Original 043579
Do you mean something like
Code:
program: $#id - 100000000
?

I suggest you look at the template language documentation.
chaley is offline   Reply With Quote
Old 02-20-2022, 04:26 PM   #927
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: 720
Karma: 228142
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
Quote:
Originally Posted by chaley View Post
Do you mean something like
Code:
program: $#id - 100000000
?

I suggest you look at the template language documentation.
If something like that!
Thanks because I was thinking about it with this post and it was simpler
https://www.mobileread.com/forums/sh...17&postcount=8


Well not everything can be perfect.
First of all I must say that I lack command of pyton, how could you add conditionals.
Example:
what remains if the number is between 10000000 and 10999999 only
Attached Thumbnails
Click image for larger version

Name:	1.png
Views:	124
Size:	8.2 KB
ID:	192406  

Last edited by dunhill; 02-20-2022 at 06:33 PM.
dunhill is offline   Reply With Quote
Old 02-21-2022, 10:33 AM   #928
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,545
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Something like this should work.

Code:
program:
## obviously replace $#yournum with your column
	if 
			$#yournum>=#10000000
		&& 
			$#yournum<=#10999999
	then
## using 'round' to fix the float/decimal output I got in my test
		round(subtract($#yournum, 100000000))

	else
		$#yournum

	fi
You'll want the "else $#yournum" or it will give you a blank for those instances.

Last edited by ownedbycats; 02-21-2022 at 10:35 AM.
ownedbycats is online now   Reply With Quote
Old 02-21-2022, 05:06 PM   #929
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: 720
Karma: 228142
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
Quote:
Originally Posted by ownedbycats View Post
Something like this should work.

Code:
program:
## obviously replace $#yournum with your column
	if 
			$#yournum>=#10000000
		&& 
			$#yournum<=#10999999
	then
## using 'round' to fix the float/decimal output I got in my test
		round(subtract($#yournum, 100000000))

	else
		$#yournum

	fi
You'll want the "else $#yournum" or it will give you a blank for those instances.

Thank you very much, that solves the problem
dunhill is offline   Reply With Quote
Old 03-16-2022, 08:30 AM   #930
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,545
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I use this as a stored template, readstatus().

Note that #percentread is integer and #readinglist is series-like managed with the Reading List plugin.

Code:
program:

	if $$#percentread >=#1 && $$#percentread <=#99
	then 'currentlyreading' 

	elif "To Be Read" in $#readinglist && $$#percentread ==#0
	then 'toberead' 

	elif $$#percentread >=#100
	then 'read' 

	elif $$#percentread == 'None'
	then 'undefined' 

	elif $$#percentread >=#0
	then 'unread' 

	fi
This allows the user to use readstatus() == 'currentlyreading' or '(unread|toberead)' in readstatus() in templates rather than checking the columns directly.

It would probably also work as a composite column.

Last edited by ownedbycats; 03-16-2022 at 10:18 AM.
ownedbycats 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 01:36 PM.


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