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 06-04-2021, 08:37 AM   #61
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 421
Karma: 145424
Join Date: Dec 2017
Device: Kobo
Nothing, that'll teach me not to read the whole doc
Spoiler:
Cool, but why merge the value and type into 1 element?
Wouldn't it be easier to separate them into 2 like date_arithmetic(date, value, type, fmt*)
is much more understandable, right?

EDIT: crap, I thought that as the function was not yet officially implemented, I thought we had time to "debate" it.
But the question remains.

Last edited by un_pogaz; 06-04-2021 at 08:46 AM.
un_pogaz is offline   Reply With Quote
Old 06-04-2021, 09:49 AM   #62
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,043
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by un_pogaz View Post
Nothing, that'll teach me not to read the whole doc


For completeness, the reason for the string is that you can specify several operations in one call, for example adding 3 days, 12 hours, and 30 minutes (3d12h30m).
chaley is offline   Reply With Quote
Advert
Old 06-04-2021, 10:44 AM   #63
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: 9,576
Karma: 64960983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by chaley View Post
And yes, the 'months' specifier is missing, because the number of days in a month depend on both the source date month and year. This is also why a year is fixed at 365 days.
Curious: is there any handling for leap years?
ownedbycats is offline   Reply With Quote
Old 06-04-2021, 10:51 AM   #64
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,043
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Curious: is there any handling for leap years?
Nope.
chaley is offline   Reply With Quote
Old 06-04-2021, 01:47 PM   #65
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: 9,576
Karma: 64960983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I hope it doesn't break if a date is set to February 29, 2020. I'm testing it myself but still working out how the syntax works.
ownedbycats is offline   Reply With Quote
Advert
Old 06-04-2021, 02:29 PM   #66
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,043
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
I hope it doesn't break if a date is set to February 29, 2020. I'm testing it myself but still working out how the syntax works.
It won't break if the date ends up being on 29 Feb of a leap year. For example, 28 Feb 2020 + (1 day) will produce 29 Feb 2020. The date 28 Feb 2021 + (1 day) will produce 1 Mar 2021

By not supporting leap year I mean that with the exception of years, no calculation requires knowledge of whether 29 Feb (EDIT: or any other day of the month) matters. That is why there is no "month" calculation specifier, because the calculation can change when going over a leap February (EDIT: or if the current day doesn't exist in the target month). The problem is finessed for "years" by defining a year as 365 days, which given a valid date can never generate an invalid date, but the result might be a day short.

The syntax is straightforward: pairs of (numbers followed by a letter). The order is not important. Examples:
  • -10w: subtract 10 weeks.
  • 3d-1y: add 3 days and subtract 1 year.
  • -1y3d-10w: subtract one year, add 3 days, then subtract 10 weeks.

Last edited by chaley; 06-04-2021 at 05:39 PM.
chaley is offline   Reply With Quote
Old 10-07-2021, 03:29 PM   #67
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,043
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Bug in calibre versions V5.23 - V5.28: Composite column templates that use Template Program Mode and reference other composite columns can sometimes generate list index error exceptions. Using General Program Mode instead of Template Program Mode avoids the error.

EDIT: Fixed in V5.29

Last edited by chaley; 10-08-2021 at 06:06 AM.
chaley is offline   Reply With Quote
Old 10-19-2021, 05:00 AM   #68
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,043
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Bug in calibre versions 5.13 - 5.29: the assign() function wouldn't parse. The fix will be in the next calibre release.

Thanks to David Tardon for finding and fixing this bug.
chaley is offline   Reply With Quote
Old 10-19-2021, 06:18 AM   #69
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: 9,576
Karma: 64960983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
You have a different kitty!
ownedbycats is offline   Reply With Quote
Old 10-19-2021, 06:45 AM   #70
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: 30,453
Karma: 58055868
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 ownedbycats View Post
You have a different kitty!
I wonder how many MR members have cats in their Avatars?
(I know a whole lot have feline helpers at home)
theducks is online now   Reply With Quote
Old 10-19-2021, 07:22 AM   #71
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,043
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
You have a different kitty!
Quote:
Originally Posted by theducks View Post
I wonder how many MR members have cats in their Avatars?
(I know a whole lot have feline helpers at home)
We have three, 2 ginger brothers and one calico. She was my previous avatar and is still feral. I must use welder's leather arm gloves to pick her up. One brother (the current avatar) insists on helping with everything and everyone; plumbers in particular appreciate him jumping on their backs to inspect their work. The other brother is nervous and shy but is the most skillful at hunting down cat treats.
chaley is offline   Reply With Quote
Old 10-31-2021, 10:10 AM   #72
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,043
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Bug fix: arithmetic operators fail if a value is undefined

31 October 2021 (In calibre 5.31.1)
  • Bug fix: the binary arithmetic operators (+ - * /) failed if either value was undefined e.g., if $$#myint doesn't have a value for the book. The fix: make them work like the comparison operators: assume undefined is zero.

Last edited by chaley; 11-05-2021 at 11:12 AM.
chaley is offline   Reply With Quote
Old 11-10-2021, 12:05 PM   #73
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,043
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
New formatter function: current_virtual_library_name()

10 November 2021 (In calibre source)
  • Add the function current_virtual_library_name(). The documentation:
    Quote:
    Return the name of the current virtual library if there is one, otherwise the empty string. Library name case is preserved. Example:
    Code:
    program: current_virtual_library_name()
    This function can be used only in the GUI.
chaley is offline   Reply With Quote
Old 11-11-2021, 07:47 AM   #74
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,043
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Performance improvements

11 November 2021 (in calibre source)
  • Fix: fix failure to inline the functions first_non_empty() and test().
  • New: inline the strcat() function

Last edited by chaley; 11-11-2021 at 08:51 AM.
chaley is offline   Reply With Quote
Old 03-27-2022, 11:28 AM   #75
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,043
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
New language constructs

27 March 2022 (In calibre version 5.40)
  • The ability to define local functions. For example, the following example computes an approximate duration in years, months, days from a number of days. It uses the defined local function to_plural() to format the numbers for output.
    Code:
    program:
    	days = 2112;
    	years = floor(days/360);
    	months = floor(mod(days, 360)/30);
    	days = days - ((years*360) + (months * 30));
    
    	def to_plural(v, str):
    		if v == 0 then return '' fi;
    		return v & ' ' & (if v == 1 then str else str & 's' fi) & ' '
    	fed;
    
    	to_plural(years, 'year') & to_plural(months, 'month') & to_plural(days, 'day')
    Notes:
    • The grammar for defining a function is
      Code:
      function ::= 'def' function_name '(' argument_expr [',' argument_expr]* ')' ':' 
                    expression_list 'fed'
      argument_expr ::= identifier | identifier '=' expression
    • Functions must be defined before they are used.
    • The outer scope local variables are not visible inside a function.
    • The parameters in the definition can have default values.
    • You can call a function with fewer arguments than defined parameters. Parameters matched to 'missing' arguments are given their default value or the empty string if there isn't a default value.
  • A 'concatenate strings' operator '&'. The expression
    Code:
    'aaa' & 'bbb' & 'ccc'
    is equivalent to
    Code:
    strcat('aaa', 'bbb', 'ccc')

Last edited by chaley; 04-01-2022 at 11:17 AM.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A few questions... (template language, mainly) Clem2605 Library Management 2 12-30-2020 04:25 AM
Template Language phossler Calibre 8 01-12-2016 05:37 PM
Help needed with template language Mamaijee Devices 12 02-19-2013 02:52 AM
Help with template language Pepin33 Calibre 8 11-11-2012 09:32 AM
Template language question BookJunkieLI Library Management 7 02-02-2012 07:55 PM


All times are GMT -4. The time now is 04:50 PM.


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