Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 03-15-2021, 03:55 PM   #1
lrpirlet
Enthusiast
lrpirlet began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Mar 2020
Location: Belgium (sorry I speaks french only)
Device: PW3, Kobo Libra H2O
One possible bug report, two questions about developing metadata sources sources

I have a working metadata source that download information from noosfere. Well, when I say working, it means that I have been able to download correctly about 100 metadata books without failure. Yet I still need to bring in some fine tuning...

To perform that I need to introduce a boolean, a number, a choice and maybe a text into the "configure Metadata download" window. I can make the various boxes without problem, but it seems that the "restore defaults" button does nothing... for any metadata source I have tried. According to the class Option(object) doc there is a param default. Do I miss something??

Now, I find very unclear how to make the "param name" in the option to become available to the plugin code. Is there any doc I should read about that? (Sorry if that is noob question, I make that project to learn python and object programming)

Is there a way to verify, from inside the source plugin, if we are in bulk mode or in single book mode. I am playing with the idea to have a different behavior.

Last, but not least, noosfere does present several "volumes" for the same book. The volume share the authors and the text, but the publisher, the publication date, the isbn, the cover, the... may or may not be different. I have created a dedicated nsfr_id that is unique to each volume of a single book... Is that id enough to prevent auto-grouping of several book with same title and authors??? (i know about the tick box that allows to "keep more than one entry per source" in the configure Metadata download)

Thanks in advance for any help.
lrpirlet is offline   Reply With Quote
Old 03-16-2021, 07:55 AM   #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: 39,658
Karma: 17465128
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
restore defaults doesnt act on plugin specific settings, there would need to be a plugin specic restore button for those, which I havent bothered to create.

self.prefs['param_name']
kovidgoyal is offline   Reply With Quote
Advert
Old 03-16-2021, 09:49 AM   #3
lrpirlet
Enthusiast
lrpirlet began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Mar 2020
Location: Belgium (sorry I speaks french only)
Device: PW3, Kobo Libra H2O
Thanks

Ok, fair enough this explains the behavior and that is ok for me...

I could make the Option work, but I am still not to sure I understand... I did copy it from other source plugin without really understanding. All options do work like I expected...

Code:
    options = (
            Option(
                   'priority_handling',
                   'choices',
                   '1le_plus_ancien_avec_un_isbn',
                   _('priorité de tri:'),
                   _("Comment pousser la priorité d'un volume, si plusieurs existent."),
                   choices=PRIORITY_HANDLING
                   ),
            Option(
                   'fat_publisher',
                   'bool',
                   False,
                   _("Ajoute collection et son numéro d'ordre au champ èditeur"),
                   _("Cochez cette case pour ajouter la collection et son numéro d'ordre au champs de l'éditeur.")
                   ),
            Option(
                   'debug_level',
                   'number',
                   0,
                   _('Loquacité du journal, de 0 à 7'),
                   _('Le niveau de loquacité. O un minimum de rapport, 1 rapport etendu de __init__,'
                     ' 2 rapport étendu de worker, 4 rapport etendu des annexes... La somme 3, 5 ou 7'
                     ' peut etre introduite. Ainsi 7 donne un maximun de rapport. Note: ce sont les 3'
                     ' derniers bits de debug_level en notation binaire')
                   ),
            )

    @property
    def priority_handling(self):
        x = getattr(self, 'prio_handling', None)
        if x is not None:
            return x
        prio_handling = self.prefs['priority_handling']
        if prio_handling not in self.PRIORITY_HANDLING:
            prio_handling = self.PRIORITY_HANDLING[0]
        return prio_handling
 
   @property
    def extended_publisher(self):
        x = getattr(self, 'ext_pub', None)
        if x is not None:
            return x
        ext_pub = self.prefs.get('fat_publisher', False)
        return ext_pub

    @property
    def dbg_lvl(self):
        x = getattr(self, 'dl', None)
        if x is not None:
            return x
        dl = self.prefs.get('debug_level', False)
        return dl
May I assume that priority_handling, fat_publisher and debug_level as I define it in the option are in fact variables somewhere in calibre that will be remembered across restart?

Then may I assume that self.prefs and self.prefs.get are 2 versions of the same code? What is the role of the @property decorator in the case of self.prefs.get??

Not that this will make my code better, but I really would like to understand what I am doing (blindly)

Again, thanks in advance.

Last edited by lrpirlet; 03-16-2021 at 10:01 AM.
lrpirlet is offline   Reply With Quote
Old 03-16-2021, 10:03 AM   #4
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: 39,658
Karma: 17465128
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
yes they persist and yes you can use either form.
kovidgoyal is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Metadata Sources Questions (Fastest, Differences) Richs Library Management 1 02-27-2014 05:03 PM
manga metadata sources? cptsquid Library Management 2 10-10-2013 05:27 PM
Metadata sources PhM Library Management 1 05-13-2011 11:58 AM
Metadata sources pappcam Plugins 0 02-21-2011 09:36 PM
Italian metadata sources giovpres Calibre 1 12-02-2010 09:07 AM


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


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