Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 03-30-2023, 04:07 PM   #541
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: 12,453
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Question: Rarely when updating a saved template, I get an error about it being duplicated when using it elsewhere. This disappears upon restart. Is this a known glitch?
Does this happen if you push the Replace button instead of the Create button?
chaley is offline   Reply With Quote
Old 03-30-2023, 04:18 PM   #542
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: 11,044
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Unless my hand slipped, I used the replace button.
ownedbycats is offline   Reply With Quote
Advert
Old 03-30-2023, 04:26 PM   #543
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: 12,453
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Unless my hand slipped, I used the replace button.
In which case I can't explain it. Next time it happens please capture the exact error message.
chaley is offline   Reply With Quote
Old 03-30-2023, 06:25 PM   #544
criscros
Fulltime reader
criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.
 
Posts: 44
Karma: 9296
Join Date: Mar 2021
Device: Kobo Clara
I have a question I can't quite figure out. I was trying to create a virtual library or a search on a % column. I can do <100 and get 99 or below, but I can't figure out how to include rows that are empty. Probably dead simple, but beyond me
Thanks!!
criscros is offline   Reply With Quote
Old 03-30-2023, 06:54 PM   #545
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: 11,044
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by criscros View Post
I have a question I can't quite figure out. I was trying to create a virtual library or a search on a % column. I can do <100 and get 99 or below, but I can't figure out how to include rows that are empty. Probably dead simple, but beyond me
Thanks!!
#intcolumn:false should work for search

$$#intcolumn== 'None' for template

I have the latter for my readstatus() template:
Spoiler:

Code:
program:

	if ($$#percentread >=#1 && $$#percentread <=#99) || ($#readinglist == 'Reference')
	then 'currentlyreading' 

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

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

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

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

	fi

Last edited by ownedbycats; 03-30-2023 at 07:00 PM.
ownedbycats is offline   Reply With Quote
Advert
Old 03-30-2023, 06:55 PM   #546
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,097
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by criscros View Post
I have a question I can't quite figure out. I was trying to create a virtual library or a search on a % column. I can do <100 and get 99 or below, but I can't figure out how to include rows that are empty. Probably dead simple, but beyond me
Thanks!!
Have you tried colname:true and colname:<100
theducks is offline   Reply With Quote
Old 03-30-2023, 06:59 PM   #547
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,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Try this search:

Code:
#percent:false or #percent:<100
replace #percent with your column name
capink is offline   Reply With Quote
Old 03-30-2023, 07:52 PM   #548
criscros
Fulltime reader
criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.criscros can eat soup with a fork.
 
Posts: 44
Karma: 9296
Join Date: Mar 2021
Device: Kobo Clara
This

#percent:false or #percent:<100

actually looks like it works. I'll have to go through to see if what I expect is there.
Thanks!
criscros is offline   Reply With Quote
Old 03-31-2023, 08:44 PM   #549
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: 11,044
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Code:
program:
	id = list_re($#admintags, ',', 'related:(\d+)', '\1');
	strcat('<a href="', 'calibre://book-details/My%20Books/',id, '">', 'Related Book','</a>')
This looks for related:x entries in #admintags, extracts x and then uses strcat to turn it into a link.

If there's multiple ids returned by the list_re how would I create a link for each one instead of calibre://book-details/My%20Books/x,y,z?

Last edited by ownedbycats; 03-31-2023 at 10:33 PM. Reason: typos
ownedbycats is offline   Reply With Quote
Old 04-01-2023, 04:21 AM   #550
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: 12,453
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Code:
program:
	id = list_re($#admintags, ',', 'related:(\d+)', '\1');
	strcat('<a href="', 'calibre://book-details/My%20Books/',id, '">', 'Related Book','</a>')
This looks for related:x entries in #admintags, extracts x and then uses strcat to turn it into a link.

If there's multiple ids returned by the list_re how would I create a link for each one instead of calibre://book-details/My%20Books/x,y,z?
Something like this, suitably altered for your columns and for the formatting you want.
Code:
program:
	ids = list_re($tags, ',', '(.*)', '\1');
	links = '';
	for id in ids:
		links = links & strcat('<a href="', 'calibre://book-details/My%20Books/',id, '">', 
					'Related Book','</a>', ', ')
	rof;
# remove the trailing comma
	substr(links, 0, -1)
chaley is offline   Reply With Quote
Old 04-01-2023, 02:54 PM   #551
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: 11,044
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
It works

Btw, what should I put for "My Books" in the url when there's a space?
ownedbycats is offline   Reply With Quote
Old 04-01-2023, 03:21 PM   #552
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 ownedbycats View Post
It works

Btw, what should I put for "My Books" in the url when there's a space?
Just guessing – but probably you can URL-encode it which for a space character would mean using “%20”.
isarl is offline   Reply With Quote
Old 04-01-2023, 03:30 PM   #553
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 ownedbycats View Post
It works

Btw, what should I put for "My Books" in the url when there's a space?
After a little more experimentation, and if you are wiling to use Python templates in Calibre, then the standard library function urllib.parse.quote() may be of use to you – here's an example Python template which uses this function to correctly encode a string in the manner I described above:

Code:
python:
def evaluate(book, context):
  import urllib.parse
  return urllib.parse.quote(book.title)
Example output:

Quote:
To%20Say%20Nothing%20of%20the%20Dog
The%20Poppy%20War
The%20Fifth%20Season
(At first I thought the Calibre template function to_hex() might be useful, but it hex-encodes the entire string, and without the “%” character. Not really what we want here.)
isarl is offline   Reply With Quote
Old 04-01-2023, 04:04 PM   #554
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: 12,453
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by isarl View Post
(At first I thought the Calibre template function to_hex() might be useful, but it hex-encodes the entire string, and without the “%” character. Not really what we want here.)
Actually, to_hex() is exactly what you want. If you use it then you don't do any url encoding.

Libraries that are hex encoded must start with '_hex_-'.

Here is an example of building a calibre:// url using the function.
Code:
program:
	lib = 'library.test_small';
	hex_lib = '_hex_-' & to_hex(lib);
	url = 'calibre://book-details/' & hex_lib & '/' & $id;
	'<a href="' & url & '">Book id ' & $id & '</a>'
It produces links that look like
Code:
calibre://book-details/_hex_-6c6962726172792e746573745f736d616c6c/1385
You can also use it for query strings. Instead of q=string, you use eq=hex-encoded-string.

All of this is documented here.
chaley is offline   Reply With Quote
Old 04-01-2023, 04:10 PM   #555
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: 11,044
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
That's useful to know
ownedbycats is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Library Management: various questions not worth their own thread ownedbycats Library Management 225 08-04-2025 06:31 PM
[Metadata Source Plugin] Questions regarding parse select, docs and ref templates Boilerplate4U Development 13 07-07-2020 02:35 AM
Questions on Kobo [Interfered with another thread topic] spdavies Kobo Reader 8 10-12-2014 11:37 AM
[OLD Thread] Some questions before buying the fire. darthreader13 Kindle Fire 7 05-10-2013 09:19 PM
Thread management questions meme Feedback 6 01-31-2011 05:07 PM


All times are GMT -4. The time now is 10:34 PM.


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