Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 01-07-2021, 03:15 PM   #1
feuille
Connoisseur
feuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enough
 
Posts: 59
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
More than one result per metadata source

Hello,

a title search in a metadata source found two results. Both are in result queue, as the log says. The results are two different books with the same title, but distinct authors and identifiers.

In the metadata source configuration, the check box "more than one entry per source" is checked. Both entrys have priority 0.

But in the gui only the 2nd book found is visible.

Any hints?

Thanks!
feuille is offline   Reply With Quote
Old 01-07-2021, 09:48 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: 44,428
Karma: 24044628
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
metadata results are coalesced before being presented to the user if calibre determines they are the same. Although if as you say they have all different identifiers, they should not be getting coalesced. Look at the log,
kovidgoyal is offline   Reply With Quote
Advert
Old 01-11-2021, 07:09 AM   #3
feuille
Connoisseur
feuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enough
 
Posts: 59
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
Perhaps found the cause

Hello Kovid,

looking into the log is good, looking into the source is even better ;-)

In calibre\src\calibre\ebooks\metadata\sources\identi fy.py the results may be mixed or not according to different criteria.

Since the search with identifier is preferred, I soon suspected the ISBN as bad guy.
Hit!
My source only has ISBNs in a few cases, namely for paperbacks. Most books are booklets with no ISBN, so i have created a identifier.

In this case there were two sources: a paperback with ISBN and a booklet without ISBN. As I said, both have the same title, but different authors, identifiers, series, publication dates etc.

With ISBN identifier in one of the two sources the log says:

Found 2 results
(...)
Merging results from different sources
We have 1 merged results, merging took: 0.00 seconds


When i comment out the setting of the ISBN identifier in my plugin, the log says:

Found 2 results
(...)
Merging results from different sources
We have 2 merged results, merging took: 0.00 seconds


And in the GUI both are listed.
Can you check that please.
feuille is offline   Reply With Quote
Old 01-11-2021, 09:47 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: 44,428
Karma: 24044628
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I dont see how thats possible. Merging on title is by (title, authors) so if the authors are different it wont merge. And merging on identifiers happens when there is at least one common identifier. So one of those two criteria must be true.
kovidgoyal is offline   Reply With Quote
Old 01-12-2021, 07:31 AM   #5
feuille
Connoisseur
feuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enough
 
Posts: 59
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
Side effect on isbn?

Hello Kovid,

thanks for the answer. This is was i've seen in identify.py. But, again, i've two results (comments are omitted):

Found 2 results
---
Title : Schergen der SOL
Author(s) : Rüdiger Schäfer
Publisher : Pabel-Moewig Verlag KG
Tags : None, None, SOL, Mausefalle-System
Series : Atlan - Das absolute Abenteuer #2
Languages : deu
Published : 2013-02-15T01:00:00+00:00
Identifiers : ppid:ATH2, isbn:9783845347547
---
Title : Schergen der SOL
Author(s) : Peter Terrid
Publisher : Pabel-Moewig Verlag KG
Tags : Die Abenteuer der SOL, Die Solaner, SOL, Atlan, Wort Danyl, Chart Deccon, Kav Wergen, Tordya, Voorn Mekher
Series : Atlan-Heftserie #503
Languages : deu
Published : 1981-01-01T01:00:00+00:00
Identifiers : ppid:A503


And when the line

mi.set_identifier('isbn', isbn)

is active, only the result with the isbn is displayed. When comment out, both results are displayed. No other change, i swear!
feuille is offline   Reply With Quote
Advert
Old 09-24-2024, 10:54 AM   #6
feuille
Connoisseur
feuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enough
 
Posts: 59
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
Quote:
Originally Posted by feuille View Post
Hello Kovid,

And when the line

mi.set_identifier('isbn', isbn)

is active, only the result with the isbn is displayed. When comment out, both results are displayed. No other change, I swear!
Hello Kovid,
it's been a while, but in another plugin (from another author) I've stumbled over the same issue: The log shows three books with search string in title, only one with ISBN. In the GUI, only the result with ISBN is displayed. This time, I'm searching the Calibre source in https://github.com/kovidgoyal/calibr...es/identify.py and found a code sequence, who is possible the cause for this behavior:

Code:
        # Now handle results that have no ISBNs
        results = sorted(self.isbnless_results,
                key=attrgetter('relevance_in_source'))
        # Only use results that are from sources that have not also returned a
        # result with an ISBN
        results = [r for r in results if r.identify_plugin not in isbn_sources or not r.identify_plugin.prefer_results_with_isbn]
        if results:
            # Pick only the most relevant result from each source
            seen = set()
            for result in results:
                if msprefs['keep_dups'] or result.identify_plugin not in seen:
                    seen.add(result.identify_plugin)
                    self.results.append(result)
                    result.average_source_relevance = \
                        result.relevance_in_source

        self.merge_metadata_results()
Is there a way to set
Code:
msprefs['keep_dups']
or another option to avoid the merge process?
feuille is offline   Reply With Quote
Old 09-24-2024, 12:57 PM   #7
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: 44,428
Karma: 24044628
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by kovidgoyal View Post
I dont see how thats possible. Merging on title is by (title, authors) so if the authors are different it wont merge. And merging on identifiers happens when there is at least one common identifier. So one of those two criteria must be true.
As I said, merging happens when one identifier is common. So if you set the isbn to a comman value then the results will be merged. If the isbn is not set to a common value they wont beunless title and author match.
kovidgoyal is offline   Reply With Quote
Old 09-26-2024, 06:09 AM   #8
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 772
Karma: 2298438
Join Date: Jan 2017
Location: Poland
Device: Various
@feuille:

I understand your problem, but it is not directly related to identify.py.

It's just that, by default, the result that contains the ISBN identifier is preferred – look in the base.py file:
Code:
#: If set to True, and this source returns multiple results for a query,
#: some of which have ISBNs and some of which do not, the results without
#: ISBNs will be ignored
prefer_results_with_isbn = True
You can easily override this, simply below among the other options in your plugin, e.g.

Code:
has_html_comments = True
can_get_multiple_covers = True
cached_cover_url_is_reliable = True
Add one more option:

Code:
prefer_results_with_isbn = False
And of course, disable the inline comment:

Code:
mi.set_identifier(‘isbn’, isbn)
BeckyEbook is offline   Reply With Quote
Old 09-26-2024, 08:54 AM   #9
feuille
Connoisseur
feuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enough
 
Posts: 59
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
Quote:
Originally Posted by BeckyEbook View Post
@feuille:

It's just that, by default, the result that contains the ISBN identifier is preferred – look in the base.py file:
Hello BeckyEbook,
I set it up like this yesterday and tested it after studying the code in base.py again. It works! But I wanted to make sure before giving feedback. Thanks for the confirmation!
feuille is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add new metadata source richardofyork Library Management 1 10-25-2017 01:58 PM
Download Metadata - Showing Only 1 Result chris_crawford Calibre 10 04-12-2015 11:38 PM
Download metadata merge result ? abuck Library Management 1 10-11-2013 08:49 AM
Metadata source? rp272 Library Management 1 08-02-2011 09:33 AM
Is there any way to add a metadata source? slayda Calibre 3 06-09-2011 07:06 AM


All times are GMT -4. The time now is 02:26 PM.


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