![]() |
#826 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,327
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
program: def first_letter(x): return strcat('[', substr(x, 0, 1), ']') fed; # Replace periods with unicode "One Dot Leader" (․) period = '․'; # Replace commas with unicode "Small Comma" (﹐) comma = '﹐'; if $series then series = strcat('.', first_letter($series), '.', re($series, '\.', period)) else series = '.Standalone' fi; sep = ''; result = ''; for aut in 'authors': result = strcat(result, sep, first_letter(aut), '.', re(re(aut, '\.', period), ',', comma), series); sep = ',' rof; result |
|
![]() |
![]() |
![]() |
#827 | |
Connoisseur
![]() Posts: 63
Karma: 10
Join Date: Nov 2023
Device: Kindle Oasis
|
Quote:
![]() ![]() ![]() |
|
![]() |
![]() |
![]() |
#828 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,647
Karma: 74166147
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Code:
program: cost = $$#purchasecost; switch_if( cost == 'none', '', '[Bundle]' inlist $#admintags, '[Bundle]', 'kobopoints:' inlist $#admintags, '[Kobo VIP]', cost ==# '00.00', '$0.00', cost <=# '00.99', '$0.01 - $0.99', cost <=# '04.99', '$1.00 - $4.99', cost <=# '10.00', '$5.00 - $9.99', cost <=# '15.00', '$10.00 - $14.99', cost <=# '15.00', '$10.00 - $14.99', cost <=# '20.00', '$15.00 - $19.99', cost <=# '30.00', '$20.00 - $29.99', '$30.00 and up' ) This returns [Bundle] for nearly everything, even when the entry doesn't exist in admintags. It doesn't happen when I remove square brackets in the test. What happened? |
![]() |
![]() |
![]() |
#829 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,327
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
'^\[Bundle\]$' inlist_field '#admintags', '[Bundle]', Note that you can also use the str_in_list() function that doesn't use regular expressions and returns 'found_val' only if the value matches an entire list item. |
|
![]() |
![]() |
![]() |
#830 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,647
Karma: 74166147
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thanks. I think I ran into something similar once before
![]() |
![]() |
![]() |
![]() |
#831 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,647
Karma: 74166147
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Question: Can this be used in a plugboard? I would like to remove the series name on device if I have only 1 book.
Code:
program: switch_if( series_multibook(), $series, '' ) |
![]() |
![]() |
![]() |
#832 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,327
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
#833 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,647
Karma: 74166147
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
In another post, I asked about setting specific time. Now I'd like to know if possble to:
1. Take current date. 2. Subtract one day (April 23 -> April 22). 3. Set the time to 23:59 of that date. This would be for Reading Goal setting the #lastread - I update my daily page at end of day, but sometimes forget till next morning which messes up the page-per-day count. |
![]() |
![]() |
![]() |
#834 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,327
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
program: date_arithmetic(re(today(), 'T.*\+', 'T00:00:00+'), '-1m') |
|
![]() |
![]() |
![]() |
#835 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,647
Karma: 74166147
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I'm not sure why, but can't get it working. Returns current datetime minus 1 minute.
|
![]() |
![]() |
![]() |
#836 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,327
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Please attach both what today() and the re() return so I can check the regular expression. Both must be in ISO format. |
|
![]() |
![]() |
![]() |
#837 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,327
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Try this:
Code:
program: date_arithmetic(re(today(), 'T.*([+-])', 'T00:00:00\1'), '-1m') |
![]() |
![]() |
![]() |
#838 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,647
Karma: 74166147
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
re(): 2025-04-23T19:51:10.719873-03:00
today(): 2025-04-23T19:50:10.719873-03:00 The new code works. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Library Management: various questions not worth their own thread | ownedbycats | Library Management | 198 | 04-26-2025 07:02 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 |