Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 04-07-2023, 04:31 PM   #1066
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Question: If I set this to run on 1 book, can it get around problems when it's running on a selection rather than individual books?
Quote:
Originally Posted by ownedbycats View Post
Use-case 2: Using an action with a conditional that checks something from the current book.
That is whate template scopes is for. It allows you narrow down the action scope to whatever number of books based on whatever criteria you want. If you want the action to work on some books but not other, use template scope.

Quote:
Originally Posted by ownedbycats View Post
Use-case 3: This.
The same principle applies here. You narrow it down using template scopes.

Edit: For actions that does not support scopes, namely Calibre Actions, you use the "Search Using Templates" action in the same way you would the template scopes.
capink is offline   Reply With Quote
Old 04-08-2023, 07:57 PM   #1067
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: 10,988
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Ampersand escape bug in submenus.
Attached Thumbnails
Click image for larger version

Name:	2023-04-08 20_57_07-Window.png
Views:	901
Size:	11.4 KB
ID:	200888   Click image for larger version

Name:	2023-04-08 20_57_28-Window.png
Views:	894
Size:	3.4 KB
ID:	200889  
ownedbycats is offline   Reply With Quote
Old 04-09-2023, 03:25 AM   #1068
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,611
Karma: 7891011
Join Date: Sep 2020
Device: none
Hi, I was testing something else and found I couldn't start the Content Server when running from current source (latest commit: a9cec37) with Action Chains enabled. I had a previous version archived (1.18.3) and server wouldn't start using that version either... After removing Action Chains, content server could be started running from source.

Anyway, I'm reporting this just in case it becomes a relevant issue, as everything is working fine with the latest official 6.15.1 release and AC latest version 1.18.5.
Comfy.n is offline   Reply With Quote
Old 04-09-2023, 06:09 AM   #1069
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Updating to the latest version should take care of this. There were recently some changes in calibre that renders older versions incompatible.

Last edited by capink; 04-09-2023 at 06:12 AM.
capink is offline   Reply With Quote
Old 04-10-2023, 02:42 AM   #1070
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: 10,988
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Question: Is intended or unavoidable that a runtime SFE on 'language' shows only the short language codes?
Attached Thumbnails
Click image for larger version

Name:	2023-04-10 03_44_32-Edit Field.png
Views:	861
Size:	4.9 KB
ID:	200922  

Last edited by ownedbycats; 04-10-2023 at 02:49 AM. Reason: screenshot add
ownedbycats is offline   Reply With Quote
Old 04-10-2023, 03:09 AM   #1071
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Question: Is intended or unavoidable that a runtime SFE on 'language' shows only the short language codes?
Let's just say it was easier and involved less work. I was not willing to put in the required work for what I thought would be the least used field/datatype.

Last edited by capink; 04-10-2023 at 03:15 AM.
capink is offline   Reply With Quote
Old 04-10-2023, 03:19 AM   #1072
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: 10,988
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Makes sense. By 'unavoidable' I probably meant 'a bit annoying to bother changing'
ownedbycats is offline   Reply With Quote
Old 04-12-2023, 05:53 PM   #1073
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: 10,988
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I am making a formula that displays some statistics:

Code:
program:
strcat(
	$author, ' - ', $title, character('newline'),
	'Chapter Count: ', $$#chaptercount, character('newline'),
	'Page Count: ', $$#pagecount,character('newline'),
	'Average Pages per Chapter: ', format_number((divide($$#pagecount, $$#chaptercount)), '{0:5.2f}')
	);
Click image for larger version

Name:	2023-04-12 18_56_07-Formulas.png
Views:	834
Size:	8.4 KB
ID:	201004

If I run it on multiple books, it only displays information for one. How should I change the template to display information for each selected book?

Last edited by ownedbycats; 04-12-2023 at 05:56 PM. Reason: adding screenshot
ownedbycats is offline   Reply With Quote
Old 04-12-2023, 07:28 PM   #1074
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
You have one of two approaches:
  • One Formulas Action: You replace the formula you have above with this one:
    Code:
    program:
        report = '';
        for book_id in from_selection('id'):
            report = strcat(
                report,
                character('newline'),
                book_field(book_id, 'author'), ' - ', book_field(book_id, 'title'), character('newline'),
                'Chapter Count: ', book_raw_field(book_id, '#chaptercount'), character('newline'),
                'Page Count: ', book_raw_field(book_id, '#pagecount'),character('newline'),
                'Average Pages per Chapter: ', format_number((divide(book_raw_field(book_id, '#pagecount'), book_raw_field(book_id, '#chaptercount'))), '{0:5.2f}'),
                )
        rof;
        report
    As you can see it uses for loop to traverse all selected books (from_selection function). It can access metadata for books using the book_field() and book_raw_field() functions, both of which needs the book_id.

    This might be slightly slower than the second approach, I've never done any bench-marking and not interested in doing it, because the speed is fine for me.


  • Two Actions Chain (Chain Variables + Formulas): If you don't want to dabble in plugin specific functions like from_selection, book_field ...etc, do the following:

    First add a Chain Variables action, then add a variable called report and remember to tick the iterate checkbox, then add this template:

    Code:
    program:
        report = globals(report);
        strcat(
            report,
            character('newline'),
            $author, ' - ', $title, character('newline'),
            'Chapter Count: ', $$#chaptercount, character('newline'),
            'Page Count: ', $$#pagecount,character('newline'),
            'Average Pages per Chapter: ', format_number((divide($$#pagecount, $$#chaptercount)), '{0:5.2f}')
            )
    Now add a Formulas Action with the following template:

    Code:
    program:
        globals(report)

N.B This is the same approach I talked about when I told you to narrow down the books scope using templates scope. So if you have an action that needs to act on a subset of selected books, you filter the books ids you want to act upon using one of the two above techniques, and feed the list of book_ids to the action via template scopes.

Last edited by capink; 04-12-2023 at 07:31 PM.
capink is offline   Reply With Quote
Old 04-12-2023, 11:51 PM   #1075
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: 10,988
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
The speed of the first one doesn't seem too much. Thanks

I've been testing out template scopes (duplicating existing chains is helpful for this). I think I've got it mostly figured out by now.
ownedbycats is offline   Reply With Quote
Old 04-13-2023, 05:55 PM   #1076
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: 10,988
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Selection Modifier: Would any of the options select 'initial selection before running chain'?
ownedbycats is offline   Reply With Quote
Old 04-13-2023, 06:07 PM   #1077
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Selection Modifier: Would any of the options select 'initial selection before running chain'?
No. You have to save them by creating a Chain Variables as the first action, with a variable called initial_selection:

Code:
program:
    from_selection('id')
Whenever you need to re-select these books, create a "Search Using Template" action with the following template:

Code:
program:
    globals(initial_selection)
You also have to select the option "Template Output is a list of ids", and tick the checkbox "Select all books resulting from this template"

Notes:
  • You have to ensure that the current library view shows all the books, or at least showing the books you are trying to select, so it is better to insert a selection modifier clearing any previous search.
  • Using this approach you are not restricted to only choosing the books before running the chain. You can save and restore selection during any point in the chain e.g. restore selection before 3rd action and so on.

Last edited by capink; 04-13-2023 at 06:28 PM. Reason: typo in variable name
capink is offline   Reply With Quote
Old 04-13-2023, 06:37 PM   #1078
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: 10,988
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Thanks

I think tips and tricks like this would be helpful for the second reserved post
ownedbycats is offline   Reply With Quote
Old 04-13-2023, 06:57 PM   #1079
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
There is already a section of Misc Tips in the first post. I will add this to it.
capink is offline   Reply With Quote
Old 04-18-2023, 07:08 PM   #1080
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: 10,988
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
A new question: A while ago, I think you mentioned changes to the icons. Does that include using a custom folder instead of resources/images? Generate Cover and Job Spy both use a folder in plugins, for example.

A few days ago, I couldn't figure out why a tag browser icon had changed until I realized I had a 'series.png' used by Action Chains. (Renaming to icon_series.png fixed it.)
ownedbycats is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Editor Plugin] Editor Chains capink Plugins 106 06-17-2025 05:36 PM
Action Chains Resources capink Plugins 77 06-16-2025 12:45 PM
[GUI Plugin] Noosfere_util, a companion plugin to noosfere DB lrpirlet Plugins 2 08-18-2022 03:15 PM
[GUI Plugin] Save Virtual Libraries To Column (GUI) chaley Plugins 14 04-04-2021 05:25 AM


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


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