Skip to content

Commit c68658c

Browse files
authored
Bump v3.4.2
* Better mp4 bar * Fix raiplay * Ruff fix * Add "get_progress_data" * Bump v3.4.5 * Remove max_timeout
1 parent b2fe510 commit c68658c

File tree

25 files changed

+831
-276
lines changed

25 files changed

+831
-276
lines changed

StreamingCommunity/Api/Site/altadefinizione/film.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
# Variable
3232
console = Console()
33-
max_timeout = config_manager.get_int("REQUESTS", "timeout")
3433
extension_output = config_manager.get("M3U8_CONVERSION", "extension")
3534

3635

StreamingCommunity/Api/Site/altadefinizione/series.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
map_episode_title,
2222
validate_selection,
2323
validate_episode_selection,
24-
display_episodes_list
24+
display_episodes_list,
25+
display_seasons_list
2526
)
2627
from StreamingCommunity.Api.Template.config_loader import site_constant
2728
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
@@ -151,16 +152,11 @@ def download_series(select_season: MediaItem, season_selection: str = None, epis
151152
- episode_selection (str, optional): Pre-defined episode selection that bypasses manual input
152153
"""
153154
scrape_serie = GetSerieInfo(select_season.url)
154-
155-
# Get total number of seasons
156155
seasons_count = scrape_serie.getNumberSeason()
157156

158157
if site_constant.TELEGRAM_BOT:
159158
bot = get_bot_instance()
160159

161-
# Prompt user for season selection and download episodes
162-
console.print(f"\n[green]Seasons found: [red]{seasons_count}")
163-
164160
# If season_selection is provided, use it instead of asking for input
165161
if season_selection is None:
166162
if site_constant.TELEGRAM_BOT:
@@ -180,10 +176,7 @@ def download_series(select_season: MediaItem, season_selection: str = None, epis
180176
)
181177

182178
else:
183-
index_season_selected = msg.ask(
184-
"\n[cyan]Insert season number [yellow](e.g., 1), [red]* [cyan]to download all seasons, "
185-
"[yellow](e.g., 1-2) [cyan]for a range of seasons, or [yellow](e.g., 3-*) [cyan]to download from a specific season to the end"
186-
)
179+
index_season_selected = display_seasons_list(scrape_serie.seasons_manager)
187180
else:
188181
index_season_selected = season_selection
189182
console.print(f"\n[cyan]Using provided season selection: [yellow]{season_selection}")
@@ -195,10 +188,8 @@ def download_series(select_season: MediaItem, season_selection: str = None, epis
195188
# Loop through the selected seasons and download episodes
196189
for i_season in list_season_select:
197190
if len(list_season_select) > 1 or index_season_selected == "*":
198-
# Download all episodes if multiple seasons are selected or if '*' is used
199191
download_episode(i_season, scrape_serie, download_all=True)
200192
else:
201-
# Otherwise, let the user select specific episodes for the single season
202193
download_episode(i_season, scrape_serie, download_all=False, episode_selection=episode_selection)
203194

204195
if site_constant.TELEGRAM_BOT:

StreamingCommunity/Api/Site/altadefinizione/site.py

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

88

99
# Internal utilities
10-
from StreamingCommunity.Util.config_json import config_manager
1110
from StreamingCommunity.Util.headers import get_userAgent
1211
from StreamingCommunity.Util.http_client import create_client
1312
from StreamingCommunity.Util.table import TVShowManager
@@ -23,7 +22,6 @@
2322
console = Console()
2423
media_search_manager = MediaManager()
2524
table_show_manager = TVShowManager()
26-
max_timeout = config_manager.get_int("REQUESTS", "timeout")
2725

2826

2927
def title_search(query: str) -> int:

StreamingCommunity/Api/Site/crunchyroll/series.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
map_episode_title,
2323
validate_selection,
2424
validate_episode_selection,
25-
display_episodes_list
25+
display_episodes_list,
26+
display_seasons_list
2627
)
2728
from StreamingCommunity.Api.Template.config_loader import site_constant
2829
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
@@ -160,20 +161,11 @@ def download_series(select_season: MediaItem, season_selection: str = None, epis
160161
- episode_selection (str, optional): Pre-defined episode selection that bypasses manual input
161162
"""
162163
scrape_serie = GetSerieInfo(select_season.url.split("/")[-1])
163-
164-
# Get total number of seasons
165164
seasons_count = scrape_serie.getNumberSeason()
166165

167-
# Prompt user for season selection and download episodes
168-
console.print(f"\n[green]Seasons found: [red]{seasons_count}")
169-
170166
# If season_selection is provided, use it instead of asking for input
171167
if season_selection is None:
172-
index_season_selected = msg.ask(
173-
"\n[cyan]Insert season number [yellow](e.g., 1), [red]* [cyan]to download all seasons, "
174-
"[yellow](e.g., 1-2) [cyan]for a range of seasons, or [yellow](e.g., 3-*) [cyan]to download from a specific season to the end"
175-
)
176-
168+
index_season_selected = display_seasons_list(scrape_serie.seasons_manager)
177169
else:
178170
index_season_selected = season_selection
179171
console.print(f"\n[cyan]Using provided season selection: [yellow]{season_selection}")
@@ -185,9 +177,6 @@ def download_series(select_season: MediaItem, season_selection: str = None, epis
185177
# Loop through the selected seasons and download episodes
186178
for i_season in list_season_select:
187179
if len(list_season_select) > 1 or index_season_selected == "*":
188-
# Download all episodes if multiple seasons are selected or if '*' is used
189180
download_episode(i_season, scrape_serie, download_all=True)
190-
191181
else:
192-
# Otherwise, let the user select specific episodes for the single season
193182
download_episode(i_season, scrape_serie, download_all=False, episode_selection=episode_selection)

StreamingCommunity/Api/Site/guardaserie/series.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
dynamic_format_number,
2121
validate_selection,
2222
validate_episode_selection,
23-
display_episodes_list
23+
display_episodes_list,
24+
display_seasons_list
2425
)
2526
from StreamingCommunity.Api.Template.config_loader import site_constant
2627
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
@@ -145,19 +146,11 @@ def download_series(dict_serie: MediaItem, season_selection: str = None, episode
145146

146147
# Create class
147148
scrape_serie = GetSerieInfo(dict_serie)
148-
149-
# Get season count
150149
seasons_count = scrape_serie.get_seasons_number()
151-
152-
# Prompt user for season selection and download episodes
153-
console.print(f"\n[green]Seasons found: [red]{seasons_count}")
154150

155151
# If season_selection is provided, use it instead of asking for input
156152
if season_selection is None:
157-
index_season_selected = msg.ask(
158-
"\n[cyan]Insert season number [yellow](e.g., 1), [red]* [cyan]to download all seasons, "
159-
"[yellow](e.g., 1-2) [cyan]for a range of seasons, or [yellow](e.g., 3-*) [cyan]to download from a specific season to the end"
160-
)
153+
index_season_selected = display_seasons_list(scrape_serie.seasons_manager)
161154
else:
162155
index_season_selected = season_selection
163156
console.print(f"\n[cyan]Using provided season selection: [yellow]{season_selection}")
@@ -169,10 +162,6 @@ def download_series(dict_serie: MediaItem, season_selection: str = None, episode
169162
# Loop through the selected seasons and download episodes
170163
for i_season in list_season_select:
171164
if len(list_season_select) > 1 or index_season_selected == "*":
172-
173-
# Download all episodes if multiple seasons are selected or if '*' is used
174165
download_episode(scrape_serie, i_season, download_all=True)
175166
else:
176-
177-
# Otherwise, let the user select specific episodes for the single season
178167
download_episode(scrape_serie, i_season, download_all=False, episode_selection=episode_selection)

StreamingCommunity/Api/Site/mediasetinfinity/series.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
map_episode_title,
2323
validate_selection,
2424
validate_episode_selection,
25-
display_episodes_list
25+
display_episodes_list,
26+
display_seasons_list
2627
)
2728
from StreamingCommunity.Api.Template.config_loader import site_constant
2829
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
@@ -148,20 +149,11 @@ def download_series(select_season: MediaItem, season_selection: str = None, epis
148149
- episode_selection (str, optional): Pre-defined episode selection that bypasses manual input
149150
"""
150151
scrape_serie = GetSerieInfo(select_season.url)
151-
152-
# Get total number of seasons
153152
seasons_count = scrape_serie.getNumberSeason()
154153

155-
# Prompt user for season selection and download episodes
156-
console.print(f"\n[green]Seasons found: [red]{seasons_count}")
157-
158154
# If season_selection is provided, use it instead of asking for input
159155
if season_selection is None:
160-
index_season_selected = msg.ask(
161-
"\n[cyan]Insert season number [yellow](e.g., 1), [red]* [cyan]to download all seasons, "
162-
"[yellow](e.g., 1-2) [cyan]for a range of seasons, or [yellow](e.g., 3-*) [cyan]to download from a specific season to the end"
163-
)
164-
156+
index_season_selected = display_seasons_list(scrape_serie.seasons_manager)
165157
else:
166158
index_season_selected = season_selection
167159
console.print(f"\n[cyan]Using provided season selection: [yellow]{season_selection}")
@@ -173,8 +165,6 @@ def download_series(select_season: MediaItem, season_selection: str = None, epis
173165
# Loop through the selected seasons and download episodes
174166
for i_season in list_season_select:
175167
if len(list_season_select) > 1 or index_season_selected == "*":
176-
# Download all episodes if multiple seasons are selected or if '*' is used
177168
download_episode(i_season, scrape_serie, download_all=True)
178169
else:
179-
# Otherwise, let the user select specific episodes for the single season
180170
download_episode(i_season, scrape_serie, download_all=False, episode_selection=episode_selection)

StreamingCommunity/Api/Site/raiplay/film.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ def download_film(select_title: MediaItem) -> Tuple[str, bool]:
7878
# Get final output path and status
7979
r_proc = dash_process.get_status()
8080

81-
8281
if r_proc['error'] is not None:
8382
try:
8483
os.remove(r_proc['path'])

StreamingCommunity/Api/Site/raiplay/series.py

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
map_episode_title,
2424
validate_selection,
2525
validate_episode_selection,
26-
display_episodes_list
26+
display_episodes_list,
27+
display_seasons_list
2728
)
2829
from StreamingCommunity.Api.Template.config_loader import site_constant
2930
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
@@ -71,17 +72,8 @@ def download_video(index_season_selected: int, index_episode_selected: int, scra
7172
m3u8_url=master_playlist,
7273
output_path=os.path.join(mp4_path, mp4_name)
7374
).start()
74-
# Get streaming URL
75-
master_playlist = VideoSource.extract_m3u8_url(obj_episode.url)
7675

77-
# HLS
78-
if ".mpd" not in master_playlist:
79-
r_proc = HLS_Downloader(
80-
m3u8_url=master_playlist,
81-
output_path=os.path.join(mp4_path, mp4_name)
82-
).start()
83-
84-
# MPD
76+
# MPD (DASH)
8577
else:
8678
full_license_url = generate_license_url(obj_episode.mpd_id)
8779
license_headers = {
@@ -169,15 +161,10 @@ def download_series(select_season: MediaItem, season_selection: str = None, epis
169161
# Get seasons info
170162
scrape_serie.collect_info_title()
171163
seasons_count = len(scrape_serie.seasons_manager)
172-
console.print(f"\n[green]Seasons found: [red]{seasons_count}")
173164

174165
# If season_selection is provided, use it instead of asking for input
175166
if season_selection is None:
176-
index_season_selected = msg.ask(
177-
"\n[cyan]Insert season number [yellow](e.g., 1), [red]* [cyan]to download all seasons, "
178-
"[yellow](e.g., 1-2) [cyan]for a range of seasons, or [yellow](e.g., 3-*) [cyan]to download from a specific season to the end"
179-
)
180-
167+
index_season_selected = display_seasons_list(scrape_serie.seasons_manager)
181168
else:
182169
index_season_selected = season_selection
183170
console.print(f"\n[cyan]Using provided season selection: [yellow]{season_selection}")
@@ -191,4 +178,4 @@ def download_series(select_season: MediaItem, season_selection: str = None, epis
191178
if len(list_season_select) > 1 or index_season_selected == "*":
192179
download_episode(season_number, scrape_serie, download_all=True)
193180
else:
194-
download_episode(season_number, scrape_serie, download_all=False, episode_selection=episode_selection)
181+
download_episode(season_number, scrape_serie, download_all=False, episode_selection=episode_selection)

StreamingCommunity/Api/Site/raiplay/site.py

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,12 @@
1212
from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
1313

1414

15-
# Logic Import
16-
from .util.ScrapeSerie import GetSerieInfo
17-
18-
1915
# Variable
2016
console = Console()
2117
media_search_manager = MediaManager()
2218
table_show_manager = TVShowManager()
2319

2420

25-
def determine_media_type(item):
26-
"""
27-
Determine if the item is a film or TV series by checking actual seasons count
28-
using GetSerieInfo.
29-
"""
30-
try:
31-
scraper = GetSerieInfo(item.get('path_id'))
32-
scraper.collect_info_title()
33-
return scraper.prog_tipology, scraper.prog_description, scraper.prog_year
34-
35-
except Exception as e:
36-
console.print(f"[red]Error determining media type: {e}[/red]")
37-
return None, None, None
38-
39-
4021
def title_search(query: str) -> int:
4122
"""
4223
Search for titles based on a search query.
@@ -72,24 +53,49 @@ def title_search(query: str) -> int:
7253
console.print(f"[red]Site: {site_constant.SITE_NAME}, request search error: {e}")
7354
return 0
7455

75-
# Limit to only 15 results for performance
76-
data = response.json().get('agg').get('titoli').get('cards')[:15]
56+
try:
57+
response_data = response.json()
58+
cards = response_data.get('agg', {}).get('titoli', {}).get('cards', [])
59+
60+
# Limit to only 15 results for performance
61+
data = cards[:15]
62+
console.print(f"[cyan]Found {len(cards)} results, processing first {len(data)}...[/cyan]")
63+
64+
except Exception as e:
65+
console.print(f"[red]Error parsing search results: {e}[/red]")
66+
return 0
7767

7868
# Process each item and add to media manager
79-
for item in data:
80-
media_type, prog_description, prog_year = determine_media_type(item)
81-
if media_type is None:
69+
for idx, item in enumerate(data, 1):
70+
try:
71+
# Get path_id
72+
path_id = item.get('path_id', '')
73+
if not path_id:
74+
console.print("[yellow]Skipping item due to missing path_id[/yellow]")
75+
continue
76+
77+
# Get image URL - handle both relative and absolute URLs
78+
image = item.get('immagine', '')
79+
if image and not image.startswith('http'):
80+
image = f"https://www.raiplay.it{image}"
81+
82+
# Get URL - handle both relative and absolute URLs
83+
url = item.get('url', '')
84+
if url and not url.startswith('http'):
85+
url = f"https://www.raiplay.it{url}"
86+
87+
media_search_manager.add_media({
88+
'id': item.get('id', ''),
89+
'name': item.get('titolo', 'Unknown'),
90+
'type': "tv",
91+
'path_id': path_id,
92+
'url': url,
93+
'image': image,
94+
'year': image.split("/")[5]
95+
})
96+
97+
except Exception as e:
98+
console.print(f"[red]Error processing item '{item.get('titolo', 'Unknown')}': {e}[/red]")
8299
continue
83-
84-
media_search_manager.add_media({
85-
'id': item.get('id', ''),
86-
'name': item.get('titolo', ''),
87-
'type': media_type,
88-
'path_id': item.get('path_id', ''),
89-
'url': f"https://www.raiplay.it{item.get('url', '')}",
90-
'image': f"https://www.raiplay.it{item.get('immagine', '')}",
91-
'desc': prog_description,
92-
'year': prog_year
93-
})
94-
100+
95101
return media_search_manager.get_length()

0 commit comments

Comments
 (0)