![]() |
#256 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
gui.current_db().refresh() EDIT2: you might need to check the "Refresh book list after edit" in the bulk dialog for 'correction' to work. Last edited by chaley; 12-27-2021 at 05:04 PM. |
|
![]() |
![]() |
![]() |
#257 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,012
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Yes, the bulk metadata edit fixes it.
I tried making this custom AC module, but it gave me an error: Code:
from calibre_plugins.action_chains.actions.base import ChainAction class RefreshAction(ChainAction): name = 'Refresh GUI' def run(self, gui, settings, chain): gui.current_db().refresh() |
![]() |
![]() |
Advert | |
|
![]() |
#258 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
gui.current_db().data.refresh() Code:
gui.refresh_all() |
|
![]() |
![]() |
![]() |
#259 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,012
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Hmm, data.refresh gave me the same error:
Code:
calibre, version 5.34.0 ERROR: Unhandled exception: <b>TypeError</b>:'LibraryDatabase' object is not callable calibre 5.34 [64bit] embedded-python: True is64bit: True Windows-10-10.0.19041 Windows ('64bit', 'WindowsPE') ('Windows', '10', '10.0.19041') Python 3.8.5 Windows: ('10', '10.0.19041', '', 'Multiprocessor Free') Interface language: None Successfully initialized third party plugins: DeACSM (0, 0, 15) && DeDRM (7, 2, 1) && Action Chains (1, 14, 0) && Barnes & Noble (1, 2, 16) && Calibre Power Search Plugin (2, 1, 1) && Comments Cleaner (1, 5, 0) && Count Pages (1, 11, 1) && Embed Comic Metadata (1, 6, 1) && EpubCheck (0, 2, 3) && EpubMerge (2, 11, 0) && Extract ISBN (1, 5, 0) && FanFicFare (4, 8, 4) && Fantastic Fiction (1, 5, 0) && Favourites Menu (1, 0, 5) && Find Duplicates (1, 8, 10) && Generate Cover (2, 0, 2) && GetFileName (0, 1, 1) && Goodreads (1, 5, 1) && Import List (1, 5, 6) && Job Spy (1, 0, 190) && Kindle hi-res covers (0, 5, 0) && Kobo Books (1, 8, 3) && Kobo Utilities (2, 14, 1) && KoboTouchExtended (3, 5, 4) && Last Modified (0, 7, 1) && Library Codes (1, 0, 50) && Manage Series (1, 2, 11) && Modify ePub (1, 6, 3) && MultiColumnSearch (1, 0, 87) && Obok DeDRM (7, 2, 1) && Open With (1, 5, 13) && Overdrive Link (2, 49, 0) && Quality Check (1, 11, 4) && Reading List (1, 7, 7) && Search The Internet (1, 8, 1) && SmartEject (2, 3, 0) && Standard Ebooks (1, 0, 0) && Sum Column (0, 3, 1) && View Manager (1, 6, 1) && Walk Search History (1, 3, 2) && Overdrive Link* (2, 49, 0) Traceback (most recent call last): File "calibre_plugins.action_chains.action", line 454, in run_chain File "calibre_plugins.action_chains.chains", line 396, in run File "calibre_plugins.action_chains.chains", line 211, in _run_loop File "calibre_plugins.action_chains.chains", line 188, in _run_loop File "Refresh GUI", line 8, in run TypeError: 'LibraryDatabase' object is not callable |
![]() |
![]() |
![]() |
#260 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,012
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Also, unrelated to the above error:
Is it possible to put a strcat inside a first_non_empty? For icon_fanfics shared template, I want to display multiple icons, but if none exist then use a placeholder. This gave me an error: Code:
program: first_non_empty( strcat ( if "^foo$" inlist $#taglike then 'foo.png:' fi, if "^bar$" inlist $#taglike then 'bar.png:' fi, if "^foobar$" inlist $#taglike then 'foobar.png:' fi, ) if $#taglike then 'placeholder.png' fi ) EDIT: I found a very weird workaround that maybe only works because it's a shared template. I put this in column rules/emblems: Code:
program: if icons_fanfic() then icons_fanfic() else 'placeholder.png' fi Last edited by ownedbycats; 12-27-2021 at 08:36 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#261 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
gui.current_db.data.refresh() Last edited by chaley; 12-28-2021 at 05:26 AM. |
|
![]() |
![]() |
![]() |
#262 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
program: first_non_empty( strcat ( if "^foo$" inlist $#taglike then 'foo.png:' fi, if "^bar$" inlist $#taglike then 'bar.png:' fi, if "^foobar$" inlist $#taglike then 'foobar.png:' fi ), if $#taglike then 'placeholder.png' fi ) |
|
![]() |
![]() |
![]() |
#263 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,012
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
gui.current_db.data.refresh() worked - made the sorting go weird, so instead of attaching it to the tab-switch chain itself I instead made a chain (bound to Ctrl+F5) that runs the module and then re-applies the view/sort.
|
![]() |
![]() |
![]() |
#264 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
gui.library_view.model().resort() and gui.library_view.model().research() |
|
![]() |
![]() |
![]() |
#265 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,012
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Code:
from calibre_plugins.action_chains.actions.base import ChainAction class RefreshAction(ChainAction): name = 'Refresh GUI' def run(self, gui, settings, chain): gui.current_db.data.refresh() gui.library_view.model().resort() |
![]() |
![]() |
![]() |
#266 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#267 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,012
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
current_virtual_library_name() is a relatively new function, so I'm possibly the first person to even think of it. Mostly just to see it I could - I already use the function to display/hide icons based on the current VL, so why not column values? Creating the read/unread VLs was a good opportunity to experiment.
I did some across an oddity though. The book list view is sorted, but not in book details. Not a big issue, but curious as to what's going on seeing as there's no sorting going on in the template. Last edited by ownedbycats; 12-29-2021 at 06:54 PM. |
![]() |
![]() |
![]() |
#268 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,012
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Quick question: Are there any instances where field('column') and $column (or raw_field and $$column) are not interchangeable?
|
![]() |
![]() |
![]() |
#269 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
x = field(substr($a, 1, 10)) |
|
![]() |
![]() |
![]() |
#270 | |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,012
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Question: Is it possible to set variables outside of the stored template?
Context: I am making this template meant for use in the column colouring. Code:
program: ## date = $#datecol; now = format_date(today(), 'yyyy-MM-dd'); if days_between(date, now) <= '1' then '#aaaaa' elif days_between(date, now) <= '3' then '#bbbbb' elif days_between(date, now) <= '7' then '#ccccc' fi ![]() Note that the date variable is commented out -- I tried saving it as a stored template, colours_days_between. then this in the template tester: Code:
program: date = $#fanficupdated; colours_daysbetween() I noticed this Quote:
Last edited by ownedbycats; 01-06-2022 at 10:27 PM. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Library Management: various questions not worth their own thread | ownedbycats | Library Management | 218 | 07-11-2025 07:34 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 |