mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 12:05:35 +00:00
Se la lista dei sottotitoli è vuota vengono scaricati tutti + aggiunta possibilità di non mergiare i sottotitoli
This commit is contained in:
parent
7ee959c36c
commit
6c61193b19
@ -51,6 +51,7 @@ DOWNLOAD_SPECIFIC_SUBTITLE = config_manager.get_list('M3U8_DOWNLOAD', 'specific_
|
|||||||
DOWNLOAD_VIDEO = config_manager.get_bool('M3U8_DOWNLOAD', 'download_video')
|
DOWNLOAD_VIDEO = config_manager.get_bool('M3U8_DOWNLOAD', 'download_video')
|
||||||
DOWNLOAD_AUDIO = config_manager.get_bool('M3U8_DOWNLOAD', 'download_audio')
|
DOWNLOAD_AUDIO = config_manager.get_bool('M3U8_DOWNLOAD', 'download_audio')
|
||||||
DOWNLOAD_SUB = config_manager.get_bool('M3U8_DOWNLOAD', 'download_sub')
|
DOWNLOAD_SUB = config_manager.get_bool('M3U8_DOWNLOAD', 'download_sub')
|
||||||
|
MERGE_SUBTITLE = config_manager.get_bool('M3U8_DOWNLOAD', 'merge_subs')
|
||||||
REMOVE_SEGMENTS_FOLDER = config_manager.get_bool('M3U8_DOWNLOAD', 'cleanup_tmp_folder')
|
REMOVE_SEGMENTS_FOLDER = config_manager.get_bool('M3U8_DOWNLOAD', 'cleanup_tmp_folder')
|
||||||
FILTER_CUSTOM_REOLUTION = config_manager.get_int('M3U8_PARSER', 'force_resolution')
|
FILTER_CUSTOM_REOLUTION = config_manager.get_int('M3U8_PARSER', 'force_resolution')
|
||||||
CREATE_REPORT = config_manager.get_bool('M3U8_DOWNLOAD', 'create_report')
|
CREATE_REPORT = config_manager.get_bool('M3U8_DOWNLOAD', 'create_report')
|
||||||
@ -342,9 +343,10 @@ class Downloader():
|
|||||||
|
|
||||||
for obj_subtitle in self.list_available_subtitles:
|
for obj_subtitle in self.list_available_subtitles:
|
||||||
|
|
||||||
# Check if the language should be downloaded based on configuration
|
if len(DOWNLOAD_SPECIFIC_SUBTITLE) > 0:
|
||||||
if obj_subtitle.get('language') not in DOWNLOAD_SPECIFIC_SUBTITLE:
|
# Check if the language should be downloaded based on configuration
|
||||||
continue
|
if obj_subtitle.get('language') not in DOWNLOAD_SPECIFIC_SUBTITLE:
|
||||||
|
continue
|
||||||
|
|
||||||
sub_language = obj_subtitle.get('language')
|
sub_language = obj_subtitle.get('language')
|
||||||
sub_full_path = os.path.join(self.subtitle_segments_path, sub_language + ".vtt")
|
sub_full_path = os.path.join(self.subtitle_segments_path, sub_language + ".vtt")
|
||||||
@ -353,6 +355,7 @@ class Downloader():
|
|||||||
# Add the subtitle to the list of downloaded subtitles
|
# Add the subtitle to the list of downloaded subtitles
|
||||||
self.downloaded_subtitle.append({
|
self.downloaded_subtitle.append({
|
||||||
'name': obj_subtitle.get('name').split(" ")[0],
|
'name': obj_subtitle.get('name').split(" ")[0],
|
||||||
|
'language': obj_subtitle.get('language'),
|
||||||
'path': sub_full_path
|
'path': sub_full_path
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -542,8 +545,27 @@ class Downloader():
|
|||||||
|
|
||||||
# Join subtitle
|
# Join subtitle
|
||||||
if there_is_subtitle:
|
if there_is_subtitle:
|
||||||
if converted_out_path is not None:
|
if MERGE_SUBTITLE:
|
||||||
converted_out_path = self.__join_video_subtitles__(converted_out_path)
|
if converted_out_path is not None:
|
||||||
|
converted_out_path = self.__join_video_subtitles__(converted_out_path)
|
||||||
|
else:
|
||||||
|
for obj_sub in self.downloaded_subtitle:
|
||||||
|
language = obj_sub.get('language')
|
||||||
|
path = obj_sub.get('path')
|
||||||
|
forced = 'forced' in language
|
||||||
|
|
||||||
|
if forced:
|
||||||
|
language = language.replace("forced-", "")
|
||||||
|
new_path = self.output_filename.replace(".mp4", f".{language}.forced.vtt")
|
||||||
|
else:
|
||||||
|
new_path = self.output_filename.replace(".mp4", f".{language}.vtt")
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.rename(path, new_path)
|
||||||
|
logging.info(f"Subtitle moved to {new_path}")
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"Failed to move subtitle {path} to {new_path}: {e}")
|
||||||
|
|
||||||
|
|
||||||
# Clean all tmp file
|
# Clean all tmp file
|
||||||
self.__clean__(converted_out_path)
|
self.__clean__(converted_out_path)
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
"download_video": true,
|
"download_video": true,
|
||||||
"download_audio": true,
|
"download_audio": true,
|
||||||
"download_sub": true,
|
"download_sub": true,
|
||||||
|
"merge_subs": true,
|
||||||
"specific_list_audio": ["ita"],
|
"specific_list_audio": ["ita"],
|
||||||
"specific_list_subtitles": ["eng"],
|
"specific_list_subtitles": ["eng"],
|
||||||
"cleanup_tmp_folder": true,
|
"cleanup_tmp_folder": true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user