From 13e26556157955b2a2c33e6524a10116d818b685 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Wed, 10 Jan 2024 03:45:23 +0300 Subject: [PATCH] Refactor(web): Get download destination path from config [skip ci] --- m_librarian/download.py | 2 ++ m_librarian/web/app.py | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/m_librarian/download.py b/m_librarian/download.py index 281efca..c0bc101 100755 --- a/m_librarian/download.py +++ b/m_librarian/download.py @@ -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: diff --git a/m_librarian/web/app.py b/m_librarian/web/app.py index 39a1779..7885d46 100644 --- a/m_librarian/web/app.py +++ b/m_librarian/web/app.py @@ -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), -- 2.39.5