Skip to content

Commit 0c5dc37

Browse files
committed
Bumpv v3.4.8
1 parent 474ce52 commit 0c5dc37

File tree

2 files changed

+51
-4
lines changed

2 files changed

+51
-4
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__title__ = 'StreamingCommunity'
2-
__version__ = '3.4.7'
2+
__version__ = '3.4.8'
33
__author__ = 'Arrowar'
44
__description__ = 'A command-line program to download film'
55
__copyright__ = 'Copyright 2025'

StreamingCommunity/Util/installer/device_install.py

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88

99
# External library
10+
import httpx
1011
from rich.console import Console
1112

1213

@@ -21,6 +22,7 @@
2122
class DeviceDownloader:
2223
def __init__(self):
2324
self.base_dir = binary_paths.ensure_binary_directory()
25+
self.github_png_url = "https://github.com/Arrowar/StreamingCommunity/raw/main/.github/.site/img/crunchyroll_etp_rt.png"
2426

2527
def extract_png_chunk(self, png_with_wvd: str, out_wvd_path: str) -> bool:
2628
"""Extract WVD data"""
@@ -85,19 +87,64 @@ def _find_png_recursively(self, start_dir: str = ".") -> Optional[str]:
8587
logging.error(f"Error during recursive PNG search: {e}")
8688
return None
8789

90+
def _download_png_from_github(self, output_path: str) -> bool:
91+
"""Download PNG file from GitHub repository."""
92+
try:
93+
logging.info(f"Downloading PNG from GitHub: {self.github_png_url}")
94+
95+
with httpx.Client(timeout=30.0, follow_redirects=True) as client:
96+
response = client.get(self.github_png_url)
97+
response.raise_for_status()
98+
99+
with open(output_path, "wb") as f:
100+
f.write(response.content)
101+
102+
logging.info(f"Successfully downloaded PNG to: {output_path}")
103+
return True
104+
105+
except httpx.HTTPError as e:
106+
logging.error(f"HTTP error downloading PNG from GitHub: {e}")
107+
return False
108+
except Exception as e:
109+
logging.error(f"Error downloading PNG from GitHub: {e}")
110+
return False
111+
88112
def download(self) -> Optional[str]:
89113
"""
90114
Main method to extract WVD file from PNG.
115+
Downloads PNG from GitHub if not found locally.
91116
"""
92117
try:
118+
# Try to find PNG locally first
93119
png_path = self._find_png_recursively()
120+
temp_png_path = None
121+
122+
# If not found locally, download from GitHub
94123
if not png_path:
95-
logging.error("PNG file not found, cannot extract device.wvd")
96-
return None
124+
logging.info("PNG not found locally, downloading from GitHub")
125+
temp_png_path = os.path.join(self.base_dir, 'crunchyroll_etp_rt.png')
126+
127+
if not self._download_png_from_github(temp_png_path):
128+
logging.error("Failed to download PNG from GitHub")
129+
return None
130+
131+
png_path = temp_png_path
97132

98133
device_wvd_path = os.path.join(self.base_dir, 'device.wvd')
99134

100-
if self.extract_png_chunk(png_path, device_wvd_path):
135+
# Extract WVD from PNG
136+
extraction_success = self.extract_png_chunk(png_path, device_wvd_path)
137+
138+
# Clean up temporary PNG file if it was downloaded
139+
if temp_png_path and os.path.exists(temp_png_path):
140+
try:
141+
os.remove(temp_png_path)
142+
logging.info("Removed temporary PNG file")
143+
except Exception as e:
144+
logging.warning(f"Could not remove temporary PNG file: {e}")
145+
146+
# Check extraction result
147+
if extraction_success:
101148
if os.path.exists(device_wvd_path) and os.path.getsize(device_wvd_path) > 0:
102149
logging.info("Successfully extracted device.wvd from PNG")
103150
return device_wvd_path

0 commit comments

Comments
 (0)