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 07-17-2021, 04:49 PM   #1
estherflails
Member
estherflails began at the beginning.
 
Posts: 23
Karma: 10
Join Date: Jul 2021
Device: none
Referring to column colors in template

Basically, I have set up a column color rule that I would like to refer to in a custom column template to add a tag based on the color.

I have done the opposite in the past - set up a custom column and refer to it in the color rule - which worked, but I have to update the custom column with info periodically, and since my library is quite large, it takes a long time to save, which is quite inconvenient. However, I found that updating the color rules is much faster, and I can basically use the same template as I had in the custom column. I do still want to add a tag to books as well as color, though, hence my question.

If this is not possible, would I be able to do an advanced search based on colors in a column instead?

Thank you!
estherflails is offline   Reply With Quote
Old 07-17-2021, 09:06 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,859
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I dont believe colors are queryable in any way either by searching or in templates, they are only applied dynamically when the data in question is rendered.
kovidgoyal is offline   Reply With Quote
Advert
Old 07-18-2021, 05:49 AM   #3
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: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
You might be able to do what you want with a stored template. If I am understanding correctly (not at all sure ) then the stored template would compute the color based on the column content. The color rule would 'call' the template and return the color. The composite column template would call the template and do whatever you want with the returned value.
chaley is offline   Reply With Quote
Old 07-18-2021, 08:15 AM   #4
estherflails
Member
estherflails began at the beginning.
 
Posts: 23
Karma: 10
Join Date: Jul 2021
Device: none
Thank you for the stored template idea. I tried it and I believe it would work, but after saving the stored template and returning to the Preferences screen, when I try to close that screen, Calibre freezes. I tried adding the Template Functions button to the menu and accessing it that way, but Calibre still freezes when clicking the Apply button. Not sure if this is because of my library size or an error, but either way, unfortunately, this means it's not a better option to update this periodically than to update a custom column.
estherflails is offline   Reply With Quote
Old 07-18-2021, 08:22 AM   #5
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: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by estherflails View Post
Thank you for the stored template idea. I tried it and I believe it would work, but after saving the stored template and returning to the Preferences screen, when I try to close that screen, Calibre freezes. I tried adding the Template Functions button to the menu and accessing it that way, but Calibre still freezes when clicking the Apply button. Not sure if this is because of my library size or an error, but either way, unfortunately, this means it's not a better option to update this periodically than to update a custom column.
Hmmm ... that doesn't happen to me on calibre 5.23/Windows 64. What I tried:
  1. Open Preferences.
  2. Click Template functions
  3. Entered a new name in the Template name box.
  4. Entered "program: 1" (a trivial GPM template) into the template box.
  5. Pressed the Create button.
  6. Pressed the Apply button. The Template functions dialog closed and the Preferences dialog was exposed.
  7. Pressed the Close button. The Preference dialog closed.
Using the shortcut also worked, without of course seeing the preferences dialog.

What are you doing different from the above? What version of calibre are you running, on what OS?

NB: I am the developer of the calibre template language. If there is a hang I really want to know how to reproduce it.
chaley is offline   Reply With Quote
Advert
Old 07-18-2021, 08:45 AM   #6
estherflails
Member
estherflails began at the beginning.
 
Posts: 23
Karma: 10
Join Date: Jul 2021
Device: none
Quote:
Originally Posted by chaley View Post
  1. Open Preferences.
  2. Click Template functions
  3. Entered a new name in the Template name box.
  4. Entered "program: 1" (a trivial GPM template) into the template box.
  5. Pressed the Create button.
  6. Pressed the Apply button. The Template functions dialog closed and the Preferences dialog was exposed.
  7. Pressed the Close button. The Preference dialog closed.
Using the shortcut also worked, without of course seeing the preferences dialog.
I followed these exact steps and the freezing still happened.

Quote:
Originally Posted by chaley View Post
What are you doing different from the above? What version of calibre are you running, on what OS?
I am running calibre 5.21 on Windows 10. In this particular library, I do have over 12k books at the moment, which is probably the issue. I tried the same steps above in a separate library with only a few books, and there was no freezing or delay.
estherflails is offline   Reply With Quote
Old 07-18-2021, 09:42 AM   #7
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: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
For calibre, 12,000 books isn't that many but it could matter depending on the computer you are using and where the library is stored.

First question: have you ever waited for some time to see if calibre becomes responsive again?

When you save a template function, calibre resets its internal data so that any usages of the changed/new function will be taken into account. The reset forces rereading of the database. The speed of this process is mostly determined by a) how the library is sorted, b) whether there is a virtual library active, and c) whether the computer has enough memory to compute everything necessary. In your case:
  • How is the library sorted? Is it a complicated sort using composite columns (columns built from other columns), especially those that touch the disk to get information about formats?
  • Do you have a VL active?
  • Are you running 32- or 64-bit calibre? It is hard to imagine that this matters, but it might.

Last question: have you run it in debug mode? I doubt it would show anything but one never knows.

Last suggestion: sometimes the calibre database gets quite large as it collects detritus from change operations. An overly large library database can be slow. Running Library maintenance / Check library (click on the Library button to see this choice) will compact the database. You don't need to run "Check if files" step (but I would just to see).
chaley is offline   Reply With Quote
Old 07-18-2021, 11:36 AM   #8
estherflails
Member
estherflails began at the beginning.
 
Posts: 23
Karma: 10
Join Date: Jul 2021
Device: none
Quote:
Originally Posted by chaley View Post
For calibre, 12,000 books isn't that many but it could matter depending on the computer you are using and where the library is stored.
I am using a few years old laptop, but it isn't especially slow in most operations so I'm not sure how much it contributes to the issue. It has 8GB memory and Intel Core i5 CPU. The library is stored locally on the C Drive.

Quote:
Originally Posted by chaley View Post
First question: have you ever waited for some time to see if calibre becomes responsive again?
I have, and it does start working again eventually.

Quote:
Originally Posted by chaley View Post
Last suggestion: sometimes the calibre database gets quite large as it collects detritus from change operations. An overly large library database can be slow. Running Library maintenance / Check library (click on the Library button to see this choice) will compact the database. You don't need to run "Check if files" step (but I would just to see).
Tried this before anything else. The first check found no errors. Check files found 5 extra titles and 4 extra authors, which I deleted.

Quote:
Originally Posted by chaley View Post
  • How is the library sorted? Is it a complicated sort using composite columns (columns built from other columns), especially those that touch the disk to get information about formats?
  • Do you have a VL active?
  • Are you running 32- or 64-bit calibre? It is hard to imagine that this matters, but it might.
  • I do have many composite columns, but I just tested adding a template when the sorting was on the title, and it still froze.
  • I do not.
  • 64-bit.

Quote:
Originally Posted by chaley View Post
Last question: have you run it in debug mode? I doubt it would show anything but one never knows.
I tried just now, but it doesn't seem to snow anything related.

Spoiler:
Code:
EpubMerge: DEBUG: 2021-07-18 17:05:21,438: calibre_plugins.epubmerge.epubmerge_plugin(158): macmenuhack file_path:C:\Users\Felhasználó\AppData\Roaming\calibre\plugins\fanficfare_macmenuhack.txt
FFF: DEBUG: 2021-07-18 17:05:21,464: calibre_plugins.fanficfare_plugin.fff_plugin(221): Plugin FanFicFare macmenuhack file_path:C:\Users\Felhasználó\AppData\Roaming\calibre\plugins\fanficfare_macmenuhack.txt
calibre Debug log
calibre 5.21 [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: en_GB
Integration status: True
Successfully initialized third party plugins: Audit Log (1, 0, 16) && Count Pages (1, 11, 0) && EpubMerge (2, 11, 0) && F_rating (3, 2, 0) && FanFicFare (4, 3, 0) && Goodreads (1, 5, 1) && Goodreads More Tags (1, 2, 1) && Goodreads_Rating (3, 1, 0) && Job Spy (1, 0, 190) && Reading List (1, 7, 6) && Save Composite Custom Columns (1, 1, 1)
calibre 5.21 [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: en_GB
Successfully initialized third party plugins: Audit Log (1, 0, 16) && Count Pages (1, 11, 0) && EpubMerge (2, 11, 0) && F_rating (3, 2, 0) && FanFicFare (4, 3, 0) && Goodreads (1, 5, 1) && Goodreads More Tags (1, 2, 1) && Goodreads_Rating (3, 1, 0) && Job Spy (1, 0, 190) && Reading List (1, 7, 6) && Save Composite Custom Columns (1, 1, 1)
Turning on automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 120.0 x 120.0
physicalDpi: 141.7674418604651 x 142.13471502590673
Using calibre Qt style: True
[0.00] Starting up...
[0.00] Showing splash screen...
[12.94] splash screen shown
[12.94] Initializing db...
[18.81] db initialized
[18.81] Constructing main UI...
Job Spy has begun initialization...
Calibre, and hence Job Spy, was gracefully shut down last time?  True
Last time daemon started:  never
Last time daemon failed:  never
Total daemon starts inception_to_date:  0
Total daemon failures inception-to-date:  0
wildcard specified in Job Spy last-viewed tool active library names, which includes:  Calibre Ao3 Library
>>>[2] update_last_viewed_custom_column_automatically_control initialization_complete 'method' object is not connected
ERROR: extract_plugin_resources Exception:  'ascii' codec can't encode character '\xe1' in position 17: ordinal not in range(128)
Job Spy has finished initialization...
[249.27] main UI initialized...
[249.27] Hiding splash screen
Starting QuickView
[250.88] splash screen hidden
[250.88] Started up in 250.88 seconds with 12339 books
plugin Save Composite Custom Columns library C:\Users\Felhasználó\Documents\MEGAsync\Calibre Ao3 Library: updated 12339 books in 0:00:13.371089
estherflails is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me with Custom Column template nqk Library Management 3 09-23-2016 10:22 PM
Copying Template Value to a column rszasz Library Management 1 06-15-2016 11:16 AM
Template for custom column BeeTee-Ess Library Management 5 10-04-2013 08:55 PM
column colors based on what reading list a book is on? BeccaPrice Calibre 3 01-22-2012 04:29 PM
column colors iomari Calibre 2 10-07-2011 10:39 AM


All times are GMT -4. The time now is 11:10 AM.


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