StreamingCommunity 2.5.7__py3-none-any.whl → 2.5.8__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/Player/ddl.py +2 -3
- StreamingCommunity/Api/Site/1337xx/__init__.py +5 -6
- StreamingCommunity/Api/Site/1337xx/site.py +7 -14
- StreamingCommunity/Api/Site/1337xx/title.py +3 -5
- StreamingCommunity/Api/Site/altadefinizionegratis/__init__.py +7 -6
- StreamingCommunity/Api/Site/altadefinizionegratis/film.py +14 -19
- StreamingCommunity/Api/Site/altadefinizionegratis/site.py +6 -14
- StreamingCommunity/Api/Site/animeunity/__init__.py +7 -7
- StreamingCommunity/Api/Site/animeunity/film_serie.py +29 -31
- StreamingCommunity/Api/Site/animeunity/site.py +14 -22
- StreamingCommunity/Api/Site/cb01new/__init__.py +5 -4
- StreamingCommunity/Api/Site/cb01new/film.py +2 -5
- StreamingCommunity/Api/Site/cb01new/site.py +5 -13
- StreamingCommunity/Api/Site/ddlstreamitaly/__init__.py +5 -4
- StreamingCommunity/Api/Site/ddlstreamitaly/series.py +12 -49
- StreamingCommunity/Api/Site/ddlstreamitaly/site.py +6 -16
- StreamingCommunity/Api/Site/ddlstreamitaly/util/ScrapeSerie.py +2 -3
- StreamingCommunity/Api/Site/guardaserie/__init__.py +5 -4
- StreamingCommunity/Api/Site/guardaserie/series.py +11 -46
- StreamingCommunity/Api/Site/guardaserie/site.py +5 -13
- StreamingCommunity/Api/Site/guardaserie/util/ScrapeSerie.py +10 -14
- StreamingCommunity/Api/Site/ilcorsaronero/__init__.py +5 -4
- StreamingCommunity/Api/Site/ilcorsaronero/site.py +5 -13
- StreamingCommunity/Api/Site/ilcorsaronero/title.py +3 -5
- StreamingCommunity/Api/Site/mostraguarda/__init__.py +2 -2
- StreamingCommunity/Api/Site/mostraguarda/film.py +4 -8
- StreamingCommunity/Api/Site/streamingcommunity/__init__.py +8 -7
- StreamingCommunity/Api/Site/streamingcommunity/film.py +14 -18
- StreamingCommunity/Api/Site/streamingcommunity/series.py +25 -76
- StreamingCommunity/Api/Site/streamingcommunity/site.py +11 -23
- StreamingCommunity/Api/Template/Util/__init__.py +8 -1
- StreamingCommunity/Api/Template/Util/manage_ep.py +46 -2
- StreamingCommunity/Api/Template/config_loader.py +71 -0
- StreamingCommunity/Lib/Downloader/HLS/downloader.py +60 -59
- StreamingCommunity/Lib/Downloader/HLS/segments.py +40 -14
- StreamingCommunity/Lib/Downloader/MP4/downloader.py +47 -40
- StreamingCommunity/Lib/FFmpeg/command.py +59 -3
- StreamingCommunity/Lib/M3U8/estimator.py +5 -5
- StreamingCommunity/Lib/M3U8/parser.py +12 -51
- StreamingCommunity/Lib/TMBD/tmdb.py +66 -99
- StreamingCommunity/TelegramHelp/telegram_bot.py +222 -68
- StreamingCommunity/Util/_jsonConfig.py +14 -13
- StreamingCommunity/Util/ffmpeg_installer.py +70 -64
- StreamingCommunity/Util/headers.py +11 -122
- StreamingCommunity/Util/os.py +64 -55
- StreamingCommunity/Util/table.py +62 -108
- StreamingCommunity/run.py +15 -10
- {StreamingCommunity-2.5.7.dist-info → StreamingCommunity-2.5.8.dist-info}/METADATA +56 -22
- StreamingCommunity-2.5.8.dist-info/RECORD +86 -0
- StreamingCommunity/Api/Site/1337xx/costant.py +0 -15
- StreamingCommunity/Api/Site/altadefinizionegratis/costant.py +0 -21
- StreamingCommunity/Api/Site/animeunity/costant.py +0 -21
- StreamingCommunity/Api/Site/cb01new/costant.py +0 -19
- StreamingCommunity/Api/Site/ddlstreamitaly/costant.py +0 -20
- StreamingCommunity/Api/Site/guardaserie/costant.py +0 -19
- StreamingCommunity/Api/Site/ilcorsaronero/costant.py +0 -19
- StreamingCommunity/Api/Site/mostraguarda/costant.py +0 -19
- StreamingCommunity/Api/Site/streamingcommunity/costant.py +0 -21
- StreamingCommunity/TelegramHelp/request_manager.py +0 -82
- StreamingCommunity/TelegramHelp/session.py +0 -56
- StreamingCommunity-2.5.7.dist-info/RECORD +0 -96
- {StreamingCommunity-2.5.7.dist-info → StreamingCommunity-2.5.8.dist-info}/LICENSE +0 -0
- {StreamingCommunity-2.5.7.dist-info → StreamingCommunity-2.5.8.dist-info}/WHEEL +0 -0
- {StreamingCommunity-2.5.7.dist-info → StreamingCommunity-2.5.8.dist-info}/entry_points.txt +0 -0
- {StreamingCommunity-2.5.7.dist-info → StreamingCommunity-2.5.8.dist-info}/top_level.txt +0 -0
|
@@ -7,14 +7,13 @@ from StreamingCommunity.Util.table import TVShowManager
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
# Logic class
|
|
10
|
-
from StreamingCommunity.Api.Template import
|
|
10
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
11
11
|
from StreamingCommunity.Api.Template.Util import search_domain
|
|
12
12
|
from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
|
|
13
13
|
from .util.ilCorsarScraper import IlCorsaroNeroScraper
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
# Variable
|
|
17
|
-
from .costant import SITE_NAME, DOMAIN_NOW
|
|
18
17
|
media_search_manager = MediaManager()
|
|
19
18
|
table_show_manager = TVShowManager()
|
|
20
19
|
max_timeout = config_manager.get_int("REQUESTS", "timeout")
|
|
@@ -35,14 +34,14 @@ async def title_search(word_to_search: str) -> int:
|
|
|
35
34
|
table_show_manager.clear()
|
|
36
35
|
|
|
37
36
|
# Find new domain if prev dont work
|
|
38
|
-
domain_to_use = DOMAIN_NOW
|
|
37
|
+
domain_to_use = site_constant.DOMAIN_NOW
|
|
39
38
|
|
|
40
39
|
if not disable_searchDomain:
|
|
41
|
-
domain_to_use, base_url = search_domain(SITE_NAME, f"https://{SITE_NAME}.{DOMAIN_NOW}")
|
|
40
|
+
domain_to_use, base_url = search_domain(site_constant.SITE_NAME, f"https://{site_constant.SITE_NAME}.{site_constant.DOMAIN_NOW}")
|
|
42
41
|
|
|
43
42
|
# Create scraper and collect result
|
|
44
43
|
print("\n")
|
|
45
|
-
scraper = IlCorsaroNeroScraper(f"https://{SITE_NAME}.{domain_to_use}/", 1)
|
|
44
|
+
scraper = IlCorsaroNeroScraper(f"https://{site_constant.SITE_NAME}.{domain_to_use}/", 1)
|
|
46
45
|
results = await scraper.search(word_to_search)
|
|
47
46
|
|
|
48
47
|
for i, torrent in enumerate(results):
|
|
@@ -62,11 +61,4 @@ async def title_search(word_to_search: str) -> int:
|
|
|
62
61
|
print(f"Error parsing a film entry: {e}")
|
|
63
62
|
|
|
64
63
|
# Return the number of titles found
|
|
65
|
-
return media_search_manager.get_length()
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
def run_get_select_title():
|
|
69
|
-
"""
|
|
70
|
-
Display a selection of titles and prompt the user to choose one.
|
|
71
|
-
"""
|
|
72
|
-
return get_select_title(table_show_manager, media_search_manager)
|
|
64
|
+
return media_search_manager.get_length()
|
|
@@ -11,12 +11,10 @@ from StreamingCommunity.Lib.Downloader import TOR_downloader
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
# Logic class
|
|
14
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
14
15
|
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
|
|
15
16
|
|
|
16
17
|
|
|
17
|
-
# Config
|
|
18
|
-
from .costant import MOVIE_FOLDER
|
|
19
|
-
|
|
20
18
|
|
|
21
19
|
def download_title(select_title: MediaItem):
|
|
22
20
|
"""
|
|
@@ -32,7 +30,7 @@ def download_title(select_title: MediaItem):
|
|
|
32
30
|
|
|
33
31
|
# Define output path
|
|
34
32
|
title_name = os_manager.get_sanitize_file(select_title.name)
|
|
35
|
-
mp4_path = os.path.join(MOVIE_FOLDER, title_name.replace(".mp4", ""))
|
|
33
|
+
mp4_path = os.path.join(site_constant.MOVIE_FOLDER, title_name.replace(".mp4", ""))
|
|
36
34
|
|
|
37
35
|
# Create output folder
|
|
38
36
|
os_manager.create_path(mp4_path)
|
|
@@ -41,4 +39,4 @@ def download_title(select_title: MediaItem):
|
|
|
41
39
|
manager = TOR_downloader()
|
|
42
40
|
manager.add_magnet_link(select_title.url)
|
|
43
41
|
manager.start_download()
|
|
44
|
-
manager.move_downloaded_files(mp4_path)
|
|
42
|
+
manager.move_downloaded_files(mp4_path)
|
|
@@ -8,6 +8,7 @@ from StreamingCommunity.Util.console import console, msg
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
# Logic class
|
|
11
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
11
12
|
from StreamingCommunity.Lib.TMBD import tmdb, Json_film
|
|
12
13
|
from .film import download_film
|
|
13
14
|
|
|
@@ -18,7 +19,6 @@ _useFor = "film"
|
|
|
18
19
|
_deprecate = False
|
|
19
20
|
_priority = 2
|
|
20
21
|
_engineDownload = "hls"
|
|
21
|
-
from .costant import SITE_NAME
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
@@ -27,7 +27,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
|
27
27
|
"""
|
|
28
28
|
|
|
29
29
|
if string_to_search is None:
|
|
30
|
-
string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{SITE_NAME}").strip()
|
|
30
|
+
string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{site_constant.SITE_NAME}").strip()
|
|
31
31
|
|
|
32
32
|
# Not available for the moment
|
|
33
33
|
if get_onylDatabase:
|
|
@@ -22,14 +22,11 @@ from StreamingCommunity.Lib.Downloader import HLS_Downloader
|
|
|
22
22
|
from StreamingCommunity.Api.Player.supervideo import VideoSource
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
#
|
|
25
|
+
# Logic class
|
|
26
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
26
27
|
from StreamingCommunity.Lib.TMBD import Json_film
|
|
27
28
|
|
|
28
29
|
|
|
29
|
-
# Config
|
|
30
|
-
from .costant import SITE_NAME, DOMAIN_NOW, MOVIE_FOLDER
|
|
31
|
-
|
|
32
|
-
|
|
33
30
|
def download_film(movie_details: Json_film) -> str:
|
|
34
31
|
"""
|
|
35
32
|
Downloads a film using the provided tmbd id.
|
|
@@ -44,11 +41,10 @@ def download_film(movie_details: Json_film) -> str:
|
|
|
44
41
|
# Start message and display film information
|
|
45
42
|
start_message()
|
|
46
43
|
console.print(f"[yellow]Download: [red]{movie_details.title} \n")
|
|
47
|
-
console.print(f"[cyan]You can safely stop the download with [bold]Ctrl+c[bold] [cyan] \n")
|
|
48
44
|
|
|
49
45
|
# Make request to main site
|
|
50
46
|
try:
|
|
51
|
-
url = f"https://{SITE_NAME}.{DOMAIN_NOW}/set-movie-a/{movie_details.imdb_id}"
|
|
47
|
+
url = f"https://{site_constant.SITE_NAME}.{site_constant.DOMAIN_NOW}/set-movie-a/{movie_details.imdb_id}"
|
|
52
48
|
response = httpx.get(url, headers={'User-Agent': get_headers()})
|
|
53
49
|
response.raise_for_status()
|
|
54
50
|
|
|
@@ -70,7 +66,7 @@ def download_film(movie_details: Json_film) -> str:
|
|
|
70
66
|
|
|
71
67
|
# Define output path
|
|
72
68
|
title_name = os_manager.get_sanitize_file(movie_details.title) + ".mp4"
|
|
73
|
-
mp4_path = os.path.join(MOVIE_FOLDER, title_name.replace(".mp4", ""))
|
|
69
|
+
mp4_path = os.path.join(site_constant.MOVIE_FOLDER, title_name.replace(".mp4", ""))
|
|
74
70
|
|
|
75
71
|
# Get m3u8 master playlist
|
|
76
72
|
master_playlist = video_source.get_playlist()
|
|
@@ -7,11 +7,13 @@ from urllib.parse import quote_plus
|
|
|
7
7
|
|
|
8
8
|
# Internal utilities
|
|
9
9
|
from StreamingCommunity.Util.console import console, msg
|
|
10
|
+
from StreamingCommunity.Api.Template import get_select_title
|
|
10
11
|
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
# Logic class
|
|
14
|
-
from .
|
|
15
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
16
|
+
from .site import get_version_and_domain, title_search, table_show_manager, media_search_manager
|
|
15
17
|
from .film import download_film
|
|
16
18
|
from .series import download_series
|
|
17
19
|
|
|
@@ -22,14 +24,13 @@ _useFor = "film_serie"
|
|
|
22
24
|
_deprecate = False
|
|
23
25
|
_priority = 1
|
|
24
26
|
_engineDownload = "hls"
|
|
25
|
-
from .costant import SITE_NAME, TELEGRAM_BOT
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
29
30
|
"""
|
|
30
31
|
Main function of the application for film and series.
|
|
31
32
|
"""
|
|
32
|
-
if TELEGRAM_BOT:
|
|
33
|
+
if site_constant.TELEGRAM_BOT:
|
|
33
34
|
bot = get_bot_instance()
|
|
34
35
|
|
|
35
36
|
if string_to_search is None:
|
|
@@ -49,7 +50,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
|
49
50
|
|
|
50
51
|
else:
|
|
51
52
|
if string_to_search is None:
|
|
52
|
-
string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{SITE_NAME}").strip()
|
|
53
|
+
string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{site_constant.SITE_NAME}").strip()
|
|
53
54
|
|
|
54
55
|
# Get site domain and version and get result of the search
|
|
55
56
|
site_version, domain = get_version_and_domain()
|
|
@@ -62,7 +63,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
|
62
63
|
if len_database > 0:
|
|
63
64
|
|
|
64
65
|
# Select title from list
|
|
65
|
-
select_title =
|
|
66
|
+
select_title = get_select_title(table_show_manager, media_search_manager)
|
|
66
67
|
|
|
67
68
|
if select_title.type == 'tv':
|
|
68
69
|
download_series(select_title, site_version)
|
|
@@ -73,8 +74,8 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
|
73
74
|
else:
|
|
74
75
|
console.print(f"\n[red]Nothing matching was found for[white]: [purple]{string_to_search}")
|
|
75
76
|
|
|
76
|
-
if TELEGRAM_BOT:
|
|
77
|
-
|
|
77
|
+
if site_constant.TELEGRAM_BOT:
|
|
78
|
+
bot.send_message(f"Nessun risultato trovato riprova", None)
|
|
78
79
|
|
|
79
80
|
# Retry
|
|
80
81
|
search()
|
|
@@ -8,11 +8,11 @@ from StreamingCommunity.Util.console import console
|
|
|
8
8
|
from StreamingCommunity.Util.os import os_manager
|
|
9
9
|
from StreamingCommunity.Util.message import start_message
|
|
10
10
|
from StreamingCommunity.Lib.Downloader import HLS_Downloader
|
|
11
|
-
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
|
|
12
|
-
from StreamingCommunity.TelegramHelp.session import get_session, updateScriptId, deleteScriptId
|
|
11
|
+
from StreamingCommunity.TelegramHelp.telegram_bot import TelegramSession, get_bot_instance
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
# Logic class
|
|
15
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
16
16
|
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
|
|
17
17
|
|
|
18
18
|
|
|
@@ -20,10 +20,6 @@ from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
|
|
|
20
20
|
from StreamingCommunity.Api.Player.vixcloud import VideoSource
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
# Variable
|
|
24
|
-
from .costant import SITE_NAME, MOVIE_FOLDER, TELEGRAM_BOT
|
|
25
|
-
|
|
26
|
-
|
|
27
23
|
def download_film(select_title: MediaItem) -> str:
|
|
28
24
|
"""
|
|
29
25
|
Downloads a film using the provided film ID, title name, and domain.
|
|
@@ -35,24 +31,24 @@ def download_film(select_title: MediaItem) -> str:
|
|
|
35
31
|
Return:
|
|
36
32
|
- str: output path
|
|
37
33
|
"""
|
|
38
|
-
if TELEGRAM_BOT:
|
|
34
|
+
if site_constant.TELEGRAM_BOT:
|
|
39
35
|
bot = get_bot_instance()
|
|
40
36
|
bot.send_message(f"Download in corso:\n{select_title.name}", None)
|
|
41
37
|
|
|
42
|
-
# Viene usato per lo screen
|
|
38
|
+
# Viene usato per lo screen
|
|
43
39
|
console.print(f"## Download: [red]{select_title.name} ##")
|
|
44
|
-
|
|
40
|
+
|
|
45
41
|
# Get script_id
|
|
46
|
-
script_id = get_session()
|
|
42
|
+
script_id = TelegramSession.get_session()
|
|
47
43
|
if script_id != "unknown":
|
|
48
|
-
updateScriptId(script_id, select_title.name)
|
|
44
|
+
TelegramSession.updateScriptId(script_id, select_title.name)
|
|
49
45
|
|
|
50
46
|
# Start message and display film information
|
|
51
47
|
start_message()
|
|
52
48
|
console.print(f"[yellow]Download: [red]{select_title.name} \n")
|
|
53
49
|
|
|
54
50
|
# Init class
|
|
55
|
-
video_source = VideoSource(SITE_NAME, False)
|
|
51
|
+
video_source = VideoSource(site_constant.SITE_NAME, False)
|
|
56
52
|
video_source.setup(select_title.id)
|
|
57
53
|
|
|
58
54
|
# Retrieve scws and if available master playlist
|
|
@@ -62,20 +58,20 @@ def download_film(select_title: MediaItem) -> str:
|
|
|
62
58
|
|
|
63
59
|
# Define the filename and path for the downloaded film
|
|
64
60
|
title_name = os_manager.get_sanitize_file(select_title.name) + ".mp4"
|
|
65
|
-
mp4_path = os.path.join(MOVIE_FOLDER, title_name.replace(".mp4", ""))
|
|
61
|
+
mp4_path = os.path.join(site_constant.MOVIE_FOLDER, title_name.replace(".mp4", ""))
|
|
66
62
|
|
|
67
63
|
# Download the film using the m3u8 playlist, and output filename
|
|
68
64
|
r_proc = HLS_Downloader(
|
|
69
|
-
m3u8_url=master_playlist,
|
|
65
|
+
m3u8_url=master_playlist,
|
|
70
66
|
output_path=os.path.join(mp4_path, title_name)
|
|
71
67
|
).start()
|
|
72
68
|
|
|
73
|
-
if TELEGRAM_BOT:
|
|
74
|
-
|
|
69
|
+
if site_constant.TELEGRAM_BOT:
|
|
70
|
+
|
|
75
71
|
# Delete script_id
|
|
76
|
-
script_id = get_session()
|
|
72
|
+
script_id = TelegramSession.get_session()
|
|
77
73
|
if script_id != "unknown":
|
|
78
|
-
deleteScriptId(script_id)
|
|
74
|
+
TelegramSession.deleteScriptId(script_id)
|
|
79
75
|
|
|
80
76
|
if "error" in r_proc.keys():
|
|
81
77
|
try:
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
# 3.12.23
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
|
-
import sys
|
|
5
4
|
from typing import Tuple
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
# Internal utilities
|
|
9
8
|
from StreamingCommunity.Util.console import console, msg
|
|
10
9
|
from StreamingCommunity.Util.message import start_message
|
|
11
|
-
from StreamingCommunity.Util.table import TVShowManager
|
|
12
10
|
from StreamingCommunity.Lib.Downloader import HLS_Downloader
|
|
13
|
-
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
|
|
14
|
-
from StreamingCommunity.TelegramHelp.session import get_session, updateScriptId, deleteScriptId
|
|
15
|
-
|
|
11
|
+
from StreamingCommunity.TelegramHelp.telegram_bot import TelegramSession, get_bot_instance
|
|
16
12
|
|
|
17
13
|
# Logic class
|
|
18
14
|
from .util.ScrapeSerie import ScrapeSerie
|
|
19
|
-
from StreamingCommunity.Api.Template.Util import
|
|
15
|
+
from StreamingCommunity.Api.Template.Util import (
|
|
16
|
+
manage_selection,
|
|
17
|
+
map_episode_title,
|
|
18
|
+
dynamic_format_number,
|
|
19
|
+
validate_selection,
|
|
20
|
+
validate_episode_selection,
|
|
21
|
+
display_episodes_list
|
|
22
|
+
)
|
|
23
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
20
24
|
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
|
|
21
25
|
|
|
22
26
|
|
|
@@ -24,10 +28,6 @@ from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
|
|
|
24
28
|
from StreamingCommunity.Api.Player.vixcloud import VideoSource
|
|
25
29
|
|
|
26
30
|
|
|
27
|
-
# Variable
|
|
28
|
-
from .costant import SITE_NAME, SERIES_FOLDER, TELEGRAM_BOT
|
|
29
|
-
|
|
30
|
-
|
|
31
31
|
def download_video(index_season_selected: int, index_episode_selected: int, scrape_serie: ScrapeSerie, video_source: VideoSource) -> Tuple[str,bool]:
|
|
32
32
|
"""
|
|
33
33
|
Download a single episode video.
|
|
@@ -48,9 +48,9 @@ def download_video(index_season_selected: int, index_episode_selected: int, scra
|
|
|
48
48
|
console.print(f"[yellow]Download: [red]{index_season_selected}:{index_episode_selected} {obj_episode.name}")
|
|
49
49
|
print()
|
|
50
50
|
|
|
51
|
-
if TELEGRAM_BOT:
|
|
51
|
+
if site_constant.TELEGRAM_BOT:
|
|
52
52
|
bot = get_bot_instance()
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
# Invio a telegram
|
|
55
55
|
bot.send_message(
|
|
56
56
|
f"Download in corso\nSerie: {scrape_serie.series_name}\nStagione: {index_season_selected}\nEpisodio: {index_episode_selected}\nTitolo: {obj_episode.name}",
|
|
@@ -58,25 +58,25 @@ def download_video(index_season_selected: int, index_episode_selected: int, scra
|
|
|
58
58
|
)
|
|
59
59
|
|
|
60
60
|
# Get script_id and update it
|
|
61
|
-
script_id = get_session()
|
|
61
|
+
script_id = TelegramSession.get_session()
|
|
62
62
|
if script_id != "unknown":
|
|
63
|
-
updateScriptId(script_id, f"{scrape_serie.series_name} - S{index_season_selected} - E{index_episode_selected} - {obj_episode.name}")
|
|
63
|
+
TelegramSession.updateScriptId(script_id, f"{scrape_serie.series_name} - S{index_season_selected} - E{index_episode_selected} - {obj_episode.name}")
|
|
64
64
|
|
|
65
65
|
# Define filename and path for the downloaded video
|
|
66
66
|
mp4_name = f"{map_episode_title(scrape_serie.series_name, index_season_selected, index_episode_selected, obj_episode.name)}.mp4"
|
|
67
|
-
mp4_path = os.path.join(SERIES_FOLDER, scrape_serie.series_name, f"S{index_season_selected}")
|
|
67
|
+
mp4_path = os.path.join(site_constant.SERIES_FOLDER, scrape_serie.series_name, f"S{index_season_selected}")
|
|
68
68
|
|
|
69
69
|
# Retrieve scws and if available master playlist
|
|
70
70
|
video_source.get_iframe(obj_episode.id)
|
|
71
71
|
video_source.get_content()
|
|
72
72
|
master_playlist = video_source.get_playlist()
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
# Download the episode
|
|
75
75
|
r_proc = HLS_Downloader(
|
|
76
76
|
m3u8_url=master_playlist,
|
|
77
77
|
output_path=os.path.join(mp4_path, mp4_name)
|
|
78
78
|
).start()
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
if "error" in r_proc.keys():
|
|
81
81
|
try:
|
|
82
82
|
os.remove(r_proc['path'])
|
|
@@ -116,7 +116,7 @@ def download_episode(index_season_selected: int, scrape_serie: ScrapeSerie, vide
|
|
|
116
116
|
else:
|
|
117
117
|
|
|
118
118
|
# Display episodes list and manage user selection
|
|
119
|
-
last_command = display_episodes_list(scrape_serie)
|
|
119
|
+
last_command = display_episodes_list(scrape_serie.episode_manager.episodes)
|
|
120
120
|
list_episode_select = manage_selection(last_command, episodes_count)
|
|
121
121
|
|
|
122
122
|
try:
|
|
@@ -141,15 +141,15 @@ def download_series(select_season: MediaItem, version: str) -> None:
|
|
|
141
141
|
- domain (str): Domain from which to download.
|
|
142
142
|
- version (str): Version of the site.
|
|
143
143
|
"""
|
|
144
|
-
if TELEGRAM_BOT:
|
|
144
|
+
if site_constant.TELEGRAM_BOT:
|
|
145
145
|
bot = get_bot_instance()
|
|
146
146
|
|
|
147
147
|
# Start message and set up video source
|
|
148
148
|
start_message()
|
|
149
149
|
|
|
150
150
|
# Init class
|
|
151
|
-
scrape_serie = ScrapeSerie(SITE_NAME)
|
|
152
|
-
video_source = VideoSource(SITE_NAME, True)
|
|
151
|
+
scrape_serie = ScrapeSerie(site_constant.SITE_NAME)
|
|
152
|
+
video_source = VideoSource(site_constant.SITE_NAME, True)
|
|
153
153
|
|
|
154
154
|
# Setup video source
|
|
155
155
|
scrape_serie.setup(version, select_season.id, select_season.slug)
|
|
@@ -162,7 +162,7 @@ def download_series(select_season: MediaItem, version: str) -> None:
|
|
|
162
162
|
# Prompt user for season selection and download episodes
|
|
163
163
|
console.print(f"\n[green]Seasons found: [red]{seasons_count}")
|
|
164
164
|
|
|
165
|
-
if TELEGRAM_BOT:
|
|
165
|
+
if site_constant.TELEGRAM_BOT:
|
|
166
166
|
console.print("\n[cyan]Insert season number [yellow](e.g., 1), [red]* [cyan]to download all seasons, "
|
|
167
167
|
"[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")
|
|
168
168
|
|
|
@@ -200,61 +200,10 @@ def download_series(select_season: MediaItem, version: str) -> None:
|
|
|
200
200
|
# Otherwise, let the user select specific episodes for the single season
|
|
201
201
|
download_episode(i_season, scrape_serie, video_source, download_all=False)
|
|
202
202
|
|
|
203
|
-
if TELEGRAM_BOT:
|
|
203
|
+
if site_constant.TELEGRAM_BOT:
|
|
204
204
|
bot.send_message(f"Finito di scaricare tutte le serie e episodi", None)
|
|
205
205
|
|
|
206
206
|
# Get script_id
|
|
207
|
-
script_id = get_session()
|
|
207
|
+
script_id = TelegramSession.get_session()
|
|
208
208
|
if script_id != "unknown":
|
|
209
|
-
deleteScriptId(script_id)
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
def display_episodes_list(scrape_serie) -> str:
|
|
213
|
-
"""
|
|
214
|
-
Display episodes list and handle user input.
|
|
215
|
-
|
|
216
|
-
Returns:
|
|
217
|
-
last_command (str): Last command entered by the user.
|
|
218
|
-
"""
|
|
219
|
-
if TELEGRAM_BOT:
|
|
220
|
-
bot = get_bot_instance()
|
|
221
|
-
|
|
222
|
-
# Set up table for displaying episodes
|
|
223
|
-
table_show_manager = TVShowManager()
|
|
224
|
-
table_show_manager.set_slice_end(10)
|
|
225
|
-
|
|
226
|
-
# Add columns to the table
|
|
227
|
-
column_info = {
|
|
228
|
-
"Index": {'color': 'red'},
|
|
229
|
-
"Name": {'color': 'magenta'},
|
|
230
|
-
"Duration": {'color': 'green'}
|
|
231
|
-
}
|
|
232
|
-
table_show_manager.add_column(column_info)
|
|
233
|
-
|
|
234
|
-
# Populate the table with episodes information
|
|
235
|
-
if TELEGRAM_BOT:
|
|
236
|
-
choices = []
|
|
237
|
-
|
|
238
|
-
for i, media in enumerate(scrape_serie.episode_manager.episodes):
|
|
239
|
-
table_show_manager.add_tv_show({
|
|
240
|
-
'Index': str(media.number),
|
|
241
|
-
'Name': media.name,
|
|
242
|
-
'Duration': str(media.duration)
|
|
243
|
-
})
|
|
244
|
-
|
|
245
|
-
if TELEGRAM_BOT:
|
|
246
|
-
choice_text = f"{media.number} - {media.name} ({media.duration} min)"
|
|
247
|
-
choices.append(choice_text)
|
|
248
|
-
|
|
249
|
-
if TELEGRAM_BOT:
|
|
250
|
-
if choices:
|
|
251
|
-
bot.send_message(f"Lista episodi:", choices)
|
|
252
|
-
|
|
253
|
-
# Run the table and handle user input
|
|
254
|
-
last_command = table_show_manager.run()
|
|
255
|
-
|
|
256
|
-
if last_command == "q" or last_command == "quit":
|
|
257
|
-
console.print("\n[red]Quit [white]...")
|
|
258
|
-
sys.exit(0)
|
|
259
|
-
|
|
260
|
-
return last_command
|
|
209
|
+
TelegramSession.deleteScriptId(script_id)
|
|
@@ -19,14 +19,11 @@ from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
# Logic class
|
|
22
|
-
from StreamingCommunity.Api.Template import
|
|
22
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
23
23
|
from StreamingCommunity.Api.Template.Util import search_domain
|
|
24
24
|
from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
# Config
|
|
28
|
-
from .costant import SITE_NAME, DOMAIN_NOW, TELEGRAM_BOT
|
|
29
|
-
|
|
30
27
|
|
|
31
28
|
# Variable
|
|
32
29
|
media_search_manager = MediaManager()
|
|
@@ -47,7 +44,7 @@ def get_version(domain: str):
|
|
|
47
44
|
"""
|
|
48
45
|
try:
|
|
49
46
|
response = httpx.get(
|
|
50
|
-
url=f"https://{SITE_NAME}.{domain}/",
|
|
47
|
+
url=f"https://{site_constant.SITE_NAME}.{domain}/",
|
|
51
48
|
headers={'User-Agent': get_headers()},
|
|
52
49
|
timeout=max_timeout
|
|
53
50
|
)
|
|
@@ -75,12 +72,10 @@ def get_version_and_domain():
|
|
|
75
72
|
- Determines the correct domain to use for the site by searching for a specific meta tag.
|
|
76
73
|
- Fetches the content of the site to extract the version information.
|
|
77
74
|
"""
|
|
78
|
-
|
|
79
|
-
# Find new domain if prev dont work
|
|
80
|
-
domain_to_use = DOMAIN_NOW
|
|
75
|
+
domain_to_use = site_constant
|
|
81
76
|
|
|
82
77
|
if not disable_searchDomain:
|
|
83
|
-
domain_to_use, base_url = search_domain(SITE_NAME, f"https://{SITE_NAME}.{DOMAIN_NOW}")
|
|
78
|
+
domain_to_use, base_url = search_domain(site_constant.SITE_NAME, f"https://{site_constant.SITE_NAME}.{site_constant.DOMAIN_NOW}")
|
|
84
79
|
|
|
85
80
|
try:
|
|
86
81
|
version = get_version(domain_to_use)
|
|
@@ -103,7 +98,7 @@ def title_search(title_search: str, domain: str) -> int:
|
|
|
103
98
|
Returns:
|
|
104
99
|
int: The number of titles found.
|
|
105
100
|
"""
|
|
106
|
-
if TELEGRAM_BOT:
|
|
101
|
+
if site_constant.TELEGRAM_BOT:
|
|
107
102
|
bot = get_bot_instance()
|
|
108
103
|
|
|
109
104
|
media_search_manager.clear()
|
|
@@ -111,17 +106,17 @@ def title_search(title_search: str, domain: str) -> int:
|
|
|
111
106
|
|
|
112
107
|
try:
|
|
113
108
|
response = httpx.get(
|
|
114
|
-
url=f"https://{SITE_NAME}.{domain}/api/search?q={title_search.replace(' ', '+')}",
|
|
109
|
+
url=f"https://{site_constant.SITE_NAME}.{domain}/api/search?q={title_search.replace(' ', '+')}",
|
|
115
110
|
headers={'user-agent': get_headers()},
|
|
116
111
|
timeout=max_timeout
|
|
117
112
|
)
|
|
118
113
|
response.raise_for_status()
|
|
119
114
|
|
|
120
115
|
except Exception as e:
|
|
121
|
-
console.print(f"Site: {SITE_NAME}, request search error: {e}")
|
|
116
|
+
console.print(f"Site: {site_constant.SITE_NAME}, request search error: {e}")
|
|
122
117
|
|
|
123
118
|
# Prepara le scelte per l'utente
|
|
124
|
-
if TELEGRAM_BOT:
|
|
119
|
+
if site_constant.TELEGRAM_BOT:
|
|
125
120
|
choices = []
|
|
126
121
|
|
|
127
122
|
for i, dict_title in enumerate(response.json()['data']):
|
|
@@ -135,23 +130,16 @@ def title_search(title_search: str, domain: str) -> int:
|
|
|
135
130
|
'score': dict_title.get('score')
|
|
136
131
|
})
|
|
137
132
|
|
|
138
|
-
if TELEGRAM_BOT:
|
|
133
|
+
if site_constant.TELEGRAM_BOT:
|
|
139
134
|
choice_text = f"{i} - {dict_title.get('name')} ({dict_title.get('type')}) - {dict_title.get('last_air_date')}"
|
|
140
135
|
choices.append(choice_text)
|
|
141
136
|
|
|
142
137
|
except Exception as e:
|
|
143
138
|
print(f"Error parsing a film entry: {e}")
|
|
144
139
|
|
|
145
|
-
if TELEGRAM_BOT:
|
|
140
|
+
if site_constant.TELEGRAM_BOT:
|
|
146
141
|
if choices:
|
|
147
142
|
bot.send_message(f"Lista dei risultati:", choices)
|
|
148
143
|
|
|
149
144
|
# Return the number of titles found
|
|
150
|
-
return media_search_manager.get_length()
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
def run_get_select_title():
|
|
154
|
-
"""
|
|
155
|
-
Display a selection of titles and prompt the user to choose one.
|
|
156
|
-
"""
|
|
157
|
-
return get_select_title(table_show_manager, media_search_manager)
|
|
145
|
+
return media_search_manager.get_length()
|
|
@@ -2,4 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
from .recall_search import execute_search
|
|
4
4
|
from .get_domain import search_domain
|
|
5
|
-
from .manage_ep import
|
|
5
|
+
from .manage_ep import (
|
|
6
|
+
manage_selection,
|
|
7
|
+
map_episode_title,
|
|
8
|
+
validate_episode_selection,
|
|
9
|
+
validate_selection,
|
|
10
|
+
dynamic_format_number,
|
|
11
|
+
display_episodes_list
|
|
12
|
+
)
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
# 19.06.24
|
|
2
2
|
|
|
3
|
+
import sys
|
|
3
4
|
import logging
|
|
4
5
|
from typing import List
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
# Internal utilities
|
|
8
|
-
from StreamingCommunity.Util.
|
|
9
|
+
from StreamingCommunity.Util.console import console
|
|
9
10
|
from StreamingCommunity.Util.os import os_manager
|
|
11
|
+
from StreamingCommunity.Util._jsonConfig import config_manager
|
|
12
|
+
from StreamingCommunity.Util.table import TVShowManager
|
|
10
13
|
|
|
11
14
|
|
|
12
15
|
# Config
|
|
@@ -176,4 +179,45 @@ def validate_episode_selection(list_episode_select: List[int], episodes_count: i
|
|
|
176
179
|
|
|
177
180
|
# Prompt the user for valid input again
|
|
178
181
|
input_episodes = input(f"Enter valid episode numbers (1-{episodes_count}): ")
|
|
179
|
-
list_episode_select = list(map(int, input_episodes.split(',')))
|
|
182
|
+
list_episode_select = list(map(int, input_episodes.split(',')))
|
|
183
|
+
|
|
184
|
+
def display_episodes_list(episodes_manager) -> str:
|
|
185
|
+
"""
|
|
186
|
+
Display episodes list and handle user input.
|
|
187
|
+
|
|
188
|
+
Returns:
|
|
189
|
+
last_command (str): Last command entered by the user.
|
|
190
|
+
"""
|
|
191
|
+
# Set up table for displaying episodes
|
|
192
|
+
table_show_manager = TVShowManager()
|
|
193
|
+
table_show_manager.set_slice_end(10)
|
|
194
|
+
|
|
195
|
+
# Add columns to the table
|
|
196
|
+
column_info = {
|
|
197
|
+
"Index": {'color': 'red'},
|
|
198
|
+
"Name": {'color': 'magenta'},
|
|
199
|
+
"Duration": {'color': 'blue'}
|
|
200
|
+
}
|
|
201
|
+
table_show_manager.add_column(column_info)
|
|
202
|
+
|
|
203
|
+
# Populate the table with episodes information
|
|
204
|
+
for i, media in enumerate(episodes_manager):
|
|
205
|
+
name = media.get('name') if isinstance(media, dict) else getattr(media, 'name', None)
|
|
206
|
+
duration = media.get('duration') if isinstance(media, dict) else getattr(media, 'duration', None)
|
|
207
|
+
|
|
208
|
+
episode_info = {
|
|
209
|
+
'Index': str(i + 1),
|
|
210
|
+
'Name': name,
|
|
211
|
+
'Duration': duration
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
table_show_manager.add_tv_show(episode_info)
|
|
215
|
+
|
|
216
|
+
# Run the table and handle user input
|
|
217
|
+
last_command = table_show_manager.run()
|
|
218
|
+
|
|
219
|
+
if last_command in ("q", "quit"):
|
|
220
|
+
console.print("\n[red]Quit [white]...")
|
|
221
|
+
sys.exit(0)
|
|
222
|
+
|
|
223
|
+
return last_command
|