Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to v0.2.2 #19

Merged
merged 9 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ktoolbox/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__title__ = "KToolBox"
# noinspection SpellCheckingInspection
__description__ = "A useful CLI tool for downloading posts in Kemono.party / .su"
__version__ = "0.2.1"
__version__ = "0.2.2"
7 changes: 6 additions & 1 deletion ktoolbox/action/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,12 @@ async def create_job_from_creator(
job_list: List[Job] = []
for post in post_list:
# Get post path
default_post_path = path if mix_posts else path / sanitize_filename(post.title)
if mix_posts:
default_post_path = path
elif config.job.post_id_as_path:
default_post_path = path / post.id
else:
default_post_path = path / sanitize_filename(post.title)
if update_from:
if not (post_path := update_from.posts_path.get(post.id)):
post_path = default_post_path
Expand Down
16 changes: 3 additions & 13 deletions ktoolbox/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from ktoolbox.api.misc import get_app_version
from ktoolbox.api.posts import get_post as get_post_api
from ktoolbox.configuration import config
from ktoolbox.downloader import Downloader
from ktoolbox.enum import TextEnum
from ktoolbox.job import JobRunner, CreatorIndices
from ktoolbox.utils import dump_search, parse_webpage_url, generate_msg
Expand All @@ -35,8 +34,8 @@ async def site_version():
# noinspection PyShadowingBuiltins
@staticmethod
async def search_creator(
id: str = None,
name: str = None,
id: str = None,
service: str = None,
*,
dump: Path = None
Expand Down Expand Up @@ -172,9 +171,10 @@ async def download_post(
post_id=post_id
)
if ret:
post_path = path / ret.data.id if config.job.post_id_as_path else path / sanitize_filename(ret.data.title)
job_list = await create_job_from_post(
post=ret.data,
post_path=path / sanitize_filename(ret.data.title),
post_path=post_path,
dump_post_data=dump_post_data
)
job_runner = JobRunner(job_list=job_list)
Expand Down Expand Up @@ -299,13 +299,3 @@ async def sync_creator(
await job_runner.start()
else:
return ret.message

@staticmethod
async def dev_test():
"""Dev test"""
downloader = Downloader(
"https://github.com/Ljzd-PRO/Mys_Goods_Tool/releases/download/v2.1.0/v2.1.0-Linux-x86_64.zip",
Path("./")
)
ret = await downloader.run(progress=True)
return ret.data if ret else ret.message
2 changes: 1 addition & 1 deletion ktoolbox/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class JobConfiguration(BaseModel):
"""Download jobs Configuration"""
count: int = 4
"""Number of coroutines for concurrent download"""
post_id_as_name: bool = False
post_id_as_path: bool = False
"""Use post ID as post directory name"""
post_structure: PostStructureConfiguration = PostStructureConfiguration()
"""Post path structure"""
Expand Down
Loading