aboutsummaryrefslogtreecommitdiff
path: root/lib/books.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/books.py')
-rw-r--r--lib/books.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/books.py b/lib/books.py
index 1c4b4a5..95df374 100644
--- a/lib/books.py
+++ b/lib/books.py
@@ -13,10 +13,6 @@ ABS_PATH = os.path.dirname(os.path.abspath(__file__))
CACHE_PATH = os.path.join(ABS_PATH, '../', 'cache')
JSON_PATH = os.path.join(CACHE_PATH, 'audiobooks.json')
-# use Flask's config parser, configparser would be hacky
-APP = Flask(__name__)
-APP.config.from_pyfile(os.path.join(ABS_PATH, '../', 'app.cfg'))
-
class Books:
def __init__(self):
'''
@@ -86,7 +82,7 @@ class Books:
now = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
print('%s %s' % (now, msg))
- def scan_books(self):
+ def scan_books(self, audiobook_path=None):
'''
Discover audiobooks under :root_path: and populate books object
@@ -94,7 +90,7 @@ class Books:
(existing content is not re-hashed)
'''
ex = self._get_path_hash_dict()
- dirs = self._get_dirs(APP.config['ROOT_PATH'])
+ dirs = self._get_dirs(audiobook_path)
books = dict()
for path in dirs:
@@ -145,7 +141,7 @@ class Books:
# previous conditions met, we've found at least one track
is_book = True
- self._log(f)
+ self._log(os.path.join(path, f))
# hash track (used as a key) and update folder hash
file_hash = hashlib.md5()