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 05-16-2024, 05:03 AM   #1
dandman
Enthusiast
dandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watch
 
Posts: 29
Karma: 10545
Join Date: May 2024
Device: none
Metadata plugun multiple results

i am trying to cause Caliber show multiple book options to the user (in case i cannot pinpoint the exact book)

i do that by adding several Metadata objects into the result_queue
i also check the size of the queue before the end of the identify() function and it has multiple entries (i also print the results to the log)

but the UI always show only one result,
why is that ?
can it be done (show more then 1 results) ?

here is a sample of my code flow:

PHP Code:
    def identify(selflogLogresult_queueQueueabortEventtitlestr NoneauthorsIterable[str] = NoneidentifiersMapping[strstr] = Nonetimeoutint 10) -> None:
        
log.info("=================  identify()  =================")

        ...

        
log.info(f"********** in Q before {result_queue.qsize()}")
        
self.retrieve_book_details(logbook_idiresult_queueaborttimeout)
        
log.info(f"********** in Q after {result_queue.qsize()}")



    
def retrieve_book_details(selflogLogplugin_idstrrelevanceintresult_queueQueueabortEventtimeoutint) -> None:
        
log.info(f"Q size {result_queue.qsize()}")
        
log.info("=================  retrieve_book_details()  =================")
        
mi Metadata(titleauthors)

        ...

        
log.info(f"adding to Q[{result_queue.qsize()}]: {mi}")
        
result_queue.put(mi)
        
log.info(f"added to Q[{result_queue.qsize()}]"

this is an example of the log i get after process of metadata retrieve is finished:


Code:
The log from individual plugins is below 

...

****************************** e-plugin (100, 4, 21) ****************************** 
Found 15 results 
Downloading from e-plugin took 7.139270305633545 

...

********** in Q before: 0
Q size: 0
=================  retrieve_book_details()  =================
adding to Q[0]: ...
added to Q[1]
********** in Q after: 1


...

********** in Q before: 14
Q size: 14
=================  retrieve_book_details()  =================
adding to Q[14]: ...
added to Q[15]
********** in Q after: 15

******************************************************************************** 
The identify phase took 7.19 seconds 
The longest time (7.139270) was taken by: e-plugin 
Merging results from different sources 
We have 1 merged results, merging took: 0.00 seconds
dandman is offline   Reply With Quote
Old 05-16-2024, 05:26 AM   #2
dandman
Enthusiast
dandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watch
 
Posts: 29
Karma: 10545
Join Date: May 2024
Device: none
never mind i found the checkbox to allow more then one result from a single plugin,

Code:
Preferences -> Metadata Download -> keep more than one entry per source
i thought that it only display one if the results are **THE SAME**, but apparently it is simple 1 or multi checkbox
dandman is offline   Reply With Quote
Advert
Old 05-16-2024, 06:32 AM   #3
lewisch
Junior Member
lewisch began at the beginning.
 
Posts: 2
Karma: 10
Join Date: May 2024
Device: Kobo Libra 2
Quote:
Originally Posted by dandman View Post
never mind i found the checkbox to allow more then one result from a single plugin,

Code:
Preferences -> Metadata Download -> keep more than one entry per source
i thought that it only display one if the results are **THE SAME**, but apparently it is simple 1 or multi checkbox
Does it save all the records or just the ones that are different?
lewisch is offline   Reply With Quote
Old 05-16-2024, 06:07 PM   #4
dandman
Enthusiast
dandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watchdandman is clearly one to watch
 
Posts: 29
Karma: 10545
Join Date: May 2024
Device: none
as far as i can tell, every record i added to the queue was displayed to the user,

there was just one strange behavior worth mentioning:
after every call to url using
PHP Code:
self.browser.open_novisit() 
the result_queue would be emptied, so i had to back it up before the call to the open_novisit and restore it after the call, like this:

PHP Code:
            # Create a separate queue for downloaded metadata
            
downloaded_metadata_queue Queue()

            
# Before calling open_novisit(), save downloaded metadata
            
while not result_queue.empty():
                
item result_queue.get() #get also remove the item
                
downloaded_metadata_queue.put(item)
            
            
# call the URL
            
response self.browser.open_novisit(request)
            
            
# Merge the downloaded metadata back to result_queue after the call
            
while not downloaded_metadata_queue.empty():
                
item downloaded_metadata_queue.get()
                
result_queue.put(item
dandman is offline   Reply With Quote
Reply

Tags
metadata, multi-book, plugin


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Metadata Search Results Overwrite Issue with Multiple Plugins PBence Library Management 3 02-27-2024 01:16 PM
Prevent Calibre from merging metadata results? PlatypusInc Library Management 4 12-21-2023 11:11 AM
Metadata download: No Amazon results even with mobi-asin present. ownedbycats Library Management 11 04-27-2022 05:47 AM
Avoiding metadata identify results merge Ramblurr Development 1 06-05-2014 01:10 AM
Select multiple items in "Check library results" window Pepin33 Library Management 2 08-01-2012 12:10 PM


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


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