mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Implemented the return of unique files for storage
This commit is contained in:
@@ -2,10 +2,12 @@
|
||||
import os
|
||||
import zipfile
|
||||
from config import Config
|
||||
from library import Catalogue
|
||||
from storage import Storage
|
||||
from lib.library import Catalogue
|
||||
from lib.storage import Storage
|
||||
config = Config()
|
||||
Storage = Storage()
|
||||
|
||||
|
||||
class InitFiles:
|
||||
"""First run file creation operations"""
|
||||
def __init__(self, file_array):
|
||||
@@ -18,7 +20,7 @@ class InitFiles:
|
||||
"""Create the file"""
|
||||
if not os.path.isdir(os.path.split(_pointer)[0]):
|
||||
os.mkdir(os.path.split(_pointer)[0])
|
||||
f = open(_pointer, "w+")
|
||||
f = open(_pointer, "w+")
|
||||
f.close()
|
||||
|
||||
|
||||
@@ -29,8 +31,9 @@ class Epub:
|
||||
self.book_path = config.book_path
|
||||
self.Catalogue = Catalogue()
|
||||
|
||||
def import_books(self):
|
||||
book_list = self.Catalogue.filter_books()
|
||||
def import_books(self, list=None):
|
||||
if list is not None: book_list = list
|
||||
else: book_list = self.Catalogue.filter_books()
|
||||
for book in book_list:
|
||||
extracted = self.Catalogue.extract_metadata(book_list[book])
|
||||
Storage.insert_book(extracted)
|
||||
|
||||
Reference in New Issue
Block a user