mirror of
https://gitlab.com/LazyLibrarian/LazyLibrarian.git
synced 2026-02-06 02:36:49 +00:00
Return default download directory for downloads from annas/zlib/libgen
This commit is contained in:
parent
ef0b7a5a78
commit
170858cfe3
@ -30,8 +30,8 @@ import lazylibrarian
|
||||
from lazylibrarian import database
|
||||
from lazylibrarian.blockhandler import BLOCKHANDLER
|
||||
from lazylibrarian.config2 import CONFIG
|
||||
from lazylibrarian.filesystem import DIRS, path_isfile, remove_file
|
||||
from lazylibrarian.formatter import check_int, get_list, md5_utf8, plural, sanitize, size_in_bytes
|
||||
from lazylibrarian.filesystem import DIRS, get_directory, path_isfile, remove_file
|
||||
from lazylibrarian.formatter import check_int, md5_utf8, plural, sanitize, size_in_bytes
|
||||
|
||||
py310 = sys.version_info >= (3, 10)
|
||||
|
||||
@ -360,7 +360,7 @@ def annas_download(md5, folder, title, extn):
|
||||
logger.warning(msg)
|
||||
return False, msg
|
||||
logger.debug(f"Got {len(filedata)} bytes for {url}")
|
||||
download_dir = get_list(CONFIG['DOWNLOAD_DIR'])[0]
|
||||
download_dir = get_directory('Download')
|
||||
if folder:
|
||||
parent = os.path.join(download_dir, folder)
|
||||
if not os.path.isdir(parent):
|
||||
|
||||
@ -394,9 +394,12 @@ class BookState:
|
||||
|
||||
if self.source and self.download_id:
|
||||
general_folder = get_download_folder(self.source, self.download_id)
|
||||
download_name = get_download_name(
|
||||
self.download_title, self.source, self.download_id
|
||||
)
|
||||
download_name = get_download_name(self.download_title, self.source, self.download_id)
|
||||
if general_folder is None and self.source == 'DIRECT':
|
||||
res = db.match("SELECT NZBprov,NZBtitle from wanted where source='DIRECT' and DownloadID=?", (self.download_id, ))
|
||||
# These download into first download_dir
|
||||
if res and res['NZBprov'] in ['annas', 'zlibrary'] or res['NZBprov'].startswith('libgen'):
|
||||
general_folder = get_directory('Download')
|
||||
|
||||
# For usenet clients (SABnzbd, NZBGet), the storage field already contains
|
||||
# the complete download path including the folder name, so we don't join
|
||||
|
||||
@ -152,7 +152,7 @@ class Zlibrary:
|
||||
def unsaveUserBook(self, bookid: [int, str]) -> dict[str, str]:
|
||||
return self.__makeGetRequest(f"/eapi/user/book/{bookid}/unsave")
|
||||
|
||||
def getBookForamt(self, bookid: [int, str], hashid: str) -> dict[str, str]:
|
||||
def getBookFormat(self, bookid: [int, str], hashid: str) -> dict[str, str]:
|
||||
return self.__makeGetRequest(f"/eapi/book/{bookid}/{hashid}/formats")
|
||||
|
||||
def getDonations(self) -> dict[str, str]:
|
||||
|
||||
2
unittests/testdata/testconfig-defaults.ini
vendored
2
unittests/testdata/testconfig-defaults.ini
vendored
@ -1,6 +1,6 @@
|
||||
[GENERAL]
|
||||
no_ipv6 = True
|
||||
imp_preflang = en-US, eng, en, English, en-GB
|
||||
imp_preflang = English, en-GB, en, eng, en-US
|
||||
http_ext_timeout = 100
|
||||
ebook_dir = ./testdata/eBooks
|
||||
audio_dir = ./testdata/Audiobooks
|
||||
|
||||
Loading…
Reference in New Issue
Block a user