Skip to content

Commit

Permalink
Merge pull request #19 from Ljzd-PRO/devel
Browse files Browse the repository at this point in the history
Bump to v0.2.2
  • Loading branch information
Ljzd-PRO authored Dec 1, 2023
2 parents c9d83f7 + e2a2ac1 commit fbf54db
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 127 deletions.
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

0 comments on commit fbf54db

Please sign in to comment.