kmoe-manga-downloader 1.1.0__py3-none-any.whl → 1.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kmdr/module/downloader/DirectDownloader.py +2 -2
- kmdr/module/downloader/ReferViaDownloader.py +2 -2
- kmdr/module/downloader/utils.py +18 -3
- {kmoe_manga_downloader-1.1.0.dist-info → kmoe_manga_downloader-1.1.1.dist-info}/METADATA +1 -1
- {kmoe_manga_downloader-1.1.0.dist-info → kmoe_manga_downloader-1.1.1.dist-info}/RECORD +9 -9
- {kmoe_manga_downloader-1.1.0.dist-info → kmoe_manga_downloader-1.1.1.dist-info}/WHEEL +0 -0
- {kmoe_manga_downloader-1.1.0.dist-info → kmoe_manga_downloader-1.1.1.dist-info}/entry_points.txt +0 -0
- {kmoe_manga_downloader-1.1.0.dist-info → kmoe_manga_downloader-1.1.1.dist-info}/licenses/LICENSE +0 -0
- {kmoe_manga_downloader-1.1.0.dist-info → kmoe_manga_downloader-1.1.1.dist-info}/top_level.txt +0 -0
|
@@ -17,9 +17,9 @@ class DirectDownloader(Downloader):
|
|
|
17
17
|
|
|
18
18
|
download_file(
|
|
19
19
|
self._session,
|
|
20
|
-
self.construct_download_url(book, volume),
|
|
20
|
+
lambda: self.construct_download_url(book, volume),
|
|
21
21
|
download_path,
|
|
22
|
-
f'[Kmoe][{book.name}][{volume.name}].epub',
|
|
22
|
+
safe_filename(f'[Kmoe][{book.name}][{volume.name}].epub'),
|
|
23
23
|
retry,
|
|
24
24
|
callback=lambda: self._callback(book, volume) if self._callback else None
|
|
25
25
|
)
|
|
@@ -23,9 +23,9 @@ class ReferViaDownloader(Downloader):
|
|
|
23
23
|
|
|
24
24
|
download_file(
|
|
25
25
|
self._session if not self._scraper else self._scraper,
|
|
26
|
-
self.fetch_download_url(book_id=book.id, volume_id=volume.id),
|
|
26
|
+
lambda: self.fetch_download_url(book_id=book.id, volume_id=volume.id),
|
|
27
27
|
download_path,
|
|
28
|
-
f'[Kmoe][{book.name}][{volume.name}].epub',
|
|
28
|
+
safe_filename(f'[Kmoe][{book.name}][{volume.name}].epub'),
|
|
29
29
|
retry,
|
|
30
30
|
headers={
|
|
31
31
|
"X-Km-From": "kb_http_down"
|
kmdr/module/downloader/utils.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Callable, Optional
|
|
1
|
+
from typing import Callable, Optional, Union
|
|
2
2
|
import os
|
|
3
3
|
import time
|
|
4
4
|
from functools import wraps
|
|
@@ -13,7 +13,7 @@ MIN_BLOCK_SIZE = 2048
|
|
|
13
13
|
|
|
14
14
|
def download_file(
|
|
15
15
|
session: Session,
|
|
16
|
-
url: str,
|
|
16
|
+
url: Union[str, Callable[[], str]],
|
|
17
17
|
dest_path: str,
|
|
18
18
|
filename: str,
|
|
19
19
|
retry_times: int = 0,
|
|
@@ -21,10 +21,22 @@ def download_file(
|
|
|
21
21
|
callback: Optional[Callable] = None,
|
|
22
22
|
block_size: int = 8192
|
|
23
23
|
):
|
|
24
|
+
"""
|
|
25
|
+
下载文件
|
|
26
|
+
|
|
27
|
+
:param session: requests.Session 对象
|
|
28
|
+
:param url: 下载链接或者其 Supplier
|
|
29
|
+
:param dest_path: 目标路径
|
|
30
|
+
:param filename: 文件名
|
|
31
|
+
:param retry_times: 重试次数
|
|
32
|
+
:param headers: 请求头
|
|
33
|
+
:param callback: 下载完成后的回调函数
|
|
34
|
+
:param block_size: 块大小
|
|
35
|
+
"""
|
|
24
36
|
if headers is None:
|
|
25
37
|
headers = {}
|
|
26
38
|
filename_downloading = f'{filename}.downloading'
|
|
27
|
-
|
|
39
|
+
|
|
28
40
|
file_path = f'{dest_path}/{filename}'
|
|
29
41
|
tmp_file_path = f'{dest_path}/{filename_downloading}'
|
|
30
42
|
|
|
@@ -34,6 +46,9 @@ def download_file(
|
|
|
34
46
|
if os.path.exists(file_path):
|
|
35
47
|
tqdm.write(f"{filename} already exists.")
|
|
36
48
|
return
|
|
49
|
+
|
|
50
|
+
if callable(url):
|
|
51
|
+
url = url()
|
|
37
52
|
|
|
38
53
|
resume_from = 0
|
|
39
54
|
total_size_in_bytes = 0
|
|
@@ -16,18 +16,18 @@ kmdr/module/configurer/ConfigUnsetter.py,sha256=ZjySNAQj4-j9k68_tbXa2Z9G0TqGgfKP
|
|
|
16
16
|
kmdr/module/configurer/OptionLister.py,sha256=qc-nWPft_EtbEgJnz32h3nwGyGbe9oabKZpm6dIJi_o,516
|
|
17
17
|
kmdr/module/configurer/OptionSetter.py,sha256=9MIkWZb-aFUTqpVCVrnri3JZTE0zO3CIYuN_nz5yzzY,842
|
|
18
18
|
kmdr/module/configurer/option_validate.py,sha256=DdtUG0E-LgjjHQgPBSyRZ_ID40QRRFSS_FEQHdK94hM,3327
|
|
19
|
-
kmdr/module/downloader/DirectDownloader.py,sha256=
|
|
20
|
-
kmdr/module/downloader/ReferViaDownloader.py,sha256=
|
|
21
|
-
kmdr/module/downloader/utils.py,sha256=
|
|
19
|
+
kmdr/module/downloader/DirectDownloader.py,sha256=5ny3or9fj2rb3qGxEWBmiEs5vlIfvCSGFiMoFISs_J8,1060
|
|
20
|
+
kmdr/module/downloader/ReferViaDownloader.py,sha256=_x-hniGmIqc_7OFY-kQUrOIH0TwDcf-_NCsmVql2pp0,1694
|
|
21
|
+
kmdr/module/downloader/utils.py,sha256=TdZ5ojVsw4ke-n5347pDzgulndOt-r56JD9lD7CuEW4,4323
|
|
22
22
|
kmdr/module/lister/BookUrlLister.py,sha256=Mq7EBXWSKd-6cygfkTjmOvgcUUaJI4NMQiaEIv9VDSk,470
|
|
23
23
|
kmdr/module/lister/FollowedBookLister.py,sha256=_fShmCAsZQqboeuRtLBjo6d9CkGpat8xNKC3COtKllc,1537
|
|
24
24
|
kmdr/module/lister/utils.py,sha256=0EHQIA05EZ1V0_SfkJ8demjzMRmFh9Q5qPvE6jvBqSU,2560
|
|
25
25
|
kmdr/module/picker/ArgsFilterPicker.py,sha256=f3suMPPeFEtB3u7aUY63k_sGIOP196R-VviQ9RfDBTA,1756
|
|
26
26
|
kmdr/module/picker/DefaultVolPicker.py,sha256=kpG5dvv1UKMhSA01VKGNB59zM5uszspyUVfRlL9aQA0,750
|
|
27
27
|
kmdr/module/picker/utils.py,sha256=lpxM7q9BJeupFQy8glBrHu1o4E38dk7iLexzKytAE6g,1222
|
|
28
|
-
kmoe_manga_downloader-1.1.
|
|
29
|
-
kmoe_manga_downloader-1.1.
|
|
30
|
-
kmoe_manga_downloader-1.1.
|
|
31
|
-
kmoe_manga_downloader-1.1.
|
|
32
|
-
kmoe_manga_downloader-1.1.
|
|
33
|
-
kmoe_manga_downloader-1.1.
|
|
28
|
+
kmoe_manga_downloader-1.1.1.dist-info/licenses/LICENSE,sha256=bKQlsXu8mAYKRZyoZKOEqMcCc8YjT5Q3Hgr21e0yU4E,1068
|
|
29
|
+
kmoe_manga_downloader-1.1.1.dist-info/METADATA,sha256=1Rj0x86vnKIJbG5C_0Q2A615ssX0b7FujbHseuSbnVs,7773
|
|
30
|
+
kmoe_manga_downloader-1.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
31
|
+
kmoe_manga_downloader-1.1.1.dist-info/entry_points.txt,sha256=DGMytQAhx4uNuKQL7BPkiWESHLXkH-2KSEqwHdygNPA,47
|
|
32
|
+
kmoe_manga_downloader-1.1.1.dist-info/top_level.txt,sha256=e0qxOgWp0tl3GLpmXGjZv3--q_TLoJ7GztM48Ov27wM,5
|
|
33
|
+
kmoe_manga_downloader-1.1.1.dist-info/RECORD,,
|
|
File without changes
|
{kmoe_manga_downloader-1.1.0.dist-info → kmoe_manga_downloader-1.1.1.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{kmoe_manga_downloader-1.1.0.dist-info → kmoe_manga_downloader-1.1.1.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{kmoe_manga_downloader-1.1.0.dist-info → kmoe_manga_downloader-1.1.1.dist-info}/top_level.txt
RENAMED
|
File without changes
|