diff --git a/__pycache__/config.cpython-37.pyc b/__pycache__/config.cpython-37.pyc index b9e701e..c7d7e72 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 bd5dcde..11f517b 100755 --- a/config.py +++ b/config.py @@ -1,13 +1,11 @@ class Config: - """Main System Configuration""" - def __init__(self): - self.book_path = "books/" - self.book_shelf = "data/shelf.json" - self.catalogue_db = "data/catalogue.db" - self.file_array = [ - "data/catalogue.json", - self.book_shelf, - self.catalogue_db, - "conf/settings.json" - ] - self.auto_scan = True + """Main System Configuration""" + def __init__(self): + self.book_path = "/home/raelon/Books/" + self.book_shelf = "data/shelf.json" + self.catalogue_db = "data/catalogue.db" + self.file_array = [ + self.book_shelf, + self.catalogue_db, + ] + self.auto_scan = True diff --git a/data/shelf.json b/data/shelf.json index 5efa207..4c4bc29 100644 --- a/data/shelf.json +++ b/data/shelf.json @@ -1 +1 @@ -{"/home/raelon/Projects/pyShelf/books/Python Tricks by Dan Bader.epub": {"files": ["content.opf", "media/cover-6x9.png", "cover.xhtml"], "path": "/home/raelon/Projects/pyShelf/books/Python Tricks by Dan Bader.epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/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/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Dune Chronicles (Dune 7)/Dune Chronicles 1 - Hunters of Dune.epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Dune Chronicles (Dune 7)/Dune Chronicles 2 - The Sandworms of Dune.epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Great Schools of Dune/Great Schools of Dune 1 - Sisterhood of Dune.epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Great Schools of Dune/Great Schools of Dune 2 - Mentats of Dune.epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Great Schools of Dune/Great Schools of Dune 2.5 - Red Plague.epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Great Schools of Dune/Great Schools of Dune 3 - Navigators of Dune.epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Heroes of Dune/Heroes of Dune 1 - Paul of Dune.epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Heroes of Dune/Heroes of Dune 2 - The Winds of Dune.epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Original Dune series/1 - Dune - Frank Herbert (1965).epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Original Dune series/2 - Dune Messiah - Frank Herbert (1969).epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Original Dune series/3 - Children of Dune - Frank Herbert (1976).epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Original Dune series/4 - God Emperor Of Dune - Frank Herbert (1981).epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Original Dune series/5 - Heretics of Dune - Frank Herbert (1984).epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Original Dune series/6 - Chapter House Dune - Frank Herbert (1985).epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Prelude to Dune/Prelude to Dune 1 - House Atreides.epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Prelude to Dune/Prelude to Dune 2 - House Harkonnen.epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Prelude to Dune/Prelude to Dune 3 - House Corrino.epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/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/Projects/pyShelf/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/Projects/pyShelf/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/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Short story collections and extras/Eye (Short stories) - Frank Herbert.epub"}, "/home/raelon/Projects/pyShelf/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/Projects/pyShelf/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/Projects/pyShelf/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/Projects/pyShelf/books/All Dune books + short stories + extras ePUB/Short story collections and extras/The Road to Dune (Companion book) - Frank Herbert et al.epub"}} \ No newline at end of file +{"/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/\\" "b/lib/\\" new file mode 100644 index 0000000..77dfd98 --- /dev/null +++ "b/lib/\\" @@ -0,0 +1,59 @@ +#!/usr/bin/python +import os +import zipfile +from http.server import HTTPServer, BaseHTTPRequestHandler +from config import Config +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): + print("Begining creation of file structure") + for _pointer in file_array: + if not os.path.isfile(_pointer): + self.CreateFile(_pointer) + + def CreateFile(self, _pointer): + """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.close() + + +class BookServer: + """HTTP Frontend""" + def __init__(self): + self.server_address = ('', 8000) + self.handler = 'BaseHTTPRequestHandler' + + def close_prompt(self): + close = input("Close Server? y/n") + if close == 'y': + self.close() + return True + else: + self.close_prompt() + + def run(self): + self.httpd = HTTPServer(self.server_address, self.handler) + try: + self.httpd.serve_forever() + self.httpd.handle_request() + if self.close_prompt() == True: + pass + except Exception: + self.close() + return False + + def close(self): + try: + self.httpd.server_close() + return True + except Exception: + return False + diff --git a/lib/pyShelf.py b/lib/pyShelf.py index abb4d5c..8ed4d39 100755 --- a/lib/pyShelf.py +++ b/lib/pyShelf.py @@ -1,6 +1,7 @@ #!/usr/bin/python import os import zipfile +from http.server import HTTPServer, BaseHTTPRequestHandler from config import Config from lib.library import Catalogue from lib.storage import Storage @@ -22,3 +23,49 @@ class InitFiles: os.mkdir(os.path.split(_pointer)[0]) f = open(_pointer, "w+") f.close() + + +class RequestHandler(BaseHTTPRequestHandler): + """Request Handler""" + def do_GET(self): + self.send_response(200) + self.end_headers() + self.wfile.write(b'Welcome To pyShelf!') + + +class BookServer: + """HTTP Frontend""" + def __init__(self): + self.server_address = ('', 8000) + self.handler = RequestHandler + + def close_prompt(self): + """Prompt to close server""" + close = input("Close Server? y/n") + if close == 'y': + self.close() + return True + else: + self.close_prompt() + + def run(self): + """Start HTTP Server""" + self.httpd = HTTPServer(self.server_address, self.handler) + try: + self.httpd.serve_forever() + self.httpd.handle_request() + if self.close_prompt() == True: + pass + except KeyboardInterrupt: + print(KeyboardInterrupt, " Closing Server") + self.close() + return False + + def close(self): + """Stop HTTP Server""" + try: + self.httpd.server_close() + return True + except Exception: + return False + diff --git a/main.py b/main.py index 083c060..1e0acfb 100755 --- a/main.py +++ b/main.py @@ -4,15 +4,17 @@ import sys from config import Config from lib.library import Catalogue from lib.pyShelf import InitFiles +from lib.pyShelf import BookServer -sys.path.insert(1, 'lib/') +# sys.path.insert(1, 'lib/') config = Config() # Get configuration settings InitFiles(config.file_array) # Initialize file system Catalogue = Catalogue() # Open the Catalogue - +Server = BookServer() # new_books = Catalogue.new_files() Catalogue.import_books() # Filter Your books +Server.run() # TODO Figure out a system to get books page count # TODO Update Documentation # TODO Requirements.txt diff --git a/tests/test_bookserver.py b/tests/test_bookserver.py new file mode 100644 index 0000000..6b5108f --- /dev/null +++ b/tests/test_bookserver.py @@ -0,0 +1,11 @@ +import unittest +import sys +sys.path.insert(0, '../lib') +sys.path.insert(1, '../') +from pyShelf import BookServer + +class BookServerTest(unittest.TestCase): + + def test_bookserver(self): + server = BookServer() + self.assertTrue(server.run()) diff --git a/tests/test_library.py b/tests/test_library.py index 8b4b03d..b120fca 100755 --- a/tests/test_library.py +++ b/tests/test_library.py @@ -1,9 +1,9 @@ import unittest -import sys # sys.path.insert(1, '../') from lib.library import Catalogue Catalogue = Catalogue() + class LibraryTest(unittest.TestCase): def test_libray_catalogue(self):