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

v2.1.12 #53

Merged
merged 18 commits into from
Aug 5, 2024
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: 0 additions & 2 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
poetry==1.7.1
# Poetry plugins
# poetry-plugin-exports==1.6.0
14 changes: 5 additions & 9 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# New features and Changes
- Shorten long anime titles in progress bars
- Hover on folder button shows folder location
- senpcli: Always show units/time instead of time/units in progress bars
- senpcli: Add anime tracking functionality
- senpcli: Add option to print direct download links instead of downloading
- No features?

# Bug fixes
- Fix some gogo downloads randomly failing, if you still experience it be sure to report it
- Fix failed to fetch direct download links notification on cancelling direct download links retrieval
- Fix anime randomizer
- Fix opening chosen anime window for other anime failing if previous attempt failed
- gogo: Fix randomly skipped episodes, if it still happens please report it
- pahe: Fix downloading the same episode for anime with recaps
- Fix anime with long titles being downloaded with the shortened title
- senpcli: Fix check tracked anime crashing if no episode of the anime was initially downloaded
13 changes: 8 additions & 5 deletions docs/senpcli-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pkg update -y && curl https://raw.githubusercontent.com/SenZmaKi/Senpwai/master/
## Usage

```bash
senpcli [-h] [-v] [-sd {sub,dub}] [-s {pahe,gogo}] [-se START_EPISODE] [-ee END_EPISODE] [-q {1080p,720p,480p,360p}] [-hls] [-sc] [-msd] [-of] title
senpcli [-h] [-v] [-sd {sub,dub}] [-s {pahe,gogo}] [-se] [-ee] [-q {1080p,720p,480p,360p}] [-hls] [-sc] [-msd] [-of] [-cta] [-ata] [-rta] [-ddl] title
```

### Positional Arguments
Expand All @@ -45,14 +45,17 @@ senpcli [-h] [-v] [-sd {sub,dub}] [-s {pahe,gogo}] [-se START_EPISODE] [-ee END_
- `-c, --config` Show config file contents and location
- `-u, --update` Check for updates
- `-s {pahe,gogo}, --site {pahe,gogo}`: Site to download from
- `-se START_EPISODE, --start_episode START_EPISODE`: Episode to start downloading at
- `-ee END_EPISODE, --end_episode END_EPISODE`: Episode to stop downloading at
- `-se, --start_episode`: Episode to start downloading at
- `-ee, --end_episode`: Episode to stop downloading at
- `-q {1080p,720p,480p,360p}, --quality {1080p,720p,480p,360p}`: Quality to download the anime in
- `-sd {sub,dub}, --sub_or_dub {sub,dub}`: Whether to download the subbed or dubbed version of the anime
- `-hls, --hls`: Use HLS mode to download the anime (Gogo only and requires FFmpeg to be installed)
- `-sc, --skip_calculating`: Skip calculating the total download size (Gogo only)
- `-of, --open_folder`: Open the folder containing the downloaded anime once the download finishes
- `-msd MAX_SIMULTANEOUS_DOWNLOADS, --max_simultaneous_downloads MAX_SIMULTANEOUS_DOWNLOADS`: Maximum number of simultaneous downloads
- `-msd, --max_simultaneous_downloads`: Maximum number of simultaneous downloads
- ` -cta, --check_tracked_anime`: Check tracked anime for new episodes then download
- `-ata, --add_tracked_anime`: Add an anime to the tracked anime list. Use the anime's title as it appears on your tracking site
- `-rta, --remove_tracked_anime`: Remove an anime from the tracked anime list
- `-ddl, --direct_download_links`: Print direct download links instead of downloading

### Settings

Expand Down
786 changes: 785 additions & 1 deletion poetry.lock

Large diffs are not rendered by default.

61 changes: 36 additions & 25 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "senpwai"
version = "2.1.11"
version = "2.1.12"
description = "A desktop app for tracking and batch downloading anime"
authors = ["SenZmaKi <[email protected]>"]
license = "GPL v3"
Expand All @@ -11,18 +11,18 @@ exclude = ["src/**/test.py"]
repository = "https://github.com/SenZmaKi/Senpwai"
documentation = "https://github.com/SenZmaKi/Senpwai/blob/master/README.md"
keywords = [
"anime",
"app",
"cli",
"desktop app",
"anime downloader",
"anime cli",
"anime app",
"anime tracker",
"batch anime downloader",
"bulk anime downloader",
"anime desktop app",
"anime tracker app",
"anime",
"app",
"cli",
"desktop app",
"anime downloader",
"anime cli",
"anime app",
"anime tracker",
"batch anime downloader",
"bulk anime downloader",
"anime desktop app",
"anime tracker app",
]

[tool.cx_freeze]
Expand Down Expand Up @@ -57,30 +57,36 @@ pyqt6 = "^6.6.1"
cx-freeze = "^6.15.12"
ruff = "^0.2.1"
poethepoet = "^0.24.4"
poetry-plugin-export = "^1.8.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poe.tasks]
release = "python -m scripts.release"
export_dependencies = "poetry export -f requirements.txt --output requirements.txt"
bump_version = "python -m scripts.bump_version"
announce = "python -m scripts.announce"
announce_discord = "python scripts/announce/discord.py"
announce_reddit = "python scripts/announce/reddit.py"
format = "python -m scripts.ruff --format"
lint_fix = "python -m scripts.ruff --lint_fix"
lint = "python -m scripts.ruff --lint"
build_release_test = [{ref = "lint"}, { ref = "test" }, { ref = "build_release" }]
build_release_test = [
{ ref = "lint" },
{ ref = "test" },
{ ref = "build_release" },
]
build_release_ddl = [{ ref = "test_ddl" }, { ref = "build_release" }]
build_release = [
{ ref = "build_exes" },
{ ref = "compile_installers" },
{ ref = "install" },
{ ref = "run_exes" },
{ ref = "build_pip" },
{ ref = "install_pip" },
{ ref = "run_pip_exes" },
{ ref = "build_exes" },
{ ref = "compile_installers" },
{ ref = "install" },
{ ref = "run_exes" },
{ ref = "build_pip" },
{ ref = "install_pip" },
{ ref = "run_pip_exes" },
]
test = [{ ref = "test_pahe" }, { ref = "test_gogo" }]
test_pahe = "python -m senpwai.scrapers.test --site pahe all"
Expand All @@ -94,14 +100,19 @@ test_pahe_dpl = "python -m senpwai.scrapers.test --site pahe download_page"
test_gogo_ddl = [{ ref = "test_gogo_norm_ddl" }, { ref = "test_gogo_hls_ddl" }]
test_gogo_norm_ddl = "python -m senpwai.scrapers.test --site gogo direct_links"
test_gogo_hls_ddl = "python -m senpwai.scrapers.test --site gogo hls_links"
test_pip = [
{ ref = "build_pip" },
{ ref = "install_pip" },
{ ref = "run_pip_exes" },
]

build_exes = [{ ref = "build_senpwai_exe" }, { ref = "build_senpcli_exe" }]
build_senpwai_exe = "python -m scripts.setup build"
build_senpcli_exe = "python -m scripts.setup --senpcli build"

compile_installers = [
{ ref = "compile_senpwai_installer" },
{ ref = "compile_senpcli_installer" },
{ ref = "compile_senpwai_installer" },
{ ref = "compile_senpcli_installer" },
]
compile_senpwai_installer = "iscc scripts/setup.iss /Q"
compile_senpcli_installer = "iscc scripts/setup_senpcli.iss /Q"
Expand All @@ -118,8 +129,8 @@ publish_pip = "poetry publish"
run_all_exes = "python -m scripts.run_exes --all"
run_exes = [{ ref = "run_senpwai_exe" }, { ref = "run_senpcli_exe" }]
run_pip_exes = [
{ ref = "run_senpwai_pip_exe" },
{ ref = "run_senpcli_pip_exe" },
{ ref = "run_senpwai_pip_exe" },
{ ref = "run_senpcli_pip_exe" },
]
run_senpwai_exe = "python -m scripts.run_exes --senpwai"
run_senpcli_exe = "python -m scripts.run_exes --senpcli"
Expand Down
2 changes: 1 addition & 1 deletion scripts/announce/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .main import main # noqa F403
from scripts.announce.main import main # noqa F403
10 changes: 5 additions & 5 deletions scripts/bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import sys
import re
from typing import cast
from .common import (
from scripts.common import (
ROOT_DIR,
get_current_branch_name,
git_commit,
log_error as common_log_error,
log_info,
log_warning,
overwrite,
)
from scripts import common


PYPROJECT_FILE_PATH = ROOT_DIR.joinpath("pyproject.toml")
Expand All @@ -28,20 +28,20 @@


def log_error(msg: str, exit=False) -> None:
common_log_error(msg, exit)
common.log_error(msg, exit)
global ENCOUNTERED_ERROR
ENCOUNTERED_ERROR = True


@cache
def get_prev_version() -> str:
def get_prev_version(exit=True) -> str:
prev_version = ""
with open(PYPROJECT_FILE_PATH, "r") as f:
opt_version = VERSION_REGEX.search(f.read())
if opt_version is not None:
prev_version = opt_version.group(1)
if not prev_version:
log_error("Failed to get previous version", True)
log_error("Failed to get previous version", exit)
return prev_version


Expand Down
61 changes: 40 additions & 21 deletions scripts/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@


def merge_branch() -> None:
completed_process = subprocess.run(
"git status", capture_output=True, text=True
)
completed_process = subprocess.run("git status", capture_output=True, text=True)
completed_process.check_returncode()
if "Changes" in completed_process.stdout:
log_error("You have uncommited changes", True)
Expand All @@ -29,35 +27,38 @@ def merge_branch() -> None:
subprocess.run("gh pr merge --auto --merge --delete-branch").check_returncode()


def add_change_log_link(release_notes: str) -> str:
prev_version = bump_version.get_prev_version()
def add_change_log_link(release_notes: str, previous_version: str | None) -> str:
new_version = bump_version.get_new_version()
if new_version == prev_version:
prev_version = input(
'Failed to get previous version number, manual input required (without the "v" prefix)\n> '
)
if not prev_version:
sys.exit()
if previous_version:
prev_version = previous_version
else:
prev_version = bump_version.get_prev_version(False)
if new_version == prev_version:
prev_version = input(
'Failed to get previous version number, manual input required (without the "v" prefix)\n> '
)
if not prev_version:
sys.exit()
change_log_link = (
f"**Full Changelog**: {REPO_URL}/compare/v{prev_version}...v{new_version}"
)
return f"{release_notes}\n\n{change_log_link}"


def get_release_notes(from_commits: bool) -> str:
def get_release_notes(from_commits: bool, previous_version: str | None) -> str:
with open(ROOT_DIR.joinpath("docs", "release-notes.md"), "r+") as f:
if not from_commits:
return add_change_log_link(f.read())
return add_change_log_link(f.read(), previous_version)
completed_process = subprocess.run(
f'git log --oneline --format="%s" master..{BRANCH_NAME}',
f'git log --format="%s" master..{BRANCH_NAME}',
capture_output=True,
text=True,
)
completed_process.check_returncode()
release_notes = f"# Changes\n\n{completed_process.stdout}"
overwrite(f, release_notes)
git_commit("Generate release notes from commits").check_returncode()
return add_change_log_link(release_notes)
return add_change_log_link(release_notes, previous_version)


def publish_release(release_notes: str) -> None:
Expand All @@ -69,10 +70,18 @@ def publish_release(release_notes: str) -> None:
f'gh release create {BRANCH_NAME} --notes "{release_notes}"'
).check_returncode()
subprocess.run(
f'gh release upload {BRANCH_NAME} {ROOT_DIR.joinpath("setups/Senpwai-setup.exe")} {ROOT_DIR.joinpath("setups/Senpcli-setup.exe")}'
f'gh release upload {BRANCH_NAME} {ROOT_DIR.joinpath("setups","Senpwai-setup.exe")} {ROOT_DIR.joinpath("setups", "Senpcli-setup.exe")}'
).check_returncode()


def new_branch() -> None:
new_branch_name = input(
'Enter new branch name (with the "v" prefix if necessary)\n> '
)
if new_branch_name:
subprocess.run(f"git checkout -b {new_branch_name}").check_returncode()


def main() -> None:
parser = ArgumentParser(description="Release pipeline")
parser.add_argument(
Expand All @@ -81,6 +90,12 @@ def main() -> None:
action="store_true",
help="Generate release notes from commits",
)
parser.add_argument(
"-sed",
"--skip_export_dependencies",
action="store_true",
help="Skip exporting poetry dependencies to requirements.txt",
)
parser.add_argument(
"-sb", "--skip_bump", action="store_true", help="Skip bumping version"
)
Expand Down Expand Up @@ -117,9 +132,16 @@ def main() -> None:
action="store_true",
help="Skip creating new branch",
)
parser.add_argument(
"-pv", "--previous_version", help='Previous version number (without the "v" prefix)', type=str
)
parsed = parser.parse_args()
if BRANCH_NAME == "master":
log_error("On master branch, switch to version branch", True)
if not parsed.skip_export_dependencies:
log_info("Exporting dependencies")
subprocess.run("poe export_dependencies").check_returncode()
git_commit("Export poetry dependencies to requirements.txt")
if not parsed.skip_bump:
log_info("Bumping version")
bump_version.main(True)
Expand All @@ -128,7 +150,7 @@ def main() -> None:
if not parsed.skip_build_release:
log_info("Building release")
subprocess.run("poe build_release_ddl").check_returncode()
release_notes = get_release_notes(parsed.from_commits)
release_notes = get_release_notes(parsed.from_commits, parsed.previous_version)
if not parsed.skip_merge_branch:
log_info(f"Merging branch {BRANCH_NAME}")
merge_branch()
Expand All @@ -145,10 +167,7 @@ def main() -> None:
)
log_info(f"Finished release {BRANCH_NAME}")
if not parsed.skip_new_branch:
new_branch_name = input("Enter new branch name\n> ")
if new_branch_name:
subprocess.run("git checkout master").check_returncode()
subprocess.run(f"git checkout -b {new_branch_name}").check_returncode()
new_branch()


if __name__ == "__main__":
Expand Down
6 changes: 3 additions & 3 deletions scripts/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Senpwai"
#define MyAppVersion "2.1.11"
#define MyAppVersion "2.1.12"
#define MyAppPublisher "AkatsuKi Inc."
#define MyAppURL "https://github.com/SenZmaKi/Senpwai"
#define MyAppExeName "senpwai.exe"
Expand All @@ -11,10 +11,10 @@
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{B1AC746D-A6F0-44EF-B812.1.11-0DF4571B51}}
AppId={{B1AC746D-A6F0-44EF-B812.1.12-0DF4571B51}}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
VersionInfoVersion=2.1.11.0
VersionInfoVersion=2.1.12.0
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
Expand Down
Loading
Loading