Skip to content

Commit

Permalink
Merge pull request #59 from SenZmaKi/v2.1.13
Browse files Browse the repository at this point in the history
v2.1.13
  • Loading branch information
SenZmaKi authored Sep 2, 2024
2 parents 484d495 + bbe16ab commit 16f8e93
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 42 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ poetry run senpwai
## FAQ

<details> <summary> Why did you make this? </summary>
I couldn't afford wifi so I used my college wifi to download anime after class but batch downloading from streaming sites is a pain in the ass,
I couldn't afford wifi so I used my college wifi to batch download anime after class but batch downloading from streaming sites is a pain in the ass,
you have to click billions of links just to download one episode, so I made Senpwai to help me and possibly others that face a similar problem.
</details>

Expand All @@ -137,10 +137,10 @@ More sources means more writing more code which in turn means fixing more bugs.

## Links

[Sub-reddit](https://reddit.com/r/Senpwai)

[Discord server](https://discord.com/invite/e9UxkuyDX2)

[Subreddit](https://reddit.com/r/Senpwai)

[GitHub Sponsors](https://github.com/sponsors/SenZmaKi)

[Patreon](https://patreon.com/Senpwai)
Expand Down
5 changes: 1 addition & 4 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
- No features?

# Bug fixes
- 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
- pahe: Fix some anime only downloading the first episode
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "senpwai"
version = "2.1.12"
version = "2.1.13"
description = "A desktop app for tracking and batch downloading anime"
authors = ["SenZmaKi <[email protected]>"]
license = "GPL v3"
Expand Down
2 changes: 1 addition & 1 deletion scripts/announce/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def remove_embed_url(string: str) -> str:


def send_message(message: str, channel_id: str, message_reference_id: str) -> None:
with open(ROOT_DIR.joinpath(".credentials", "discord.json")) as f:
with open(ROOT_DIR / ".credentials" / "discord.json") as f:
token = json.load(f)["token"]
headers = {
"Authorization": f"Bot {token}",
Expand Down
2 changes: 1 addition & 1 deletion scripts/announce/reddit.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def validate_response(is_ok: bool, response_json: dict[str, Any]) -> None:


def fetch_access_token() -> str:
with open(ROOT_DIR.joinpath(".credentials", "reddit.json"), "r") as f:
with open(ROOT_DIR / ".credentials" / "reddit.json", "r") as f:
credentials = json.load(f)
data = {
"scope": "*",
Expand Down
8 changes: 4 additions & 4 deletions scripts/bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
from scripts import common


PYPROJECT_FILE_PATH = ROOT_DIR.joinpath("pyproject.toml")
PYPROJECT_FILE_PATH = ROOT_DIR / "pyproject.toml"
FILES_PATHS = [
PYPROJECT_FILE_PATH,
ROOT_DIR.joinpath("senpwai/common/static.py"),
ROOT_DIR.joinpath("scripts/setup.iss"),
ROOT_DIR.joinpath("scripts/setup_senpcli.iss"),
ROOT_DIR / "senpwai/common/static.py",
ROOT_DIR / "scripts/setup.iss",
ROOT_DIR / "scripts/setup_senpcli.iss",
]

ENCOUNTERED_ERROR = False
Expand Down
2 changes: 1 addition & 1 deletion scripts/install_pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def main() -> None:
# Global pip cause venv pip is weird sometimes cause poetry and stuff
pip_path = join_from_py_scripts("pip.exe")
dist_dir = ROOT_DIR.joinpath("dist")
dist_dir = ROOT_DIR / "dist"
distributable = next(dist_dir.glob("*"))
subprocess.run(f"{pip_path} uninstall senpwai -y").check_returncode()
subprocess.run(f"{pip_path} install {distributable}").check_returncode()
Expand Down
20 changes: 17 additions & 3 deletions scripts/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def add_change_log_link(release_notes: str, previous_version: str | None) -> 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:
with open(ROOT_DIR / "docs" / "release-notes.md", "r+") as f:
if not from_commits:
return add_change_log_link(f.read(), previous_version)
completed_process = subprocess.run(
Expand All @@ -70,7 +70,7 @@ 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 / "setups" / "Senpwai-setup.exe"} {ROOT_DIR / "setups"/ "Senpcli-setup.exe"}'
).check_returncode()


Expand All @@ -82,6 +82,14 @@ def new_branch() -> None:
subprocess.run(f"git checkout -b {new_branch_name}").check_returncode()


def get_debug_comment_location() -> str | None:
for f in (ROOT_DIR / "senpwai").rglob("*.py"):
with open(f, "r", encoding="utf-8") as file:
for idx, line in enumerate(file.readlines()):
if "DEBUG" in line:
return f"{f}, line {idx + 1}"


def main() -> None:
parser = ArgumentParser(description="Release pipeline")
parser.add_argument(
Expand Down Expand Up @@ -133,11 +141,17 @@ def main() -> None:
help="Skip creating new branch",
)
parser.add_argument(
"-pv", "--previous_version", help='Previous version number (without the "v" prefix)', type=str
"-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)
debug_comment = get_debug_comment_location()
if debug_comment:
log_error(f"Debug comment found in {debug_comment}", True)
if not parsed.skip_export_dependencies:
log_info("Exporting dependencies")
subprocess.run("poe export_dependencies").check_returncode()
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.12"
#define MyAppVersion "2.1.13"
#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.12-0DF4571B51}}
AppId={{B1AC746D-A6F0-44EF-B812.1.13-0DF4571B51}}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
VersionInfoVersion=2.1.12.0
VersionInfoVersion=2.1.13.0
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
Expand Down
6 changes: 3 additions & 3 deletions scripts/setup_senpcli.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 "Senpcli"
#define MyAppVersion "2.1.12"
#define MyAppVersion "2.1.13"
#define MyAppPublisher "AkatsuKi Inc."
#define MyAppURL "https://github.com/SenZmaKi/Senpwai"
#define MyAppExeName "Senpcli.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={{7D4A0DD5-EACB-45-81FC-2.1.125FCFF05BB6}}
AppId={{7D4A0DD5-EACB-45-81FC-2.1.135FCFF05BB6}}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
VersionInfoVersion=2.1.12.0
VersionInfoVersion=2.1.13.0
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
Expand Down
3 changes: 2 additions & 1 deletion senpwai/common/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ def load_settings(self) -> None:
if gogo_norm_or_hls_mode is not None:
self.gogo_mode = gogo_norm_or_hls_mode
settings.pop("gogo_norm_or_hls_mode")
if "gogo_skip_calculate" in settings:
settings.pop("gogo_skip_calculate")
self.__dict__.update(settings)
except json.JSONDecodeError:
pass
Expand Down Expand Up @@ -233,7 +235,6 @@ def update_tracking_interval(self, tracking_interval: int) -> None:
self.tracking_interval = tracking_interval
self.save_settings()


def update_pahe_home_url(self, pahe_home_url: str) -> None:
self.pahe_home_url = pahe_home_url
self.save_settings()
Expand Down
4 changes: 2 additions & 2 deletions senpwai/common/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def custom_exception_handler(

APP_NAME = "Senpwai"
APP_NAME_LOWER = "senpwai"
VERSION = "2.1.12"
VERSION = "2.1.13"
DESCRIPTION = "A desktop app for tracking and batch downloading anime"

IS_PIP_INSTALL = False
Expand Down Expand Up @@ -87,7 +87,7 @@ def windows_setup_file_titles(app_name: str) -> tuple[str, str]:
return (f"{app_name}-setup.exe", f"{app_name}-setup.msi")


# TODO: DEPRECATION Remove in version 2.1.12+ since we download updates to temp
# TODO: DEPRECATION Remove in version 2.1.13+ since we download updates to temp
for title in windows_setup_file_titles(APP_NAME):
try_deleting(os.path.join(ROOT_DIRECTORY, title))
for title in windows_setup_file_titles("Senpcli"):
Expand Down
10 changes: 4 additions & 6 deletions senpwai/scrapers/pahe/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,8 @@ def generate_episode_page_links(
episodes_data: list[dict[str, Any]],
anime_id: str,
):
# These values should theoritically never remain as they are unless something crashes
# as in both of the ifs in the for loop should always eventually evaluate to True
start_idx = 0
end_idx = 0
end_idx = len(episodes_data) - 1

for idx, episode in enumerate(episodes_data):
# Sometimes for sequels animepahe continues the episode numbers from the last episode of the previous season
Expand All @@ -132,7 +130,7 @@ def generate_episode_page_links(
episode_num = episode["episode"] - (first_episode - 1)
if episode_num == start_episode:
start_idx = idx
if episode_num == end_episode:
if episode_num == end_episode:
end_idx = idx
break
episodes_data = episodes_data[start_idx : end_idx + 1]
Expand Down Expand Up @@ -164,8 +162,8 @@ def get_episode_page_links(
if start_page_num == 1:
episodes_data.extend(first_page_json["data"])
start_page_num += 1
if progress_update_callback:
progress_update_callback(1)
if progress_update_callback:
progress_update_callback(1)
for page_num in range(start_page_num, end_page_num + 1):
page_url = LOAD_EPISODES_URL.format(anime_page_link, page_num)
page_json = site_request(page_url).json()
Expand Down
9 changes: 6 additions & 3 deletions senpwai/scrapers/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
DEFAULT_END_EPISODE = "2"
DEFAULT_SUB_OR_DUB = "sub"
DEFAULT_SITE = "pahe"
DEFAULT_DOWNLOAD_FOLDER_PATH = os.path.join(ROOT_DIRECTORY, "..", ".test-downloads")
DEFAULT_DOWNLOAD_FOLDER_PATH = os.path.join(
os.path.dirname(ROOT_DIRECTORY), ".test-downloads"
)
DEFAULT_VERBOSE = False
DEFAULT_SILENT = False
SILENT = DEFAULT_SILENT
Expand Down Expand Up @@ -585,14 +587,15 @@ def print_metadata(metadata: AnimeMetadata):
if args.sub_or_dub == "dub" and not dub_available:
print("Couldn't find Dub for the anime on the specified site")
return
if args.arg_in_group_was_passed(COMMANDS) and args.site == GOGO:
if args.arg_in_group_was_passed(COMMANDS):
if args.end_eps > metadata.episode_count:
return print(
f"The chosen target anime has {metadata.episode_count} episodes yet you specified the ('--end_episode', '-ee') as {args.end_eps}"
)
elif args.site == GOGO and dub_available:
dub_metadata, dub_page_content = test_get_metadata(
args.site, ["", dub_link],
args.site,
["", dub_link],
)
if args.sub_or_dub == "dub":
metadata, page_content = dub_metadata, dub_page_content
Expand Down
3 changes: 2 additions & 1 deletion senpwai/senpcli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,12 @@ def gogo_get_direct_download_links(
) = gogo.GetDirectDownloadLinks().get_direct_download_links(
download_page_links, quality, pbar.update_
)
pbar.close_()
size = sum(download_sizes) // IBYTES_TO_MBS_DIVISOR
size_text = add_color(
f"{size} MB { ', go shower' if size >= 1000 else ''}", Color.MAGENTA
)
print_info(f"Total download size: {size_text}")
pbar.close_()
return direct_download_links, download_sizes


Expand Down Expand Up @@ -621,6 +621,7 @@ def handle_pahe(parsed: Namespace, anime_details: AnimeDetails):
)
direct_download_links = pahe_get_direct_download_links(download_page_links)
if parsed.direct_download_links:
print("Direct download links:")
print("\n".join(direct_download_links))
return
download_manager(
Expand Down
11 changes: 6 additions & 5 deletions senpwai/windows/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
OS,
PATREON_ICON_PATH,
REDDIT_ICON_PATH,
SEN_ANILIST_ID,
SEN_ICON_PATH,
VERSION,
)
Expand Down Expand Up @@ -62,10 +63,10 @@ def __init__(self, main_window: "MainWindow"):
- If Senpwai can't find the quality you want it will pick the closest lower one e.g., if you choose 720p but only 1080p and 360p is available it'll pick 360p
- So long as the app is open Senpwai will try to resume⏯️ ongoing downloads even if you lose an internet connection
- Experiencing slow downloads? Use gogo hls mode for the fastest🚀 download speeds
- [Hover✨](https://open.spotify.com/playlist/460b5y4LB8Dixh0XajVVaL?si=fce0f0f762464e81) over something that you don't understand there's probably a tool tip for it
- [Hover✨](https://anilist.co/user/{SEN_ANILIST_ID}) over something that you don't understand there's probably a tool tip for it
- If the app screen📺 is white after you minimised it to tray and reopened it (usually on Windows🗑️), click the tray icon to fix it
- Open the settings folder by clicking the button with its location in the top left corner of the settings window
- Downloading from Pahe skips⏩ recap episodes
- Downloading from Pahe skips⏩ recap episodes, but this kinds of messes up the episode numbering
- To completely remove Senpwai (don't know why you would though), post-uninstallation delete the settings folder, 🫵🏿®️🅰️🤡
- To use a custom font family, edit the `font_family` value in the settings file, if left empty, it will default to your OS setting
- Hate the background images📸? Check out the [discord]({DISCORD_INVITE_LINK}) for [senptheme](https://discord.com/channels/1131981618777702540/1211137093955362837/1211175899895038033)
Expand Down Expand Up @@ -128,7 +129,7 @@ def __init__(self, main_window: "MainWindow"):
donation_buttons_widget.setLayout(donation_buttons_layout)
leave_a_star_label = StyledLabel()
leave_a_star_label.setText(
"You can also support Senpwai by leaving a star on the github repo, stars help other weebs like us know about it"
"You can also support Senpwai by starring the github repo, stars are free and help other weebs like us know about Senpwai"
)
set_minimum_size_policy(leave_a_star_label)
social_links_title = Title("Social Links")
Expand All @@ -151,11 +152,11 @@ def __init__(self, main_window: "MainWindow"):
discord_button.setToolTip(DISCORD_INVITE_LINK)
social_links_buttons_widget = QWidget()
social_links_buttons_layout = QHBoxLayout()
social_links_buttons_layout.addWidget(discord_button)
social_links_buttons_layout.addSpacing(30)
social_links_buttons_layout.addWidget(github_button)
social_links_buttons_layout.addSpacing(30)
social_links_buttons_layout.addWidget(reddit_button)
social_links_buttons_layout.addSpacing(30)
social_links_buttons_layout.addWidget(discord_button)
social_links_buttons_layout.setAlignment(Qt.AlignmentFlag.AlignLeft)
social_links_buttons_widget.setLayout(social_links_buttons_layout)
version_title = Title(f"Version {VERSION}")
Expand Down

0 comments on commit 16f8e93

Please sign in to comment.