Skip to content

Commit 3614ab5

Browse files
committed
Bump v3.4.8
1 parent aba7fe4 commit 3614ab5

File tree

7 files changed

+41
-54
lines changed

7 files changed

+41
-54
lines changed

StreamingCommunity/Lib/Downloader/DASH/downloader.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -588,14 +588,11 @@ def finalize_output(self):
588588
self.output_file = new_filename
589589

590590
# Display file information
591-
if os.path.exists(output_file):
592-
file_size = internet_manager.format_file_size(os.path.getsize(output_file))
593-
duration = print_duration_table(output_file, description=False, return_string=True)
594-
console.print(f"[yellow]Output [red]{os.path.abspath(output_file)} [cyan]with size [red]{file_size} [cyan]and duration [red]{duration}")
595-
else:
596-
console.print(f"[red]Output file not found: {output_file}")
597-
self.error = f"Output file not found: {output_file}"
598-
return None
591+
file_size = internet_manager.format_file_size(os.path.getsize(output_file))
592+
duration = print_duration_table(output_file, description=False, return_string=True)
593+
console.print(f"[yellow]Output[white]: [red]{os.path.abspath(output_file)} \n"
594+
f" [cyan]with size[white]: [red]{file_size} \n"
595+
f" [cyan]and duration[white]: [red]{duration}")
599596

600597
if CLEANUP_TMP:
601598

StreamingCommunity/Lib/Downloader/HLS/downloader.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,10 @@ def _print_summary(self, use_shortest: bool):
706706
os.rename(self.path_manager.output_path, new_filename)
707707
self.path_manager.output_path = new_filename
708708

709-
console.print(f"[yellow]Output [red]{os.path.abspath(self.path_manager.output_path)} [cyan]with size [red]{file_size} [cyan]and duration [red]{duration}")
709+
# Display file information
710+
console.print(f"[yellow]Output[white]: [red]{os.path.abspath(self.path_manager.output_path)} \n"
711+
f" [cyan]with size[white]: [red]{file_size} \n"
712+
f" [cyan]and duration[white]: [red]{duration}")
710713

711714
def get_progress_data(self) -> Optional[Dict]:
712715
"""Get current download progress data."""
@@ -721,4 +724,4 @@ def get_progress_data(self) -> Optional[Dict]:
721724

722725
except Exception as e:
723726
logging.error(f"Error getting progress data: {e}")
724-
return None
727+
return None

StreamingCommunity/Lib/Downloader/MEGA/mega.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from Crypto.PublicKey import RSA
1818
from Crypto.Util import Counter
1919
from rich.console import Console
20-
from rich.panel import Panel
2120

2221

2322
# Internal utilities
@@ -33,6 +32,7 @@
3332
from StreamingCommunity.Util.color import Colors
3433
from StreamingCommunity.Util.config_json import config_manager
3534
from StreamingCommunity.Util.os import internet_manager, os_manager
35+
from StreamingCommunity.Util.headers import get_userAgent
3636
from ...FFmpeg import print_duration_table
3737

3838

@@ -240,9 +240,10 @@ def _download_file(self, file_handle, file_key, dest_path=None):
240240
start_time = time.time()
241241
downloaded = 0
242242

243+
console.print("[cyan]You can safely stop the download with [bold]Ctrl+c[bold] [cyan]")
243244
with open(output_path, 'wb') as output_file:
244-
with httpx.Client(timeout=None) as client:
245-
with client.stream('GET', file_url) as response:
245+
with httpx.Client(timeout=None, headers={'User-Agent': get_userAgent()}) as client:
246+
with client.stream('GET', file_url, headers={'User-Agent': get_userAgent()}) as response:
246247
response.raise_for_status()
247248

248249
progress_bar = tqdm(
@@ -312,13 +313,9 @@ def _download_file(self, file_handle, file_key, dest_path=None):
312313
output_path.unlink()
313314
raise ValueError('Mismatched mac')
314315

315-
print("")
316-
console.print(Panel(
317-
f"[bold green]Download completed![/bold green]\n"
318-
f"[cyan]File size: [bold red]{internet_manager.format_file_size(os.path.getsize(output_path))}[/bold red]\n"
319-
f"[cyan]Duration: [bold]{print_duration_table(output_path, description=False, return_string=True)}[/bold]",
320-
title=f"{os.path.basename(str(output_path).replace(f'.{EXTENSION_OUTPUT}', ''))}",
321-
border_style="green"
322-
))
323-
324-
return output_path
316+
# Display file information
317+
file_size = internet_manager.format_file_size(os.path.getsize(output_path))
318+
duration = print_duration_table(output_path, description=False, return_string=True)
319+
console.print(f"[yellow]Output[white]: [red]{os.path.abspath(output_path)} \n"
320+
f" [cyan]with size[white]: [red]{file_size} \n"
321+
f" [cyan]and duration[white]: [red]{duration}")

StreamingCommunity/Lib/Downloader/MP4/downloader.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from tqdm import tqdm
1515
from rich.console import Console
1616
from rich.prompt import Prompt
17-
from rich.panel import Panel
1817

1918

2019
# Internal utilities
@@ -182,14 +181,11 @@ def MP4_downloader(url: str, path: str, referer: str = None, headers_: dict = No
182181
os.rename(temp_path, path)
183182

184183
if os.path.exists(path):
185-
print("")
186-
console.print(Panel(
187-
f"[bold green]Download completed{' (Partial)' if interrupt_handler.force_quit else ''}![/bold green]\n"
188-
f"[cyan]File size: [bold red]{internet_manager.format_file_size(os.path.getsize(path))}[/bold red]\n"
189-
f"[cyan]Duration: [bold]{print_duration_table(path, description=False, return_string=True)}[/bold]",
190-
title=f"{os.path.basename(path.replace(f'.{extension_output}', ''))}",
191-
border_style="green"
192-
))
184+
file_size = internet_manager.format_file_size(os.path.getsize(path))
185+
duration = print_duration_table(path, description=False, return_string=True)
186+
console.print(f"[yellow]Output[white]: [red]{os.path.abspath(path)} \n"
187+
f" [cyan]with size[white]: [red]{file_size} \n"
188+
f" [cyan]and duration[white]: [red]{duration}")
193189

194190
if TELEGRAM_BOT:
195191
message = f"Download completato{'(Parziale)' if interrupt_handler.force_quit else ''}\nDimensione: {internet_manager.format_file_size(os.path.getsize(path))}\nDurata: {print_duration_table(path, description=False, return_string=True)}\nTitolo: {os.path.basename(path.replace(f'.{extension_output}', ''))}"

StreamingCommunity/Upload/update.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ async def async_github_requests():
4040
"""Make concurrent GitHub API requests"""
4141
async with httpx.AsyncClient() as client:
4242
tasks = [
43-
fetch_github_data(client, f"https://api.github.com/repos/{__author__}/{__title__}"),
4443
fetch_github_data(client, f"https://api.github.com/repos/{__author__}/{__title__}/releases"),
4544
fetch_github_data(client, f"https://api.github.com/repos/{__author__}/{__title__}/commits")
4645
]
@@ -65,15 +64,12 @@ def update():
6564
"""Check for updates on GitHub and display relevant information."""
6665
try:
6766
# Run async requests concurrently
68-
response_reposity, response_releases, response_commits = asyncio.run(async_github_requests())
67+
response_releases, response_commits = asyncio.run(async_github_requests())
6968

7069
except Exception as e:
7170
console.print(f"[red]Error accessing GitHub API: {e}")
7271
return
7372

74-
# Get stargazers count from the repository
75-
stargazers_count = response_reposity.get('stargazers_count', 0)
76-
7773
# Calculate total download count from all releases
7874
total_download_count = sum(asset['download_count'] for release in response_releases for asset in release.get('assets', []))
7975

@@ -83,12 +79,6 @@ def update():
8379
else:
8480
last_version = 'Unknown'
8581

86-
# Calculate percentual of stars based on download count
87-
if total_download_count > 0 and stargazers_count > 0:
88-
percentual_stars = round(stargazers_count / total_download_count * 100, 2)
89-
else:
90-
percentual_stars = 0
91-
9282
# Get the current version (installed version)
9383
try:
9484
current_version = importlib.metadata.version(__title__)
@@ -105,8 +95,14 @@ def update():
10595
if str(current_version).replace('v', '') != str(last_version).replace('v', ''):
10696
console.print(f"\n[cyan]New version available: [yellow]{last_version}")
10797

108-
console.print(f"\n[red]{__title__} has been downloaded [yellow]{total_download_count} [red]times, but only [yellow]{percentual_stars}% [red]of users have starred it.\n\
109-
[yellow]{get_execution_mode()} - [green]Current installed version: [yellow]{current_version} [green]last commit: [white]'[yellow]{latest_commit_message.splitlines()[0]}[white]'\n\
110-
[cyan]Help the repository grow today by leaving a [yellow]star [cyan]and [yellow]sharing [cyan]it with others online!")
98+
console.print(
99+
f"\n[red]{__title__} has been downloaded [yellow]{total_download_count}"
100+
f"\n[yellow]{get_execution_mode()} - [green]Current installed version: [yellow]{current_version} "
101+
f"[green]last commit: [white]'[yellow]{latest_commit_message.splitlines()[0]}[white]'\n"
102+
f" [cyan]Help the repository grow today by leaving a [yellow]star [cyan]and [yellow]sharing "
103+
f"[cyan]it with others online!\n"
104+
f" [magenta]If you'd like to support development and keep the program updated, consider leaving a "
105+
f"[yellow]donation[magenta]. Thank you!"
106+
)
111107

112108
time.sleep(1)
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/message.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@ def start_message():
2222
"""Display a stylized start message in the console."""
2323

2424
msg = r'''
25-
[red]+[cyan]=======================================================================================[red]+[purple]
26-
| ___ ______ _ |
27-
| / _ | ___________ _ _____ _____ __ __ / __/ /________ ___ ___ _ (_)__ ___ _ |
28-
| / __ |/ __/ __/ _ \ |/|/ / _ `/ __/ \ \ / _\ \/ __/ __/ -_) _ `/ ' \/ / _ \/ _ `/ |
29-
| /_/ |_/_/ /_/ \___/__,__/\_,_/_/ /_\_\ /___/\__/_/ \__/\_,_/_/_/_/_/_//_/\_, / |
30-
| /___/ |
31-
[red]+[cyan]=======================================================================================[red]+
25+
___ ______ _
26+
/ _ | ___________ _ _____ _____ __ __ / __/ /________ ___ ___ _ (_)__ ___ _
27+
/ __ |/ __/ __/ _ \ |/|/ / _ `/ __/ \ \ / _\ \/ __/ __/ -_) _ `/ ' \/ / _ \/ _ `/
28+
/_/ |_/_/ /_/ \___/__,__/\_,_/_/ /_\_\ /___/\__/_/ \__/\_,_/_/_/_/_/_//_/\_, /
29+
/___/
3230
'''.rstrip()
3331

3432
if CLEAN:

0 commit comments

Comments
 (0)