Finalized filter_books. dumps to shelf.json

This commit is contained in:
Mike
2019-09-27 16:03:37 -04:00
parent f160a3bdde
commit 81fe90bce5
8 changed files with 233 additions and 103 deletions

29
scratchpad.py Normal file
View File

@@ -0,0 +1,29 @@
# To add a new cell, type '#%%'
# To add a new markdown cell, type '#%% [markdown]'
#%%
from library import Catalogue
import zipfile
import pprint as pp
import re
Catalogue = Catalogue()
book_list = Catalogue.filter_books(1)
unpacked = []
for book in book_list:
book = zipfile.ZipFile(book, 'r')
with book as bookzip:
try:
content_opf = bookzip.open('content.opf')
print(content_opf)
except KeyError as e:
expanded = bookzip.infolist()
regx1 = re.compile(r'\.opf|^cover')
for i in expanded:
if re.search(regx1, str(i)) == True: pp.pprint(i.filename); print(res)
#%%