]> git.phdru.name Git - m_librarian.git/commitdiff
Refactor(web): Get download destination path from config
authorOleg Broytman <phd@phdru.name>
Wed, 10 Jan 2024 00:45:23 +0000 (03:45 +0300)
committerOleg Broytman <phd@phdru.name>
Wed, 10 Jan 2024 00:45:23 +0000 (03:45 +0300)
[skip ci]

m_librarian/download.py
m_librarian/web/app.py

index 281efcaf7a2c81b4f32013da206b71c314ea2f74..c0bc1010ca51365b50909fa14b3b7b92b3b387be 100755 (executable)
@@ -71,6 +71,8 @@ _library_path = None
 
 
 def download(book, dest_path=None, lib_path=None, a_format=None):
+    if dest_path is None:
+        dest_path = get_config().getpath('download', 'path')
     if lib_path is None:
         global _library_path
         if _library_path is None:
index 39a1779d38c907ae5cbdc829f44913655eb4fd0e..7885d4608d58cd15366430c3becb094ce7dec8a0 100644 (file)
@@ -65,11 +65,10 @@ def download_books():
             for bid in form.getall(k):
                 books_ids.append(bid)
     if books_ids:
-        download_path = get_config().getpath('download', 'path')
         try:
             for bid in books_ids:
                 book = Book.get(int(bid))
-                download(book, download_path)
+                download(book)
         except Exception as e:
             return {
                 'error': str(e),