Fix "_failed" tag added incorrectly (#222)

This commit is contained in:
Lovi 2025-01-10 09:14:21 +01:00
parent f7941dfbb9
commit 4b54817198
5 changed files with 24 additions and 7 deletions

View File

@ -404,7 +404,7 @@ The `run-container` command mounts also the `config.json` file, so any change to
| [Altadefinizione](https://altadefinizione.prof/) | ✅ | | [Altadefinizione](https://altadefinizione.prof/) | ✅ |
| [AnimeUnity](https://animeunity.so/) | ✅ | | [AnimeUnity](https://animeunity.so/) | ✅ |
| [Ilcorsaronero](https://ilcorsaronero.link/) | ✅ | | [Ilcorsaronero](https://ilcorsaronero.link/) | ✅ |
| [CB01New](https://cb01new.quest/) | ✅ | | [CB01New](https://cb01new.sbs/) | ✅ |
| [DDLStreamItaly](https://ddlstreamitaly.co/) | ✅ | | [DDLStreamItaly](https://ddlstreamitaly.co/) | ✅ |
| [GuardaSerie](https://guardaserie.academy/) | ✅ | | [GuardaSerie](https://guardaserie.academy/) | ✅ |
| [MostraGuarda](https://mostraguarda.stream/) | ✅ | | [MostraGuarda](https://mostraguarda.stream/) | ✅ |

View File

@ -11,7 +11,7 @@ import httpx
# Internal utilities # Internal utilities
from StreamingCommunity.Util._jsonConfig import config_manager from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.console import console, Panel, Table from StreamingCommunity.Util.console import console, Panel
from StreamingCommunity.Util.color import Colors from StreamingCommunity.Util.color import Colors
from StreamingCommunity.Util.os import ( from StreamingCommunity.Util.os import (
compute_sha1_hash, compute_sha1_hash,
@ -284,6 +284,7 @@ class ContentExtractor:
print("") print("")
class DownloadTracker: class DownloadTracker:
def __init__(self, path_manager: PathManager): def __init__(self, path_manager: PathManager):
""" """
@ -815,6 +816,9 @@ class HLS_Downloader:
else: else:
console.log("[red]Error: m3u8_index is None") console.log("[red]Error: m3u8_index is None")
# Reset
self._reset()
def _clean(self, out_path: str) -> None: def _clean(self, out_path: str) -> None:
""" """
Cleans up temporary files and folders after downloading and processing. Cleans up temporary files and folders after downloading and processing.
@ -953,3 +957,9 @@ class HLS_Downloader:
# Clean up temporary files and directories # Clean up temporary files and directories
self._clean(self.content_joiner.converted_out_path) self._clean(self.content_joiner.converted_out_path)
def _reset(self):
global list_MissingTs, m3u8_url_fixer
m3u8_url_fixer.reset_playlist()
list_MissingTs = []

View File

@ -558,15 +558,16 @@ class M3U8_Segments:
if file_size == 0: if file_size == 0:
raise Exception("Output file is empty") raise Exception("Output file is empty")
# Display additional # Display additional info when there is missing stream file
if self.info_nRetry >= len(self.segments) * 0.3: if self.info_nFailed > 0:
# Get expected time # Get expected time
ex_hours, ex_minutes, ex_seconds = format_duration(self.expected_real_time_s) ex_hours, ex_minutes, ex_seconds = format_duration(self.expected_real_time_s)
ex_formatted_duration = f"[yellow]{int(ex_hours)}[red]h [yellow]{int(ex_minutes)}[red]m [yellow]{int(ex_seconds)}[red]s" ex_formatted_duration = f"[yellow]{int(ex_hours)}[red]h [yellow]{int(ex_minutes)}[red]m [yellow]{int(ex_seconds)}[red]s"
console.print(f"[cyan]Max retry per URL[white]: [green]{self.info_maxRetry}[green] [white]| [cyan]Total retry done[white]: [green]{self.info_nRetry}[green] [white]| [cyan]Missing TS: [red]{self.info_nFailed} [white]| [cyan]Duration: {print_duration_table(self.tmp_file_path, None, True)} [white]| [cyan]Expected duation: {ex_formatted_duration} \n") console.print(f"[cyan]Max retry per URL[white]: [green]{self.info_maxRetry}[green] [white]| [cyan]Total retry done[white]: [green]{self.info_nRetry}[green] [white]| [cyan]Missing TS: [red]{self.info_nFailed} [white]| [cyan]Duration: {print_duration_table(self.tmp_file_path, None, True)} [white]| [cyan]Expected duation: {ex_formatted_duration} \n")
console.print("[yellow]⚠ Warning:[/yellow] Too many retries detected! Consider reducing the number of [cyan]workers[/cyan] in the [magenta]config.json[/magenta] file. This will impact [bold]performance[/bold]. \n") if self.info_nRetry >= len(self.segments) * 0.3:
console.print("[yellow]⚠ Warning:[/yellow] Too many retries detected! Consider reducing the number of [cyan]workers[/cyan] in the [magenta]config.json[/magenta] file. This will impact [bold]performance[/bold]. \n")
# Info to return # Info to return
return {'type': type, 'nFailed': self.info_nFailed} return {'type': type, 'nFailed': self.info_nFailed}

View File

@ -49,4 +49,10 @@ class M3U8_UrlFix:
full_url = urljoin(base_url, url_resource) full_url = urljoin(base_url, url_resource)
return full_url return full_url
def reset_playlist(self) -> None:
"""
Reset the M3U8 playlist URL to its default state (None).
"""
self.url_playlist = None

View File

@ -20,7 +20,7 @@
"not_close": false "not_close": false
}, },
"REQUESTS": { "REQUESTS": {
"timeout": 35, "timeout": 30,
"max_retry": 8, "max_retry": 8,
"proxy_start_min": 0.1, "proxy_start_min": 0.1,
"proxy_start_max": 0.5 "proxy_start_max": 0.5
@ -81,7 +81,7 @@
"domain": "so" "domain": "so"
}, },
"cb01new": { "cb01new": {
"domain": "quest" "domain": "sbs"
}, },
"1337xx": { "1337xx": {
"domain": "to" "domain": "to"