Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 12-24-2022, 03:09 PM   #1
yamusing
Enthusiast
yamusing began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Jul 2019
Device: none
Metadata download create limit

Is there a way to create a metadata download limit when fetching metadata from the website?
I happen to have a lot of books to fetch metadata for but happen to get IP banned from the website for sending too many requests.
I would like to limit the metadata download to be limited to 1 request every 5 seconds for example.
yamusing is offline   Reply With Quote
Old 12-24-2022, 03:28 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,048
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by yamusing View Post
Is there a way to create a metadata download limit when fetching metadata from the website?
I happen to have a lot of books to fetch metadata for but happen to get IP banned from the website for sending too many requests.
I would like to limit the metadata download to be limited to 1 request every 5 seconds for example.
It is builtin (I believe the default is 10 seconds, but I can't find the Tweak. I did find the email one )
theducks is offline   Reply With Quote
Advert
Old 12-24-2022, 05:38 PM   #3
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: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It already does that.
kovidgoyal is offline   Reply With Quote
Old 12-24-2022, 07:29 PM   #4
yamusing
Enthusiast
yamusing began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Jul 2019
Device: none
Is there a way to set the limit? As it seems to fetch too fast and I'll try increasing it if possible
yamusing is offline   Reply With Quote
Old 12-24-2022, 10:32 PM   #5
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: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No, you'd have to run from source and personally, I wouldn't bother. The services keep tuning the parameters of their bot detection. Just pause once you start getting the errors and resume in a few hours.
kovidgoyal is offline   Reply With Quote
Advert
Old 12-24-2022, 10:40 PM   #6
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,048
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Just queue as a bunch of small batches (~10). That also has the advantage if you crash of only losing that (active) batch of data. A crash loses all un posted data
theducks is offline   Reply With Quote
Old 12-27-2022, 05:14 PM   #7
yamusing
Enthusiast
yamusing began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Jul 2019
Device: none
Quote:
Originally Posted by kovidgoyal View Post
No, you'd have to run from source and personally, I wouldn't bother. The services keep tuning the parameters of their bot detection. Just pause once you start getting the errors and resume in a few hours.
for the website there isn't a bot detection for the website as it clearly states the Load limiting for API requests "25 entries per request, 4-5 sequential requests usually okay before having to wait for ~5 seconds". When I try to download metadata at once on Calibre it clearly doesn't have a time limit between requests as I can see it finished downloading metadata for 4 books in 3 seconds in the job interface so it send request one at a time without any delay.

Is there really no way to implment it on my side for creating a download metadata limit per book?

Or if possible add in time.sleep(10) in the metadata plugin would this work?

Last edited by yamusing; 12-27-2022 at 06:10 PM.
yamusing is offline   Reply With Quote
Old 12-27-2022, 06:14 PM   #8
yamusing
Enthusiast
yamusing began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Jul 2019
Device: none
Quote:
Originally Posted by theducks View Post
Just queue as a bunch of small batches (~10). That also has the advantage if you crash of only losing that (active) batch of data. A crash loses all un posted data
I've got over 1000 of books to get metadata from so this would take a lot of time
yamusing is offline   Reply With Quote
Old 12-27-2022, 06:58 PM   #9
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,048
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by yamusing View Post
I've got over 1000 of books to get metadata from so this would take a lot of time
And spotting and FIXING erroneous metadata doesn't?
theducks is offline   Reply With Quote
Old 12-27-2022, 09:57 PM   #10
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: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by yamusing View Post
for the website there isn't a bot detection for the website as it clearly states the Load limiting for API requests "25 entries per request, 4-5 sequential requests usually okay before having to wait for ~5 seconds". When I try to download metadata at once on Calibre it clearly doesn't have a time limit between requests as I can see it finished downloading metadata for 4 books in 3 seconds in the job interface so it send request one at a time without any delay.

Is there really no way to implment it on my side for creating a download metadata limit per book?

Or if possible add in time.sleep(10) in the metadata plugin would this work?
What website is this? None of the builtin plugins use an API. And yes if you are using a specific website then you will need to implement policies specific to it in the plugin. No time.sleep() wont work since downloads are threaded. You will need to use the rate_limit() decorator from sources/search_engines.py this is how the builtin plugins implement rate limiting.
kovidgoyal is offline   Reply With Quote
Old 12-28-2022, 05:43 AM   #11
yamusing
Enthusiast
yamusing began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Jul 2019
Device: none
Quote:
Originally Posted by kovidgoyal View Post
What website is this? None of the builtin plugins use an API. And yes if you are using a specific website then you will need to implement policies specific to it in the plugin. No time.sleep() wont work since downloads are threaded. You will need to use the rate_limit() decorator from sources/search_engines.py this is how the builtin plugins implement rate limiting.
Would time.sleep(20) work if I add multiple seperate jobs to the metadata download queue? It would add a 20 second delay to each start of a metadata download batch right?
yamusing is offline   Reply With Quote
Old 12-28-2022, 07:34 AM   #12
yamusing
Enthusiast
yamusing began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Jul 2019
Device: none
It seems to work well when putting in the time.sleep(60) for the metadata plugin and queuing batches of 8 books each for metadata download. Its a bit less automated though if there is a better way to go about this? as I have to keep selecting 8 books and download metadata
yamusing is offline   Reply With Quote
Old 12-28-2022, 09:14 AM   #13
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: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I told you how you can implement site specific rate limiting in the plugin. Not sure what else you are asking.
kovidgoyal is offline   Reply With Quote
Old 12-28-2022, 11:16 AM   #14
yamusing
Enthusiast
yamusing began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Jul 2019
Device: none
Quote:
Originally Posted by kovidgoyal View Post
I told you how you can implement site specific rate limiting in the plugin. Not sure what else you are asking.
Sorry I'm not sure how to use the rate_limit(), do I only have to implment a number in the brackets and it'll work fine?
yamusing is offline   Reply With Quote
Old 12-28-2022, 10:02 PM   #15
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: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Look inside the same file for examples of its use. You basically use it in a with statement that contains any calls to the remote service.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Size limit of metadata.calibre file? thundermonkey KOReader 2 06-27-2022 10:19 AM
Limit metadata download to single field zakman Library Management 1 04-24-2022 06:58 PM
ebook download limit Ricky D'Angelo Amazon Kindle 17 08-14-2018 11:35 PM
limit download dream46go Calibre 11 08-06-2014 06:27 PM
Limit download/unread messages nlundberg Recipes 3 02-04-2013 02:56 PM


All times are GMT -4. The time now is 12:06 PM.


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