StreamingCommunity 3.3.0__py3-none-any.whl → 3.3.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of StreamingCommunity might be problematic. Click here for more details.
- StreamingCommunity/Api/Site/altadefinizione/__init__.py +37 -17
- StreamingCommunity/Api/Site/animeunity/__init__.py +36 -16
- StreamingCommunity/Api/Site/animeworld/__init__.py +50 -6
- StreamingCommunity/Api/Site/crunchyroll/__init__.py +42 -16
- StreamingCommunity/Api/Site/crunchyroll/site.py +1 -1
- StreamingCommunity/Api/Site/guardaserie/__init__.py +50 -6
- StreamingCommunity/Api/Site/mediasetinfinity/__init__.py +43 -5
- StreamingCommunity/Api/Site/mediasetinfinity/film.py +1 -1
- StreamingCommunity/Api/Site/mediasetinfinity/site.py +6 -3
- StreamingCommunity/Api/Site/mediasetinfinity/util/ScrapeSerie.py +6 -7
- StreamingCommunity/Api/Site/mediasetinfinity/util/get_license.py +189 -0
- StreamingCommunity/Api/Site/raiplay/__init__.py +45 -14
- StreamingCommunity/Api/Site/raiplay/series.py +9 -5
- StreamingCommunity/Api/Site/raiplay/site.py +6 -4
- StreamingCommunity/Api/Site/raiplay/util/ScrapeSerie.py +6 -2
- StreamingCommunity/Api/Site/streamingcommunity/__init__.py +7 -2
- StreamingCommunity/Api/Site/streamingcommunity/site.py +0 -3
- StreamingCommunity/Api/Site/streamingwatch/__init__.py +44 -14
- StreamingCommunity/Api/Site/streamingwatch/site.py +0 -3
- StreamingCommunity/Lib/Downloader/DASH/cdm_helpher.py +1 -18
- StreamingCommunity/Lib/Downloader/DASH/downloader.py +88 -52
- StreamingCommunity/Lib/Downloader/HLS/downloader.py +38 -14
- StreamingCommunity/Lib/Downloader/HLS/segments.py +1 -1
- StreamingCommunity/Lib/FFmpeg/command.py +66 -7
- StreamingCommunity/Lib/FFmpeg/util.py +16 -13
- StreamingCommunity/Lib/M3U8/decryptor.py +0 -14
- StreamingCommunity/Lib/TMBD/tmdb.py +0 -12
- StreamingCommunity/Upload/version.py +1 -1
- StreamingCommunity/Util/{bento4_installer.py → installer/bento4_install.py} +15 -33
- StreamingCommunity/Util/installer/binary_paths.py +83 -0
- StreamingCommunity/Util/{ffmpeg_installer.py → installer/ffmpeg_install.py} +11 -54
- StreamingCommunity/Util/logger.py +3 -8
- StreamingCommunity/Util/os.py +67 -68
- StreamingCommunity/run.py +1 -1
- {streamingcommunity-3.3.0.dist-info → streamingcommunity-3.3.2.dist-info}/METADATA +313 -498
- {streamingcommunity-3.3.0.dist-info → streamingcommunity-3.3.2.dist-info}/RECORD +40 -39
- {streamingcommunity-3.3.0.dist-info → streamingcommunity-3.3.2.dist-info}/WHEEL +0 -0
- {streamingcommunity-3.3.0.dist-info → streamingcommunity-3.3.2.dist-info}/entry_points.txt +0 -0
- {streamingcommunity-3.3.0.dist-info → streamingcommunity-3.3.2.dist-info}/licenses/LICENSE +0 -0
- {streamingcommunity-3.3.0.dist-info → streamingcommunity-3.3.2.dist-info}/top_level.txt +0 -0
|
@@ -38,25 +38,39 @@ def get_user_input(string_to_search: str = None):
|
|
|
38
38
|
"""
|
|
39
39
|
Asks the user to input a search term.
|
|
40
40
|
Handles both Telegram bot input and direct input.
|
|
41
|
+
If string_to_search is provided, it's returned directly (after stripping).
|
|
41
42
|
"""
|
|
42
|
-
if string_to_search is None:
|
|
43
|
-
|
|
44
|
-
bot = get_bot_instance()
|
|
45
|
-
string_to_search = bot.ask(
|
|
46
|
-
"key_search",
|
|
47
|
-
"Enter the search term\nor type 'back' to return to the menu: ",
|
|
48
|
-
None
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
if string_to_search == 'back':
|
|
43
|
+
if string_to_search is not None:
|
|
44
|
+
return string_to_search.strip()
|
|
52
45
|
|
|
46
|
+
if site_constant.TELEGRAM_BOT:
|
|
47
|
+
bot = get_bot_instance()
|
|
48
|
+
user_response = bot.ask(
|
|
49
|
+
"key_search", # Request type
|
|
50
|
+
"Enter the search term\nor type 'back' to return to the menu: ",
|
|
51
|
+
None
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
if user_response is None:
|
|
55
|
+
bot.send_message("Timeout: No search term entered.", None)
|
|
56
|
+
return None
|
|
57
|
+
|
|
58
|
+
if user_response.lower() == 'back':
|
|
59
|
+
bot.send_message("Returning to the main menu...", None)
|
|
60
|
+
|
|
61
|
+
try:
|
|
53
62
|
# Restart the script
|
|
54
63
|
subprocess.Popen([sys.executable] + sys.argv)
|
|
55
64
|
sys.exit()
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
|
|
66
|
+
except Exception as e:
|
|
67
|
+
bot.send_message(f"Error during restart attempt: {e}", None)
|
|
68
|
+
return None # Return None if restart fails
|
|
69
|
+
|
|
70
|
+
return user_response.strip()
|
|
71
|
+
|
|
72
|
+
else:
|
|
73
|
+
return msg.ask(f"\n[purple]Insert a word to search in [green]{site_constant.SITE_NAME}").strip()
|
|
60
74
|
|
|
61
75
|
def process_search_result(select_title, selections=None):
|
|
62
76
|
"""
|
|
@@ -66,6 +80,9 @@ def process_search_result(select_title, selections=None):
|
|
|
66
80
|
select_title (MediaItem): The selected media item
|
|
67
81
|
selections (dict, optional): Dictionary containing selection inputs that bypass manual input
|
|
68
82
|
{'season': season_selection, 'episode': episode_selection}
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
bool: True if processing was successful, False otherwise
|
|
69
86
|
"""
|
|
70
87
|
if not select_title:
|
|
71
88
|
if site_constant.TELEGRAM_BOT:
|
|
@@ -73,7 +90,7 @@ def process_search_result(select_title, selections=None):
|
|
|
73
90
|
bot.send_message("No title selected or selection cancelled.", None)
|
|
74
91
|
else:
|
|
75
92
|
console.print("[yellow]No title selected or selection cancelled.")
|
|
76
|
-
return
|
|
93
|
+
return False
|
|
77
94
|
|
|
78
95
|
if select_title.type == 'tv':
|
|
79
96
|
season_selection = None
|
|
@@ -84,9 +101,11 @@ def process_search_result(select_title, selections=None):
|
|
|
84
101
|
episode_selection = selections.get('episode')
|
|
85
102
|
|
|
86
103
|
download_series(select_title, season_selection, episode_selection)
|
|
104
|
+
return True
|
|
87
105
|
|
|
88
106
|
else:
|
|
89
107
|
download_film(select_title)
|
|
108
|
+
return True
|
|
90
109
|
|
|
91
110
|
# search("Game of Thrones", selections={"season": "1", "episode": "1-3"})
|
|
92
111
|
def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_item: dict = None, selections: dict = None):
|
|
@@ -107,8 +126,8 @@ def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_
|
|
|
107
126
|
if direct_item:
|
|
108
127
|
select_title = MediaItem(**direct_item)
|
|
109
128
|
process_search_result(select_title, selections)
|
|
110
|
-
return
|
|
111
|
-
|
|
129
|
+
return True
|
|
130
|
+
|
|
112
131
|
# Get the user input for the search term
|
|
113
132
|
actual_search_query = get_user_input(string_to_search)
|
|
114
133
|
|
|
@@ -129,6 +148,7 @@ def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_
|
|
|
129
148
|
if len_database > 0:
|
|
130
149
|
select_title = get_select_title(table_show_manager, media_search_manager, len_database)
|
|
131
150
|
process_search_result(select_title, selections)
|
|
151
|
+
return True
|
|
132
152
|
|
|
133
153
|
else:
|
|
134
154
|
if bot:
|
|
@@ -37,25 +37,39 @@ def get_user_input(string_to_search: str = None):
|
|
|
37
37
|
"""
|
|
38
38
|
Asks the user to input a search term.
|
|
39
39
|
Handles both Telegram bot input and direct input.
|
|
40
|
+
If string_to_search is provided, it's returned directly (after stripping).
|
|
40
41
|
"""
|
|
41
|
-
if string_to_search is None:
|
|
42
|
-
|
|
43
|
-
bot = get_bot_instance()
|
|
44
|
-
string_to_search = bot.ask(
|
|
45
|
-
"key_search",
|
|
46
|
-
"Enter the search term\nor type 'back' to return to the menu: ",
|
|
47
|
-
None
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
if string_to_search == 'back':
|
|
42
|
+
if string_to_search is not None:
|
|
43
|
+
return string_to_search.strip()
|
|
51
44
|
|
|
45
|
+
if site_constant.TELEGRAM_BOT:
|
|
46
|
+
bot = get_bot_instance()
|
|
47
|
+
user_response = bot.ask(
|
|
48
|
+
"key_search", # Request type
|
|
49
|
+
"Enter the search term\nor type 'back' to return to the menu: ",
|
|
50
|
+
None
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
if user_response is None:
|
|
54
|
+
bot.send_message("Timeout: No search term entered.", None)
|
|
55
|
+
return None
|
|
56
|
+
|
|
57
|
+
if user_response.lower() == 'back':
|
|
58
|
+
bot.send_message("Returning to the main menu...", None)
|
|
59
|
+
|
|
60
|
+
try:
|
|
52
61
|
# Restart the script
|
|
53
62
|
subprocess.Popen([sys.executable] + sys.argv)
|
|
54
63
|
sys.exit()
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
|
|
65
|
+
except Exception as e:
|
|
66
|
+
bot.send_message(f"Error during restart attempt: {e}", None)
|
|
67
|
+
return None # Return None if restart fails
|
|
68
|
+
|
|
69
|
+
return user_response.strip()
|
|
70
|
+
|
|
71
|
+
else:
|
|
72
|
+
return msg.ask(f"\n[purple]Insert a word to search in [green]{site_constant.SITE_NAME}").strip()
|
|
59
73
|
|
|
60
74
|
def process_search_result(select_title, selections=None):
|
|
61
75
|
"""
|
|
@@ -65,6 +79,9 @@ def process_search_result(select_title, selections=None):
|
|
|
65
79
|
select_title (MediaItem): The selected media item
|
|
66
80
|
selections (dict, optional): Dictionary containing selection inputs that bypass manual input
|
|
67
81
|
{'season': season_selection, 'episode': episode_selection}
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
bool: True if processing was successful, False otherwise
|
|
68
85
|
"""
|
|
69
86
|
if not select_title:
|
|
70
87
|
if site_constant.TELEGRAM_BOT:
|
|
@@ -72,10 +89,11 @@ def process_search_result(select_title, selections=None):
|
|
|
72
89
|
bot.send_message("No title selected or selection cancelled.", None)
|
|
73
90
|
else:
|
|
74
91
|
console.print("[yellow]No title selected or selection cancelled.")
|
|
75
|
-
return
|
|
92
|
+
return False
|
|
76
93
|
|
|
77
94
|
if select_title.type == 'Movie':
|
|
78
95
|
download_film(select_title)
|
|
96
|
+
return True
|
|
79
97
|
|
|
80
98
|
else:
|
|
81
99
|
season_selection = None
|
|
@@ -86,6 +104,7 @@ def process_search_result(select_title, selections=None):
|
|
|
86
104
|
episode_selection = selections.get('episode')
|
|
87
105
|
|
|
88
106
|
download_series(select_title, season_selection, episode_selection)
|
|
107
|
+
return True
|
|
89
108
|
|
|
90
109
|
def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_item: dict = None, selections: dict = None):
|
|
91
110
|
"""
|
|
@@ -105,7 +124,7 @@ def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_
|
|
|
105
124
|
if direct_item:
|
|
106
125
|
select_title = MediaItem(**direct_item)
|
|
107
126
|
process_search_result(select_title, selections)
|
|
108
|
-
return
|
|
127
|
+
return True
|
|
109
128
|
|
|
110
129
|
# Get the user input for the search term
|
|
111
130
|
actual_search_query = get_user_input(string_to_search)
|
|
@@ -127,6 +146,7 @@ def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_
|
|
|
127
146
|
if len_database > 0:
|
|
128
147
|
select_title = get_select_title(table_show_manager, media_search_manager, len_database)
|
|
129
148
|
process_search_result(select_title, selections)
|
|
149
|
+
return True
|
|
130
150
|
|
|
131
151
|
else:
|
|
132
152
|
if bot:
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# 21.03.25
|
|
2
2
|
|
|
3
|
+
import sys
|
|
4
|
+
import subprocess
|
|
5
|
+
|
|
6
|
+
|
|
3
7
|
# External library
|
|
4
8
|
from rich.console import Console
|
|
5
9
|
from rich.prompt import Prompt
|
|
@@ -29,7 +33,44 @@ msg = Prompt()
|
|
|
29
33
|
console = Console()
|
|
30
34
|
|
|
31
35
|
|
|
36
|
+
def get_user_input(string_to_search: str = None):
|
|
37
|
+
"""
|
|
38
|
+
Asks the user to input a search term.
|
|
39
|
+
Handles both Telegram bot input and direct input.
|
|
40
|
+
If string_to_search is provided, it's returned directly (after stripping).
|
|
41
|
+
"""
|
|
42
|
+
if string_to_search is not None:
|
|
43
|
+
return string_to_search.strip()
|
|
32
44
|
|
|
45
|
+
if site_constant.TELEGRAM_BOT:
|
|
46
|
+
bot = get_bot_instance()
|
|
47
|
+
user_response = bot.ask(
|
|
48
|
+
"key_search", # Request type
|
|
49
|
+
"Enter the search term\nor type 'back' to return to the menu: ",
|
|
50
|
+
None
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
if user_response is None:
|
|
54
|
+
bot.send_message("Timeout: No search term entered.", None)
|
|
55
|
+
return None
|
|
56
|
+
|
|
57
|
+
if user_response.lower() == 'back':
|
|
58
|
+
bot.send_message("Returning to the main menu...", None)
|
|
59
|
+
|
|
60
|
+
try:
|
|
61
|
+
# Restart the script
|
|
62
|
+
subprocess.Popen([sys.executable] + sys.argv)
|
|
63
|
+
sys.exit()
|
|
64
|
+
|
|
65
|
+
except Exception as e:
|
|
66
|
+
bot.send_message(f"Error during restart attempt: {e}", None)
|
|
67
|
+
return None # Return None if restart fails
|
|
68
|
+
|
|
69
|
+
return user_response.strip()
|
|
70
|
+
|
|
71
|
+
else:
|
|
72
|
+
return msg.ask(f"\n[purple]Insert a word to search in [green]{site_constant.SITE_NAME}").strip()
|
|
73
|
+
|
|
33
74
|
def process_search_result(select_title, selections=None):
|
|
34
75
|
"""
|
|
35
76
|
Handles the search result and initiates the download for either a film or series.
|
|
@@ -38,6 +79,9 @@ def process_search_result(select_title, selections=None):
|
|
|
38
79
|
select_title (MediaItem): The selected media item
|
|
39
80
|
selections (dict, optional): Dictionary containing selection inputs that bypass manual input
|
|
40
81
|
{'season': season_selection, 'episode': episode_selection}
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
bool: True if processing was successful, False otherwise
|
|
41
85
|
"""
|
|
42
86
|
if not select_title:
|
|
43
87
|
if site_constant.TELEGRAM_BOT:
|
|
@@ -45,16 +89,18 @@ def process_search_result(select_title, selections=None):
|
|
|
45
89
|
bot.send_message("No title selected or selection cancelled.", None)
|
|
46
90
|
else:
|
|
47
91
|
console.print("[yellow]No title selected or selection cancelled.")
|
|
48
|
-
return
|
|
92
|
+
return False
|
|
49
93
|
|
|
50
94
|
if select_title.type == "TV":
|
|
51
95
|
episode_selection = None
|
|
52
96
|
if selections:
|
|
53
97
|
episode_selection = selections.get('episode')
|
|
54
98
|
download_series(select_title, episode_selection)
|
|
99
|
+
return True
|
|
55
100
|
|
|
56
101
|
else:
|
|
57
102
|
download_film(select_title)
|
|
103
|
+
return True
|
|
58
104
|
|
|
59
105
|
def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_item: dict = None, selections: dict = None):
|
|
60
106
|
"""
|
|
@@ -74,13 +120,10 @@ def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_
|
|
|
74
120
|
if direct_item:
|
|
75
121
|
select_title = MediaItem(**direct_item)
|
|
76
122
|
process_search_result(select_title, selections)
|
|
77
|
-
return
|
|
123
|
+
return True
|
|
78
124
|
|
|
79
125
|
# Get the user input for the search term
|
|
80
|
-
|
|
81
|
-
actual_search_query = msg.ask(f"\n[purple]Insert a word to search in [green]{site_constant.SITE_NAME}").strip()
|
|
82
|
-
else:
|
|
83
|
-
actual_search_query = string_to_search
|
|
126
|
+
actual_search_query = get_user_input(string_to_search)
|
|
84
127
|
|
|
85
128
|
# Perform the database search
|
|
86
129
|
if not actual_search_query:
|
|
@@ -98,6 +141,7 @@ def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_
|
|
|
98
141
|
if len_database > 0:
|
|
99
142
|
select_title = get_select_title(table_show_manager, media_search_manager, len_database)
|
|
100
143
|
process_search_result(select_title, selections)
|
|
144
|
+
return True
|
|
101
145
|
|
|
102
146
|
else:
|
|
103
147
|
if bot:
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# 16.03.25
|
|
2
2
|
|
|
3
|
+
import sys
|
|
4
|
+
import subprocess
|
|
3
5
|
from urllib.parse import quote_plus
|
|
4
6
|
|
|
5
7
|
|
|
@@ -36,11 +38,39 @@ def get_user_input(string_to_search: str = None):
|
|
|
36
38
|
"""
|
|
37
39
|
Asks the user to input a search term.
|
|
38
40
|
Handles both Telegram bot input and direct input.
|
|
41
|
+
If string_to_search is provided, it's returned directly (after stripping).
|
|
39
42
|
"""
|
|
40
|
-
if string_to_search is None:
|
|
41
|
-
string_to_search
|
|
43
|
+
if string_to_search is not None:
|
|
44
|
+
return string_to_search.strip()
|
|
42
45
|
|
|
43
|
-
|
|
46
|
+
if site_constant.TELEGRAM_BOT:
|
|
47
|
+
bot = get_bot_instance()
|
|
48
|
+
user_response = bot.ask(
|
|
49
|
+
"key_search", # Request type
|
|
50
|
+
"Enter the search term\nor type 'back' to return to the menu: ",
|
|
51
|
+
None
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
if user_response is None:
|
|
55
|
+
bot.send_message("Timeout: No search term entered.", None)
|
|
56
|
+
return None
|
|
57
|
+
|
|
58
|
+
if user_response.lower() == 'back':
|
|
59
|
+
bot.send_message("Returning to the main menu...", None)
|
|
60
|
+
|
|
61
|
+
try:
|
|
62
|
+
# Restart the script
|
|
63
|
+
subprocess.Popen([sys.executable] + sys.argv)
|
|
64
|
+
sys.exit()
|
|
65
|
+
|
|
66
|
+
except Exception as e:
|
|
67
|
+
bot.send_message(f"Error during restart attempt: {e}", None)
|
|
68
|
+
return None # Return None if restart fails
|
|
69
|
+
|
|
70
|
+
return user_response.strip()
|
|
71
|
+
|
|
72
|
+
else:
|
|
73
|
+
return msg.ask(f"\n[purple]Insert a word to search in [green]{site_constant.SITE_NAME}").strip()
|
|
44
74
|
|
|
45
75
|
def process_search_result(select_title, selections=None):
|
|
46
76
|
"""
|
|
@@ -50,6 +80,9 @@ def process_search_result(select_title, selections=None):
|
|
|
50
80
|
select_title (MediaItem): The selected media item
|
|
51
81
|
selections (dict, optional): Dictionary containing selection inputs that bypass manual input
|
|
52
82
|
{'season': season_selection, 'episode': episode_selection}
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
bool: True if processing was successful, False otherwise
|
|
53
86
|
"""
|
|
54
87
|
if not select_title:
|
|
55
88
|
if site_constant.TELEGRAM_BOT:
|
|
@@ -57,7 +90,7 @@ def process_search_result(select_title, selections=None):
|
|
|
57
90
|
bot.send_message("No title selected or selection cancelled.", None)
|
|
58
91
|
else:
|
|
59
92
|
console.print("[yellow]No title selected or selection cancelled.")
|
|
60
|
-
return
|
|
93
|
+
return False
|
|
61
94
|
|
|
62
95
|
if select_title.type == 'tv':
|
|
63
96
|
season_selection = None
|
|
@@ -68,25 +101,17 @@ def process_search_result(select_title, selections=None):
|
|
|
68
101
|
episode_selection = selections.get('episode')
|
|
69
102
|
|
|
70
103
|
download_series(select_title, season_selection, episode_selection)
|
|
104
|
+
return True
|
|
71
105
|
|
|
72
106
|
else:
|
|
73
107
|
download_film(select_title)
|
|
74
|
-
|
|
108
|
+
return True
|
|
109
|
+
|
|
75
110
|
# search("Game of Thrones", selections={"season": "1", "episode": "1-3"})
|
|
76
111
|
def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_item: dict = None, selections: dict = None):
|
|
77
112
|
"""
|
|
78
113
|
Main function of the application for search.
|
|
79
114
|
|
|
80
|
-
Parameters:
|
|
81
|
-
string_to_search (str, optional): String to search for
|
|
82
|
-
get_onlyDatabase (bool, optional): If True, return only the database object
|
|
83
|
-
direct_item (dict, optional): Direct item to process (bypass search)
|
|
84
|
-
selections (dict, optional): Dictionary containing selection inputs that bypass manual input
|
|
85
|
-
{'season': season_selection, 'episode': episode_selection}
|
|
86
|
-
"""
|
|
87
|
-
"""
|
|
88
|
-
Main function of the application for search.
|
|
89
|
-
|
|
90
115
|
Parameters:
|
|
91
116
|
string_to_search (str, optional): String to search for
|
|
92
117
|
get_onlyDatabase (bool, optional): If True, return only the database object
|
|
@@ -101,7 +126,7 @@ def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_
|
|
|
101
126
|
if direct_item:
|
|
102
127
|
select_title = MediaItem(**direct_item)
|
|
103
128
|
process_search_result(select_title, selections)
|
|
104
|
-
return
|
|
129
|
+
return True
|
|
105
130
|
|
|
106
131
|
# Get the user input for the search term
|
|
107
132
|
actual_search_query = get_user_input(string_to_search)
|
|
@@ -123,6 +148,7 @@ def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_
|
|
|
123
148
|
if len_database > 0:
|
|
124
149
|
select_title = get_select_title(table_show_manager, media_search_manager, len_database)
|
|
125
150
|
process_search_result(select_title, selections)
|
|
151
|
+
return True
|
|
126
152
|
|
|
127
153
|
else:
|
|
128
154
|
if bot:
|
|
@@ -50,7 +50,7 @@ def title_search(query: str) -> int:
|
|
|
50
50
|
|
|
51
51
|
# Check if x_cr_tab_id or etp_rt is present
|
|
52
52
|
if config_manager.get_dict("SITE_LOGIN", "crunchyroll")['x_cr_tab_id'] is None or config_manager.get_dict("SITE_LOGIN", "crunchyroll")['x_cr_tab_id'] == "" or config_manager.get_dict("SITE_LOGIN", "crunchyroll")['etp_rt'] is None or config_manager.get_dict("SITE_LOGIN", "crunchyroll")['etp_rt'] == "":
|
|
53
|
-
console.print(
|
|
53
|
+
console.print("[bold red] x_cr_tab_id or etp_rt is missing or empty.[/bold red]")
|
|
54
54
|
sys.exit(0)
|
|
55
55
|
|
|
56
56
|
# Build new Crunchyroll API search URL
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# 09.06.24
|
|
2
2
|
|
|
3
|
+
import sys
|
|
4
|
+
import subprocess
|
|
3
5
|
from urllib.parse import quote_plus
|
|
4
6
|
|
|
5
7
|
|
|
@@ -31,6 +33,44 @@ msg = Prompt()
|
|
|
31
33
|
console = Console()
|
|
32
34
|
|
|
33
35
|
|
|
36
|
+
def get_user_input(string_to_search: str = None):
|
|
37
|
+
"""
|
|
38
|
+
Asks the user to input a search term.
|
|
39
|
+
Handles both Telegram bot input and direct input.
|
|
40
|
+
If string_to_search is provided, it's returned directly (after stripping).
|
|
41
|
+
"""
|
|
42
|
+
if string_to_search is not None:
|
|
43
|
+
return string_to_search.strip()
|
|
44
|
+
|
|
45
|
+
if site_constant.TELEGRAM_BOT:
|
|
46
|
+
bot = get_bot_instance()
|
|
47
|
+
user_response = bot.ask(
|
|
48
|
+
"key_search", # Request type
|
|
49
|
+
"Enter the search term\nor type 'back' to return to the menu: ",
|
|
50
|
+
None
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
if user_response is None:
|
|
54
|
+
bot.send_message("Timeout: No search term entered.", None)
|
|
55
|
+
return None
|
|
56
|
+
|
|
57
|
+
if user_response.lower() == 'back':
|
|
58
|
+
bot.send_message("Returning to the main menu...", None)
|
|
59
|
+
|
|
60
|
+
try:
|
|
61
|
+
# Restart the script
|
|
62
|
+
subprocess.Popen([sys.executable] + sys.argv)
|
|
63
|
+
sys.exit()
|
|
64
|
+
|
|
65
|
+
except Exception as e:
|
|
66
|
+
bot.send_message(f"Error during restart attempt: {e}", None)
|
|
67
|
+
return None # Return None if restart fails
|
|
68
|
+
|
|
69
|
+
return user_response.strip()
|
|
70
|
+
|
|
71
|
+
else:
|
|
72
|
+
return msg.ask(f"\n[purple]Insert a word to search in [green]{site_constant.SITE_NAME}").strip()
|
|
73
|
+
|
|
34
74
|
def process_search_result(select_title, selections=None):
|
|
35
75
|
"""
|
|
36
76
|
Handles the search result and initiates the download for either a film or series.
|
|
@@ -39,6 +79,9 @@ def process_search_result(select_title, selections=None):
|
|
|
39
79
|
select_title (MediaItem): The selected media item
|
|
40
80
|
selections (dict, optional): Dictionary containing selection inputs that bypass manual input
|
|
41
81
|
{'season': season_selection, 'episode': episode_selection}
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
bool: True if processing was successful, False otherwise
|
|
42
85
|
"""
|
|
43
86
|
if not select_title:
|
|
44
87
|
if site_constant.TELEGRAM_BOT:
|
|
@@ -46,7 +89,7 @@ def process_search_result(select_title, selections=None):
|
|
|
46
89
|
bot.send_message("No title selected or selection cancelled.", None)
|
|
47
90
|
else:
|
|
48
91
|
console.print("[yellow]No title selected or selection cancelled.")
|
|
49
|
-
return
|
|
92
|
+
return False
|
|
50
93
|
|
|
51
94
|
season_selection = None
|
|
52
95
|
episode_selection = None
|
|
@@ -56,6 +99,7 @@ def process_search_result(select_title, selections=None):
|
|
|
56
99
|
episode_selection = selections.get('episode')
|
|
57
100
|
|
|
58
101
|
download_series(select_title, season_selection, episode_selection)
|
|
102
|
+
return True
|
|
59
103
|
|
|
60
104
|
def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_item: dict = None, selections: dict = None):
|
|
61
105
|
"""
|
|
@@ -79,12 +123,10 @@ def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_
|
|
|
79
123
|
if direct_item:
|
|
80
124
|
select_title = MediaItem(**direct_item)
|
|
81
125
|
process_search_result(select_title, selections)
|
|
82
|
-
return
|
|
126
|
+
return True
|
|
83
127
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
else:
|
|
87
|
-
actual_search_query = string_to_search
|
|
128
|
+
# Get the user input for the search term
|
|
129
|
+
actual_search_query = get_user_input(string_to_search)
|
|
88
130
|
|
|
89
131
|
# Handle empty input
|
|
90
132
|
if not actual_search_query:
|
|
@@ -103,6 +145,8 @@ def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_
|
|
|
103
145
|
if len_database > 0:
|
|
104
146
|
select_title = get_select_title(table_show_manager, media_search_manager, len_database)
|
|
105
147
|
process_search_result(select_title, selections)
|
|
148
|
+
return True
|
|
149
|
+
|
|
106
150
|
else:
|
|
107
151
|
if bot:
|
|
108
152
|
bot.send_message(f"No results found for: '{actual_search_query}'", None)
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# 21.05.24
|
|
2
2
|
|
|
3
|
+
import sys
|
|
4
|
+
import subprocess
|
|
5
|
+
|
|
3
6
|
|
|
4
7
|
# External library
|
|
5
8
|
from rich.console import Console
|
|
@@ -33,11 +36,40 @@ console = Console()
|
|
|
33
36
|
def get_user_input(string_to_search: str = None):
|
|
34
37
|
"""
|
|
35
38
|
Asks the user to input a search term.
|
|
39
|
+
Handles both Telegram bot input and direct input.
|
|
40
|
+
If string_to_search is provided, it's returned directly (after stripping).
|
|
36
41
|
"""
|
|
37
|
-
if string_to_search is None:
|
|
38
|
-
string_to_search
|
|
42
|
+
if string_to_search is not None:
|
|
43
|
+
return string_to_search.strip()
|
|
39
44
|
|
|
40
|
-
|
|
45
|
+
if site_constant.TELEGRAM_BOT:
|
|
46
|
+
bot = get_bot_instance()
|
|
47
|
+
user_response = bot.ask(
|
|
48
|
+
"key_search", # Request type
|
|
49
|
+
"Enter the search term\nor type 'back' to return to the menu: ",
|
|
50
|
+
None
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
if user_response is None:
|
|
54
|
+
bot.send_message("Timeout: No search term entered.", None)
|
|
55
|
+
return None
|
|
56
|
+
|
|
57
|
+
if user_response.lower() == 'back':
|
|
58
|
+
bot.send_message("Returning to the main menu...", None)
|
|
59
|
+
|
|
60
|
+
try:
|
|
61
|
+
# Restart the script
|
|
62
|
+
subprocess.Popen([sys.executable] + sys.argv)
|
|
63
|
+
sys.exit()
|
|
64
|
+
|
|
65
|
+
except Exception as e:
|
|
66
|
+
bot.send_message(f"Error during restart attempt: {e}", None)
|
|
67
|
+
return None # Return None if restart fails
|
|
68
|
+
|
|
69
|
+
return user_response.strip()
|
|
70
|
+
|
|
71
|
+
else:
|
|
72
|
+
return msg.ask(f"\n[purple]Insert a word to search in [green]{site_constant.SITE_NAME}").strip()
|
|
41
73
|
|
|
42
74
|
def process_search_result(select_title, selections=None):
|
|
43
75
|
"""
|
|
@@ -47,6 +79,9 @@ def process_search_result(select_title, selections=None):
|
|
|
47
79
|
select_title (MediaItem): The selected media item
|
|
48
80
|
selections (dict, optional): Dictionary containing selection inputs that bypass manual input
|
|
49
81
|
{'season': season_selection, 'episode': episode_selection}
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
bool: True if processing was successful, False otherwise
|
|
50
85
|
"""
|
|
51
86
|
if not select_title:
|
|
52
87
|
if site_constant.TELEGRAM_BOT:
|
|
@@ -54,7 +89,7 @@ def process_search_result(select_title, selections=None):
|
|
|
54
89
|
bot.send_message("No title selected or selection cancelled.", None)
|
|
55
90
|
else:
|
|
56
91
|
console.print("[yellow]No title selected or selection cancelled.")
|
|
57
|
-
return
|
|
92
|
+
return False
|
|
58
93
|
|
|
59
94
|
if select_title.type == 'tv':
|
|
60
95
|
season_selection = None
|
|
@@ -65,9 +100,11 @@ def process_search_result(select_title, selections=None):
|
|
|
65
100
|
episode_selection = selections.get('episode')
|
|
66
101
|
|
|
67
102
|
download_series(select_title, season_selection, episode_selection)
|
|
103
|
+
return True
|
|
68
104
|
|
|
69
105
|
else:
|
|
70
106
|
download_film(select_title)
|
|
107
|
+
return True
|
|
71
108
|
|
|
72
109
|
def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_item: dict = None, selections: dict = None):
|
|
73
110
|
"""
|
|
@@ -87,7 +124,7 @@ def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_
|
|
|
87
124
|
if direct_item:
|
|
88
125
|
select_title = MediaItem(**direct_item)
|
|
89
126
|
process_search_result(select_title, selections)
|
|
90
|
-
return
|
|
127
|
+
return True
|
|
91
128
|
|
|
92
129
|
# Get the user input for the search term
|
|
93
130
|
actual_search_query = get_user_input(string_to_search)
|
|
@@ -109,6 +146,7 @@ def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_
|
|
|
109
146
|
if len_database > 0:
|
|
110
147
|
select_title = get_select_title(table_show_manager, media_search_manager, len_database)
|
|
111
148
|
process_search_result(select_title, selections)
|
|
149
|
+
return True
|
|
112
150
|
|
|
113
151
|
else:
|
|
114
152
|
if bot:
|
|
@@ -60,7 +60,7 @@ def download_film(select_title: MediaItem) -> Tuple[str, bool]:
|
|
|
60
60
|
cdm_device=get_wvd_path(),
|
|
61
61
|
license_url=license_url,
|
|
62
62
|
mpd_url=mpd_url,
|
|
63
|
-
output_path=mp4_path,
|
|
63
|
+
output_path=os.path.join(mp4_path, title_name),
|
|
64
64
|
)
|
|
65
65
|
dash_process.parse_manifest(custom_headers=get_headers())
|
|
66
66
|
|
|
@@ -49,8 +49,10 @@ def title_search(query: str) -> int:
|
|
|
49
49
|
sys.exit(0)
|
|
50
50
|
|
|
51
51
|
# Check if beToken is present
|
|
52
|
-
if config_manager.get_dict("SITE_LOGIN", "mediasetinfinity")["beToken"] is None or config_manager.get_dict("SITE_LOGIN", "mediasetinfinity")["beToken"] == ""
|
|
53
|
-
|
|
52
|
+
if (config_manager.get_dict("SITE_LOGIN", "mediasetinfinity")["beToken"] is None or config_manager.get_dict("SITE_LOGIN", "mediasetinfinity")["beToken"] == "") and \
|
|
53
|
+
(config_manager.get_dict("SITE_LOGIN", "mediasetinfinity").get("username") is None or config_manager.get_dict("SITE_LOGIN", "mediasetinfinity").get("username") == "" \
|
|
54
|
+
or config_manager.get_dict("SITE_LOGIN", "mediasetinfinity").get("password") is None or config_manager.get_dict("SITE_LOGIN", "mediasetinfinity").get("password") == ""):
|
|
55
|
+
console.print("[bold red] beToken or credentials are missing or empty.[/bold red]")
|
|
54
56
|
sys.exit(0)
|
|
55
57
|
|
|
56
58
|
search_url = 'https://api-ott-prod-fe.mediaset.net/PROD/play/reco/account/v2.0'
|
|
@@ -121,7 +123,8 @@ def title_search(query: str) -> int:
|
|
|
121
123
|
'name': item.get('title', ''),
|
|
122
124
|
'type': media_type,
|
|
123
125
|
'url': page_url,
|
|
124
|
-
'image':
|
|
126
|
+
'image': item.get('thumbnails', {}).get('image_header_poster-768x384', '').get('url', ''),
|
|
127
|
+
'date': item.get('year', ''),
|
|
125
128
|
})
|
|
126
129
|
|
|
127
130
|
return media_search_manager.get_length()
|