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 02-15-2022, 01:35 PM   #346
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,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Could it have been possible there were, via some glitch, two versions of the stored template temporarily in memory? I checked and saw there was only one icons_fanfic(), but restarting Calibre fixed the error.
Yes, it is possible. The compiled templates functions are kept in a few places such as in the db layer, in the template processor, and in action chains. It could be that one of these isn't being notified when the functions change.
chaley is offline   Reply With Quote
Old 02-17-2022, 11:35 AM   #347
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,039
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quick question: I'm having issues with the placement of a fi:

Code:
program:
vl = current_virtual_library_name();

	if 'OVERDRIVE' inlist approximate_formats() && vl!='Loans' then 'overdrive.png'
	elif 'PAPERBOOK' inlist approximate_formats() && vl!='Physical Books' then 'book.png'

	elif '^(|Read|Unread|Currently Reading|On Device|Cleanup)$' in vl then
		if $#manualtype then 'helpbook.png'	
		elif $#fanficcat then icons_fanfic() 
		else 'view.png'	
		fi

	fi
In this one, 'view.png' only appears when the current VL is All Books|Read|Unread|Currently Reading|On Device|Cleanup.

Code:
program:
vl = current_virtual_library_name();

	if 'OVERDRIVE' inlist approximate_formats() && vl!='Loans' then 'overdrive.png'
	elif 'PAPERBOOK' inlist approximate_formats() && vl!='Physical Books' then 'book.png'

	elif '^(|Read|Unread|Currently Reading|On Device|Cleanup)$' in vl then
		if $#manualtype then 'helpbook.png'	
		elif $#fanficcat then icons_fanfic() 
		fi

	else 'view.png'	

	fi
With this, view.png doesn't appear when the current VL is All Books|Read|Unread|Currently Reading|On Device|Cleanup -- I think the fi after icons_fanfic() is making the template stop processing?

If I want view.png to appear on any book that doesn't match the other checks on any VL, where should I put it?

Last edited by ownedbycats; 02-17-2022 at 11:49 AM.
ownedbycats is online now   Reply With Quote
Old 02-17-2022, 12:11 PM   #348
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,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post

If I want view.png to appear on any book that doesn't match the other checks on any VL, where should I put it?
This appears to be the same problem we discussed in posts 336/337. The same solution should work

Last edited by chaley; 02-17-2022 at 12:46 PM.
chaley is offline   Reply With Quote
Old 02-19-2022, 11:56 AM   #349
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,039
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Thanks.

When using Action Chains to populate an enumerated column, should it be treated the same as other columns? I'm not sure what would happen if you tried to add a value that didn't exist in the permissible values list.
ownedbycats is online now   Reply With Quote
Old 02-19-2022, 12:43 PM   #350
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,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
When using Action Chains to populate an enumerated column, should it be treated the same as other columns?
What does "treated the same as other columns" mean?
Quote:
I'm not sure what would happen if you tried to add a value that didn't exist in the permissible values list.
An attempt to set a non-permitted value is ignored. The column doesn't change. No error is signaled.
chaley is offline   Reply With Quote
Old 02-19-2022, 01:09 PM   #351
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,039
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Basically, just inputting values the same as you would with a regular text column.
ownedbycats is online now   Reply With Quote
Old 02-19-2022, 01:16 PM   #352
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,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Basically, just inputting values the same as you would with a regular text column.
Then yes. These columns are internally equivalent to "Text, column shown in the Tag browser" where a book can hold a single value. As I said above, assignment of a value that is not in the list of permitted values is ignored. It is up to you to ensure the value you assign is permitted.
chaley is offline   Reply With Quote
Old 03-05-2022, 08:22 PM   #353
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,039
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quick question:

Code:
program: if $something then 'Yes' fi
Code:
program: if $something then 'Yes' else 'No' fi
Is there any difference in performance of returning 'No' for yes/no sorting?
ownedbycats is online now   Reply With Quote
Old 03-06-2022, 04:14 AM   #354
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,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Quick question:

Code:
program: if $something then 'Yes' fi
Code:
program: if $something then 'Yes' else 'No' fi
Is there any difference in performance of returning 'No' for yes/no sorting?
Returning 'No' is perhaps a microsecond per book slower when the template is processed, which is once per book when sorting. 'No' vs the empty string should make no difference at all.
chaley is offline   Reply With Quote
Old 03-19-2022, 05:08 PM   #355
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,039
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Question:

I have two timedate columns with a difference of less than an hour.* If I put the raw input into a days_between, depending on what order I either get 0.0 or -0.0.

Is the negative intended or a bug? There's something called a signed zero but I don't quite understand what it means.

I tried multiplying to see what would happen but still got -0.0.

* 2022-03-19 02:03:12+00:00 and 2022-03-19 03:00:00+00:00 exactly.

Last edited by ownedbycats; 03-19-2022 at 05:17 PM.
ownedbycats is online now   Reply With Quote
Old 03-19-2022, 05:34 PM   #356
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,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Question:

I have two timedate columns with a difference of less than an hour.* If I put the raw input into a days_between, depending on what order I either get 0.0 or -0.0.

Is the negative intended or a bug? There's something called a signed zero but I don't quite understand what it means.

I tried multiplying to see what would happen but still got -0.0.

* 2022-03-19 02:03:12+00:00 and 2022-03-19 03:00:00+00:00 exactly.
It means that there are digits you aren't seeing. It is formatted with 1 decimal place, the 10ths column. The full result will have a value in the 100ths or maybe even the 1000ths column. Thus the answer is less than zero.

If you don't like it, use round(), floor(), or ceiling(). Or convert the dates to timestamps, do the arithmetic, divide the result by 86,400 to get the fractional days, then format it with whatever precision you want.
chaley is offline   Reply With Quote
Old 03-19-2022, 05:43 PM   #357
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,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Question:

I have two timedate columns with a difference of less than an hour.* If I put the raw input into a days_between, depending on what order I either get 0.0 or -0.0.

Is the negative intended or a bug? There's something called a signed zero but I don't quite understand what it means.

I tried multiplying to see what would happen but still got -0.0.

* 2022-03-19 02:03:12+00:00 and 2022-03-19 03:00:00+00:00 exactly.
For fun try the template
Code:
program: format_number((-0.001), '.1f')
You will see the negative 0. It is what python does.

You can see it without the formatter as the intermediary using the python command line interpreter.
Code:
>>> '%.1f'%(0.01)
'0.0'
>>> '%.1f'%(-0.01)
'-0.0'
>>> '%.1f'%(-0.01/10)
'-0.0'
>>> '%.3f'%(-0.01/10)
'-0.001'
chaley is offline   Reply With Quote
Old 03-19-2022, 07:03 PM   #358
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,039
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I found this: https://en.wikipedia.org/wiki/IEEE_754

Quote:
Moreover, there are two zero values, called signed zeros: the sign bit specifies whether a zero is +0 (positive zero) or −0 (negative zero).
That makes more sense than the other thing I tried to read on signed zeros
ownedbycats is online now   Reply With Quote
Old 03-20-2022, 06:29 AM   #359
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,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
I found this: https://en.wikipedia.org/wiki/IEEE_754



That makes more sense than the other thing I tried to read on signed zeros
This might be helpful: Negative Binary Numbers. Two of the three representations, sign-and-magnitude and ones-complement, can represent negative zero. Twos-complement, the most common, cannot represent negative zero.

The above discussion leaves out the complexity of floating point numbers that usually have three separate components: a sign, a "value", and an "exponent". Because (usually) the sign is separate from the number is it similar to sign-and-magnitude representation. See https://floating-point-gui.de/formats/fp/ for more explanation.
chaley is offline   Reply With Quote
Old 03-26-2022, 12:17 PM   #360
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,039
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Question: What would be the best way to take an integer (say, from days_between) and then turn that into "x years, x months, x days"?

I started trying to make a template using fractional_part and I think multiply but it didn't come out right.
ownedbycats is online now   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 06:54 PM.


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