StreamingCommunity 2.5.2__py3-none-any.whl → 2.5.5__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/Helper/Vixcloud/js_parser.py +143 -143
- StreamingCommunity/Api/Player/Helper/Vixcloud/util.py +136 -136
- StreamingCommunity/Api/Player/ddl.py +89 -89
- StreamingCommunity/Api/Player/maxstream.py +151 -151
- StreamingCommunity/Api/Player/supervideo.py +193 -193
- StreamingCommunity/Api/Player/vixcloud.py +272 -272
- StreamingCommunity/Api/Site/1337xx/__init__.py +51 -50
- StreamingCommunity/Api/Site/1337xx/costant.py +14 -14
- StreamingCommunity/Api/Site/1337xx/site.py +87 -89
- StreamingCommunity/Api/Site/1337xx/title.py +63 -64
- StreamingCommunity/Api/Site/altadefinizionegratis/__init__.py +74 -50
- StreamingCommunity/Api/Site/altadefinizionegratis/costant.py +21 -19
- StreamingCommunity/Api/Site/altadefinizionegratis/film.py +81 -72
- StreamingCommunity/Api/Site/altadefinizionegratis/site.py +116 -94
- StreamingCommunity/Api/Site/animeunity/__init__.py +75 -50
- StreamingCommunity/Api/Site/animeunity/costant.py +21 -19
- StreamingCommunity/Api/Site/animeunity/film_serie.py +171 -134
- StreamingCommunity/Api/Site/animeunity/site.py +191 -174
- StreamingCommunity/Api/Site/animeunity/util/ScrapeSerie.py +97 -97
- StreamingCommunity/Api/Site/cb01new/__init__.py +51 -51
- StreamingCommunity/Api/Site/cb01new/costant.py +19 -19
- StreamingCommunity/Api/Site/cb01new/film.py +61 -71
- StreamingCommunity/Api/Site/cb01new/site.py +82 -82
- StreamingCommunity/Api/Site/ddlstreamitaly/__init__.py +55 -55
- StreamingCommunity/Api/Site/ddlstreamitaly/costant.py +20 -20
- StreamingCommunity/Api/Site/ddlstreamitaly/series.py +149 -145
- StreamingCommunity/Api/Site/ddlstreamitaly/site.py +98 -98
- StreamingCommunity/Api/Site/ddlstreamitaly/util/ScrapeSerie.py +84 -84
- StreamingCommunity/Api/Site/guardaserie/__init__.py +50 -50
- StreamingCommunity/Api/Site/guardaserie/costant.py +19 -19
- StreamingCommunity/Api/Site/guardaserie/series.py +199 -198
- StreamingCommunity/Api/Site/guardaserie/site.py +89 -89
- StreamingCommunity/Api/Site/guardaserie/util/ScrapeSerie.py +110 -110
- StreamingCommunity/Api/Site/ilcorsaronero/__init__.py +51 -51
- StreamingCommunity/Api/Site/ilcorsaronero/costant.py +18 -18
- StreamingCommunity/Api/Site/ilcorsaronero/site.py +71 -71
- StreamingCommunity/Api/Site/ilcorsaronero/title.py +44 -44
- StreamingCommunity/Api/Site/ilcorsaronero/util/ilCorsarScraper.py +149 -149
- StreamingCommunity/Api/Site/mostraguarda/__init__.py +48 -48
- StreamingCommunity/Api/Site/mostraguarda/costant.py +18 -18
- StreamingCommunity/Api/Site/mostraguarda/film.py +90 -101
- StreamingCommunity/Api/Site/streamingcommunity/__init__.py +79 -55
- StreamingCommunity/Api/Site/streamingcommunity/costant.py +21 -19
- StreamingCommunity/Api/Site/streamingcommunity/film.py +86 -75
- StreamingCommunity/Api/Site/streamingcommunity/series.py +259 -207
- StreamingCommunity/Api/Site/streamingcommunity/site.py +156 -142
- StreamingCommunity/Api/Site/streamingcommunity/util/ScrapeSerie.py +124 -124
- StreamingCommunity/Api/Template/Class/SearchType.py +101 -101
- StreamingCommunity/Api/Template/Util/__init__.py +4 -4
- StreamingCommunity/Api/Template/Util/get_domain.py +201 -201
- StreamingCommunity/Api/Template/Util/manage_ep.py +178 -178
- StreamingCommunity/Api/Template/Util/recall_search.py +37 -37
- StreamingCommunity/Api/Template/__init__.py +2 -2
- StreamingCommunity/Api/Template/site.py +87 -87
- StreamingCommunity/Lib/Downloader/HLS/downloader.py +529 -1008
- StreamingCommunity/Lib/Downloader/HLS/proxyes.py +110 -110
- StreamingCommunity/Lib/Downloader/HLS/segments.py +446 -573
- StreamingCommunity/Lib/Downloader/MP4/downloader.py +181 -155
- StreamingCommunity/Lib/Downloader/TOR/downloader.py +297 -295
- StreamingCommunity/Lib/Downloader/__init__.py +4 -4
- StreamingCommunity/Lib/FFmpeg/__init__.py +4 -4
- StreamingCommunity/Lib/FFmpeg/capture.py +170 -170
- StreamingCommunity/Lib/FFmpeg/command.py +264 -296
- StreamingCommunity/Lib/FFmpeg/util.py +248 -248
- StreamingCommunity/Lib/M3U8/__init__.py +5 -5
- StreamingCommunity/Lib/M3U8/decryptor.py +164 -164
- StreamingCommunity/Lib/M3U8/estimator.py +146 -228
- StreamingCommunity/Lib/M3U8/parser.py +666 -666
- StreamingCommunity/Lib/M3U8/url_fixer.py +57 -57
- StreamingCommunity/Lib/TMBD/__init__.py +1 -1
- StreamingCommunity/Lib/TMBD/obj_tmbd.py +39 -39
- StreamingCommunity/Lib/TMBD/tmdb.py +345 -345
- StreamingCommunity/TelegramHelp/__init__.py +0 -0
- StreamingCommunity/TelegramHelp/request_manager.py +82 -0
- StreamingCommunity/TelegramHelp/session.py +56 -0
- StreamingCommunity/TelegramHelp/telegram_bot.py +561 -0
- StreamingCommunity/Upload/update.py +75 -67
- StreamingCommunity/Upload/version.py +5 -5
- StreamingCommunity/Util/_jsonConfig.py +227 -228
- StreamingCommunity/Util/call_stack.py +42 -42
- StreamingCommunity/Util/color.py +20 -20
- StreamingCommunity/Util/console.py +12 -12
- StreamingCommunity/Util/ffmpeg_installer.py +342 -370
- StreamingCommunity/Util/headers.py +159 -159
- StreamingCommunity/Util/logger.py +61 -61
- StreamingCommunity/Util/message.py +36 -64
- StreamingCommunity/Util/os.py +500 -507
- StreamingCommunity/Util/table.py +271 -228
- StreamingCommunity/run.py +352 -245
- {StreamingCommunity-2.5.2.dist-info → StreamingCommunity-2.5.5.dist-info}/LICENSE +674 -674
- {StreamingCommunity-2.5.2.dist-info → StreamingCommunity-2.5.5.dist-info}/METADATA +601 -543
- StreamingCommunity-2.5.5.dist-info/RECORD +96 -0
- {StreamingCommunity-2.5.2.dist-info → StreamingCommunity-2.5.5.dist-info}/entry_points.txt +0 -1
- StreamingCommunity/Api/Player/Helper/Vixcloud/__pycache__/js_parser.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Player/Helper/Vixcloud/__pycache__/js_parser.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Player/Helper/Vixcloud/__pycache__/util.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Player/Helper/Vixcloud/__pycache__/util.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Player/__pycache__/ddl.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Player/__pycache__/ddl.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Player/__pycache__/maxstream.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Player/__pycache__/maxstream.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Player/__pycache__/supervideo.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Player/__pycache__/supervideo.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Player/__pycache__/vixcloud.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Player/__pycache__/vixcloud.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/1337xx/__pycache__/__init__.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/1337xx/__pycache__/__init__.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/1337xx/__pycache__/costant.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/1337xx/__pycache__/costant.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/1337xx/__pycache__/site.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/1337xx/__pycache__/site.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/1337xx/__pycache__/title.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/1337xx/__pycache__/title.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/altadefinizionegratis/__pycache__/__init__.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/altadefinizionegratis/__pycache__/__init__.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/altadefinizionegratis/__pycache__/costant.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/altadefinizionegratis/__pycache__/costant.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/altadefinizionegratis/__pycache__/film.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/altadefinizionegratis/__pycache__/film.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/altadefinizionegratis/__pycache__/site.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/altadefinizionegratis/__pycache__/site.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/animeunity/__pycache__/__init__.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/animeunity/__pycache__/__init__.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/animeunity/__pycache__/costant.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/animeunity/__pycache__/costant.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/animeunity/__pycache__/film_serie.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/animeunity/__pycache__/film_serie.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/animeunity/__pycache__/site.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/animeunity/__pycache__/site.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/animeunity/util/__pycache__/ScrapeSerie.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/animeunity/util/__pycache__/ScrapeSerie.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/cb01new/__pycache__/__init__.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/cb01new/__pycache__/__init__.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/cb01new/__pycache__/costant.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/cb01new/__pycache__/costant.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/cb01new/__pycache__/film.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/cb01new/__pycache__/film.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/cb01new/__pycache__/site.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/cb01new/__pycache__/site.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/ddlstreamitaly/__pycache__/__init__.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/ddlstreamitaly/__pycache__/__init__.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/ddlstreamitaly/__pycache__/costant.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/ddlstreamitaly/__pycache__/costant.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/ddlstreamitaly/__pycache__/series.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/ddlstreamitaly/__pycache__/series.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/ddlstreamitaly/__pycache__/site.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/ddlstreamitaly/__pycache__/site.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/ddlstreamitaly/util/__pycache__/ScrapeSerie.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/ddlstreamitaly/util/__pycache__/ScrapeSerie.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/guardaserie/__pycache__/__init__.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/guardaserie/__pycache__/__init__.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/guardaserie/__pycache__/costant.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/guardaserie/__pycache__/costant.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/guardaserie/__pycache__/series.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/guardaserie/__pycache__/series.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/guardaserie/__pycache__/site.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/guardaserie/__pycache__/site.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/guardaserie/util/__pycache__/ScrapeSerie.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/guardaserie/util/__pycache__/ScrapeSerie.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/ilcorsaronero/__pycache__/__init__.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/ilcorsaronero/__pycache__/__init__.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/ilcorsaronero/__pycache__/costant.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/ilcorsaronero/__pycache__/costant.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/ilcorsaronero/__pycache__/site.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/ilcorsaronero/__pycache__/site.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/ilcorsaronero/__pycache__/title.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/ilcorsaronero/__pycache__/title.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/ilcorsaronero/util/__pycache__/ilCorsarScraper.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/ilcorsaronero/util/__pycache__/ilCorsarScraper.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/mostraguarda/__pycache__/__init__.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/mostraguarda/__pycache__/__init__.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/mostraguarda/__pycache__/costant.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/mostraguarda/__pycache__/costant.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/mostraguarda/__pycache__/film.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/mostraguarda/__pycache__/film.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/streamingcommunity/__pycache__/__init__.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/streamingcommunity/__pycache__/__init__.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/streamingcommunity/__pycache__/costant.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/streamingcommunity/__pycache__/costant.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/streamingcommunity/__pycache__/film.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/streamingcommunity/__pycache__/film.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/streamingcommunity/__pycache__/series.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/streamingcommunity/__pycache__/series.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/streamingcommunity/__pycache__/site.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/streamingcommunity/__pycache__/site.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Site/streamingcommunity/util/__pycache__/ScrapeSerie.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Site/streamingcommunity/util/__pycache__/ScrapeSerie.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Template/Class/__pycache__/SearchType.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Template/Class/__pycache__/SearchType.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Template/Util/__pycache__/__init__.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Template/Util/__pycache__/__init__.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Template/Util/__pycache__/get_domain.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Template/Util/__pycache__/get_domain.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Template/Util/__pycache__/manage_ep.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Template/Util/__pycache__/manage_ep.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Template/Util/__pycache__/recall_search.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Template/Util/__pycache__/recall_search.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Template/__pycache__/__init__.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Template/__pycache__/__init__.cpython-39.pyc +0 -0
- StreamingCommunity/Api/Template/__pycache__/site.cpython-313.pyc +0 -0
- StreamingCommunity/Api/Template/__pycache__/site.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/Downloader/HLS/__pycache__/downloader.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/Downloader/HLS/__pycache__/downloader.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/Downloader/HLS/__pycache__/proxyes.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/Downloader/HLS/__pycache__/proxyes.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/Downloader/HLS/__pycache__/segments.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/Downloader/HLS/__pycache__/segments.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/Downloader/MP4/__pycache__/downloader.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/Downloader/MP4/__pycache__/downloader.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/Downloader/TOR/__pycache__/downloader.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/Downloader/TOR/__pycache__/downloader.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/Downloader/__pycache__/__init__.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/Downloader/__pycache__/__init__.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/FFmpeg/__pycache__/__init__.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/FFmpeg/__pycache__/__init__.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/FFmpeg/__pycache__/capture.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/FFmpeg/__pycache__/capture.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/FFmpeg/__pycache__/command.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/FFmpeg/__pycache__/command.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/FFmpeg/__pycache__/util.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/FFmpeg/__pycache__/util.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/M3U8/__pycache__/__init__.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/M3U8/__pycache__/__init__.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/M3U8/__pycache__/decryptor.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/M3U8/__pycache__/decryptor.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/M3U8/__pycache__/estimator.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/M3U8/__pycache__/estimator.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/M3U8/__pycache__/parser.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/M3U8/__pycache__/parser.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/M3U8/__pycache__/url_fixer.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/M3U8/__pycache__/url_fixer.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/TMBD/__pycache__/__init__.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/TMBD/__pycache__/__init__.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/TMBD/__pycache__/obj_tmbd.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/TMBD/__pycache__/obj_tmbd.cpython-39.pyc +0 -0
- StreamingCommunity/Lib/TMBD/__pycache__/tmdb.cpython-313.pyc +0 -0
- StreamingCommunity/Lib/TMBD/__pycache__/tmdb.cpython-39.pyc +0 -0
- StreamingCommunity/Upload/__pycache__/update.cpython-313.pyc +0 -0
- StreamingCommunity/Upload/__pycache__/update.cpython-39.pyc +0 -0
- StreamingCommunity/Upload/__pycache__/version.cpython-313.pyc +0 -0
- StreamingCommunity/Upload/__pycache__/version.cpython-39.pyc +0 -0
- StreamingCommunity/Util/__pycache__/_jsonConfig.cpython-313.pyc +0 -0
- StreamingCommunity/Util/__pycache__/_jsonConfig.cpython-39.pyc +0 -0
- StreamingCommunity/Util/__pycache__/call_stack.cpython-313.pyc +0 -0
- StreamingCommunity/Util/__pycache__/call_stack.cpython-39.pyc +0 -0
- StreamingCommunity/Util/__pycache__/color.cpython-313.pyc +0 -0
- StreamingCommunity/Util/__pycache__/color.cpython-39.pyc +0 -0
- StreamingCommunity/Util/__pycache__/console.cpython-313.pyc +0 -0
- StreamingCommunity/Util/__pycache__/console.cpython-39.pyc +0 -0
- StreamingCommunity/Util/__pycache__/ffmpeg_installer.cpython-313.pyc +0 -0
- StreamingCommunity/Util/__pycache__/ffmpeg_installer.cpython-39.pyc +0 -0
- StreamingCommunity/Util/__pycache__/headers.cpython-313.pyc +0 -0
- StreamingCommunity/Util/__pycache__/headers.cpython-39.pyc +0 -0
- StreamingCommunity/Util/__pycache__/logger.cpython-313.pyc +0 -0
- StreamingCommunity/Util/__pycache__/logger.cpython-39.pyc +0 -0
- StreamingCommunity/Util/__pycache__/message.cpython-313.pyc +0 -0
- StreamingCommunity/Util/__pycache__/message.cpython-39.pyc +0 -0
- StreamingCommunity/Util/__pycache__/os.cpython-313.pyc +0 -0
- StreamingCommunity/Util/__pycache__/os.cpython-39.pyc +0 -0
- StreamingCommunity/Util/__pycache__/table.cpython-313.pyc +0 -0
- StreamingCommunity/Util/__pycache__/table.cpython-39.pyc +0 -0
- StreamingCommunity/__pycache__/__init__.cpython-313.pyc +0 -0
- StreamingCommunity/__pycache__/__init__.cpython-39.pyc +0 -0
- StreamingCommunity/__pycache__/run.cpython-313.pyc +0 -0
- StreamingCommunity/__pycache__/run.cpython-39.pyc +0 -0
- StreamingCommunity-2.5.2.dist-info/RECORD +0 -264
- {StreamingCommunity-2.5.2.dist-info → StreamingCommunity-2.5.5.dist-info}/WHEEL +0 -0
- {StreamingCommunity-2.5.2.dist-info → StreamingCommunity-2.5.5.dist-info}/top_level.txt +0 -0
|
File without changes
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# 04.02.25
|
|
2
|
+
# Made by: @GiuPic
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
import time
|
|
6
|
+
from typing import Optional
|
|
7
|
+
|
|
8
|
+
class RequestManager:
|
|
9
|
+
_instance = None
|
|
10
|
+
|
|
11
|
+
def __new__(cls, *args, **kwargs):
|
|
12
|
+
if not cls._instance:
|
|
13
|
+
cls._instance = super().__new__(cls)
|
|
14
|
+
return cls._instance
|
|
15
|
+
|
|
16
|
+
def __init__(self, json_file: str = "active_requests.json"):
|
|
17
|
+
if not hasattr(self, 'initialized'):
|
|
18
|
+
self.json_file = json_file
|
|
19
|
+
self.initialized = True
|
|
20
|
+
self.on_response_callback = None
|
|
21
|
+
|
|
22
|
+
def create_request(self, type: str) -> str:
|
|
23
|
+
request_data = {
|
|
24
|
+
"type": type,
|
|
25
|
+
"response": None,
|
|
26
|
+
"timestamp": time.time()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
with open(self.json_file, "w") as f:
|
|
30
|
+
json.dump(request_data, f)
|
|
31
|
+
|
|
32
|
+
return "Ok"
|
|
33
|
+
|
|
34
|
+
def save_response(self, message_text: str) -> bool:
|
|
35
|
+
try:
|
|
36
|
+
# Carica il file JSON
|
|
37
|
+
with open(self.json_file, "r") as f:
|
|
38
|
+
data = json.load(f)
|
|
39
|
+
|
|
40
|
+
# Controlla se esiste la chiave 'type' e se la risposta è presente
|
|
41
|
+
if "type" in data and "response" in data:
|
|
42
|
+
data["response"] = message_text # Aggiorna la risposta
|
|
43
|
+
|
|
44
|
+
with open(self.json_file, "w") as f:
|
|
45
|
+
json.dump(data, f, indent=4)
|
|
46
|
+
|
|
47
|
+
return True
|
|
48
|
+
else:
|
|
49
|
+
return False
|
|
50
|
+
|
|
51
|
+
except (FileNotFoundError, json.JSONDecodeError) as e:
|
|
52
|
+
print(f"⚠️ save_response - errore: {e}")
|
|
53
|
+
return False
|
|
54
|
+
|
|
55
|
+
def get_response(self) -> Optional[str]:
|
|
56
|
+
try:
|
|
57
|
+
with open(self.json_file, "r") as f:
|
|
58
|
+
data = json.load(f)
|
|
59
|
+
|
|
60
|
+
# Verifica se esiste la chiave "response"
|
|
61
|
+
if "response" in data:
|
|
62
|
+
response = data["response"] # Ottieni la risposta direttamente
|
|
63
|
+
|
|
64
|
+
if response is not None and self.on_response_callback:
|
|
65
|
+
self.on_response_callback(response)
|
|
66
|
+
|
|
67
|
+
return response
|
|
68
|
+
|
|
69
|
+
except (FileNotFoundError, json.JSONDecodeError) as e:
|
|
70
|
+
print(f"get_response - errore: {e}")
|
|
71
|
+
return None
|
|
72
|
+
|
|
73
|
+
def clear_file(self) -> bool:
|
|
74
|
+
try:
|
|
75
|
+
with open(self.json_file, "w") as f:
|
|
76
|
+
json.dump({}, f)
|
|
77
|
+
print(f"File {self.json_file} è stato svuotato con successo.")
|
|
78
|
+
return True
|
|
79
|
+
|
|
80
|
+
except Exception as e:
|
|
81
|
+
print(f"⚠️ clear_file - errore: {e}")
|
|
82
|
+
return False
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# 04.02.25
|
|
2
|
+
# Made by: @GiuPic
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
|
|
6
|
+
session_data = {}
|
|
7
|
+
|
|
8
|
+
def set_session(value):
|
|
9
|
+
session_data['script_id'] = value
|
|
10
|
+
|
|
11
|
+
def get_session():
|
|
12
|
+
return session_data.get('script_id', 'unknown')
|
|
13
|
+
|
|
14
|
+
def updateScriptId(screen_id, titolo):
|
|
15
|
+
json_file = "scripts.json"
|
|
16
|
+
try:
|
|
17
|
+
with open(json_file, 'r') as f:
|
|
18
|
+
scripts_data = json.load(f)
|
|
19
|
+
except FileNotFoundError:
|
|
20
|
+
scripts_data = []
|
|
21
|
+
|
|
22
|
+
# cerco lo script con lo screen_id
|
|
23
|
+
for script in scripts_data:
|
|
24
|
+
if script["screen_id"] == screen_id:
|
|
25
|
+
# se trovo il match, aggiorno il titolo
|
|
26
|
+
script["titolo"] = titolo
|
|
27
|
+
|
|
28
|
+
# aggiorno il file json
|
|
29
|
+
with open(json_file, 'w') as f:
|
|
30
|
+
json.dump(scripts_data, f, indent=4)
|
|
31
|
+
|
|
32
|
+
return
|
|
33
|
+
|
|
34
|
+
print(f"Screen_id {screen_id} non trovato.")
|
|
35
|
+
|
|
36
|
+
def deleteScriptId(screen_id):
|
|
37
|
+
json_file = "scripts.json"
|
|
38
|
+
try:
|
|
39
|
+
with open(json_file, 'r') as f:
|
|
40
|
+
scripts_data = json.load(f)
|
|
41
|
+
except FileNotFoundError:
|
|
42
|
+
scripts_data = []
|
|
43
|
+
|
|
44
|
+
for script in scripts_data:
|
|
45
|
+
if script["screen_id"] == screen_id:
|
|
46
|
+
# se trovo il match, elimino lo script
|
|
47
|
+
scripts_data.remove(script)
|
|
48
|
+
|
|
49
|
+
# aggiorno il file json
|
|
50
|
+
with open(json_file, 'w') as f:
|
|
51
|
+
json.dump(scripts_data, f, indent=4)
|
|
52
|
+
|
|
53
|
+
print(f"Script eliminato per screen_id {screen_id}")
|
|
54
|
+
return
|
|
55
|
+
|
|
56
|
+
print(f"Screen_id {screen_id} non trovato.")
|
|
@@ -0,0 +1,561 @@
|
|
|
1
|
+
# 04.02.25
|
|
2
|
+
# Made by: @GiuPic
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import re
|
|
6
|
+
import sys
|
|
7
|
+
import time
|
|
8
|
+
import uuid
|
|
9
|
+
import json
|
|
10
|
+
import threading
|
|
11
|
+
import subprocess
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# External libraries
|
|
15
|
+
import telebot
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# Fix import
|
|
19
|
+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
|
|
20
|
+
from StreamingCommunity.TelegramHelp.request_manager import RequestManager
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# Funzione per caricare variabili da un file .env
|
|
24
|
+
def load_env(file_path="../../.env"):
|
|
25
|
+
if os.path.exists(file_path):
|
|
26
|
+
with open(file_path) as f:
|
|
27
|
+
for line in f:
|
|
28
|
+
if line.strip() and not line.startswith("#"):
|
|
29
|
+
key, value = line.strip().split("=", 1)
|
|
30
|
+
os.environ[key] = value
|
|
31
|
+
|
|
32
|
+
# Carica le variabili
|
|
33
|
+
load_env()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class TelegramBot:
|
|
37
|
+
_instance = None
|
|
38
|
+
_config_file = "../../bot_config.json"
|
|
39
|
+
|
|
40
|
+
@classmethod
|
|
41
|
+
def get_instance(cls):
|
|
42
|
+
if cls._instance is None:
|
|
43
|
+
# Prova a caricare la configurazione e inizializzare il bot
|
|
44
|
+
if os.path.exists(cls._config_file):
|
|
45
|
+
with open(cls._config_file, "r") as f:
|
|
46
|
+
config = json.load(f)
|
|
47
|
+
cls._instance = cls.init_bot(
|
|
48
|
+
config["token"], config["authorized_user_id"]
|
|
49
|
+
)
|
|
50
|
+
else:
|
|
51
|
+
raise Exception(
|
|
52
|
+
"Bot non ancora inizializzato. Chiamare prima init_bot() con token e authorized_user_id"
|
|
53
|
+
)
|
|
54
|
+
return cls._instance
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def init_bot(cls, token, authorized_user_id):
|
|
58
|
+
if cls._instance is None:
|
|
59
|
+
cls._instance = cls(token, authorized_user_id)
|
|
60
|
+
# Salva la configurazione
|
|
61
|
+
config = {"token": token, "authorized_user_id": authorized_user_id}
|
|
62
|
+
with open(cls._config_file, "w") as f:
|
|
63
|
+
json.dump(config, f)
|
|
64
|
+
return cls._instance
|
|
65
|
+
|
|
66
|
+
def __init__(self, token, authorized_user_id):
|
|
67
|
+
def monitor_scripts():
|
|
68
|
+
while True:
|
|
69
|
+
try:
|
|
70
|
+
with open("../../scripts.json", "r") as f:
|
|
71
|
+
scripts_data = json.load(f)
|
|
72
|
+
except (FileNotFoundError, json.JSONDecodeError):
|
|
73
|
+
scripts_data = []
|
|
74
|
+
|
|
75
|
+
current_time = time.time()
|
|
76
|
+
|
|
77
|
+
# Crea una nuova lista senza gli script che sono scaduti o le screen che non esistono
|
|
78
|
+
scripts_data_to_save = []
|
|
79
|
+
|
|
80
|
+
for script in scripts_data:
|
|
81
|
+
screen_exists = False
|
|
82
|
+
try:
|
|
83
|
+
existing_screens = subprocess.check_output(
|
|
84
|
+
["screen", "-list"]
|
|
85
|
+
).decode("utf-8")
|
|
86
|
+
if script["screen_id"] in existing_screens:
|
|
87
|
+
screen_exists = True
|
|
88
|
+
except subprocess.CalledProcessError:
|
|
89
|
+
pass # Se il comando fallisce, significa che non ci sono screen attivi.
|
|
90
|
+
|
|
91
|
+
if screen_exists:
|
|
92
|
+
if (
|
|
93
|
+
"titolo" not in script
|
|
94
|
+
and script["status"] == "running"
|
|
95
|
+
and (current_time - script["start_time"]) > 600
|
|
96
|
+
):
|
|
97
|
+
# Prova a terminare la sessione screen
|
|
98
|
+
try:
|
|
99
|
+
subprocess.check_output(
|
|
100
|
+
["screen", "-S", script["screen_id"], "-X", "quit"]
|
|
101
|
+
)
|
|
102
|
+
print(
|
|
103
|
+
f"✅ La sessione screen con ID {script['screen_id']} è stata fermata automaticamente."
|
|
104
|
+
)
|
|
105
|
+
except subprocess.CalledProcessError:
|
|
106
|
+
print(
|
|
107
|
+
f"⚠️ Impossibile fermare la sessione screen con ID {script['screen_id']}."
|
|
108
|
+
)
|
|
109
|
+
print(
|
|
110
|
+
f"⚠️ Lo script con ID {script['screen_id']} ha superato i 10 minuti e verrà rimosso."
|
|
111
|
+
)
|
|
112
|
+
else:
|
|
113
|
+
scripts_data_to_save.append(script)
|
|
114
|
+
else:
|
|
115
|
+
print(
|
|
116
|
+
f"⚠️ La sessione screen con ID {script['screen_id']} non esiste più e verrà rimossa."
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
# Salva la lista aggiornata, senza gli script scaduti o le screen non esistenti
|
|
120
|
+
with open("../../scripts.json", "w") as f:
|
|
121
|
+
json.dump(scripts_data_to_save, f, indent=4)
|
|
122
|
+
|
|
123
|
+
time.sleep(60) # Controlla ogni minuto
|
|
124
|
+
|
|
125
|
+
# Avvia il thread di monitoraggio
|
|
126
|
+
monitor_thread = threading.Thread(target=monitor_scripts, daemon=True)
|
|
127
|
+
monitor_thread.start()
|
|
128
|
+
|
|
129
|
+
if TelegramBot._instance is not None:
|
|
130
|
+
raise Exception(
|
|
131
|
+
"Questa classe è un singleton! Usa get_instance() per ottenere l'istanza."
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
self.token = token
|
|
135
|
+
self.authorized_user_id = authorized_user_id
|
|
136
|
+
self.chat_id = authorized_user_id
|
|
137
|
+
self.bot = telebot.TeleBot(token)
|
|
138
|
+
self.request_manager = RequestManager()
|
|
139
|
+
|
|
140
|
+
# Registra gli handler
|
|
141
|
+
self.register_handlers()
|
|
142
|
+
|
|
143
|
+
def register_handlers(self):
|
|
144
|
+
|
|
145
|
+
"""@self.bot.message_handler(commands=['start'])
|
|
146
|
+
def start(message):
|
|
147
|
+
self.handle_start(message)"""
|
|
148
|
+
|
|
149
|
+
@self.bot.message_handler(commands=["get_id"])
|
|
150
|
+
def get_id(message):
|
|
151
|
+
self.handle_get_id(message)
|
|
152
|
+
|
|
153
|
+
@self.bot.message_handler(commands=["start"])
|
|
154
|
+
def start_script(message):
|
|
155
|
+
self.handle_start_script(message)
|
|
156
|
+
|
|
157
|
+
@self.bot.message_handler(commands=["list"])
|
|
158
|
+
def list_scripts(message):
|
|
159
|
+
self.handle_list_scripts(message)
|
|
160
|
+
|
|
161
|
+
@self.bot.message_handler(commands=["stop"])
|
|
162
|
+
def stop_script(message):
|
|
163
|
+
self.handle_stop_script(message)
|
|
164
|
+
|
|
165
|
+
@self.bot.message_handler(commands=["screen"])
|
|
166
|
+
def screen_status(message):
|
|
167
|
+
self.handle_screen_status(message)
|
|
168
|
+
|
|
169
|
+
@self.bot.message_handler(func=lambda message: True)
|
|
170
|
+
def handle_all_messages(message):
|
|
171
|
+
self.handle_response(message)
|
|
172
|
+
|
|
173
|
+
def is_authorized(self, user_id):
|
|
174
|
+
return user_id == self.authorized_user_id
|
|
175
|
+
|
|
176
|
+
def handle_get_id(self, message):
|
|
177
|
+
if not self.is_authorized(message.from_user.id):
|
|
178
|
+
print(f"❌ Non sei autorizzato.")
|
|
179
|
+
self.bot.send_message(message.chat.id, "❌ Non sei autorizzato.")
|
|
180
|
+
return
|
|
181
|
+
|
|
182
|
+
print(f"Il tuo ID utente è: `{message.from_user.id}`")
|
|
183
|
+
self.bot.send_message(
|
|
184
|
+
message.chat.id,
|
|
185
|
+
f"Il tuo ID utente è: `{message.from_user.id}`",
|
|
186
|
+
parse_mode="Markdown",
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
def handle_start_script(self, message):
|
|
190
|
+
if not self.is_authorized(message.from_user.id):
|
|
191
|
+
print(f"❌ Non sei autorizzato. {message.from_user.id}")
|
|
192
|
+
self.bot.send_message(message.chat.id, "❌ Non sei autorizzato.")
|
|
193
|
+
return
|
|
194
|
+
|
|
195
|
+
screen_id = str(uuid.uuid4())[:8]
|
|
196
|
+
debug_mode = os.getenv("DEBUG")
|
|
197
|
+
verbose = debug_mode
|
|
198
|
+
|
|
199
|
+
if debug_mode == "True":
|
|
200
|
+
subprocess.Popen(["python3", "../../test_run.py", screen_id])
|
|
201
|
+
else:
|
|
202
|
+
# Verifica se lo screen con il nome esiste già
|
|
203
|
+
try:
|
|
204
|
+
subprocess.check_output(["screen", "-list"])
|
|
205
|
+
existing_screens = subprocess.check_output(["screen", "-list"]).decode(
|
|
206
|
+
"utf-8"
|
|
207
|
+
)
|
|
208
|
+
if screen_id in existing_screens:
|
|
209
|
+
print(f"⚠️ Lo script con ID {screen_id} è già in esecuzione.")
|
|
210
|
+
self.bot.send_message(
|
|
211
|
+
message.chat.id,
|
|
212
|
+
f"⚠️ Lo script con ID {screen_id} è già in esecuzione.",
|
|
213
|
+
)
|
|
214
|
+
return
|
|
215
|
+
except subprocess.CalledProcessError:
|
|
216
|
+
pass # Se il comando fallisce, significa che non ci sono screen attivi.
|
|
217
|
+
|
|
218
|
+
# Crea la sessione screen e avvia lo script al suo interno
|
|
219
|
+
command = [
|
|
220
|
+
"screen",
|
|
221
|
+
"-dmS",
|
|
222
|
+
screen_id,
|
|
223
|
+
"python3",
|
|
224
|
+
"../../test_run.py",
|
|
225
|
+
screen_id,
|
|
226
|
+
]
|
|
227
|
+
|
|
228
|
+
# Avvia il comando tramite subprocess
|
|
229
|
+
subprocess.Popen(command)
|
|
230
|
+
|
|
231
|
+
# Creazione oggetto script info
|
|
232
|
+
script_info = {
|
|
233
|
+
"screen_id": screen_id,
|
|
234
|
+
"start_time": time.time(),
|
|
235
|
+
"status": "running",
|
|
236
|
+
"user_id": message.from_user.id,
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
# Salvataggio nel file JSON
|
|
240
|
+
json_file = "../../scripts.json"
|
|
241
|
+
|
|
242
|
+
# Carica i dati esistenti o crea una nuova lista
|
|
243
|
+
try:
|
|
244
|
+
with open(json_file, "r") as f:
|
|
245
|
+
scripts_data = json.load(f)
|
|
246
|
+
except (FileNotFoundError, json.JSONDecodeError):
|
|
247
|
+
scripts_data = []
|
|
248
|
+
|
|
249
|
+
# Aggiungi il nuovo script
|
|
250
|
+
scripts_data.append(script_info)
|
|
251
|
+
|
|
252
|
+
# Scrivi il file aggiornato
|
|
253
|
+
with open(json_file, "w") as f:
|
|
254
|
+
json.dump(scripts_data, f, indent=4)
|
|
255
|
+
|
|
256
|
+
def handle_list_scripts(self, message):
|
|
257
|
+
if not self.is_authorized(message.from_user.id):
|
|
258
|
+
print(f"❌ Non sei autorizzato.")
|
|
259
|
+
self.bot.send_message(message.chat.id, "❌ Non sei autorizzato.")
|
|
260
|
+
return
|
|
261
|
+
|
|
262
|
+
try:
|
|
263
|
+
with open("../../scripts.json", "r") as f:
|
|
264
|
+
scripts_data = json.load(f)
|
|
265
|
+
except (FileNotFoundError, json.JSONDecodeError):
|
|
266
|
+
scripts_data = []
|
|
267
|
+
|
|
268
|
+
if not scripts_data:
|
|
269
|
+
print(f"⚠️ Nessuno script registrato.")
|
|
270
|
+
self.bot.send_message(message.chat.id, "⚠️ Nessuno script registrato.")
|
|
271
|
+
return
|
|
272
|
+
|
|
273
|
+
current_time = time.time()
|
|
274
|
+
msg = ["🖥️ **Script Registrati:**\n"]
|
|
275
|
+
|
|
276
|
+
for script in scripts_data:
|
|
277
|
+
# Calcola la durata
|
|
278
|
+
duration = current_time - script["start_time"]
|
|
279
|
+
if "end_time" in script:
|
|
280
|
+
duration = script["end_time"] - script["start_time"]
|
|
281
|
+
|
|
282
|
+
# Formatta la durata
|
|
283
|
+
hours, rem = divmod(duration, 3600)
|
|
284
|
+
minutes, seconds = divmod(rem, 60)
|
|
285
|
+
duration_str = f"{int(hours)}h {int(minutes)}m {int(seconds)}s"
|
|
286
|
+
|
|
287
|
+
# Icona stato
|
|
288
|
+
status_icons = {"running": "🟢", "stopped": "🔴", "completed": "⚪"}
|
|
289
|
+
|
|
290
|
+
# Costruisci riga
|
|
291
|
+
line = (
|
|
292
|
+
f"• ID: `{script['screen_id']}`\n"
|
|
293
|
+
f"• Stato: {status_icons.get(script['status'], '⚫')}\n"
|
|
294
|
+
f"• Stop: `/stop {script['screen_id']}`\n"
|
|
295
|
+
f"• Screen: `/screen {script['screen_id']}`\n"
|
|
296
|
+
f"• Durata: {duration_str}\n"
|
|
297
|
+
f"• Download:\n{script.get('titolo', 'N/A')}\n"
|
|
298
|
+
)
|
|
299
|
+
msg.append(line)
|
|
300
|
+
|
|
301
|
+
# Formatta la risposta finale
|
|
302
|
+
final_msg = "\n".join(msg)
|
|
303
|
+
if len(final_msg) > 4000:
|
|
304
|
+
final_msg = final_msg[:4000] + "\n[...] (messaggio troncato)"
|
|
305
|
+
|
|
306
|
+
print(f"{final_msg}")
|
|
307
|
+
self.bot.send_message(message.chat.id, final_msg, parse_mode="Markdown")
|
|
308
|
+
|
|
309
|
+
def handle_stop_script(self, message):
|
|
310
|
+
if not self.is_authorized(message.from_user.id):
|
|
311
|
+
print(f"❌ Non sei autorizzato.")
|
|
312
|
+
self.bot.send_message(message.chat.id, "❌ Non sei autorizzato.")
|
|
313
|
+
return
|
|
314
|
+
|
|
315
|
+
parts = message.text.split()
|
|
316
|
+
if len(parts) < 2:
|
|
317
|
+
try:
|
|
318
|
+
with open("../../scripts.json", "r") as f:
|
|
319
|
+
scripts_data = json.load(f)
|
|
320
|
+
except (FileNotFoundError, json.JSONDecodeError):
|
|
321
|
+
scripts_data = []
|
|
322
|
+
|
|
323
|
+
running_scripts = [s for s in scripts_data if s["status"] == "running"]
|
|
324
|
+
|
|
325
|
+
if not running_scripts:
|
|
326
|
+
print(f"⚠️ Nessuno script attivo da fermare.")
|
|
327
|
+
self.bot.send_message(
|
|
328
|
+
message.chat.id, "⚠️ Nessuno script attivo da fermare."
|
|
329
|
+
)
|
|
330
|
+
return
|
|
331
|
+
|
|
332
|
+
msg = "🖥️ **Script Attivi:**\n"
|
|
333
|
+
for script in running_scripts:
|
|
334
|
+
msg += f"🔹 `/stop {script['screen_id']}` per fermarlo\n"
|
|
335
|
+
|
|
336
|
+
print(f"{msg}")
|
|
337
|
+
self.bot.send_message(message.chat.id, msg, parse_mode="Markdown")
|
|
338
|
+
|
|
339
|
+
elif len(parts) == 2:
|
|
340
|
+
screen_id = parts[1]
|
|
341
|
+
|
|
342
|
+
try:
|
|
343
|
+
with open("../../scripts.json", "r") as f:
|
|
344
|
+
scripts_data = json.load(f)
|
|
345
|
+
except (FileNotFoundError, json.JSONDecodeError):
|
|
346
|
+
scripts_data = []
|
|
347
|
+
|
|
348
|
+
# Filtra la lista eliminando lo script con l'ID specificato
|
|
349
|
+
new_scripts_data = [
|
|
350
|
+
script for script in scripts_data if script["screen_id"] != screen_id
|
|
351
|
+
]
|
|
352
|
+
|
|
353
|
+
if len(new_scripts_data) == len(scripts_data):
|
|
354
|
+
# Nessun elemento rimosso, quindi ID non trovato
|
|
355
|
+
print(f"⚠️ Nessuno script attivo con ID `{screen_id}`.")
|
|
356
|
+
self.bot.send_message(
|
|
357
|
+
message.chat.id,
|
|
358
|
+
f"⚠️ Nessuno script attivo con ID `{screen_id}`.",
|
|
359
|
+
parse_mode="Markdown",
|
|
360
|
+
)
|
|
361
|
+
return
|
|
362
|
+
|
|
363
|
+
# Terminare la sessione screen
|
|
364
|
+
try:
|
|
365
|
+
subprocess.check_output(["screen", "-S", screen_id, "-X", "quit"])
|
|
366
|
+
print(f"✅ La sessione screen con ID {screen_id} è stata fermata.")
|
|
367
|
+
except subprocess.CalledProcessError:
|
|
368
|
+
print(
|
|
369
|
+
f"⚠️ Impossibile fermare la sessione screen con ID `{screen_id}`."
|
|
370
|
+
)
|
|
371
|
+
self.bot.send_message(
|
|
372
|
+
message.chat.id,
|
|
373
|
+
f"⚠️ Impossibile fermare la sessione screen con ID `{screen_id}`.",
|
|
374
|
+
parse_mode="Markdown",
|
|
375
|
+
)
|
|
376
|
+
return
|
|
377
|
+
|
|
378
|
+
# Salva la lista aggiornata senza lo script eliminato
|
|
379
|
+
with open("../../scripts.json", "w") as f:
|
|
380
|
+
json.dump(new_scripts_data, f, indent=4)
|
|
381
|
+
|
|
382
|
+
print(f"✅ Script `{screen_id}` terminato con successo!")
|
|
383
|
+
self.bot.send_message(
|
|
384
|
+
message.chat.id,
|
|
385
|
+
f"✅ Script `{screen_id}` terminato con successo!",
|
|
386
|
+
parse_mode="Markdown",
|
|
387
|
+
)
|
|
388
|
+
|
|
389
|
+
def handle_response(self, message):
|
|
390
|
+
text = message.text
|
|
391
|
+
if self.request_manager.save_response(text):
|
|
392
|
+
print(f"📥 Risposta salvata correttamente per il tipo {text}")
|
|
393
|
+
else:
|
|
394
|
+
print("⚠️ Nessuna richiesta attiva.")
|
|
395
|
+
self.bot.reply_to(message, "❌ Nessuna richiesta attiva.")
|
|
396
|
+
|
|
397
|
+
def handle_screen_status(self, message):
|
|
398
|
+
command_parts = message.text.split()
|
|
399
|
+
if len(command_parts) < 2:
|
|
400
|
+
print(f"⚠️ ID mancante nel comando. Usa: /screen <ID>")
|
|
401
|
+
self.bot.send_message(
|
|
402
|
+
message.chat.id, "⚠️ ID mancante nel comando. Usa: /screen <ID>"
|
|
403
|
+
)
|
|
404
|
+
return
|
|
405
|
+
|
|
406
|
+
screen_id = command_parts[1]
|
|
407
|
+
temp_file = f"/tmp/screen_output_{screen_id}.txt"
|
|
408
|
+
|
|
409
|
+
try:
|
|
410
|
+
# Cattura l'output della screen
|
|
411
|
+
subprocess.run(
|
|
412
|
+
["screen", "-X", "-S", screen_id, "hardcopy", "-h", temp_file],
|
|
413
|
+
check=True,
|
|
414
|
+
)
|
|
415
|
+
except subprocess.CalledProcessError as e:
|
|
416
|
+
print(f"❌ Errore durante la cattura dell'output della screen: {e}")
|
|
417
|
+
self.bot.send_message(
|
|
418
|
+
message.chat.id,
|
|
419
|
+
f"❌ Errore durante la cattura dell'output della screen: {e}",
|
|
420
|
+
)
|
|
421
|
+
return
|
|
422
|
+
|
|
423
|
+
if not os.path.exists(temp_file):
|
|
424
|
+
print(f"❌ Impossibile catturare l'output della screen.")
|
|
425
|
+
self.bot.send_message(
|
|
426
|
+
message.chat.id, f"❌ Impossibile catturare l'output della screen."
|
|
427
|
+
)
|
|
428
|
+
return
|
|
429
|
+
|
|
430
|
+
try:
|
|
431
|
+
# Leggi il file con la codifica corretta
|
|
432
|
+
with open(temp_file, "r", encoding="latin-1") as file:
|
|
433
|
+
screen_output = file.read()
|
|
434
|
+
|
|
435
|
+
# Pulisci l'output
|
|
436
|
+
cleaned_output = re.sub(
|
|
437
|
+
r"[\x00-\x1F\x7F]", "", screen_output
|
|
438
|
+
) # Rimuovi caratteri di controllo
|
|
439
|
+
cleaned_output = cleaned_output.replace(
|
|
440
|
+
"\n\n", "\n"
|
|
441
|
+
) # Rimuovi newline multipli
|
|
442
|
+
|
|
443
|
+
# Estrarre tutte le parti da "Download:" fino a "Video" o "Subtitle", senza includerli
|
|
444
|
+
download_matches = re.findall(
|
|
445
|
+
r"Download: (.*?)(?:Video|Subtitle)", cleaned_output
|
|
446
|
+
)
|
|
447
|
+
if download_matches:
|
|
448
|
+
# Serie TV e Film StreamingCommunity
|
|
449
|
+
|
|
450
|
+
proc_matches = re.findall(r"Proc: ([\d\.]+%)", cleaned_output)
|
|
451
|
+
|
|
452
|
+
# Creare una stringa unica con tutti i risultati
|
|
453
|
+
result_string = "\n".join(
|
|
454
|
+
[
|
|
455
|
+
f"Download: {download_matches[i].strip()}\nDownload al {proc_matches[i]}"
|
|
456
|
+
for i in range(len(download_matches))
|
|
457
|
+
if i < len(proc_matches)
|
|
458
|
+
]
|
|
459
|
+
)
|
|
460
|
+
|
|
461
|
+
if result_string != "":
|
|
462
|
+
cleaned_output = result_string
|
|
463
|
+
else:
|
|
464
|
+
print(f"❌ La parola 'Download:' non è stata trovata nella stringa.")
|
|
465
|
+
else:
|
|
466
|
+
|
|
467
|
+
download_list = []
|
|
468
|
+
|
|
469
|
+
# Estrai tutte le righe che iniziano con "Download:" fino al prossimo "Download" o alla fine della riga
|
|
470
|
+
matches = re.findall(r"Download:\s*(.*?)(?=Download|$)", cleaned_output)
|
|
471
|
+
|
|
472
|
+
# Se sono stati trovati download, stampali
|
|
473
|
+
if matches:
|
|
474
|
+
for i, match in enumerate(matches, 1):
|
|
475
|
+
# rimuovo solo la parte "downloader.py:57Result:400" se esiste
|
|
476
|
+
match = re.sub(r"downloader.py:\d+Result:400", "", match)
|
|
477
|
+
match = match.strip() # Rimuovo gli spazi bianchi in eccesso
|
|
478
|
+
if match: # Assicurati che la stringa non sia vuota
|
|
479
|
+
print(f"Download {i}: {match}")
|
|
480
|
+
|
|
481
|
+
# Aggiungi il risultato modificato alla lista
|
|
482
|
+
download_list.append(f"Download {i}: {match}")
|
|
483
|
+
|
|
484
|
+
# Creare una stringa unica con tutti i risultati
|
|
485
|
+
cleaned_output = "\n".join(download_list)
|
|
486
|
+
else:
|
|
487
|
+
print("❌ Nessun download trovato")
|
|
488
|
+
|
|
489
|
+
# Invia l'output pulito
|
|
490
|
+
print(f"📄 Output della screen {screen_id}:\n{cleaned_output}")
|
|
491
|
+
self._send_long_message(
|
|
492
|
+
message.chat.id, f"📄 Output della screen {screen_id}:\n{cleaned_output}"
|
|
493
|
+
)
|
|
494
|
+
|
|
495
|
+
except Exception as e:
|
|
496
|
+
print(
|
|
497
|
+
f"❌ Errore durante la lettura o l'invio dell'output della screen: {e}"
|
|
498
|
+
)
|
|
499
|
+
self.bot.send_message(
|
|
500
|
+
message.chat.id,
|
|
501
|
+
f"❌ Errore durante la lettura o l'invio dell'output della screen: {e}",
|
|
502
|
+
)
|
|
503
|
+
|
|
504
|
+
# Cancella il file temporaneo
|
|
505
|
+
os.remove(temp_file)
|
|
506
|
+
|
|
507
|
+
def send_message(self, message, choices):
|
|
508
|
+
if choices is None:
|
|
509
|
+
if self.chat_id:
|
|
510
|
+
print(f"{message}")
|
|
511
|
+
self.bot.send_message(self.chat_id, message)
|
|
512
|
+
else:
|
|
513
|
+
formatted_choices = "\n".join(choices)
|
|
514
|
+
message = f"{message}\n\n{formatted_choices}"
|
|
515
|
+
if self.chat_id:
|
|
516
|
+
print(f"{message}")
|
|
517
|
+
self.bot.send_message(self.chat_id, message)
|
|
518
|
+
|
|
519
|
+
def _send_long_message(self, chat_id, text, chunk_size=4096):
|
|
520
|
+
"""Suddivide e invia un messaggio troppo lungo in più parti."""
|
|
521
|
+
for i in range(0, len(text), chunk_size):
|
|
522
|
+
print(f"{text[i:i+chunk_size]}")
|
|
523
|
+
self.bot.send_message(chat_id, text[i : i + chunk_size])
|
|
524
|
+
|
|
525
|
+
def ask(self, type, prompt_message, choices, timeout=60):
|
|
526
|
+
self.request_manager.create_request(type)
|
|
527
|
+
|
|
528
|
+
if choices is None:
|
|
529
|
+
print(f"{prompt_message}")
|
|
530
|
+
self.bot.send_message(
|
|
531
|
+
self.chat_id,
|
|
532
|
+
f"{prompt_message}",
|
|
533
|
+
)
|
|
534
|
+
else:
|
|
535
|
+
print(f"{prompt_message}\n\nOpzioni: {', '.join(choices)}")
|
|
536
|
+
self.bot.send_message(
|
|
537
|
+
self.chat_id,
|
|
538
|
+
f"{prompt_message}\n\nOpzioni: {', '.join(choices)}",
|
|
539
|
+
)
|
|
540
|
+
|
|
541
|
+
start_time = time.time()
|
|
542
|
+
while time.time() - start_time < timeout:
|
|
543
|
+
response = self.request_manager.get_response()
|
|
544
|
+
if response is not None:
|
|
545
|
+
return response
|
|
546
|
+
time.sleep(1)
|
|
547
|
+
|
|
548
|
+
print(f"⚠️ Timeout: nessuna risposta ricevuta.")
|
|
549
|
+
self.bot.send_message(self.chat_id, "⚠️ Timeout: nessuna risposta ricevuta.")
|
|
550
|
+
self.request_manager.clear_file()
|
|
551
|
+
return None
|
|
552
|
+
|
|
553
|
+
def run(self):
|
|
554
|
+
print("🚀 Avvio del bot...")
|
|
555
|
+
with open("../../scripts.json", "w") as f:
|
|
556
|
+
json.dump([], f)
|
|
557
|
+
self.bot.infinity_polling()
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
def get_bot_instance():
|
|
561
|
+
return TelegramBot.get_instance()
|