Skip to content

Commit e499aa1

Browse files
committed
Bump v3.5.6
1 parent 8b677d8 commit e499aa1

File tree

8 files changed

+45
-13
lines changed

8 files changed

+45
-13
lines changed

StreamingCommunity/Lib/FFmpeg/merge.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
PARAM_AUDIO = config_manager.config.get_list("M3U8_CONVERSION", "param_audio")
3131
PARAM_FINAL = config_manager.config.get_list("M3U8_CONVERSION", "param_final")
3232
SUBTITLE_DISPOSITION = config_manager.config.get_bool("M3U8_CONVERSION", "subtitle_disposition")
33+
SUBTITLE_DISPOSITION_LANGUAGE = config_manager.config.get("M3U8_CONVERSION", "subtitle_disposition_language")
3334

3435

3536
def add_encoding_params(ffmpeg_cmd: List[str]):
@@ -200,9 +201,21 @@ def join_subtitle(video_path: str, subtitles_list: List[Dict[str, str]], out_pat
200201
# For subtitles, we always use copy for video/audio
201202
ffmpeg_cmd.extend(['-c:v', 'copy', '-c:a', 'copy', '-c:s', subtitle_codec])
202203

203-
# Set disposition for first subtitle if enabled
204+
# Set disposition for subtitle matching the configured language
204205
if SUBTITLE_DISPOSITION and len(subtitles_list) > 0:
205-
ffmpeg_cmd.extend(['-disposition:s:0', 'default+forced'])
206+
disposition_idx = None
207+
for idx, subtitle in enumerate(subtitles_list):
208+
if subtitle.get('language', '').lower() == SUBTITLE_DISPOSITION_LANGUAGE.lower():
209+
disposition_idx = idx
210+
break
211+
212+
# If matching subtitle found, set disposition, otherwise use first subtitle
213+
if disposition_idx is not None:
214+
console.log(f"[cyan]Setting subtitle disposition for language: [red]{SUBTITLE_DISPOSITION_LANGUAGE}")
215+
ffmpeg_cmd.extend([f'-disposition:s:{disposition_idx}', 'default+forced'])
216+
else:
217+
console.log(f"[cyan]Using first subtitle for disposition.")
218+
ffmpeg_cmd.extend(['-disposition:s:0', 'default+forced'])
206219

207220
# Overwrite
208221
ffmpeg_cmd += [out_path, "-y"]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__title__ = 'StreamingCommunity'
2-
__version__ = '3.5.5'
2+
__version__ = '3.5.6'
33
__author__ = 'Arrowar'
44
__description__ = 'A command-line program to download film'
55
__copyright__ = 'Copyright 2025'

StreamingCommunity/Util/installer/bento4_install.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def check_bento4_binary(binary_name: str) -> Optional[str]:
3737
return binary_local
3838

3939
# STEP 3: Download
40-
console.print(f"[red]{binary_exec} not found. Downloading ...")
4140
binary_downloaded = binary_paths.download_binary("bento4", binary_exec)
4241

4342
if binary_downloaded:
@@ -53,12 +52,11 @@ def check_bento4_tools() -> Optional[Tuple[str, str]]:
5352
5453
Returns:
5554
Tuple[str, str]: (mp4decrypt_path, mp4dump_path)
56-
None if one of them is missing
5755
"""
5856
mp4decrypt_path = check_bento4_binary("mp4decrypt")
5957
mp4dump_path = check_bento4_binary("mp4dump")
6058

6159
if not mp4decrypt_path or not mp4dump_path:
62-
return None
60+
return None, None
6361

6462
return mp4decrypt_path, mp4dump_path

StreamingCommunity/Util/installer/binary_paths.py

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

88
# External library
99
import requests
10+
from rich.console import Console
11+
12+
13+
# Variable
14+
console = Console()
1015

1116

1217
class BinaryPaths:
@@ -99,6 +104,7 @@ def download_binary(self, tool: str, binary_name: str) -> Optional[str]:
99104
"""
100105
paths_json = self._load_paths_json()
101106
key = f"{self.system}_{self.arch}_{tool}"
107+
console.log(f"[cyan]Downloading [red]{binary_name} [cyan]for [yellow]{tool} [cyan]on [red]{self.system} {self.arch}")
102108

103109
if key not in paths_json:
104110
return None
@@ -107,6 +113,7 @@ def download_binary(self, tool: str, binary_name: str) -> Optional[str]:
107113
if rel_path.endswith(binary_name):
108114
url = f"{self.github_repo}/binaries/{rel_path}"
109115
local_path = os.path.join(self.get_binary_directory(), binary_name)
116+
console.log(f"[cyan]Downloading from [red]{url} [cyan]to [yellow]{local_path}")
110117

111118
try:
112119
response = requests.get(url, stream=True, timeout=60)

StreamingCommunity/Util/installer/ffmpeg_install.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def check_ffmpeg() -> Tuple[Optional[str], Optional[str]]:
4444
return ffmpeg_local, ffprobe_local
4545

4646
# STEP 3: Download from GitHub repository
47-
console.print("[red]FFmpeg not found. Downloading ...")
4847
ffmpeg_downloaded = binary_paths.download_binary("ffmpeg", ffmpeg_name)
4948
ffprobe_downloaded = binary_paths.download_binary("ffmpeg", ffprobe_name)
5049

StreamingCommunity/Util/installer/megatool_installer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def check_megatools() -> Optional[str]:
4141
return megatools_local
4242

4343
# STEP 3: Download from GitHub repository
44-
console.print("[red]megatools not found. Downloading ...")
4544
megatools_downloaded = binary_paths.download_binary("megatools", megatools_name)
4645

4746
if megatools_downloaded:

StreamingCommunity/Util/os.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 24.01.24
22

33
import os
4+
import time
45
import shutil
56
import logging
67
import platform
@@ -14,6 +15,7 @@
1415

1516

1617
# Internal utilities
18+
from .config_json import config_manager
1719
from .installer import check_ffmpeg, check_bento4_tools, check_device_wvd_path, check_device_prd_path, check_megatools
1820
from StreamingCommunity.Lib.DASH.extractor.ex_widevine import get_info_wvd
1921
from StreamingCommunity.Lib.DASH.extractor.ex_playready import get_info_prd
@@ -22,6 +24,7 @@
2224
# Variable
2325
msg = Prompt()
2426
console = Console()
27+
SHOW_DEVICE_INFO = config_manager.config.get('DEFAULT', 'show_device_info')
2528

2629

2730
class OsManager:
@@ -217,6 +220,16 @@ def __init__(self):
217220
self.megatools_path = check_megatools()
218221
self._display_binary_paths()
219222

223+
if self.ffmpeg_path is None or self.ffprobe_path is None:
224+
console.print("[red]\nFFmpeg tools are missing or not found in PATH. Some functionalities may not work properly.")
225+
time.sleep(5)
226+
if self.bento4_decrypt_path is None or self.bento4_dump_path is None:
227+
console.print("[red]\nBento4 tools are missing or not found in PATH. Some functionalities may not work properly.")
228+
time.sleep(5)
229+
if self.megatools_path is None:
230+
console.print("[red]\nMegatools is missing or not found in PATH. Some functionalities may not work properly.")
231+
time.sleep(5)
232+
220233
def _display_binary_paths(self):
221234
"""Display the paths of all detected binaries."""
222235
paths = {
@@ -232,10 +245,11 @@ def _display_binary_paths(self):
232245
path_strings.append(f"[red]{name} [yellow]{path_str}")
233246

234247
console.print(f"[cyan]Utilities: {', [white]'.join(path_strings)}")
235-
if self.wvd_path:
236-
get_info_wvd(self.wvd_path)
237-
if self.prd_path:
238-
get_info_prd(self.prd_path)
248+
if SHOW_DEVICE_INFO:
249+
if self.wvd_path:
250+
get_info_wvd(self.wvd_path)
251+
if self.prd_path:
252+
get_info_prd(self.prd_path)
239253

240254

241255
# Initialize the os_summary, internet_manager, and os_manager when the module is imported

config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"DEFAULT": {
33
"debug": false,
44
"show_message": true,
5-
"fetch_domain_online": true
5+
"fetch_domain_online": true,
6+
"show_device_info": true
67
},
78
"OUT_FOLDER": {
89
"root_path": "Video",
@@ -34,6 +35,7 @@
3435
"param_video": ["-c:v", "libx265", "-crf", "28", "-preset", "medium"],
3536
"param_audio": ["-c:a", "libopus", "-b:a", "128k"],
3637
"subtitle_disposition": false,
38+
"subtitle_disposition_language": "ita",
3739
"param_final": ["-c", "copy"],
3840
"force_resolution": "Best",
3941
"extension": "mkv"

0 commit comments

Comments
 (0)