22 lines
671 B
Python
22 lines
671 B
Python
"""Quick smoke test for changpei plugin."""
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from pixiv_app.core.plugin.manager import PluginManager
|
|
|
|
manager = PluginManager([ROOT / "plugins"])
|
|
plugin = manager.load_plugin(ROOT / "plugins" / "changpei" / "plugin.py")
|
|
assert plugin is not None
|
|
print("loaded", plugin.name, plugin.version)
|
|
|
|
outcome = plugin.resolve_target("2058540")
|
|
resources = outcome["resources"]
|
|
print("chapters", len(resources), outcome["book_title"])
|
|
|
|
chapter = resources[1]
|
|
paths = plugin.download(chapter, ROOT / ".tmp_changpei_test")
|
|
print("saved", paths[0], paths[0].stat().st_size)
|