Skip to content

Commit 8d6cc06

Browse files
committed
Translated comments non-english comments
1 parent 305fcbc commit 8d6cc06

4 files changed

Lines changed: 34 additions & 33 deletions

File tree

mediaflow_proxy/extractors/dlhd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ async def _extract_via_iframe(self, url: str, channel_id: str) -> Dict[str, Any]
450450
raise ExtractorError(f"All player links failed. Last error: {last_player_error}")
451451
raise ExtractorError("No valid iframe found in any player page")
452452

453-
# Prova ogni iframe finché uno non funziona
453+
# Try each iframe until one works
454454
last_iframe_error = None
455455

456456
for iframe_candidate in iframe_candidates:

mediaflow_proxy/extractors/gupload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async def extract(self, url: str) -> Dict[str, Any]:
5757
if test.status >= 400:
5858
raise ExtractorError(f"GUPLOAD: Stream unavailable ({test.status})")
5959

60-
# Return MASTER playlist
60+
# Return MASTER playlist
6161
return {
6262
"destination_url": hls_url,
6363
"request_headers": headers,

mediaflow_proxy/routes/extractor.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@
3131
# Hosts where background refresh should be DISABLED
3232
# These hosts generate unique CDN URLs per extraction - refreshing invalidates existing streams!
3333
# When a new URL is extracted, the old URL becomes invalid and causes 509 errors.
34-
_NO_BACKGROUND_REFRESH_HOSTS = frozenset({
35-
"Vidoza",
36-
# Add other hosts here that generate unique per-extraction URLs
37-
})
34+
_NO_BACKGROUND_REFRESH_HOSTS = frozenset(
35+
{
36+
"Vidoza",
37+
# Add other hosts here that generate unique per-extraction URLs
38+
}
39+
)
3840

3941

4042
async def refresh_extractor_cache(

mediaflow_proxy/routes/playlist_builder.py

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ def rewrite_m3u_links_streaming(
1919
m3u_lines_iterator: Iterator[str], base_url: str, api_password: Optional[str]
2020
) -> Iterator[str]:
2121
"""
22-
Riscrive i link da un iteratore di linee M3U secondo le regole specificate,
23-
includendo gli headers da #EXTVLCOPT e #EXTHTTP. Yields rewritten lines.
22+
Rewrites links from an M3U line iterator according to the specified rules,
23+
including headers from #EXTVLCOPT and #EXTHTTP. Yields rewritten lines.
2424
"""
25-
current_ext_headers: Dict[str, str] = {} # Dizionario per conservare gli headers dalle direttive
26-
current_kodi_props: Dict[str, str] = {} # Dizionario per conservare le proprietà KODI
25+
current_ext_headers: Dict[str, str] = {} # Dictionary to store headers from directives
26+
current_kodi_props: Dict[str, str] = {} # Dictionary to store KODI properties
2727

2828
for line_with_newline in m3u_lines_iterator:
2929
line_content = line_with_newline.rstrip("\n")
@@ -49,11 +49,11 @@ def rewrite_m3u_links_streaming(
4949
header_value = header_value.strip()
5050
current_ext_headers[header_key] = header_value
5151
elif key_vlc.startswith("http-"):
52-
# Gestisce http-user-agent, http-referer etc.
52+
# Handle http-user-agent, http-referer, etc.
5353
header_key = key_vlc[len("http-") :]
5454
current_ext_headers[header_key] = value_vlc
5555
except Exception as e:
56-
logger.error(f"⚠️ Error parsing #EXTVLCOPT '{logical_line}': {e}")
56+
logger.error(f"Error parsing #EXTVLCOPT '{logical_line}': {e}")
5757

5858
elif logical_line.startswith("#EXTHTTP:"):
5959
# Yield the original line to preserve it
@@ -62,11 +62,11 @@ def rewrite_m3u_links_streaming(
6262
is_header_tag = True
6363
try:
6464
json_str = logical_line.split(":", 1)[1]
65-
# Sostituisce tutti gli header correnti con quelli del JSON
65+
# Replace all current headers with those from the JSON
6666
current_ext_headers = json.loads(json_str)
6767
except Exception as e:
68-
logger.error(f"⚠️ Error parsing #EXTHTTP '{logical_line}': {e}")
69-
current_ext_headers = {} # Resetta in caso di errore
68+
logger.error(f"Error parsing #EXTHTTP '{logical_line}': {e}")
69+
current_ext_headers = {} # Reset on error
7070

7171
elif logical_line.startswith("#KODIPROP:"):
7272
# Yield the original line to preserve it
@@ -79,7 +79,7 @@ def rewrite_m3u_links_streaming(
7979
key_kodi, value_kodi = prop_str.split("=", 1)
8080
current_kodi_props[key_kodi.strip()] = value_kodi.strip()
8181
except Exception as e:
82-
logger.error(f"⚠️ Error parsing #KODIPROP '{logical_line}': {e}")
82+
logger.error(f"Error parsing #KODIPROP '{logical_line}': {e}")
8383

8484
if is_header_tag:
8585
continue
@@ -169,10 +169,10 @@ def rewrite_m3u_links_streaming(
169169
processed_url_content += header_params_str
170170
current_ext_headers = {}
171171

172-
# Resetta le proprietà KODI dopo averle usate
172+
# Reset KODI properties after using them
173173
current_kodi_props = {}
174174

175-
# Aggiungi api_password sempre alla fine
175+
# Always append api_password at the end
176176
if api_password:
177177
processed_url_content += f"&api_password={api_password}"
178178

@@ -207,16 +207,16 @@ async def async_download_m3u_playlist(url: str) -> list[str]:
207207

208208
def parse_channel_entries(lines: list[str]) -> list[list[str]]:
209209
"""
210-
Analizza le linee di una playlist M3U e le raggruppa in entry di canali.
211-
Ogni entry è una lista di linee che compongono un singolo canale
212-
(da #EXTINF fino all'URL, incluse le righe intermedie).
210+
Parse the lines of an M3U playlist and group them into channel entries.
211+
Each entry is a list of lines that make up a single channel
212+
(from #EXTINF to the URL, including intermediate lines).
213213
"""
214214
entries = []
215215
current_entry = []
216216
for line in lines:
217217
stripped_line = line.strip()
218218
if stripped_line.startswith("#EXTINF:"):
219-
if current_entry: # In caso di #EXTINF senza URL precedente
219+
if current_entry: # In case of #EXTINF without a preceding URL
220220
logger.warning(
221221
f"Found a new #EXTINF tag before a URL was found for the previous entry. Discarding: {current_entry}"
222222
)
@@ -242,15 +242,15 @@ async def async_generate_combined_playlist(playlist_definitions: list[str], base
242242
should_sort = True
243243
definition = definition[len("sort:") :]
244244

245-
if definition.startswith("no_proxy:"): # Può essere combinato con sort:
245+
if definition.startswith("no_proxy:"): # Can be combined with sort:
246246
should_proxy = False
247247
playlist_url_str = definition[len("no_proxy:") :]
248248
else:
249249
playlist_url_str = definition
250250

251251
download_tasks.append({"url": playlist_url_str, "proxy": should_proxy, "sort": should_sort})
252252

253-
# Scarica tutte le playlist in parallelo
253+
# Download all playlists in parallel
254254
results = await asyncio.gather(
255255
*[async_download_m3u_playlist(task["url"]) for task in download_tasks], return_exceptions=True
256256
)
@@ -293,29 +293,28 @@ def yield_header_once(lines_iter):
293293

294294
# 1. Processa e ordina le playlist marcate con 'sort'
295295
if sorted_playlist_lines:
296-
# Estrai le entry dei canali
297-
# Modifica: Estrai le entry e mantieni l'informazione sul proxy
296+
# Extract channel entries and keep proxy info
298297
channel_entries_with_proxy_info = []
299298
for idx, result in enumerate(results):
300299
task_info = download_tasks[idx]
301300
if task_info.get("sort") and isinstance(result, list):
302-
entries = parse_channel_entries(result) # result è la lista di linee della playlist
301+
entries = parse_channel_entries(result) # result is the list of playlist lines
303302
for entry_lines in entries:
304-
# L'opzione proxy si applica a tutto il blocco del canale
303+
# The proxy option applies to the entire channel block
305304
channel_entries_with_proxy_info.append((entry_lines, task_info["proxy"]))
306305

307-
# Ordina le entry in base al nome del canale (da #EXTINF)
308-
# La prima riga di ogni entry è sempre #EXTINF
306+
# Sort entries by channel name (from #EXTINF)
307+
# The first line of each entry is always #EXTINF
309308
channel_entries_with_proxy_info.sort(key=lambda x: x[0][0].split(",")[-1].strip())
310309

311-
# Gestisci l'header una sola volta per il blocco ordinato
310+
# Handle the header only once for the sorted block
312311
if not first_playlist_header_handled:
313312
yield "#EXTM3U\n"
314313
first_playlist_header_handled = True
315314

316-
# Applica la riscrittura dei link in modo selettivo
315+
# Apply link rewriting selectively
317316
for entry_lines, should_proxy in channel_entries_with_proxy_info:
318-
# L'URL è l'ultima riga dell'entry
317+
# The URL is the last line of the entry
319318
url = entry_lines[-1]
320319
# Yield tutte le righe prima dell'URL
321320
for line in entry_lines[:-1]:

0 commit comments

Comments
 (0)