aboutsummaryrefslogtreecommitdiff
path: root/lib/books.py
diff options
context:
space:
mode:
authorJordan <me@jordan.im>2021-06-16 03:04:08 -0700
committerGitHub <noreply@github.com>2021-06-16 03:04:08 -0700
commit90e0edf9865fab9822864d1f00d36c4e28a91847 (patch)
tree2cad90e05483e1b9eeeff827739b41244266938b /lib/books.py
parent4cd0884b307e28bd9f2e531c41fb7b41600b02a4 (diff)
parente7f4b527e2ee2cbae9f7a53f2a8100fa40bc9138 (diff)
downloadroka-90e0edf9865fab9822864d1f00d36c4e28a91847.tar.gz
roka-90e0edf9865fab9822864d1f00d36c4e28a91847.zip
Merge pull request #3 from dgarrett/static-generation
Static generation
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()