Scusa @fede, re add docker, fix timeout

This commit is contained in:
Lovi 2024-11-30 18:17:06 +01:00
parent 4aa103b4ad
commit bc94b86fc3
105 changed files with 670 additions and 304 deletions

5
Makefile Normal file
View File

@ -0,0 +1,5 @@
build-container:
docker build -t streaming-community-api .
run-container:
docker run --rm -it -p 8000:8000 -v ${LOCAL_DIR}:/app/Video -v ./config.json:/app/config.json streaming-community-api

View File

@ -17,6 +17,7 @@ Chat, contribute, and have fun in our **Git_StreamingCommunity** Discord [Server
- [Win 7](https://github.com/Ghost6446/StreamingCommunity_api/wiki/Installation#win-7)
- [Termux](https://github.com/Ghost6446/StreamingCommunity_api/wiki/Termux)
- [Configuration](#configuration)
- [DOCKER](#docker)
- [Tutorial](#tutorial)
- [To Do](#to-do)
@ -276,6 +277,39 @@ forced-ita hin - Hindi pol - Polish tur - Turkish
> "specific_list_subtitles": ["ita", "eng", "spa"]
> ```
## Docker 🐳
You can run the script in a docker container, to build the image just run
```
docker build -t streaming-community-api .
```
and to run it use
```
docker run -it -p 8000:8000 streaming-community-api
```
By default the videos will be saved in `/app/Video` inside the container, if you want to to save them in your machine instead of the container just run
```
docker run -it -p 8000:8000 -v /path/to/download:/app/Video streaming-community-api
```
### Docker quick setup with Make
Inside the Makefile (install `make`) are already configured two commands to build and run the container:
```
make build-container
# set your download directory as ENV variable
make LOCAL_DIR=/path/to/download run-container
```
The `run-container` command mounts also the `config.json` file, so any change to the configuration file is reflected immediately without having to rebuild the image.
### M3U8_PARSER Settings
```json

View File

@ -9,12 +9,12 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
# Variable
from StreamingCommunity.Src.Api.Site.ddlstreamitaly.costant import COOKIE
from StreamingCommunity.Api.Site.ddlstreamitaly.costant import COOKIE
max_timeout = config_manager.get_int("REQUESTS", "timeout")

View File

@ -11,8 +11,8 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
# Variable

View File

@ -11,8 +11,8 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
# Variable

View File

@ -11,9 +11,9 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Src.Util.console import console, Panel
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Util.console import console, Panel
from StreamingCommunity.Util._jsonConfig import config_manager
from .Helper.Vixcloud.util import WindowVideo, WindowParameter, StreamsCollection
from .Helper.Vixcloud.js_parser import JavaScriptParser

View File

@ -4,7 +4,7 @@ from unidecode import unidecode
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Util.console import console, msg
# Logic class

View File

@ -4,7 +4,7 @@ import os
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__)))

View File

@ -6,16 +6,16 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Src.Util.table import TVShowManager
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Util.table import TVShowManager
# Logic class
from StreamingCommunity.Src.Api.Template import get_select_title
from StreamingCommunity.Src.Api.Template.Util import search_domain
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager
from StreamingCommunity.Api.Template import get_select_title
from StreamingCommunity.Api.Template.Util import search_domain
from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
# Variable

View File

@ -9,15 +9,15 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Src.Util.os import os_manager
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Src.Lib.Downloader import TOR_downloader
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Lib.Downloader import TOR_downloader
# Logic class
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
# Config

View File

@ -4,7 +4,7 @@ from unidecode import unidecode
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Util.console import console, msg
# Logic class

View File

@ -4,7 +4,7 @@ import os
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__)))

View File

@ -5,20 +5,20 @@ import time
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Src.Util.os import os_manager
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Util.call_stack import get_call_stack
from StreamingCommunity.Src.Lib.Downloader import HLS_Downloader
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.call_stack import get_call_stack
from StreamingCommunity.Lib.Downloader import HLS_Downloader
# Logic class
from StreamingCommunity.Src.Api.Template.Util import execute_search
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Api.Template.Util import execute_search
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
# Player
from StreamingCommunity.Src.Api.Player.supervideo import VideoSource
from StreamingCommunity.Api.Player.supervideo import VideoSource
# Config

View File

@ -6,16 +6,16 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Src.Util.table import TVShowManager
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Util.table import TVShowManager
# Logic class
from StreamingCommunity.Src.Api.Template import get_select_title
from StreamingCommunity.Src.Api.Template.Util import search_domain
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager
from StreamingCommunity.Api.Template import get_select_title
from StreamingCommunity.Api.Template.Util import search_domain
from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
# Variable

View File

@ -4,7 +4,7 @@ from unidecode import unidecode
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Util.console import console, msg
# Logic class

View File

@ -6,19 +6,19 @@ import logging
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Src.Util.os import os_manager
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Lib.Downloader import MP4_downloader
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Lib.Downloader import MP4_downloader
# Logic class
from StreamingCommunity.Src.Api.Template.Util import manage_selection
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Api.Template.Util import manage_selection
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
# Player
from StreamingCommunity.Src.Api.Player.vixcloud import AnimeVideoSource as VideoSource
from StreamingCommunity.Api.Player.vixcloud import AnimeVideoSource as VideoSource
# Variable

View File

@ -4,7 +4,7 @@ import os
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__)))

View File

@ -6,20 +6,20 @@ import logging
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Src.Util.os import os_manager
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Lib.Downloader import MP4_downloader
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Lib.Downloader import MP4_downloader
# Logic class
from .util.ScrapeSerie import ScrapeSerieAnime
from StreamingCommunity.Src.Api.Template.Util import manage_selection
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Api.Template.Util import manage_selection
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
# Player
from StreamingCommunity.Src.Api.Player.vixcloud import VideoSourceAnime
from StreamingCommunity.Api.Player.vixcloud import VideoSourceAnime
# Variable

View File

@ -9,15 +9,15 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.table import TVShowManager
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.table import TVShowManager
# Logic class
from StreamingCommunity.Src.Api.Template import get_select_title
from StreamingCommunity.Src.Api.Template.Util import search_domain
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager
from StreamingCommunity.Api.Template import get_select_title
from StreamingCommunity.Api.Template.Util import search_domain
from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
# Variable

View File

@ -8,9 +8,9 @@ import httpx
# Internal utilities
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Api.Player.Helper.Vixcloud.util import EpisodeManager, Episode
from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Api.Player.Helper.Vixcloud.util import EpisodeManager, Episode
# Variable

View File

@ -4,7 +4,7 @@ from unidecode import unidecode
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Util.console import console, msg
# Logic class

View File

@ -4,7 +4,7 @@ import os
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__)))

View File

@ -6,16 +6,16 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Src.Util.table import TVShowManager
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Util.table import TVShowManager
# Logic class
from StreamingCommunity.Src.Api.Template import get_select_title
from StreamingCommunity.Src.Api.Template.Util import search_domain
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager
from StreamingCommunity.Api.Template import get_select_title
from StreamingCommunity.Api.Template.Util import search_domain
from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
# Variable

View File

@ -4,14 +4,14 @@ import os
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Util.os import os_manager
from StreamingCommunity.Src.Lib.Downloader import TOR_downloader
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Lib.Downloader import TOR_downloader
# Logic class
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
# Config

View File

@ -4,7 +4,7 @@ from unidecode import unidecode
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Util.console import console, msg
# Logic class

View File

@ -4,7 +4,7 @@ import os
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__)))

View File

@ -5,20 +5,20 @@ import time
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Src.Util.os import os_manager
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Util.call_stack import get_call_stack
from StreamingCommunity.Src.Lib.Downloader import HLS_Downloader
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.call_stack import get_call_stack
from StreamingCommunity.Lib.Downloader import HLS_Downloader
# Logic class
from StreamingCommunity.Src.Api.Template.Util import execute_search
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Api.Template.Util import execute_search
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
# Player
from StreamingCommunity.Src.Api.Player.maxstream import VideoSource
from StreamingCommunity.Api.Player.maxstream import VideoSource
# Config

View File

@ -6,15 +6,15 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Src.Util.table import TVShowManager
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Util.table import TVShowManager
# Logic class
from StreamingCommunity.Src.Api.Template import get_select_title
from StreamingCommunity.Src.Api.Template.Util import search_domain
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager
from StreamingCommunity.Api.Template import get_select_title
from StreamingCommunity.Api.Template.Util import search_domain
from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
# Variable

View File

@ -11,15 +11,17 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
# Logic class
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
# Variable
from ..costant import COOKIE
max_timeout = config_manager.get_int("REQUESTS", "timeout")
class GetSerieInfo:
@ -48,7 +50,7 @@ class GetSerieInfo:
"""
try:
response = httpx.get(self.url + "?area=online", cookies=self.cookies, headers=self.headers, timeout=10)
response = httpx.get(self.url + "?area=online", cookies=self.cookies, headers=self.headers, timeout=max_timeout)
response.raise_for_status()
except:

View File

@ -5,7 +5,7 @@ from unidecode import unidecode
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Util.console import console, msg
# Logic class

View File

@ -4,7 +4,7 @@ import os
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__)))

View File

@ -6,21 +6,21 @@ from urllib.parse import urlparse
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Util.os import os_manager
from StreamingCommunity.Src.Util.table import TVShowManager
from StreamingCommunity.Src.Lib.Downloader import MP4_downloader
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Util.table import TVShowManager
from StreamingCommunity.Lib.Downloader import MP4_downloader
# Logic class
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Src.Api.Template.Util import manage_selection, map_episode_title, validate_episode_selection
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Api.Template.Util import manage_selection, map_episode_title, validate_episode_selection
# Player
from .util.ScrapeSerie import GetSerieInfo
from StreamingCommunity.Src.Api.Player.ddl import VideoSource
from StreamingCommunity.Api.Player.ddl import VideoSource
# Variable

View File

@ -9,16 +9,16 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Src.Util.table import TVShowManager
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Util.table import TVShowManager
# Logic class
from StreamingCommunity.Src.Api.Template import get_select_title
from StreamingCommunity.Src.Api.Template.Util import search_domain
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager
from StreamingCommunity.Api.Template import get_select_title
from StreamingCommunity.Api.Template.Util import search_domain
from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
# Variable

View File

@ -11,15 +11,17 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
# Logic class
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
# Variable
from ..costant import COOKIE
max_timeout = config_manager.get_int("REQUESTS", "timeout")
class GetSerieInfo:
@ -48,7 +50,7 @@ class GetSerieInfo:
"""
try:
response = httpx.get(f"{self.url}?area=online", cookies=self.cookies, headers=self.headers, timeout=10)
response = httpx.get(f"{self.url}?area=online", cookies=self.cookies, headers=self.headers, timeout=max_timeout)
response.raise_for_status()
except Exception as e:

View File

@ -10,11 +10,16 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
# Logic class
from StreamingCommunity.Src.Api.Template .Class.SearchType import MediaItem
from StreamingCommunity.Api.Template .Class.SearchType import MediaItem
# Variable
max_timeout = config_manager.get_int("REQUESTS", "timeout")
class GetSerieInfo:
@ -40,7 +45,7 @@ class GetSerieInfo:
try:
# Make an HTTP request to the series URL
response = httpx.get(self.url, headers=self.headers, timeout=15)
response = httpx.get(self.url, headers=self.headers, timeout=max_timeout)
response.raise_for_status()
# Parse HTML content of the page
@ -75,7 +80,7 @@ class GetSerieInfo:
try:
# Make an HTTP request to the series URL
response = httpx.get(self.url, headers=self.headers, timeout=15)
response = httpx.get(self.url, headers=self.headers, timeout=max_timeout)
response.raise_for_status()
# Parse HTML content of the page

View File

@ -4,7 +4,7 @@ from unidecode import unidecode
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Util.console import console, msg
# Logic class

View File

@ -4,7 +4,7 @@ import os
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__)))

View File

@ -6,21 +6,21 @@ import time
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Util.call_stack import get_call_stack
from StreamingCommunity.Src.Util.table import TVShowManager
from StreamingCommunity.Src.Lib.Downloader import HLS_Downloader
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.call_stack import get_call_stack
from StreamingCommunity.Util.table import TVShowManager
from StreamingCommunity.Lib.Downloader import HLS_Downloader
# Logic class
from StreamingCommunity.Src.Api.Template.Util import manage_selection, map_episode_title, validate_selection, validate_episode_selection, execute_search
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Api.Template.Util import manage_selection, map_episode_title, validate_selection, validate_episode_selection, execute_search
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
# Player
from .util.ScrapeSerie import GetSerieInfo
from StreamingCommunity.Src.Api.Player.supervideo import VideoSource
from StreamingCommunity.Api.Player.supervideo import VideoSource
# Variable

View File

@ -6,16 +6,16 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Src.Util.table import TVShowManager
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Util.table import TVShowManager
# Logic class
from StreamingCommunity.Src.Api.Template import get_select_title
from StreamingCommunity.Src.Api.Template.Util import search_domain
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager
from StreamingCommunity.Api.Template import get_select_title
from StreamingCommunity.Api.Template.Util import search_domain
from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
# Variable

View File

@ -10,11 +10,11 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Util.headers import get_headers
# Logic class
from StreamingCommunity.Src.Api.Template .Class.SearchType import MediaItem
from StreamingCommunity.Api.Template .Class.SearchType import MediaItem
class GetSerieInfo:

View File

@ -4,11 +4,11 @@ from unidecode import unidecode
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Util.console import console, msg
# Logic class
from StreamingCommunity.Src.Lib.TMBD import tmdb, Json_film
from StreamingCommunity.Lib.TMBD import tmdb, Json_film
from .film import download_film

View File

@ -4,7 +4,7 @@ import os
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__)))

View File

@ -12,24 +12,24 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Src.Util.os import os_manager
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Util.call_stack import get_call_stack
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Src.Lib.Downloader import HLS_Downloader
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.call_stack import get_call_stack
from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Lib.Downloader import HLS_Downloader
# Logic class
from StreamingCommunity.Src.Api.Template.Util import execute_search
from StreamingCommunity.Api.Template.Util import execute_search
# Player
from StreamingCommunity.Src.Api.Player.supervideo import VideoSource
from StreamingCommunity.Api.Player.supervideo import VideoSource
# TMBD
from StreamingCommunity.Src.Lib.TMBD import Json_film
from StreamingCommunity.Lib.TMBD import Json_film
# Config

View File

@ -4,7 +4,7 @@ from unidecode import unidecode
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Util.console import console, msg
# Logic class

View File

@ -4,7 +4,7 @@ import os
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__)))

View File

@ -6,15 +6,15 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Src.Util.table import TVShowManager
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Util.table import TVShowManager
# Logic class
from StreamingCommunity.Src.Api.Template import get_select_title
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager
from StreamingCommunity.Api.Template import get_select_title
from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
# Variable

View File

@ -5,14 +5,14 @@ import sys
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Util.os import os_manager
from StreamingCommunity.Src.Lib.Downloader import TOR_downloader
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Lib.Downloader import TOR_downloader
# Logic class
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
# Config

View File

@ -4,7 +4,7 @@ from unidecode import unidecode
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Util.console import console, msg
# Logic class

View File

@ -4,7 +4,7 @@ import os
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__)))

View File

@ -5,20 +5,20 @@ import time
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Src.Util.os import os_manager
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Util.call_stack import get_call_stack
from StreamingCommunity.Src.Lib.Downloader import HLS_Downloader
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.call_stack import get_call_stack
from StreamingCommunity.Lib.Downloader import HLS_Downloader
# Logic class
from StreamingCommunity.Src.Api.Template.Util import execute_search
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Api.Template.Util import execute_search
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
# Player
from StreamingCommunity.Src.Api.Player.vixcloud import VideoSource
from StreamingCommunity.Api.Player.vixcloud import VideoSource
# Variable

View File

@ -6,21 +6,21 @@ import time
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Util.call_stack import get_call_stack
from StreamingCommunity.Src.Util.table import TVShowManager
from StreamingCommunity.Src.Lib.Downloader import HLS_Downloader
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.call_stack import get_call_stack
from StreamingCommunity.Util.table import TVShowManager
from StreamingCommunity.Lib.Downloader import HLS_Downloader
# Logic class
from .util.ScrapeSerie import ScrapeSerie
from StreamingCommunity.Src.Api.Template.Util import manage_selection, map_episode_title, validate_selection, validate_episode_selection, execute_search
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Api.Template.Util import manage_selection, map_episode_title, validate_selection, validate_episode_selection, execute_search
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
# Player
from StreamingCommunity.Src.Api.Player.vixcloud import VideoSource
from StreamingCommunity.Api.Player.vixcloud import VideoSource
# Variable

View File

@ -11,17 +11,17 @@ from bs4 import BeautifulSoup
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Src.Util.table import TVShowManager
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Util.table import TVShowManager
# Logic class
from StreamingCommunity.Src.Api.Template import get_select_title
from StreamingCommunity.Src.Api.Template.Util import search_domain
from StreamingCommunity.Src.Api.Template.Class.SearchType import MediaManager
from StreamingCommunity.Api.Template import get_select_title
from StreamingCommunity.Api.Template.Util import search_domain
from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
# Config

View File

@ -8,9 +8,9 @@ import httpx
# Internal utilities
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Api.Player.Helper.Vixcloud.util import SeasonManager, EpisodeManager
from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Api.Player.Helper.Vixcloud.util import SeasonManager, EpisodeManager
# Variable

View File

@ -10,9 +10,9 @@ from googlesearch import search
# Internal utilities
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Util._jsonConfig import config_manager
def google_search(query):

View File

@ -5,8 +5,8 @@ from typing import List
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.os import os_manager
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.os import os_manager
# Config

View File

@ -21,7 +21,7 @@ def execute_search(info):
# Attempt to import the specified function from the module
try:
# Construct the import statement dynamically
module_path = f"StreamingCommunity.Src.Api.Site{info['folder_base']}"
module_path = f"StreamingCommunity.Api.Site{info['folder_base']}"
exec(f"from {module_path} import {info['function']}")
# Call the specified function

View File

@ -4,7 +4,7 @@ import sys
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Util.console import console
# Variable

View File

@ -10,10 +10,10 @@ import httpx
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.console import console, Panel, Table
from StreamingCommunity.Src.Util.color import Colors
from StreamingCommunity.Src.Util.os import (
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.console import console, Panel, Table
from StreamingCommunity.Util.color import Colors
from StreamingCommunity.Util.os import (
compute_sha1_hash,
os_manager,
internet_manager

View File

@ -11,9 +11,9 @@ import httpx
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Src.Util.os import os_manager
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Util.os import os_manager
class ProxyManager:

View File

@ -19,12 +19,12 @@ from tqdm import tqdm
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Src.Util.headers import get_headers, random_headers
from StreamingCommunity.Src.Util.color import Colors
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.os import os_manager
from StreamingCommunity.Src.Util.call_stack import get_call_stack
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util.headers import get_headers, random_headers
from StreamingCommunity.Util.color import Colors
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Util.call_stack import get_call_stack
# Logic class
@ -39,15 +39,19 @@ from .proxyes import main_test_proxy
# Config
TQDM_DELAY_WORKER = config_manager.get_float('M3U8_DOWNLOAD', 'tqdm_delay')
TQDM_USE_LARGE_BAR = config_manager.get_int('M3U8_DOWNLOAD', 'tqdm_use_large_bar')
REQUEST_MAX_RETRY = config_manager.get_int('REQUESTS', 'max_retry')
REQUEST_VERIFY = config_manager.get_bool('REQUESTS', 'verify_ssl')
THERE_IS_PROXY_LIST = os_manager.check_file("list_proxy.txt")
PROXY_START_MIN = config_manager.get_float('REQUESTS', 'proxy_start_min')
PROXY_START_MAX = config_manager.get_float('REQUESTS', 'proxy_start_max')
DEFAULT_VIDEO_WORKERS = config_manager.get_int('M3U8_DOWNLOAD', 'default_video_workser')
DEFAULT_AUDIO_WORKERS = config_manager.get_int('M3U8_DOWNLOAD', 'default_audio_workser')
# Variable
headers_index = config_manager.get_dict('REQUESTS', 'user-agent')
max_timeout = config_manager.get_int("REQUESTS", "timeout")
@ -55,7 +59,7 @@ max_timeout = config_manager.get_int("REQUESTS", "timeout")
class M3U8_Segments:
def __init__(self, url: str, tmp_folder: str, is_index_url: bool = True, base_timeout=1.0, max_timeout=5.0):
def __init__(self, url: str, tmp_folder: str, is_index_url: bool = True):
"""
Initializes the M3U8_Segments object.
@ -67,7 +71,8 @@ class M3U8_Segments:
self.url = url
self.tmp_folder = tmp_folder
self.is_index_url = is_index_url
self.expected_real_time = None
self.expected_real_time = None
self.max_timeout = max_timeout
self.tmp_file_path = os.path.join(self.tmp_folder, "0.ts")
os.makedirs(self.tmp_folder, exist_ok=True)
@ -81,9 +86,8 @@ class M3U8_Segments:
self.queue = PriorityQueue()
self.stop_event = threading.Event()
self.downloaded_segments = set()
self.base_timeout = base_timeout
self.max_timeout = max_timeout
self.current_timeout = base_timeout
self.base_timeout = 1.0
self.current_timeout = 5.0
# Stopping
self.interrupt_flag = threading.Event()
@ -219,7 +223,7 @@ class M3U8_Segments:
signal.signal(signal.SIGINT, interrupt_handler)
def make_requests_stream(self, ts_url: str, index: int, progress_bar: tqdm, retries: int = 3, backoff_factor: float = 1.5) -> None:
def make_requests_stream(self, ts_url: str, index: int, progress_bar: tqdm, backoff_factor: float = 1.5) -> None:
"""
Downloads a TS segment and adds it to the segment queue with retry logic.
@ -230,7 +234,7 @@ class M3U8_Segments:
- retries (int): The number of times to retry on failure (default is 3).
- backoff_factor (float): The backoff factor for exponential backoff (default is 1.5 seconds).
"""
for attempt in range(retries):
for attempt in range(REQUEST_MAX_RETRY):
if self.interrupt_flag.is_set():
return
@ -308,10 +312,10 @@ class M3U8_Segments:
return
except Exception as e:
#logging.error(f"Attempt {attempt + 1} failed for segment {index} - '{ts_url}': {e}")
logging.info(f"Attempt {attempt + 1} failed for segment {index} - '{ts_url}': {e}")
if attempt + 1 == retries:
#logging.error(f"Final retry failed for segment {index}")
if attempt + 1 == REQUEST_MAX_RETRY:
console.log(f"[red]Final retry failed for segment: {index}")
self.queue.put((index, None)) # Marker for failed segment
progress_bar.update(1)
break
@ -482,8 +486,10 @@ class M3U8_Segments:
for index in missing_segments:
if self.interrupt_flag.is_set():
break
try:
self.make_requests_stream(self.segments[index], index, progress_bar)
except Exception as e:
logging.error(f"Failed to retry segment {index}: {str(e)}")

View File

@ -13,11 +13,11 @@ from tqdm import tqdm
# Internal utilities
from StreamingCommunity.Src.Util.headers import get_headers
from StreamingCommunity.Src.Util.color import Colors
from StreamingCommunity.Src.Util.console import console, Panel
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.os import internet_manager
from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Util.color import Colors
from StreamingCommunity.Util.console import console, Panel
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.os import internet_manager
# Logic class

View File

@ -8,9 +8,9 @@ import logging
# Internal utilities
from StreamingCommunity.Src.Util.color import Colors
from StreamingCommunity.Src.Util.os import internet_manager
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util.color import Colors
from StreamingCommunity.Util.os import internet_manager
from StreamingCommunity.Util._jsonConfig import config_manager
# External libraries

View File

@ -10,7 +10,7 @@ from seleniumbase import Driver
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
# Config

View File

@ -7,8 +7,8 @@ import subprocess
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Src.Util.os import internet_manager
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util.os import internet_manager
# Variable

View File

@ -8,9 +8,9 @@ from typing import List, Dict
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Util.os import os_manager, suppress_output
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.os import os_manager, suppress_output
from StreamingCommunity.Util.console import console
from .util import need_to_force_to_ts, check_duration_v_a
from .capture import capture_ffmpeg_real_time
from ..M3U8 import M3U8_Codec

View File

@ -9,7 +9,7 @@ from typing import Tuple
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Util.console import console
def has_audio_stream(video_path: str) -> bool:

View File

@ -7,7 +7,7 @@ import importlib.util
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Util.console import console
# Check if Crypto module is installed

View File

@ -13,9 +13,9 @@ from tqdm import tqdm
# Internal utilities
from StreamingCommunity.Src.Util.color import Colors
from StreamingCommunity.Src.Util.os import internet_manager
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util.color import Colors
from StreamingCommunity.Util.os import internet_manager
from StreamingCommunity.Util._jsonConfig import config_manager
# Variable

View File

@ -6,7 +6,7 @@ import logging
# Internal utilities
from m3u8 import loads
from StreamingCommunity.Src.Util.os import internet_manager
from StreamingCommunity.Util.os import internet_manager
# External libraries

View File

@ -11,7 +11,7 @@ from rich.console import Console
# Internal utilities
from .obj_tmbd import Json_film
from StreamingCommunity.Src.Util.table import TVShowManager
from StreamingCommunity.Util.table import TVShowManager
# Variable

View File

@ -1,12 +1,13 @@
# 01.03.2023
import os
import sys
import time
# Internal utilities
from .version import __version__, __author__, __title__
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Util.console import console
# External library
@ -14,7 +15,10 @@ import httpx
# Variable
main = os.path.abspath(os.path.dirname(__file__))
if getattr(sys, 'frozen', False): # Modalità PyInstaller
base_path = os.path.join(sys._MEIPASS, "StreamingCommunity")
else:
base_path = os.path.dirname(__file__)
def update():

View File

@ -0,0 +1,275 @@
# 24.01.2024
import os
import platform
import subprocess
import zipfile
import tarfile
import logging
import requests
import shutil
import glob
from typing import Optional, Tuple
# External library
from rich.console import Console
from rich.progress import Progress, SpinnerColumn, BarColumn, TextColumn, TimeRemainingColumn
# Variable
console = Console()
FFMPEG_CONFIGURATION = {
'windows': {
'base_dir': lambda home: os.path.join(os.path.splitdrive(home)[0] + os.path.sep, 'binary'),
'download_url': 'https://github.com/GyanD/codexffmpeg/releases/download/{version}/ffmpeg-{version}-full_build.zip',
'file_extension': '.zip',
'executables': ['ffmpeg.exe', 'ffprobe.exe', 'ffplay.exe']
},
'darwin': {
'base_dir': lambda home: os.path.join(home, 'Applications', 'binary'),
'download_url': 'https://evermeet.cx/ffmpeg/ffmpeg-{version}.zip',
'file_extension': '.zip',
'executables': ['ffmpeg', 'ffprobe', 'ffplay']
},
'linux': {
'base_dir': lambda home: os.path.join(home, '.local', 'bin', 'binary'),
'download_url': 'https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-{arch}-static.tar.xz',
'file_extension': '.tar.xz',
'executables': ['ffmpeg', 'ffprobe', 'ffplay']
}
}
class FFMPEGDownloader:
def __init__(self):
self.os_name = self._detect_system()
self.arch = self._detect_arch()
self.home_dir = os.path.expanduser('~')
self.base_dir = self._get_base_directory()
def _detect_system(self) -> str:
"""Detect and normalize operating system name."""
system = platform.system().lower()
if system in FFMPEG_CONFIGURATION:
return system
raise ValueError(f"Unsupported operating system: {system}")
def _detect_arch(self) -> str:
"""
Detect system architecture
"""
machine = platform.machine().lower()
arch_map = {
'amd64': 'x86_64',
'x86_64': 'x86_64',
'x64': 'x86_64',
'arm64': 'arm64',
'aarch64': 'arm64'
}
return arch_map.get(machine, machine)
def _get_base_directory(self) -> str:
"""
Get base directory for binaries
"""
base_dir = FFMPEG_CONFIGURATION[self.os_name]['base_dir'](self.home_dir)
os.makedirs(base_dir, exist_ok=True)
return base_dir
def _check_existing_binaries(self) -> Tuple[Optional[str], Optional[str]]:
"""
Check if FFmpeg binaries already exist in the base directory
"""
config = FFMPEG_CONFIGURATION[self.os_name]
executables = config['executables']
found_executables = []
for executable in executables:
# Search for exact executable in base directory
exe_paths = glob.glob(os.path.join(self.base_dir, executable))
if exe_paths:
found_executables.append(exe_paths[0])
# Return paths if both executables are found
if len(found_executables) == len(executables):
return tuple(found_executables)
return None, None
def _get_latest_version(self) -> str:
"""
Get the latest FFmpeg version
"""
try:
version_url = 'https://www.gyan.dev/ffmpeg/builds/release-version'
return requests.get(version_url).text.strip()
except Exception as e:
logging.error(f"Unable to get version: {e}")
return None
def _download_file(self, url: str, destination: str) -> bool:
"""
Download with Rich progress bar
"""
try:
response = requests.get(url, stream=True)
response.raise_for_status()
total_size = int(response.headers.get('content-length', 0))
with open(destination, 'wb') as file, \
Progress(
SpinnerColumn(),
TextColumn("[progress.description]{task.description}"),
BarColumn(),
TextColumn("[progress.percentage]{task.percentage:>3.0f}%"),
TimeRemainingColumn()
) as progress:
download_task = progress.add_task("[green]Downloading FFmpeg", total=total_size)
for chunk in response.iter_content(chunk_size=8192):
size = file.write(chunk)
progress.update(download_task, advance=size)
return True
except Exception as e:
logging.error(f"Download error: {e}")
return False
def _extract_and_copy_binaries(self, archive_path: str) -> Tuple[Optional[str], Optional[str]]:
"""
Extract archive and copy executables to base directory
"""
try:
# Temporary extraction path
extraction_path = os.path.join(self.base_dir, 'temp_extract')
os.makedirs(extraction_path, exist_ok=True)
# Extract based on file type
if archive_path.endswith('.zip'):
with zipfile.ZipFile(archive_path, 'r') as zip_ref:
zip_ref.extractall(extraction_path)
elif archive_path.endswith('.tar.xz'):
import lzma
with lzma.open(archive_path, 'rb') as xz_file:
with tarfile.open(fileobj=xz_file) as tar_ref:
tar_ref.extractall(extraction_path)
# Find and copy executables
config = FFMPEG_CONFIGURATION[self.os_name]
executables = config['executables']
found_paths = []
for executable in executables:
# Find executable in extracted files
exe_paths = glob.glob(os.path.join(extraction_path, '**', executable), recursive=True)
if exe_paths:
# Copy to base directory
dest_path = os.path.join(self.base_dir, executable)
shutil.copy2(exe_paths[0], dest_path)
# Set execution permissions for Unix-like systems
if self.os_name != 'windows':
os.chmod(dest_path, 0o755)
found_paths.append(dest_path)
# Clean up temporary extraction directory
shutil.rmtree(extraction_path, ignore_errors=True)
# Remove downloaded archive
os.remove(archive_path)
# Return paths if both executables found
if len(found_paths) == len(executables):
return tuple(found_paths)
return None, None
except Exception as e:
logging.error(f"Extraction/copy error: {e}")
return None, None
def download(self) -> Tuple[Optional[str], Optional[str]]:
"""
Main download procedure
Returns paths of ffmpeg and ffprobe
"""
# First, check if binaries already exist in base directory
existing_ffmpeg, existing_ffprobe = self._check_existing_binaries()
if existing_ffmpeg and existing_ffprobe:
return existing_ffmpeg, existing_ffprobe
# Get latest version
version = self._get_latest_version()
if not version:
logging.error("Cannot proceed: version not found")
return None, None
# Prepare configurations
config = FFMPEG_CONFIGURATION[self.os_name]
# Build download URL
download_url = config['download_url'].format(
version=version,
arch=self.arch
)
# Download path
download_path = os.path.join(
self.base_dir,
f'ffmpeg-{version}{config["file_extension"]}'
)
# Download
console.print(
f"[bold blue]Downloading FFmpeg from:[/] {download_url}",
)
if not self._download_file(download_url, download_path):
return None, None
# Extract and copy binaries
ffmpeg_path, ffprobe_path = self._extract_and_copy_binaries(download_path)
if ffmpeg_path and ffprobe_path:
return ffmpeg_path, ffprobe_path
logging.error("FFmpeg executables not found")
return None, None
def check_ffmpeg():
try:
# First, use 'where' command to check existing binaries on Windows
if platform.system().lower() == 'windows':
ffmpeg_path = subprocess.check_output(['where', 'ffmpeg'], text=True).strip().split('\n')[0] if subprocess.call(['where', 'ffmpeg'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) == 0 else None
ffprobe_path = subprocess.check_output(['where', 'ffprobe'], text=True).strip().split('\n')[0] if subprocess.call(['where', 'ffprobe'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) == 0 else None
if ffmpeg_path and ffprobe_path:
return ffmpeg_path, ffprobe_path
# Fallback to which/shutil method for Unix-like systems
ffmpeg_path = shutil.which('ffmpeg')
ffprobe_path = shutil.which('ffprobe')
if ffmpeg_path and ffprobe_path:
return ffmpeg_path, ffprobe_path
downloader = FFMPEGDownloader()
return downloader.download()
except Exception as e:
logging.error(f"Error checking FFmpeg: {e}")
return None, None

View File

@ -5,7 +5,7 @@ from logging.handlers import RotatingFileHandler
# Internal utilities
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
class Logger:

View File

@ -5,8 +5,8 @@ import platform
# Internal utilities
from StreamingCommunity.Src.Util.console import console
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util._jsonConfig import config_manager
# Variable

View File

@ -3,19 +3,17 @@
import io
import os
import sys
import ssl
import time
import shutil
import hashlib
import logging
import platform
import unidecode
import importlib
import subprocess
import contextlib
import pathvalidate
import urllib.request
import importlib.metadata
import pkg_resources
# External library
@ -23,7 +21,8 @@ import httpx
# Internal utilities
from StreamingCommunity.Src.Util.console import console, msg
from .ffmpeg_installer import check_ffmpeg
from StreamingCommunity.Util.console import console, msg
# Variable
@ -331,18 +330,23 @@ class OsSummary():
def get_library_version(self, lib_name: str):
"""
Retrieve the version of a Python library.
Args:
lib_name (str): The name of the Python library.
Returns:
str: The library name followed by its version, or `-not installed` if not found.
"""
try:
version = importlib.metadata.version(lib_name)
version = pkg_resources.get_distribution(lib_name).version
return f"{lib_name}-{version}"
except importlib.metadata.PackageNotFoundError:
except pkg_resources.DistributionNotFound as e:
logging.error(f"Error with get_library_version (1): {e}")
return f"{lib_name}-not installed"
except Exception as e:
logging.error(f"Error with get_library_version (2): {e}")
return f"{lib_name}-not installed"
async def download_requirements(self, url: str, filename: str):
@ -429,11 +433,13 @@ class OsSummary():
logging.info(f"Python: {python_version} ({python_implementation} {arch}) - {os_info} ({glibc_version})")
# ffmpeg and ffprobe versions
ffmpeg_path, ffprobe_path = check_ffmpeg()
ffmpeg_version = self.get_executable_version(['ffmpeg', '-version'])
ffprobe_version = self.get_executable_version(['ffprobe', '-version'])
console.print(f"[cyan]Path[white]: [red]ffmpeg [bold yellow]'{ffmpeg_path}'[/bold yellow][white], [red]ffprobe '[bold yellow]{ffprobe_path}'[/bold yellow]")
console.print(f"[cyan]Exe versions[white]: [bold red]ffmpeg {ffmpeg_version}, ffprobe {ffprobe_version}[/bold red]")
logging.info(f"Dependencies: ffmpeg {ffmpeg_version}, ffprobe {ffprobe_version}")
# Check if requirements.txt exists, if not download it
requirements_file = 'requirements.txt'
@ -449,12 +455,15 @@ class OsSummary():
# Check if libraries are installed and prompt to install missing ones
for lib in optional_libraries:
installed_version = self.get_library_version(lib)
if 'not installed' in installed_version:
# Prompt user to install missing library using Prompt.ask()
user_response = msg.ask(f"{lib} is not installed. Do you want to install it? (yes/no)", default="y")
if user_response.lower().strip() in ["yes", "y"]:
self.install_library(lib)
else:
#console.print(f"[cyan]Library[white]: [bold red]{installed_version}[/bold red]")
logging.info(f"Library: {installed_version}")

View File

@ -13,13 +13,13 @@ from typing import Callable
# Internal utilities
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Util.console import console, msg
from StreamingCommunity.Src.Util._jsonConfig import config_manager
from StreamingCommunity.Src.Upload.update import update as git_update
from StreamingCommunity.Src.Util.os import OsSummary
from StreamingCommunity.Src.Lib.TMBD import tmdb
from StreamingCommunity.Src.Util.logger import Logger
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Upload.update import update as git_update
from StreamingCommunity.Util.os import OsSummary
from StreamingCommunity.Lib.TMBD import tmdb
from StreamingCommunity.Util.logger import Logger
# Config
@ -46,8 +46,13 @@ def load_search_functions():
modules = []
loaded_functions = {}
# Traverse the Api directory
api_dir = os.path.join(os.path.dirname(__file__), 'Src', 'Api', 'Site')
# Find api home directory
if getattr(sys, 'frozen', False): # Modalità PyInstaller
base_path = os.path.join(sys._MEIPASS, "StreamingCommunity")
else:
base_path = os.path.dirname(__file__)
api_dir = os.path.join(base_path, 'Api', 'Site')
init_files = glob.glob(os.path.join(api_dir, '*', '__init__.py'))
# Retrieve modules and their indices
@ -59,7 +64,7 @@ def load_search_functions():
try:
# Dynamically import the module
mod = importlib.import_module(f'StreamingCommunity.Src.Api.Site.{module_name}')
mod = importlib.import_module(f'StreamingCommunity.Api.Site.{module_name}')
# Get 'indice' from the module
indice = getattr(mod, 'indice', 0)
@ -84,7 +89,7 @@ def load_search_functions():
try:
# Dynamically import the module
mod = importlib.import_module(f'StreamingCommunity.Src.Api.Site.{module_name}')
mod = importlib.import_module(f'StreamingCommunity.Api.Site.{module_name}')
# Get the search function from the module (assuming the function is named 'search' and defined in __init__.py)
search_function = getattr(mod, 'search')

View File

@ -9,9 +9,9 @@ sys.path.append(src_path)
# Import
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Util.logger import Logger
from StreamingCommunity.Src.Lib.Downloader import HLS_Downloader
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.logger import Logger
from StreamingCommunity.Lib.Downloader import HLS_Downloader
# Test

View File

@ -9,9 +9,9 @@ sys.path.append(src_path)
# Import
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Util.logger import Logger
from StreamingCommunity.Src.Lib.Downloader import MP4_downloader
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.logger import Logger
from StreamingCommunity.Lib.Downloader import MP4_downloader
# Test

View File

@ -9,9 +9,9 @@ sys.path.append(src_path)
# Import
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Util.logger import Logger
from StreamingCommunity.Src.Lib.Downloader import TOR_downloader
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.logger import Logger
from StreamingCommunity.Lib.Downloader import TOR_downloader
# Test

View File

@ -7,8 +7,8 @@ sys.path.append(src_path)
# Import
import json
from StreamingCommunity.Src.Api.Player.Helper.Vixcloud.js_parser import JavaScriptParser
from StreamingCommunity.Src.Api.Player.Helper.Vixcloud.util import WindowVideo, WindowParameter, StreamsCollection
from StreamingCommunity.Api.Player.Helper.Vixcloud.js_parser import JavaScriptParser
from StreamingCommunity.Api.Player.Helper.Vixcloud.util import WindowVideo, WindowParameter, StreamsCollection
# Data

View File

@ -9,9 +9,9 @@ sys.path.append(src_path)
# Import
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Util.logger import Logger
from StreamingCommunity.Src.Api.Player.maxstream import VideoSource
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.logger import Logger
from StreamingCommunity.Api.Player.maxstream import VideoSource
# Test

View File

@ -9,9 +9,9 @@ sys.path.append(src_path)
# Import
from StreamingCommunity.Src.Util.message import start_message
from StreamingCommunity.Src.Util.logger import Logger
from StreamingCommunity.Src.Api.Player.supervideo import VideoSource
from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.logger import Logger
from StreamingCommunity.Api.Player.supervideo import VideoSource
# Test

Some files were not shown because too many files have changed in this diff Show More