![]() |
#1 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Apr 2019
Device: none
|
Get metadata from Libgen based on file md5sum
I have quite a few books that don't have proper metadat and is thus is hard to search and maintain them. I wanted to make a plugin that automatically calculates md5 of a given book and load its metadata from a libgen search.
![]() Here is the main idea Code:
import hashlib import os import requests import pandas as pd def getmd5sum(filename): md5_hash = hashlib.md5() a_file = open(filename, "rb") content = a_file.read() md5_hash.update(content) digest = md5_hash.hexdigest() return digest def getdatafrommd5(md5): url ='http://gen.lib.rus.ec/book/index.php?md5=' +md5 print(url) r = requests.get(url) if(r.text == "No record with such MD5 hash has been found</body></html>"): return [-1, -1, -1, -1, -1] df_list = pd.read_html(r.text) # this parses all the tables in webpages to a list table = df_list[0] title = table.loc[table[1] == 'Title:',2].tolist()[0] author = table.loc[table[1] == 'Author(s):',2].tolist()[0] publisher = table.loc[table[1] == 'Publisher:',2].tolist()[0] series = table.loc[table[1] == 'Series:',2].tolist()[0] year = table.loc[table[1] == 'Year:',2].tolist()[0] return [title, author, publisher, series, year] |
![]() |
![]() |
![]() |
#2 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,113
Karma: 57259780
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
iama... (not trying to rain on your parade )
MD5 only lasts as long as nothing calibre does (can do) touches the file. Touch the Polish or embed metadata feature and the MD5 is obsolete |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 75,089
Karma: 131686272
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Where did these eBooks with the rubbish metadata come from?
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Kute File Monitor: A smarter file-trigger based launcher | NiLuJe | Kobo Developer's Corner | 221 | 04-28-2023 01:37 PM |
Troubleshooting Convert Metadata file .AZW3R into .MBP or "MyClippings.txt" into a Metadata file | LittleBeard | Amazon Kindle | 25 | 04-13-2020 10:41 AM |
Send to device based on Metadata | DavidTC | Calibre | 0 | 09-18-2011 01:18 PM |
rename files based on metadata | jchrist | Calibre | 10 | 09-14-2010 10:28 AM |