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 02-06-2023, 07:21 PM   #8011
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,993
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by nan1923 View Post
Thank you for the answer, I didn't know that about using templates.
Now maybe a dumb question, my test template works in the template tester, then I stored it as a stored template, but how do I get it to activate as a setting for the whole bib and actually change the metadata?
program: storedtemplatename() in the template of a 'column built from columns'
ownedbycats is online now   Reply With Quote
Old 02-06-2023, 07:53 PM   #8012
nan1923
Enthusiast
nan1923 doesn't litternan1923 doesn't litter
 
Posts: 25
Karma: 140
Join Date: Jul 2022
Device: none
It works! Thank you!

Now onto making the metadata editing a bit more efficient in my bib

nan1923 is offline   Reply With Quote
Advert
Old 02-07-2023, 01:42 AM   #8013
culytera
Zealot
culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.
 
Posts: 125
Karma: 295674
Join Date: Jul 2021
Device: iPhone
Quote:
Originally Posted by ownedbycats View Post
I use this for displaying floating-point purchase cost in the tag browser. It can be easily changed to use integer wordcount.

EDIT: Note switch_if is a relatively new function, two or three versions ago. If you're using an older version may not be present.

Code:
...
I tried to make a template for grouping word count on Calibre based on this, but it wasn't working properly for me despite having Calibre updated. I saw a different one which worked.
Code:
program:
	getWordCount = field('#ao3_words');
	wordCount = re(getWordCount, '[,]', '');
	first_non_empty(
		cmp(wordCount, 5001, '0 - 5000', '', ''),
		cmp(wordCount, 10001, '5001 - 10000', '', ''),
		cmp(wordCount, 20001, '10001 - 20000', '', ''),
		cmp(wordCount, 40001, '20001 - 40000', '', ''),
		cmp(wordCount, 80001, '40001 - 80000', '', ''),
		'80000+'
);
It looks like this for me. I wish MapleRead could sort by groups, but it's limited so I'm making do with tag grouping.
Attached Thumbnails
Click image for larger version

Name:	[calibre] 2023-02-07 14-20-03.jpg
Views:	193
Size:	84.5 KB
ID:	199548  
culytera is offline   Reply With Quote
Old 02-07-2023, 10:23 AM   #8014
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,993
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Where 'metadata' is a placeholder for an actual entry, is there any functional difference between:

Code:
include_metadata_pre:

 metadata=~^(foo|bar)$
Code:
include_metadata_pre:

 metadata=~^foo$
 metadata=~^bar$
ownedbycats is online now   Reply With Quote
Old 02-07-2023, 10:53 AM   #8015
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,974
Karma: 4604635
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
In include/exclude lines, I don't think so.

I'd try ==foo instead of =~^foo$ -- assuming foo is a simple string and not a pattern.
JimmXinu is offline   Reply With Quote
Advert
Old 02-07-2023, 05:52 PM   #8016
Ascello
Enthusiast
Ascello began at the beginning.
 
Posts: 45
Karma: 10
Join Date: Jan 2021
Device: Kindle Paperwhite 4
I have an atypical question: So, I wrote myself a site adapter for a personal blog-thingy (so sorry, can't share this one), and it works just fine with CLI version, once I dropped it in proper folder. However, i would like to use it with Calibre. It doesn't seem to work from CLI folder (maybe because I installed CLI version separately with pip. I'm a noob, I do 70% things wrong). What is the default path for FFF adapters for Calibre plugin? Is there even one? Is there any way to use a custom adapter with Calibre plugin? I only found a .zip file in what I believe to be calibre install folder, but there are no adapters inside it. Not gonna lie, it's quite possible I simply messed something up, since I'm on linux currently, but I have extremely minimal knowledge how to use it, and in general I'm way over my head with what I'm trying to do.
Ascello is offline   Reply With Quote
Old 02-07-2023, 06:00 PM   #8017
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,993
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Assuming Windows, check
C:\Users\[YourUser]\AppData\Roaming\Calibre\plugins\FanFicFare.zip\fa nficfare\adapters

I don't know if you need to modify other files
ownedbycats is online now   Reply With Quote
Old 02-07-2023, 06:36 PM   #8018
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,993
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Code:
[archiveofourown.org]
chapterslashtotal_label:Chapters
add_to_titlepage_entries:,chapterslashtotal
This adds the chapterslashtotal to the end of the titlepage. What should I do if I instead want to replace chapters? (Forum search is a pain to use.)

Less a priority, but is it possible to display it for only "5/10" and not "5/?" or "5/5"?

EDIT: Copy category? Need to figure out the regex.

Last edited by ownedbycats; 02-07-2023 at 07:59 PM.
ownedbycats is online now   Reply With Quote
Old 02-07-2023, 08:18 PM   #8019
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,993
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I managed to work this out. x/x and x/? fics get just the first number; x/y fics get both. Please let me know if any improvements to be made:

Code:
[defaults]
# 'add_to_' concats on to existing param, thus the leading comma
add_to_extra_valid_entries:,oneshot,tagscategory,covertype,ao3chaps

[archiveofourown.org]
## Chapter formatting
include_in_ao3chaps:chapterslashtotal
ao3chaps_label:Chapters
titlepage_entries: seriesHTML,category,genre,language,characters,ships,status,datePublished,dateUpdated,dateCreated,rating,warnings,ao3chaps,numWords,publisher,description

add_to_replace_metadata:
 ao3chaps=>^(\d+)/\1$=>\g<1>
 ao3chaps=>^(\d+)/\?$=>\g<1>
ownedbycats is online now   Reply With Quote
Old 02-07-2023, 08:19 PM   #8020
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,974
Karma: 4604635
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Quote:
Originally Posted by Ascello View Post
I have an atypical question: So, I wrote myself a site adapter for a personal blog-thingy (so sorry, can't share this one), and it works just fine with CLI version, once I dropped it in proper folder. However, i would like to use it with Calibre.
...
The plugin code is all in the plugin zip file. If you put your adapter (and edited __init__.py file) in fanficfare\adapters in the installed zip file it should work.

You can find the dir with the plugin zips from Calibre Preferences > Misc > Open calibre config dir. Dir named 'plugins'.

Quote:
Originally Posted by ownedbycats View Post
This adds the chapterslashtotal to the end of the titlepage. What should I do if I instead want to replace chapters? (Forum search is a pain to use.)

Less a priority, but is it possible to display it for only "5/10" and not "5/?" or "5/5"?

EDIT: Copy category? Need to figure out the regex.
Replace titlepage_entries instead of add_to_. The default value in defaults.ini is under [defaults].

Suppressing or removing "/\?" should be easy enough, just remember to escape the '?'. The key to 5/5, 6/6, etc is regexp back references.

No idea what you mean by copying category. What's that have to do with chapters?
JimmXinu is offline   Reply With Quote
Old 02-07-2023, 08:24 PM   #8021
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,993
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
"Copy category" is my general term for copying metadata entry to a custom one. Maybe I need to come up with a better one.
ownedbycats is online now   Reply With Quote
Old 02-07-2023, 08:40 PM   #8022
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,974
Karma: 4604635
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Quote:
Originally Posted by ownedbycats View Post
I managed to work this out. x/x and x/? fics get just the first number; x/y fics get both. Please let me know if any improvements to be made:
Well, since you asked...
  1. To the best of my knowledge, there's no reason to copy chapterslashtotal to a new entry instead of editing chapterslashtotal.
    But kudos for preemptive paranoia.
  2. I think it would be slightly cheaper computationally to do:
    Code:
     ao3chaps=>/\?$=>
    IE, just removing the trailing /? rather than also matching number and replacing both with the number. But I doubt you could even measure the difference in normal use.
  3. I wouldn't use both \1 and \g<1> in the same line. There's no difference in this case and it invites possible future confusion.
    By which I mean, I had to look up \g<1> to be sure it didn't have some additional special meaning.
JimmXinu is offline   Reply With Quote
Old 02-07-2023, 09:47 PM   #8023
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,993
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Thanks. I think using \g instead of \1 was just a bit of a leftover from trial-and-erroring in regex101.
ownedbycats is online now   Reply With Quote
Old 02-08-2023, 12:12 PM   #8024
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,993
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I added a slightly modified version (editing chapterslashtotal directly rather than copying it to a custom entry) to this page.
ownedbycats is online now   Reply With Quote
Old 02-08-2023, 01:03 PM   #8025
Ascello
Enthusiast
Ascello began at the beginning.
 
Posts: 45
Karma: 10
Join Date: Jan 2021
Device: Kindle Paperwhite 4
Quote:
Originally Posted by JimmXinu View Post
The plugin code is all in the plugin zip file. If you put your adapter (and edited __init__.py file) in fanficfare\adapters in the installed zip file it should work.

You can find the dir with the plugin zips from Calibre Preferences > Misc > Open calibre config dir. Dir named 'plugins'.
Hmm, so your method takes me to /home/myusername/.config/calibre/plugins/ (i'm on arch linux, but I just started to learn how to use linux rn, so that's why I have issues now, rip), but there is no fanficfare.zip file in there. I found the .zip file in /usr/share/calibre/system-plugins/, and that might actually be fine for my distro. However my issue is that there is no "adapters" folder in this .zip file. So after I open the FanFicFare.zip file, and then open fanficfare folder, the only things inside are default.ini, example.ini and browsercache folder. So clearly the plugin stores even my personal.ini somewhere else and it must be pulling adapters from somewhere else, but I have no idea from where. And this is definitely a correct .zip file, as I slightly modified plugin-defaults.ini (really, I just added a line that says #TEST123) and it was visible in calibre plugin.

EDIT: Here's a screenshot of my FanFicFare.zip file content, so that it's easier to understand what I mean, because I don't believe I explain myself well. I uploaded the screenshot to GoogleDrive, because it was easiest.

EDIT2: NVM, PROBLEM SOLVED.
Apparently it does pull adapters from same folder as CLI. Adn apparently it works just fine right now, without me changing anything. Why it didn't work yesterday? No idea! I've changed nothing. Maybe turning the PC on/off did the trick, how should I know. Still, thanks for help.

Last edited by Ascello; 02-08-2023 at 01:40 PM. Reason: Problem self-solved by mysterious ways of computers
Ascello is offline   Reply With Quote
Reply

Tags
fanfiction


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] KindleUnpack - The Plugin DiapDealer Plugins 523 07-15-2025 06:45 PM
[GUI Plugin] Open With kiwidude Plugins 404 02-21-2025 05:42 AM
[GUI Plugin] Marvin XD Philantrop Plugins 126 01-29-2017 12:48 PM
[GUI Plugin] KiNotes -axel- Plugins 0 07-14-2013 06:39 PM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM


All times are GMT -4. The time now is 10:08 PM.


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