mirror of
https://gitlab.com/LazyLibrarian/LazyLibrarian.git
synced 2026-02-06 10:47:15 +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 import database
|
||||||
from lazylibrarian.blockhandler import BLOCKHANDLER
|
from lazylibrarian.blockhandler import BLOCKHANDLER
|
||||||
from lazylibrarian.config2 import CONFIG
|
from lazylibrarian.config2 import CONFIG
|
||||||
from lazylibrarian.filesystem import DIRS, path_isfile, remove_file
|
from lazylibrarian.filesystem import DIRS, get_directory, path_isfile, remove_file
|
||||||
from lazylibrarian.formatter import check_int, get_list, md5_utf8, plural, sanitize, size_in_bytes
|
from lazylibrarian.formatter import check_int, md5_utf8, plural, sanitize, size_in_bytes
|
||||||
|
|
||||||
py310 = sys.version_info >= (3, 10)
|
py310 = sys.version_info >= (3, 10)
|
||||||
|
|
||||||
@ -360,7 +360,7 @@ def annas_download(md5, folder, title, extn):
|
|||||||
logger.warning(msg)
|
logger.warning(msg)
|
||||||
return False, msg
|
return False, msg
|
||||||
logger.debug(f"Got {len(filedata)} bytes for {url}")
|
logger.debug(f"Got {len(filedata)} bytes for {url}")
|
||||||
download_dir = get_list(CONFIG['DOWNLOAD_DIR'])[0]
|
download_dir = get_directory('Download')
|
||||||
if folder:
|
if folder:
|
||||||
parent = os.path.join(download_dir, folder)
|
parent = os.path.join(download_dir, folder)
|
||||||
if not os.path.isdir(parent):
|
if not os.path.isdir(parent):
|
||||||
|
|||||||
@ -394,9 +394,12 @@ class BookState:
|
|||||||
|
|
||||||
if self.source and self.download_id:
|
if self.source and self.download_id:
|
||||||
general_folder = get_download_folder(self.source, self.download_id)
|
general_folder = get_download_folder(self.source, self.download_id)
|
||||||
download_name = get_download_name(
|
download_name = get_download_name(self.download_title, self.source, self.download_id)
|
||||||
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
|
# For usenet clients (SABnzbd, NZBGet), the storage field already contains
|
||||||
# the complete download path including the folder name, so we don't join
|
# 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]:
|
def unsaveUserBook(self, bookid: [int, str]) -> dict[str, str]:
|
||||||
return self.__makeGetRequest(f"/eapi/user/book/{bookid}/unsave")
|
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")
|
return self.__makeGetRequest(f"/eapi/book/{bookid}/{hashid}/formats")
|
||||||
|
|
||||||
def getDonations(self) -> dict[str, str]:
|
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]
|
[GENERAL]
|
||||||
no_ipv6 = True
|
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
|
http_ext_timeout = 100
|
||||||
ebook_dir = ./testdata/eBooks
|
ebook_dir = ./testdata/eBooks
|
||||||
audio_dir = ./testdata/Audiobooks
|
audio_dir = ./testdata/Audiobooks
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user