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-10-2022, 11:20 PM   #1
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
The user template functions is not working for me no matter what I do. I can create one, see it in the database, but, when I restart calibre it does not appear. This happens whether I run from source, or use the installed beta. And, it doesn't matter how I create the library. I have tried creating a new library copying my existing structure and creating a new library with the default configuration.

The attached database and JSON file come from using the installed calibre 5.99.12 by clicking on icon created when installing. I uses "Switch/create library" and created a new directory. After that, I closed calibre. Then I opened it and created a user function template using the example in the help, except that I added a couple of a's to the name to have it first. Then I closed and reopened calibre. When I looked, the function was not their. I then zipped up the database and backup file.
Attached Files
File Type: zip Qt6TestEmpty1.zip (14.1 KB, 228 views)
davidfor is offline   Reply With Quote
Old 07-11-2022, 06:08 AM   #2
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,362
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
It works for me, of course. These 'sometimes' problems are a big pain.

What I did:
  • Updated to latest source.
  • Created an empty configuration directory to remove any possible plugin influence.
  • Created a library containing your metadata.db
  • Ran calibre, which went through the welcome wizard. I pointed it at the library containing your database.
  • Your aamy_ifempty() function was there.
  • I created a composite column calling your function. It shows the correct value.
To help trace this down I added some logging to calibre.db.backend.py. The source file is attached.

Here is the log when I ran it:
Spoiler:
Code:
c:\CBH_Data\calibre.git>test_calibre_temp.bat
c:\CBH_Data\calibre.git>set CALIBRE_CONFIG_DIRECTORY=C:\CBH_Data\calibre.git\config_test_temp
c:\CBH_Data\calibre.git>"c:\Program Files\calibre2\calibre-debug" -g

calibre 6.0*  embedded-python: True
Windows-10-10.0.19044 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19044')
Python 3.10.1
Windows: ('10', '10.0.19044', '', 'Multiprocessor Free')
Interface language: en_GB
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 86.46808510638297 x 86.41063122923588
Using calibre Qt style: True
[0.00] Starting up...
[0.00] Showing splash screen...
[0.20] splash screen shown
[0.20] Initializing db...
backend.__init__ - set template functions aamy_ifempty
backend.set_user_template_functions 1 aamy_ifempty
backend.set_user_template_functions 2 add, and, approximate_formats, arguments, assign, author_links, author_sorts, book_count, book_values, booksize, capitalize, character, check_yes_no, ceiling, cmp, connected_device_name, connected_device_uuid, contains, count, list_count, current_library_name, current_library_path, current_virtual_library_name, date_arithmetic, days_between, divide, eval, first_non_empty, field, field_exists, finish_formatting, first_matching_cmp, floor, format_date, format_number, formats_modtimes, formats_paths, formats_sizes, fractional_part, globals, has_cover, human_readable, identifier_in_list, ifempty, language_codes, language_strings, in_list, list_contains, is_marked, list_count_matching, count_matching, list_difference, list_equals, list_intersection, list_item, list_join, list_re, list_re_group, list_remove_duplicates, list_sort, list_split, list_union, merge_lists, lookup, lowercase, mod, multiply, not, ondevice, or, print, rating_to_stars, range, raw_field, raw_list, re, re_group, round, select, series_sort, set_globals, shorten, strcat, strcat_max, strcmp, str_in_list, strlen, subitems, sublist, substr, subtract, swap_around_articles, swap_around_comma, switch, template, test, titlecase, today, transliterate, uppercase, urls_from_identifiers, user_categories, virtual_libraries, annotation_count, aamy_ifempty
backend.get_user_template_functions aamy_ifempty
backend.set_global_state aamy_ifempty
backend.get_user_template_functions aamy_ifempty
[0.20] db initialized
[0.20] Constructing main UI...
backend.get_template_functions add, and, approximate_formats, arguments, assign, author_links, author_sorts, book_count, book_values, booksize, capitalize, character, check_yes_no, ceiling, cmp, connected_device_name, connected_device_uuid, contains, count, list_count, current_library_name, current_library_path, current_virtual_library_name, date_arithmetic, days_between, divide, eval, first_non_empty, field, field_exists, finish_formatting, first_matching_cmp, floor, format_date, format_number, formats_modtimes, formats_paths, formats_sizes, fractional_part, globals, has_cover, human_readable, identifier_in_list, ifempty, language_codes, language_strings, in_list, list_contains, is_marked, list_count_matching, count_matching, list_difference, list_equals, list_intersection, list_item, list_join, list_re, list_re_group, list_remove_duplicates, list_sort, list_split, list_union, merge_lists, lookup, lowercase, mod, multiply, not, ondevice, or, print, rating_to_stars, range, raw_field, raw_list, re, re_group, round, select, series_sort, set_globals, shorten, strcat, strcat_max, strcmp, str_in_list, strlen, subitems, sublist, substr, subtract, swap_around_articles, swap_around_comma, switch, template, test, titlecase, today, transliterate, uppercase, urls_from_identifiers, user_categories, virtual_libraries, annotation_count, aamy_ifempty
[1.22] main UI initialized...
[1.22] Hiding splash screen
Starting QuickView
[1.50] splash screen hidden
[1.50] Started up in 1.50 seconds with 1 books
backend.close - unloading template functions 32d3fa1c-9a4a-450a-a422-e0dcface23d5

c:\CBH_Data\calibre.git>


To make sure we are running the same thing, I am attaching my configuration folder (zipped), the library folder (zipped).
Attached Files
File Type: zip config_test_temp.zip (14.5 KB, 173 views)
File Type: zip Library.test_temp.zip (114.5 KB, 180 views)
File Type: zip backend.py.zip (19.6 KB, 172 views)
chaley is offline   Reply With Quote
Advert
Old 07-11-2022, 10:11 PM   #3
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
For simplicity, I created the same directory structure as you. That was to make sure that the paths in the config files did not not need to be fiddled with. And of course, it worked:

Spoiler:
Code:
C:\CBH_Data\calibre.git>SET CALIBRE_DEVELOP_FROM=E:\Development\GitHub\calibre\src

C:\CBH_Data\calibre.git>rem SET CALIBRE_ENABLE_DEVELOP_MODE=1

C:\CBH_Data\calibre.git>calibre-debug  -s
Failed to contact running instance of calibre
Failed to connect to Listener at: \\.\pipe\CalibreGUI-davidforx with error: QLocalSocket::connectToServer: Invalid name

C:\CBH_Data\calibre.git>calibre-debug  --paths
CALIBRE_RESOURCES_PATH=C:\Program Files\Calibre2\app\resources
CALIBRE_EXTENSIONS_PATH=C:\Program Files\Calibre2\app\bin
CALIBRE_PYTHON_PATH=

C:\CBH_Data\calibre.git>calibre-debug  -g
calibre 6.0*  embedded-python: True
Windows-10-10.0.19043 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19043')
Python 3.10.1
Windows: ('10', '10.0.19043', '', 'Multiprocessor Free')
Interface language: en_GB
devicePixelRatio: 1.5
logicalDpi: 96.0 x 96.0
physicalDpi: 127.66492146596858 x 127.59069767441859
Using calibre Qt style: True
[0.00] Starting up...
[0.00] Showing splash screen...
[0.20] splash screen shown
[0.20] Initializing db...
backend.__init__ - set template functions aamy_ifempty
backend.set_user_template_functions 1 aamy_ifempty
backend.set_user_template_functions 2 add, and, approximate_formats, arguments, assign, author_links, author_sorts, book_count, book_values, booksize, capitalize, character, check_yes_no, ceiling, cmp, connected_device_name, connected_device_uuid, contains, count, list_count, current_library_name, current_library_path, current_virtual_library_name, date_arithmetic, days_between, divide, eval, first_non_empty, field, field_exists, finish_formatting, first_matching_cmp, floor, format_date, format_number, formats_modtimes, formats_paths, formats_sizes, fractional_part, globals, has_cover, human_readable, identifier_in_list, ifempty, language_codes, language_strings, in_list, list_contains, is_marked, list_count_matching, count_matching, list_difference, list_equals, list_intersection, list_item, list_join, list_re, list_re_group, list_remove_duplicates, list_sort, list_split, list_union, merge_lists, lookup, lowercase, mod, multiply, not, ondevice, or, print, rating_to_stars, range, raw_field, raw_list, re, re_group, round, select, series_sort, set_globals, shorten, strcat, strcat_max, strcmp, str_in_list, strlen, subitems, sublist, substr, subtract, swap_around_articles, swap_around_comma, switch, template, test, titlecase, today, transliterate, uppercase, urls_from_identifiers, user_categories, virtual_libraries, annotation_count, aamy_ifempty
backend.get_user_template_functions aamy_ifempty
backend.set_global_state aamy_ifempty
backend.get_user_template_functions aamy_ifempty
[0.20] db initialized
[0.20] Constructing main UI...
backend.get_template_functions add, and, approximate_formats, arguments, assign, author_links, author_sorts, book_count, book_values, booksize, capitalize, character, check_yes_no, ceiling, cmp, connected_device_name, connected_device_uuid, contains, count, list_count, current_library_name, current_library_path, current_virtual_library_name, date_arithmetic, days_between, divide, eval, first_non_empty, field, field_exists, finish_formatting, first_matching_cmp, floor, format_date, format_number, formats_modtimes, formats_paths, formats_sizes, fractional_part, globals, has_cover, human_readable, identifier_in_list, ifempty, language_codes, language_strings, in_list, list_contains, is_marked, list_count_matching, count_matching, list_difference, list_equals, list_intersection, list_item, list_join, list_re, list_re_group, list_remove_duplicates, list_sort, list_split, list_union, merge_lists, lookup, lowercase, mod, multiply, not, ondevice, or, print, rating_to_stars, range, raw_field, raw_list, re, re_group, round, select, series_sort, set_globals, shorten, strcat, strcat_max, strcmp, str_in_list, strlen, subitems, sublist, substr, subtract, swap_around_articles, swap_around_comma, switch, template, test, titlecase, today, transliterate, uppercase, urls_from_identifiers, user_categories, virtual_libraries, annotation_count, aamy_ifempty
[1.69] main UI initialized...
[1.69] Hiding splash screen
Starting QuickView
[2.69] splash screen hidden
[2.69] Started up in 2.69 seconds with 1 books
backend.close - unloading template functions 32d3fa1c-9a4a-450a-a422-e0dcface23d5

C:\CBH_Data\calibre.git>



And running using my normal configuration it doesn't work. Looking through the log below, I can see "backend.__init__" called twice, but, only once in yours. The position in the log suggests that a plugin is triggering that.

Spoiler:
Code:
E:\Development\CalibrePlugins>SET CALIBRE_DEVELOP_FROM=E:\Development\GitHub\calibre\src

E:\Development\CalibrePlugins>rem SET CALIBRE_ENABLE_DEVELOP_MODE=1

E:\Development\CalibrePlugins>calibre-debug  -s
Failed to contact running instance of calibre
Failed to connect to Listener at: \\.\pipe\CalibreGUI-davidforx with error: QLocalSocket::connectToServer: Invalid name

E:\Development\CalibrePlugins>calibre-debug  --paths
CALIBRE_RESOURCES_PATH=C:\Program Files\Calibre2\app\resources
CALIBRE_EXTENSIONS_PATH=C:\Program Files\Calibre2\app\bin
CALIBRE_PYTHON_PATH=

E:\Development\CalibrePlugins>calibre-debug  -g
calibre 6.0*  embedded-python: True
Windows-10-10.0.19043 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19043')
Python 3.10.1
Windows: ('10', '10.0.19043', '', 'Multiprocessor Free')
Interface language: None
DEBUG:    0.0 GetFileName::__init__.py - loading translations
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 49, 0) && DeDRM (7, 2, 1) && Package KFX (from KFX Input) (1, 49, 0) && Annotations (1, 17, 10) && Calibre Power Search Plugin (2, 1, 2) && Clean Comments (0, 2, 0) && Clipboard Search (1, 3, 2) && Count Pages (1, 11, 2) && DOC Input (1, 0, 1) && Databazeknih (1, 4, 11) && Define Content (1, 0, 0) && Device Old Books (0, 0, 3) && Diaps Editing Toolbag (0, 3, 7) && Douban Books v2 (4, 2, 1) && Embed Comic Metadata (1, 6, 1) && EpubMerge (2, 13, 0) && EpubSplit (3, 3, 0) && Ex Libris (1, 0, 20) && Extract ISBN (1, 5, 1) && FanFicFare (4, 14, 0) && Fantastic Fiction (1, 5, 1) && Fantastic Fiction Adults (1, 2, 0) && Favourites Menu (1, 1, 0) && FictionDB (1, 2, 2) && Find Duplicates (1, 9, 5) && Generate Cover (2, 1, 0) && GetFileName (0, 2, 0) && Goodreads (1, 5, 3) && Goodreads Sync (1, 15, 3) && Google Scholar (0, 1, 1) && Hyphenate This! (0, 1, 3) && Import List (1, 8, 3) && KFX metadata reader (from KFX Input) (1, 49, 0) && KFX Input (1, 49, 0) && Set KFX metadata (from KFX Output) (1, 63, 0) && KFX Output (1, 63, 0) && KePub Metadata Reader (3, 4, 3) && KePub Metadata Writer (3, 4, 3) && KePub Output (3, 6, 0) && Kindle 2, 3, 4, Touch, PaperWhite, Voyage Device Interface MBP Update Mod (1, 0, 0) && Kindle hi-res covers (0, 5, 0) && Kobo Books (1, 9, 2) && Kobo Import (1, 0, 1) && Kobo Utilities (2, 16, 3) && KoboTouchExtended (3, 6, 0) && KoboTouchTOCUpdate (1, 2, 12) && LubimyCzytac (2, 2, 26) && METAmover (0, 0, 40) && Manage Series (1, 3, 0) && Manga (0, 1, 0) && Martinus.sk (2021, 12, 20) && Modify SOL Story (0, 10, 3) && Modify SOL Story (0, 10, 3) && Modify ePub (1, 7, 3) && Moly_hu (1, 1, 7) && Obok DeDRM (7, 2, 2) && Open With (1, 7, 1) && Overdrive Link (2, 51, 0) && Quality Check (1, 12, 0) && Quick Preferences (1, 5, 0) && Reading List (1, 12, 0) && Resize Cover (1, 1, 1) && ScrambleEbook (0, 6, 0) && Scroll Book Details (1, 0, 0) && Search The Internet (1, 8, 1) && Shentai (0, 0, 3) && Skoob Books (1, 5, 4) && SmartEject (2, 5, 0) && Smashwords Metadata (1, 0, 2) && Sum Column (0, 3, 3) && Unplugged (1, 0, 0) && User Category (1, 5, 6) && Velamma Comics (0, 0, 1) && View Manager (1, 8, 0) && Walk Search History (1, 3, 2) && Webscription (1, 1, 2) && WordDumb (3, 22, 0) && WorldsWithoutEnd (0, 0, 2)
devicePixelRatio: 1.5
logicalDpi: 96.0 x 96.0
physicalDpi: 127.66492146596858 x 127.59069767441859
Using calibre Qt style: False
[0.00] Starting up...
[0.00] Showing splash screen...
[0.22] splash screen shown
[0.22] Initializing db...
backend.__init__ - set template functions aamy_ifempty

from calibre.utils.formatter_functions import FormatterUserFunction
from calibre.utils.formatter_functions import formatter_functions
class UserFunction(FormatterUserFunction):
    def evaluate(self, formatter, kwargs, mi, locals, val):
        if val:
            return val
        else:
            return 'EMPTY'
backend.set_user_template_functions 1 aamy_ifempty
backend.set_user_template_functions 2 add, and, approximate_formats, arguments, assign, author_links, author_sorts, book_count, book_values, booksize, capitalize, character, check_yes_no, ceiling, cmp, connected_device_name, connected_device_uuid, contains, count, list_count, current_library_name, current_library_path, current_virtual_library_name, date_arithmetic, days_between, divide, eval, first_non_empty, field, field_exists, finish_formatting, first_matching_cmp, floor, format_date, format_number, formats_modtimes, formats_paths, formats_sizes, fractional_part, globals, has_cover, human_readable, identifier_in_list, ifempty, language_codes, language_strings, in_list, list_contains, is_marked, list_count_matching, count_matching, list_difference, list_equals, list_intersection, list_item, list_join, list_re, list_re_group, list_remove_duplicates, list_sort, list_split, list_union, merge_lists, lookup, lowercase, mod, multiply, not, ondevice, or, print, rating_to_stars, range, raw_field, raw_list, re, re_group, round, select, series_sort, set_globals, shorten, strcat, strcat_max, strcmp, str_in_list, strlen, subitems, sublist, substr, subtract, swap_around_articles, swap_around_comma, switch, template, test, titlecase, today, transliterate, uppercase, urls_from_identifiers, user_categories, virtual_libraries, annotation_count, aamy_ifempty
backend.get_user_template_functions aamy_ifempty
backend.set_global_state aamy_ifempty
backend.get_user_template_functions aamy_ifempty
[0.23] db initialized
[0.23] Constructing main UI...
DEBUG:    0.0 Annotations plugin: Error loading libiMobileDevice. This hasn't worked for a while, and is blacklisted in calibre v3.
DEBUG:    0.0 Annotations plugin: Error is:  No module named 'calibre.devices.idevice'
DEBUG:    0.0 Annotations::reader_app_support.py - loading translations
DEBUG:    0.0 Annotations::common_utils.py - loading translations
DEBUG:    0.0 Annotations::appearance.py - loading translations
DEBUG:    0.0 Annotations::config.py - loading translations
DEBUG:    0.0 Annotations::annotated_books.py - loading translations
DEBUG:    0.2 Annotations::action.py - loading translations
DEBUG:    0.0 Clean Comments::config.py - loading translations
DEBUG:    0.0 CleanComment::action.py - loading translations
DEBUG:    0.0 Goodreads Sync::dialogs.py - loading translations
DEBUG:    0.0 GoodreadsSync::action.py - loading translations
DEBUG:    0.0 kobo_import::utilities.py - loading translations
DEBUG:    0.0 kobo_import::dialogs.py - loading translations
DEBUG:    0.0 kobo_import::config.py - loading translations
DEBUG:    0.0 kobo_import::action_err.py - loading translations
DEBUG:    0.0 Kobo Utilities Configuration - CreateNewCustomColumn is supported
DEBUG:    0.0 KoboUtilites::action.py - loading translations
DEBUG:    0.0 KoboUtilites::dialogs.py - loading translations
DEBUG:    0.0 KoboUtilites::action.py - loading translations
DEBUG:    0.0 obok::utilities.py - loading translations
DEBUG:    0.0 obok::dialogs.py - loading translations
DEBUG:    0.0 obok::config.py - loading translations
DEBUG:    0.0 obok::action_err.py - loading translations
qt.webengine.QWebEngineView OK
DEBUG:    6.0  ~~~~~~~~~~~~~~~~~~~~~ Annotations plugin 1.17.10 (Windows) ~~~~~~~~~~~~~~~~~~~~~
DEBUG:    6.0 AnnotationsAction:genesis(ERROR) Error loading library libiMobileDevice: name 'libiMobileDevice' is not defined
DEBUG:    6.1 AnnotationsAction:init_options(disable_caching: True)
DEBUG:    6.1 AnnotationsDB:connect(db_version: 1)
DEBUG:    6.1 AnnotationsAction:load_dynamic_reader_classes()
DEBUG:    6.1   loading built-in class 'BooxReaderApp'
DEBUG:    6.1   loading built-in class 'GoodReader'
DEBUG:    6.1   loading built-in class 'Kindle'
DEBUG:    6.1   loading built-in class 'KoboTouch'
DEBUG:    6.1   loading built-in class 'ParseKindleMyClippingsTxt'
DEBUG:    6.1   loading built-in class 'ParseTolinoNotesTxt'
DEBUG:    6.1   loading built-in class 'PocketBook'
DEBUG:    6.1   loading built-in class 'Sony'
DEBUG:    6.1   loading built-in class 'Tolino'
DEBUG:    6.1 AnnotationsAction:inflate_dialog_resources()
backend.__init__ - set template functions aamy_ifempty

from calibre.utils.formatter_functions import FormatterUserFunction
from calibre.utils.formatter_functions import formatter_functions
class UserFunction(FormatterUserFunction):
    def evaluate(self, formatter, kwargs, mi, locals, val):
        if val:
            return val
        else:
            return 'EMPTY'
backend.set_user_template_functions 1 aamy_ifempty
backend.set_user_template_functions 2 add, and, approximate_formats, arguments, assign, author_links, author_sorts, book_count, book_values, booksize, capitalize, character, check_yes_no, ceiling, cmp, connected_device_name, connected_device_uuid, contains, count, list_count, current_library_name, current_library_path, current_virtual_library_name, date_arithmetic, days_between, divide, eval, first_non_empty, field, field_exists, finish_formatting, first_matching_cmp, floor, format_date, format_number, formats_modtimes, formats_paths, formats_sizes, fractional_part, globals, has_cover, human_readable, identifier_in_list, ifempty, language_codes, language_strings, in_list, list_contains, is_marked, list_count_matching, count_matching, list_difference, list_equals, list_intersection, list_item, list_join, list_re, list_re_group, list_remove_duplicates, list_sort, list_split, list_union, merge_lists, lookup, lowercase, mod, multiply, not, ondevice, or, print, rating_to_stars, range, raw_field, raw_list, re, re_group, round, select, series_sort, set_globals, shorten, strcat, strcat_max, strcmp, str_in_list, strlen, subitems, sublist, substr, subtract, swap_around_articles, swap_around_comma, switch, template, test, titlecase, today, transliterate, uppercase, urls_from_identifiers, user_categories, virtual_libraries, annotation_count, aamy_ifempty
backend.get_user_template_functions aamy_ifempty
backend.set_global_state aamy_ifempty
backend.get_user_template_functions aamy_ifempty
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
{'default': False, 'height': 680, 'keep_aspect_ratio': False, 'only_shrink_larger_images': True, 'width': 450}
Resize Covers::rebuild_menus - size_data={'default': False, 'height': 680, 'keep_aspect_ratio': False, 'only_shrink_larger_images': True, 'width': 450}
{'default': False, 'height': 900, 'keep_aspect_ratio': False, 'only_shrink_larger_images': True, 'width': 1100}
Resize Covers::rebuild_menus - size_data={'default': False, 'height': 900, 'keep_aspect_ratio': False, 'only_shrink_larger_images': True, 'width': 1100}
{'default': True, 'height': 900, 'keep_aspect_ratio': True, 'only_shrink_larger_images': True, 'width': 999999}
Resize Covers::rebuild_menus - size_data={'default': True, 'height': 900, 'keep_aspect_ratio': True, 'only_shrink_larger_images': True, 'width': 999999}
{'default': False, 'height': 680, 'keep_aspect_ratio': False, 'only_shrink_larger_images': False, 'width': 450}
Resize Covers::rebuild_menus - size_data={'default': False, 'height': 680, 'keep_aspect_ratio': False, 'only_shrink_larger_images': False, 'width': 450}
{'default': False, 'height': 800, 'keep_aspect_ratio': True, 'only_shrink_larger_images': False, 'width': 600}
Resize Covers::rebuild_menus - size_data={'default': False, 'height': 800, 'keep_aspect_ratio': True, 'only_shrink_larger_images': False, 'width': 600}
{'default': False, 'height': 1024, 'keep_aspect_ratio': True, 'only_shrink_larger_images': False, 'width': 758}
Resize Covers::rebuild_menus - size_data={'default': False, 'height': 1024, 'keep_aspect_ratio': True, 'only_shrink_larger_images': False, 'width': 758}
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
qt.gui.imageio: libpng warning: iCCP: cHRM chunk does not match sRGB
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
backend.get_template_functions add, and, approximate_formats, arguments, assign, author_links, author_sorts, book_count, book_values, booksize, capitalize, character, check_yes_no, ceiling, cmp, connected_device_name, connected_device_uuid, contains, count, list_count, current_library_name, current_library_path, current_virtual_library_name, date_arithmetic, days_between, divide, eval, first_non_empty, field, field_exists, finish_formatting, first_matching_cmp, floor, format_date, format_number, formats_modtimes, formats_paths, formats_sizes, fractional_part, globals, has_cover, human_readable, identifier_in_list, ifempty, language_codes, language_strings, in_list, list_contains, is_marked, list_count_matching, count_matching, list_difference, list_equals, list_intersection, list_item, list_join, list_re, list_re_group, list_remove_duplicates, list_sort, list_split, list_union, merge_lists, lookup, lowercase, mod, multiply, not, ondevice, or, print, rating_to_stars, range, raw_field, raw_list, re, re_group, round, select, series_sort, set_globals, shorten, strcat, strcat_max, strcmp, str_in_list, strlen, subitems, sublist, substr, subtract, swap_around_articles, swap_around_comma, switch, template, test, titlecase, today, transliterate, uppercase, urls_from_identifiers, user_categories, virtual_libraries, annotation_count, aamy_ifempty
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
EpubMerge: DEBUG: 2022-07-12 11:56:05,010: calibre_plugins.epubmerge.epubmerge_plugin(155): macmenuhack file_path:C:\Users\davidfor\AppData\Roaming\calibre\plugins\fanficfare_macmenuhack.txt
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
FFF: INFO: 2022-07-12 11:56:05,035: calibre_plugins.fanficfare_plugin.prefs(214): Using default settings
FFF: DEBUG: 2022-07-12 11:56:05,076: calibre_plugins.fanficfare_plugin.fff_plugin(218): Plugin FanFicFare macmenuhack file_path:C:\Users\davidfor\AppData\Roaming\calibre\plugins\fanficfare_macmenuhack.txt
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
QLayout::addChildLayout: layout "" already has a parent
DEBUG:    4.9 HttpHelper::__init__: proxy=None
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
DEBUG:    4.7 No Kobo Touch, Glo or Mini appears to be connected
DEBUG:    4.8 rebuild_menus - self.supports_ratings=None, self.supports_tiles=None
DEBUG:    4.8 KoboUtilities:set_toolbar_button_tooltip - start: text='None'
DEBUG:    4.8 KoboUtilities:set_toolbar_button_tooltip - setting to text='Utilities to use with Kobo ereaders

Driver: KoboTouchExtended'
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
Key 'Ctrl+Shift+S' for shortcut Exact text search is already used by Power Search, ignoring
backend.close - unloading template functions 32d3fa1c-9a4a-450a-a422-e0dcface23d5
[7.64] main UI initialized...
[7.64] Hiding splash screen
Starting QuickView
[8.31] splash screen hidden
[8.31] Started up in 8.31 seconds with 1 books
davidfor is offline   Reply With Quote
Old 07-11-2022, 10:27 PM   #4
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
And the problem is in the plugin Clean Comments. That has:
Code:
    def build_menus(self):
        m = self.menu
        m.clear()

        candidate = self.gui.library_path
        db = LibraryDatabase (candidate)
I don't know why it is doing that as it doesn't actually use the database in that, or the other method. Where it does use the database, it connects to it properly.

Removing the last two lines, plus the similar ones elsewhere, fixes the problem.

And I have posted a fixed version in the plugins thread.

Last edited by davidfor; 07-11-2022 at 10:41 PM.
davidfor is offline   Reply With Quote
Old 07-12-2022, 04:37 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: 12,362
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I see what is happening. When you open a database it registers its user-defined formatter functions using the library UUID. When a database instance is closed it de-registers them using that UUID. This means that if you open the *same* database twice then the functions are registered using the same UUID, which in practice means they are registered once. When either is closed the functions for both are deregistered because they share the UUID.

You can see this happening in your log:
Code:
backend.close - unloading template functions 32d3fa1c-9a4a-450a-a422-e0dcface23d5
[7.64] main UI initialized...
The problem can be avoided by passing is_second_db=True when opening the database.

I looked at checking for a second registration of functions for a given database. That won't work because it is legal to re-register functions for an open db instance, for example when functions are created/changed in preferences / template functions.
chaley is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using built-in template functions in a custom template function ilovejedd Library Management 4 01-28-2018 12:20 PM
Problem with template functions and library maintenance Terisa de morgan Library Management 12 03-11-2017 09:43 PM
template: if one of the tag is something... maybe contains or in_list functions fxp33 Calibre 4 07-19-2014 05:18 AM
Help Please - user defined USB problem HeavyTZM Library Management 4 11-26-2011 09:06 PM
Help Please - user defined USB problem HeavyTZM General Discussions 4 11-26-2011 05:36 PM


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


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