mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 12:05:35 +00:00
Fix for title.name == None
This commit is contained in:
parent
bdbcfb2fd1
commit
0996f8d415
@ -264,7 +264,8 @@ class ContentExtractor:
|
|||||||
|
|
||||||
# Check if a valid HTTPS URL is obtained
|
# Check if a valid HTTPS URL is obtained
|
||||||
if self.m3u8_index is not None and "https" in self.m3u8_index:
|
if self.m3u8_index is not None and "https" in self.m3u8_index:
|
||||||
console.print(f"[cyan]Found m3u8 index [white]=> [red]{self.m3u8_index}")
|
#console.print(f"[cyan]Found m3u8 index [white]=> [red]{self.m3u8_index}")
|
||||||
|
print()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logging.error("[download_m3u8] Can't find a valid m3u8 index")
|
logging.error("[download_m3u8] Can't find a valid m3u8 index")
|
||||||
@ -695,14 +696,16 @@ class HLS_Downloader:
|
|||||||
Returns:
|
Returns:
|
||||||
str: The generated output filename.
|
str: The generated output filename.
|
||||||
"""
|
"""
|
||||||
|
root_path = config_manager.get('DEFAULT', 'root_path')
|
||||||
new_filename = None
|
new_filename = None
|
||||||
|
new_folder = os.path.join(root_path, "undefined")
|
||||||
|
|
||||||
# Auto-generate output file name if not present
|
# Auto-generate output file name if not present
|
||||||
if output_filename is None:
|
if (output_filename is None) or ("mp4" not in output_filename):
|
||||||
if m3u8_playlist is not None:
|
if m3u8_playlist is not None:
|
||||||
new_filename = os.path.join("missing", compute_sha1_hash(m3u8_playlist))
|
new_filename = os.path.join(new_folder, compute_sha1_hash(m3u8_playlist) + ".mp4")
|
||||||
else:
|
else:
|
||||||
new_filename = os.path.join("missing", compute_sha1_hash(m3u8_index))
|
new_filename = os.path.join(new_folder, compute_sha1_hash(m3u8_index) + ".mp4")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
@ -711,7 +714,7 @@ class HLS_Downloader:
|
|||||||
|
|
||||||
# If no folder is specified, default to 'undefined'
|
# If no folder is specified, default to 'undefined'
|
||||||
if not folder:
|
if not folder:
|
||||||
folder = "undefined"
|
folder = new_folder
|
||||||
|
|
||||||
# Sanitize base name
|
# Sanitize base name
|
||||||
base_name = reduce_base_name(remove_special_characters(base_name))
|
base_name = reduce_base_name(remove_special_characters(base_name))
|
||||||
@ -731,7 +734,6 @@ class HLS_Downloader:
|
|||||||
"""
|
"""
|
||||||
Initiates the downloading process. Checks if the output file already exists and proceeds with processing the playlist or index.
|
Initiates the downloading process. Checks if the output file already exists and proceeds with processing the playlist or index.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if os.path.exists(self.output_filename):
|
if os.path.exists(self.output_filename):
|
||||||
console.log("[red]Output file already exists.")
|
console.log("[red]Output file already exists.")
|
||||||
return
|
return
|
||||||
|
@ -92,6 +92,9 @@ def remove_special_characters(input_string):
|
|||||||
Returns:
|
Returns:
|
||||||
str: A new string with specified special characters removed.
|
str: A new string with specified special characters removed.
|
||||||
"""
|
"""
|
||||||
|
if input_string is None:
|
||||||
|
return "None"
|
||||||
|
|
||||||
# Compile regular expression pattern to match special characters
|
# Compile regular expression pattern to match special characters
|
||||||
pattern = re.compile('[' + re.escape(special_chars_to_remove) + ']')
|
pattern = re.compile('[' + re.escape(special_chars_to_remove) + ']')
|
||||||
|
|
||||||
|
@ -14,6 +14,6 @@ from Src.Lib.Downloader import HLS_Downloader
|
|||||||
|
|
||||||
# Test
|
# Test
|
||||||
HLS_Downloader(
|
HLS_Downloader(
|
||||||
output_filename=r".\Video\undefined.mp4",
|
output_filename="",
|
||||||
m3u8_index=""
|
m3u8_playlist=""
|
||||||
).start()
|
).start()
|
Loading…
x
Reference in New Issue
Block a user