diff --git a/__pycache__/config.cpython-37.pyc b/__pycache__/config.cpython-37.pyc index c3590a7..fa48c03 100644 Binary files a/__pycache__/config.cpython-37.pyc and b/__pycache__/config.cpython-37.pyc differ diff --git a/config.py b/config.py index 724906e..4b39d88 100755 --- a/config.py +++ b/config.py @@ -1,7 +1,7 @@ class Config: """Main System Configuration""" def __init__(self): - self.book_path = "books/" + self.book_path = "/home/raelon/Books/" self.book_shelf = "data/shelf.json" self.catalogue_db = "data/catalogue.db" self.file_array = [ @@ -10,4 +10,4 @@ class Config: self.catalogue_db, "conf/settings.json" ] - self.auto_scan = True \ No newline at end of file + self.auto_scan = True diff --git a/data/shelf.json b/data/shelf.json index e69de29..4c4bc29 100644 --- a/data/shelf.json +++ b/data/shelf.json @@ -0,0 +1 @@ +{"/home/raelon/Books/All Dune books + short stories + extras ePUB/Dune Chronicles (Dune 7)/Dune Chronicles 1 - Hunters of Dune.epub": {"files": ["OPS/xhtml/cover.html", "OPS/9780765312921.opf"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Dune Chronicles (Dune 7)/Dune Chronicles 1 - Hunters of Dune.epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Dune Chronicles (Dune 7)/Dune Chronicles 2 - The Sandworms of Dune.epub": {"files": ["OPS/package.opf", "OPS/xhtml/cover.html"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Dune Chronicles (Dune 7)/Dune Chronicles 2 - The Sandworms of Dune.epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Great Schools of Dune/Great Schools of Dune 1 - Sisterhood of Dune.epub": {"files": ["OEBPS/content.opf", "OEBPS/Text/cover.xml"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Great Schools of Dune/Great Schools of Dune 1 - Sisterhood of Dune.epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Great Schools of Dune/Great Schools of Dune 2 - Mentats of Dune.epub": {"files": ["OEBPS/content.opf", "OEBPS/Images/cover.jpeg"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Great Schools of Dune/Great Schools of Dune 2 - Mentats of Dune.epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Great Schools of Dune/Great Schools of Dune 2.5 - Red Plague.epub": {"files": ["OEBPS/content.opf", "OEBPS/Text/cover.xhtml"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Great Schools of Dune/Great Schools of Dune 2.5 - Red Plague.epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Great Schools of Dune/Great Schools of Dune 3 - Navigators of Dune.epub": {"files": ["OEBPS/content.opf", "OEBPS/Text/cover.xhtml"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Great Schools of Dune/Great Schools of Dune 3 - Navigators of Dune.epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Heroes of Dune/Heroes of Dune 1 - Paul of Dune.epub": {"files": ["OPS/package.opf", "OPS/xhtml/cover.xml"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Heroes of Dune/Heroes of Dune 1 - Paul of Dune.epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Heroes of Dune/Heroes of Dune 2 - The Winds of Dune.epub": {"files": ["OPS/package.opf", "OPS/xhtml/cover.xml"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Heroes of Dune/Heroes of Dune 2 - The Winds of Dune.epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Original Dune series/1 - Dune - Frank Herbert (1965).epub": {"files": ["OEBPS/package.opf", "OEBPS/cover.xml"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Original Dune series/1 - Dune - Frank Herbert (1965).epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Original Dune series/2 - Dune Messiah - Frank Herbert (1969).epub": {"files": ["OEBPS/9780575104426_oeb_opf_r1.opf", "OEBPS/9780575104426_oeb_cover_r1.html"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Original Dune series/2 - Dune Messiah - Frank Herbert (1969).epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Original Dune series/3 - Children of Dune - Frank Herbert (1976).epub": {"files": ["OEBPS/9780575104402_oeb_cover_r1.html", "OEBPS/9780575104402_oeb_opf_r1.opf"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Original Dune series/3 - Children of Dune - Frank Herbert (1976).epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Original Dune series/4 - God Emperor Of Dune - Frank Herbert (1981).epub": {"files": ["OEBPS/9780575104440_oeb_opf_r1.opf", "OEBPS/9780575104440_oeb_cover_r1.html"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Original Dune series/4 - God Emperor Of Dune - Frank Herbert (1981).epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Original Dune series/5 - Heretics of Dune - Frank Herbert (1984).epub": {"files": ["OEBPS/9780575104457_oeb_cover_r1.html", "OEBPS/9780575104457_oeb_opf_r1.opf"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Original Dune series/5 - Heretics of Dune - Frank Herbert (1984).epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Original Dune series/6 - Chapter House Dune - Frank Herbert (1985).epub": {"files": ["OEBPS/9780575104396_oeb_opf_r1.opf", "OEBPS/9780575104396_oeb_cover_r1.html"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Original Dune series/6 - Chapter House Dune - Frank Herbert (1985).epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Prelude to Dune/Prelude to Dune 1 - House Atreides.epub": {"files": ["OEBPS/content.opf"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Prelude to Dune/Prelude to Dune 1 - House Atreides.epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Prelude to Dune/Prelude to Dune 2 - House Harkonnen.epub": {"files": ["Herb_9780553897838_epub_opf_r1.opf"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Prelude to Dune/Prelude to Dune 2 - House Harkonnen.epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Prelude to Dune/Prelude to Dune 3 - House Corrino.epub": {"files": ["OPS/content.opf"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Prelude to Dune/Prelude to Dune 3 - House Corrino.epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Short story collections and extras/CliffsNotes on Herbert's Dune & Other Works - L. David Allen.epub": {"files": ["OPS/images/cover.jpg", "OPS/content.opf"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Short story collections and extras/CliffsNotes on Herbert's Dune & Other Works - L. David Allen.epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Short story collections and extras/Dreamer of Dune- The Biography of Frank Herbert by Brian Herbert.epub": {"files": ["OEBPS/content.opf", "OEBPS/Images/cover.jpg"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Short story collections and extras/Dreamer of Dune- The Biography of Frank Herbert by Brian Herbert.epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Short story collections and extras/Eye (Short stories) - Frank Herbert.epub": {"files": ["OEBPS/content.opf", "OEBPS/Text/cover.xhtml"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Short story collections and extras/Eye (Short stories) - Frank Herbert.epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Short story collections and extras/Tales of Dune (Short stories) - Brian Herbert and Kevin J. Anderson.epub": {"files": ["OEBPS/content.opf"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Short story collections and extras/Tales of Dune (Short stories) - Brian Herbert and Kevin J. Anderson.epub"}, "/home/raelon/Books/All Dune books + short stories + extras ePUB/Short story collections and extras/The Road to Dune (Companion book) - Frank Herbert et al.epub": {"files": ["OEBPS/e9781429924917_cover.jpg", "OEBPS/e9781429924917_content.opf"], "path": "/home/raelon/Books/All Dune books + short stories + extras ePUB/Short story collections and extras/The Road to Dune (Companion book) - Frank Herbert et al.epub"}, "/home/raelon/Books/Clancy/Clancy, Tom/Against All Enemies/Against All Enemies - Tom Clancy.epub": {"files": ["content.opf", "cover.jpeg"], "path": "/home/raelon/Books/Clancy/Clancy, Tom/Against All Enemies/Against All Enemies - Tom Clancy.epub"}, "/home/raelon/Books/Clancy/Clancy, Tom/Archimedes Effect, The/Archimedes Effect, The - Tom Clancy.epub": {"files": ["content.opf", "cover.jpeg"], "path": "/home/raelon/Books/Clancy/Clancy, Tom/Archimedes Effect, The/Archimedes Effect, The - Tom Clancy.epub"}, "/home/raelon/Books/Clancy/Clancy, Tom/Cardinal of the Kremlin, The/Cardinal of the Kremlin, The - Tom Clancy.epub": {"files": ["content.opf", "cover1.jpeg"], "path": "/home/raelon/Books/Clancy/Clancy, Tom/Cardinal of the Kremlin, The/Cardinal of the Kremlin, The - Tom Clancy.epub"}, "/home/raelon/Books/Clancy/Clancy, Tom/Dead or Alive/Dead or Alive - Tom Clancy.epub": {"files": ["content.opf", "cover.jpeg"], "path": "/home/raelon/Books/Clancy/Clancy, Tom/Dead or Alive/Dead or Alive - Tom Clancy.epub"}, "/home/raelon/Books/Clancy/Clancy, Tom/Debt of Honor/Debt of Honor - Tom Clancy.epub": {"files": ["content.opf", "cover1.jpeg"], "path": "/home/raelon/Books/Clancy/Clancy, Tom/Debt of Honor/Debt of Honor - Tom Clancy.epub"}, "/home/raelon/Books/Clancy/Clancy, Tom/Rainbow Six/Rainbow Six - Tom Clancy.epub": {"files": ["content.opf", "cover1.jpeg"], "path": "/home/raelon/Books/Clancy/Clancy, Tom/Rainbow Six/Rainbow Six - Tom Clancy.epub"}, "/home/raelon/Books/Clancy/Clancy, Tom/Red Storm Rising/Red Storm Rising - Tom Clancy.epub": {"files": ["content.opf", "cover.jpeg"], "path": "/home/raelon/Books/Clancy/Clancy, Tom/Red Storm Rising/Red Storm Rising - Tom Clancy.epub"}, "/home/raelon/Books/Clancy/Clancy, Tom/Springboard/Springboard - Tom Clancy.epub": {"files": ["content.opf", "cover.jpeg"], "path": "/home/raelon/Books/Clancy/Clancy, Tom/Springboard/Springboard - Tom Clancy.epub"}, "/home/raelon/Books/Clancy/Clancy, Tom/State of War/State of War - Tom Clancy.epub": {"files": ["content.opf", "cover.jpeg"], "path": "/home/raelon/Books/Clancy/Clancy, Tom/State of War/State of War - Tom Clancy.epub"}, "/home/raelon/Books/Coding The Bible 2 Manuscripts - Python and Raspberry PI/Coding The Bible 2 Manuscripts - Python and Raspberry PI.epub": {"files": ["OEBPS/content.opf"], "path": "/home/raelon/Books/Coding The Bible 2 Manuscripts - Python and Raspberry PI/Coding The Bible 2 Manuscripts - Python and Raspberry PI.epub"}, "/home/raelon/Books/Automate the Boring Stuff with Python - Practical Programming for Total Beginners - 1st Edition (2015) (Pdf, Epub & Mobi) Gooner/Automate the Boring Stuff with Python (2015).epub": {"files": ["OEBPS/content.opf", "OEBPS/Images/cover00710.jpeg", "OEBPS/Text/cover_page.xhtml"], "path": "/home/raelon/Books/Automate the Boring Stuff with Python - Practical Programming for Total Beginners - 1st Edition (2015) (Pdf, Epub & Mobi) Gooner/Automate the Boring Stuff with Python (2015).epub"}, "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Commodore, The - C. S. Forester.epub": {"files": ["content.opf", "cover1.jpeg"], "path": "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Commodore, The - C. S. Forester.epub"}, "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Flying Colours - C. S. Forester.epub": {"files": ["content.opf", "cover1.jpeg"], "path": "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Flying Colours - C. S. Forester.epub"}, "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Happy Return, The - C. S. Forester.epub": {"files": ["content.opf", "cover1.jpeg"], "path": "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Happy Return, The - C. S. Forester.epub"}, "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Hornblower and the Atropos - C. S. Forester.epub": {"files": ["content.opf", "cover1.jpeg"], "path": "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Hornblower and the Atropos - C. S. Forester.epub"}, "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Hornblower and the Crisis - C. S. Forester.epub": {"files": ["content.opf", "cover1.jpeg"], "path": "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Hornblower and the Crisis - C. S. Forester.epub"}, "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Hornblower and the Hotspur - C. S. Forester.epub": {"files": ["content.opf", "cover1.jpeg"], "path": "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Hornblower and the Hotspur - C. S. Forester.epub"}, "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Hornblower in the West Indies - C. S. Forester.epub": {"files": ["content.opf", "cover1.jpeg"], "path": "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Hornblower in the West Indies - C. S. Forester.epub"}, "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Lieutenant Hornblower - C. S. Forester.epub": {"files": ["content.opf", "cover1.jpeg"], "path": "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Lieutenant Hornblower - C. S. Forester.epub"}, "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Lord Hornblower - C. S. Forester.epub": {"files": ["content.opf", "cover1.jpeg"], "path": "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Lord Hornblower - C. S. Forester.epub"}, "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Ship of the Line, A - C. S. Forester.epub": {"files": ["content.opf", "cover1.jpeg"], "path": "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Ship of the Line, A - C. S. Forester.epub"}, "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Mr. Midshipman Hornblower - C. S. Forester.epub": {"files": ["content.opf", "cover1.jpeg"], "path": "/home/raelon/Books/Horatio Hornblower series by C. S. Forester/Mr. Midshipman Hornblower - C. S. Forester.epub"}} \ No newline at end of file diff --git a/lib/api_hooks.py b/lib/api_hooks.py index 9cebcce..6d18080 100644 --- a/lib/api_hooks.py +++ b/lib/api_hooks.py @@ -1,7 +1,7 @@ #!/usr/bin/python import sys import requests -sys.path.insert(1, 'lib/') +# sys.path.insert(1, 'lib/') class DuckDuckGo: @@ -18,8 +18,11 @@ class DuckDuckGo: try: query = query.string except AttributeError: query = query search_result = requests.get(self.url+query+_key) - if search_result.status_code == 200 and search_result.json()['Image'] != '': + try: image_result = search_result.json()['Image'] + except ValueError: + image_result = '' + if search_result.status_code == 200 and image_result != '': image = requests.get(search_result.json()['Image'], stream=True) image.raw.decode_content = True return image.raw - else: return False \ No newline at end of file + else: return False diff --git a/lib/library.py b/lib/library.py index 0f343b0..6b4f642 100755 --- a/lib/library.py +++ b/lib/library.py @@ -3,7 +3,9 @@ import json import os import re import zipfile -from PIL import Image +# import sys +# sys.path.insert(1, '../') +from lib.storage import Storage from bs4 import BeautifulSoup from config import Config from lib.api_hooks import DuckDuckGo @@ -19,22 +21,29 @@ class Catalogue: self.opf_regx = re.compile(r'\.opf') self.cover_regx = re.compile(r'\.jpg|\.jpeg|\.png|\.bmp|\.gif') self.html_regx = re.compile(r'\.html') + self.scan_folder() def scan_folder(self, folder=config.book_path): for f in os.listdir(folder): - _path = os.path.abspath(folder+'/'+f) - #_path = os.path.abspath('.')+'/'+folder+f+'/' - _is_dir = os.path.isdir(_path.strip()+'/') + _path = os.path.abspath(folder + '/' + f) + # _path = os.path.abspath('.')+'/'+folder+f+'/' + _is_dir = os.path.isdir(_path.strip() + '/') if _is_dir: self.file_list.append(self.scan_folder(_path)) self.file_list.append(_path) + regx = re.compile(r"\.epub") + self.books = list(filter(regx.search, filter(None, self.file_list))) def scan_book(self, book): """REMOVE ME?""" _epub = zipfile.ZipFile(book) with _epub as _epub_open: - try: _epub_open.open('content.opf'); return True - except Exception as e: print(e); return False + try: + _epub_open.open('content.opf') + return True + except Exception as e: + print(e) + return False def filter_books(self, ret=0): """ @@ -44,16 +53,12 @@ class Catalogue: :param ret: 0 -> create class property -> dump json :param ret: 1 -> create & return class property """ - self.scan_folder() - regx = re.compile(r"\.epub") - self.books = list(filter(regx.search, filter(None, self.file_list))) _book_list_expanded = {} with open(config.book_shelf, 'w') as f: for book in self.books: _book_list_expanded[book] = self.process_book(book) if ret != 0: return _book_list_expanded else: - import ipdb; ipdb.set_trace() json.dump(_book_list_expanded, f) return _book_list_expanded @@ -87,10 +92,12 @@ class Catalogue: title = soup.find("dc:title") if title == None: title = book['path'].split('/')[-1].rsplit('.', 1)[0] - else: title = title.contents[0] + else: + title = title.contents[0] author = soup.find("dc:creator") if author != None: author = author.contents[0] - try: cover = self.extract_cover_image(book_zip, book) + try: + cover = self.extract_cover_image(book_zip, book) except IndexError: # cover = self.extract_cover_html(book_zip, book) cover = DuckDuckGo().image_result(title) @@ -99,35 +106,32 @@ class Catalogue: def extract_content(self, book_zip, book): content = book_zip.open( - list( - filter(self.opf_regx.search, book['files']) - )[0] - ) + list(filter(self.opf_regx.search, book['files']))[0]) return content def extract_cover_html(self, book_zip, book): cover = book_zip.open( - list( - filter(self.html_regx.search, book['files']) - )[0] - ) + list(filter(self.html_regx.search, book['files']))[0]) return cover def extract_cover_image(self, book_zip, book): # TODO Handle books that have no Cover Image # TODO Handle books with html covers cover = book_zip.open( - list( - filter(self.cover_regx.search, book['files']) - )[0] - ) - try: cover = book_zip.read(cover.name); return cover - except KeyError: return False - - def compare_shelf_current(self): + list(filter(self.cover_regx.search, book['files']))[0]) try: - self.books + cover = book_zip.read(cover.name) + return cover + except KeyError: + return False + + def new_files(self): + storage = Storage() + try: + a = [] + stored = storage.book_paths_list() + for i in stored: a.append(i[-1]) + unique = set(self.books) - set(a) + return unique except Exception: - self.filter_books(1) - unique = set(self.books) - set(self.catalogue) - return unique + return False diff --git a/lib/pyShelf.py b/lib/pyShelf.py index d5da1cd..a5d7c2e 100755 --- a/lib/pyShelf.py +++ b/lib/pyShelf.py @@ -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) diff --git a/lib/storage.py b/lib/storage.py index a4b186e..57d0a25 100644 --- a/lib/storage.py +++ b/lib/storage.py @@ -1,7 +1,7 @@ #!/usr/bin/python import sys import sqlite3 -sys.path.insert(1,'../') +# sys.path.insert(1, '../') from config import Config db_pointer = Config().catalogue_db @@ -55,6 +55,13 @@ class Storage: print(e) return False + def book_paths_list(self): + q = '''SELECT file_name FROM books''' + x = self.cursor.execute(q) + try: x = x.fetchall() + except Exception: x = [] + return x + def commit(self): try: self.db.commit(); return True - except Exception as e: return False \ No newline at end of file + except Exception as e: return False diff --git a/main.py b/main.py index a665933..b5cdc69 100755 --- a/main.py +++ b/main.py @@ -1,19 +1,19 @@ #!/usr/bin/python import sys -from PIL import Image sys.path.insert(1, 'lib/') from pyShelf import InitFiles, Epub from config import Config from library import Catalogue -config = Config() # Get configuration settings -InitFiles(config.file_array) # Initialize file system -Catalogue = Catalogue() # Open the Catalogue +config = Config() # Get configuration settings +InitFiles(config.file_array) # Initialize file system +Catalogue = Catalogue() # Open the Catalogue # This only needs to be run on first run, & when new books are added -Epub().import_books() # Filter Your books +new_books = Catalogue.new_files() +Epub().import_books(new_books) # Filter Your books # TODO Implement file tracking system to avoid processing already tracked books # TODO Figure out a system to get books page count # TODO Update testing # TODO Update Documentation # TODO Requirements.txt -# TODO Test image storage \ No newline at end of file +# TODO Test image storage diff --git a/requirements.txt b/requirements.txt index 36bc418..770a533 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,23 +1,10 @@ -appdirs==1.4.3 -beautifulsoup4==4.8.0 -bs4==0.0.1 -certifi==2019.9.11 -chardet==3.0.4 -cssselect==1.1.0 -fake-useragent==0.1.11 -idna==2.8 -lxml==4.4.1 -parse==1.12.1 -Pillow==6.2.0 -pyee==6.0.0 -Pygments==2.4.2 -pyppeteer==0.0.25 -pyquery==1.4.0 -requests==2.22.0 -six==1.12.0 -soupsieve==1.9.4 -tqdm==4.36.1 -urllib3==1.25.6 -urwid==2.0.1 -w3lib==1.21.0 -websockets==8.0.2 \ No newline at end of file +bs4 +certifi +lxml +Pillow +requests +soupsieve +urllib3 +urwid +w3lib +websockets diff --git a/tests/__init__.py b/tests/__init__.py index e69de29..b8bb7c9 100755 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,2 @@ +import sys +sys.path.insert(1, '../lib/') diff --git a/tests/__pycache__/test_library.cpython-37.pyc b/tests/__pycache__/test_library.cpython-37.pyc index 3a54b6d..ac1de5e 100644 Binary files a/tests/__pycache__/test_library.cpython-37.pyc and b/tests/__pycache__/test_library.cpython-37.pyc differ diff --git a/tests/__pycache__/test_sysio.cpython-37.pyc b/tests/__pycache__/test_sysio.cpython-37.pyc index e54ebc1..e7f6796 100644 Binary files a/tests/__pycache__/test_sysio.cpython-37.pyc and b/tests/__pycache__/test_sysio.cpython-37.pyc differ diff --git a/tests/test_library.py b/tests/test_library.py index 0df85af..8b4b03d 100755 --- a/tests/test_library.py +++ b/tests/test_library.py @@ -1,6 +1,6 @@ import unittest import sys -sys.path.insert(1, '../') +# sys.path.insert(1, '../') from lib.library import Catalogue Catalogue = Catalogue() @@ -12,5 +12,9 @@ class LibraryTest(unittest.TestCase): def test_library_catalogue_filter_books(self): self.assertIsNotNone(Catalogue.filter_books()) + def test_library_catalogue_new_files(self): + self.assertIsNot(Catalogue.new_files(), False) + + if __name__ == '__main__': unittest.main() diff --git a/tests/test_storage.py b/tests/test_storage.py index 5a14cb8..f3dabf5 100644 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -1,6 +1,6 @@ import unittest import sys -sys.path.insert(1, '../') +# sys.path.insert(1, '../') from lib.storage import Storage storage = Storage() diff --git a/tests/test_sysio.py b/tests/test_sysio.py index 31ea441..8e50b36 100755 --- a/tests/test_sysio.py +++ b/tests/test_sysio.py @@ -2,7 +2,7 @@ import unittest import os import shutil import sys -sys.path.insert(1, '../') +# sys.path.insert(1, '../') from lib.pyShelf import InitFiles from lib.pyShelf import Epub