Remove "console.py" (#277)

* [CORE] Remove some key from json

* [UTIL] Remove "console.py"

* [UTIL] Remove set_slice_end

* [CORE] Ffmpeg remove static variable

* [CORE] Rename _jsonConfig to config_json

* [UTIL] Remove "call_stack.py"

* [UTIL] Remove variable "USE_LARGE_BAR"
This commit is contained in:
Dark1291 2025-02-26 12:20:53 +01:00 committed by GitHub
parent 7916938c2d
commit 45f39b36c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
54 changed files with 317 additions and 219 deletions

View File

@ -9,7 +9,7 @@ from bs4 import BeautifulSoup
# Internal utilities # Internal utilities
from StreamingCommunity.Util._jsonConfig import config_manager from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent

View File

@ -11,7 +11,7 @@ from bs4 import BeautifulSoup
# Internal utilities # Internal utilities
from StreamingCommunity.Util._jsonConfig import config_manager from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent

View File

@ -11,7 +11,7 @@ from bs4 import BeautifulSoup
# Internal utilities # Internal utilities
from StreamingCommunity.Util._jsonConfig import config_manager from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent

View File

@ -8,18 +8,19 @@ from urllib.parse import urlparse, parse_qs, urlencode, urlunparse
# External libraries # External libraries
import httpx import httpx
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent
from StreamingCommunity.Util.console import console from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
from .Helper.Vixcloud.util import WindowVideo, WindowParameter, StreamsCollection from .Helper.Vixcloud.util import WindowVideo, WindowParameter, StreamsCollection
from .Helper.Vixcloud.js_parser import JavaScriptParser from .Helper.Vixcloud.js_parser import JavaScriptParser
# Variable # Variable
MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout") MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout")
console = Console()
class VideoSource: class VideoSource:

View File

@ -3,8 +3,12 @@
from urllib.parse import quote_plus from urllib.parse import quote_plus
# External library
from rich.console import Console
from rich.prompt import Prompt
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Api.Template import get_select_title from StreamingCommunity.Api.Template import get_select_title
@ -21,6 +25,9 @@ _deprecate = False
_priority = 2 _priority = 2
_engineDownload = "tor" _engineDownload = "tor"
console = Console()
msg = Prompt()
def search(string_to_search: str = None, get_onylDatabase: bool = False): def search(string_to_search: str = None, get_onylDatabase: bool = False):
""" """

View File

@ -5,11 +5,11 @@ import sys
# External libraries # External libraries
import httpx import httpx
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent
from StreamingCommunity.Util.table import TVShowManager from StreamingCommunity.Util.table import TVShowManager
@ -21,6 +21,7 @@ from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
# Variable # Variable
console = Console()
media_search_manager = MediaManager() media_search_manager = MediaManager()
table_show_manager = TVShowManager() table_show_manager = TVShowManager()
max_timeout = config_manager.get_int("REQUESTS", "timeout") max_timeout = config_manager.get_int("REQUESTS", "timeout")

View File

@ -6,10 +6,10 @@ import os
# External libraries # External libraries
import httpx import httpx
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util.os import os_manager from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Util.message import start_message from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent
@ -21,6 +21,9 @@ from StreamingCommunity.Api.Template.config_loader import site_constant
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
# Variable
console = Console()
def download_title(select_title: MediaItem): def download_title(select_title: MediaItem):
""" """

View File

@ -4,8 +4,12 @@ import sys
import subprocess import subprocess
# External library
from rich.console import Console
from rich.prompt import Prompt
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Api.Template import get_select_title from StreamingCommunity.Api.Template import get_select_title
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
@ -23,6 +27,9 @@ _deprecate = False
_priority = 2 _priority = 2
_engineDownload = "mp4" _engineDownload = "mp4"
msg = Prompt()
console = Console()
def search(string_to_search: str = None, get_onylDatabase: bool = False): def search(string_to_search: str = None, get_onylDatabase: bool = False):

View File

@ -5,8 +5,12 @@ import logging
from typing import Tuple from typing import Tuple
# External library
from rich.console import Console
from rich.prompt import Prompt
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Util.os import os_manager from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Util.message import start_message from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Lib.Downloader import MP4_downloader from StreamingCommunity.Lib.Downloader import MP4_downloader
@ -25,6 +29,8 @@ from StreamingCommunity.Api.Player.vixcloud import VideoSourceAnime
# Variable # Variable
console = Console()
msg = Prompt()
KILL_HANDLER = bool(False) KILL_HANDLER = bool(False)

View File

@ -7,11 +7,11 @@ import logging
# External libraries # External libraries
import httpx import httpx
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.table import TVShowManager from StreamingCommunity.Util.table import TVShowManager
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
@ -23,6 +23,7 @@ from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
# Variable # Variable
console = Console()
media_search_manager = MediaManager() media_search_manager = MediaManager()
table_show_manager = TVShowManager() table_show_manager = TVShowManager()
max_timeout = config_manager.get_int("REQUESTS", "timeout") max_timeout = config_manager.get_int("REQUESTS", "timeout")

View File

@ -9,7 +9,7 @@ import httpx
# Internal utilities # Internal utilities
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent
from StreamingCommunity.Util._jsonConfig import config_manager from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Api.Player.Helper.Vixcloud.util import EpisodeManager, Episode from StreamingCommunity.Api.Player.Helper.Vixcloud.util import EpisodeManager, Episode

View File

@ -3,8 +3,12 @@
from urllib.parse import quote_plus from urllib.parse import quote_plus
# External library
from rich.console import Console
from rich.prompt import Prompt
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Api.Template import get_select_title from StreamingCommunity.Api.Template import get_select_title
@ -21,6 +25,9 @@ _deprecate = False
_priority = 2 _priority = 2
_engineDownload = "mp4" _engineDownload = "mp4"
msg = Prompt()
console = Console()
def search(string_to_search: str = None, get_onylDatabase: bool = False): def search(string_to_search: str = None, get_onylDatabase: bool = False):
""" """

View File

@ -3,8 +3,11 @@
import os import os
# External library
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util.os import os_manager from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Util.message import start_message from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Lib.Downloader import HLS_Downloader from StreamingCommunity.Lib.Downloader import HLS_Downloader
@ -19,6 +22,9 @@ from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Api.Player.maxstream import VideoSource from StreamingCommunity.Api.Player.maxstream import VideoSource
# Variable
console = Console()
def download_film(select_title: MediaItem) -> str: def download_film(select_title: MediaItem) -> str:
""" """

View File

@ -2,14 +2,15 @@
import sys import sys
# External libraries # External libraries
import httpx import httpx
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent
from StreamingCommunity.Util.table import TVShowManager from StreamingCommunity.Util.table import TVShowManager
@ -21,6 +22,7 @@ from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
# Variable # Variable
console = Console()
media_search_manager = MediaManager() media_search_manager = MediaManager()
table_show_manager = TVShowManager() table_show_manager = TVShowManager()
max_timeout = config_manager.get_int("REQUESTS", "timeout") max_timeout = config_manager.get_int("REQUESTS", "timeout")

View File

@ -4,13 +4,17 @@ import logging
from urllib.parse import quote_plus from urllib.parse import quote_plus
# External library
from rich.console import Console
from rich.prompt import Prompt
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Api.Template import get_select_title from StreamingCommunity.Api.Template import get_select_title
from StreamingCommunity.Api.Template.config_loader import site_constant
# Logic class # Logic class
from StreamingCommunity.Api.Template.config_loader import site_constant
from .site import title_search, media_search_manager, table_show_manager from .site import title_search, media_search_manager, table_show_manager
from .series import download_thread from .series import download_thread
@ -22,6 +26,9 @@ _deprecate = False
_priority = 2 _priority = 2
_engineDownload = "mp4" _engineDownload = "mp4"
msg = Prompt()
console = Console()
def search(string_to_search: str = None, get_onylDatabase: bool = False): def search(string_to_search: str = None, get_onylDatabase: bool = False):
""" """

View File

@ -5,8 +5,11 @@ from urllib.parse import urlparse
from typing import Tuple from typing import Tuple
# External library
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util.message import start_message from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.os import os_manager from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Lib.Downloader import MP4_downloader from StreamingCommunity.Lib.Downloader import MP4_downloader
@ -28,6 +31,9 @@ from .util.ScrapeSerie import GetSerieInfo
from StreamingCommunity.Api.Player.ddl import VideoSource from StreamingCommunity.Api.Player.ddl import VideoSource
# Variable
console = Console()
def download_video(index_episode_selected: int, scape_info_serie: GetSerieInfo, video_source: VideoSource) -> Tuple[str,bool]: def download_video(index_episode_selected: int, scape_info_serie: GetSerieInfo, video_source: VideoSource) -> Tuple[str,bool]:
""" """

View File

@ -7,11 +7,11 @@ import logging
# External libraries # External libraries
import httpx import httpx
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent
from StreamingCommunity.Util.table import TVShowManager from StreamingCommunity.Util.table import TVShowManager
@ -23,6 +23,7 @@ from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
# Variable # Variable
console = Console()
media_search_manager = MediaManager() media_search_manager = MediaManager()
table_show_manager = TVShowManager() table_show_manager = TVShowManager()
max_timeout = config_manager.get_int("REQUESTS", "timeout") max_timeout = config_manager.get_int("REQUESTS", "timeout")

View File

@ -11,7 +11,7 @@ from bs4 import BeautifulSoup
# Internal utilities # Internal utilities
from StreamingCommunity.Util._jsonConfig import config_manager from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent

View File

@ -3,13 +3,17 @@
from urllib.parse import quote_plus from urllib.parse import quote_plus
# External library
from rich.console import Console
from rich.prompt import Prompt
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Api.Template import get_select_title from StreamingCommunity.Api.Template import get_select_title
from StreamingCommunity.Api.Template.config_loader import site_constant
# Logic class # Logic class
from StreamingCommunity.Api.Template.config_loader import site_constant
from .site import title_search, media_search_manager, table_show_manager from .site import title_search, media_search_manager, table_show_manager
from .series import download_series from .series import download_series
@ -21,6 +25,9 @@ _deprecate = False
_priority = 2 _priority = 2
_engineDownload = "hls" _engineDownload = "hls"
msg = Prompt()
console = Console()
def search(string_to_search: str = None, get_onylDatabase: bool = False): def search(string_to_search: str = None, get_onylDatabase: bool = False):
""" """

View File

@ -4,8 +4,12 @@ import os
from typing import Tuple from typing import Tuple
# External library
from rich.console import Console
from rich.prompt import Prompt
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Util.message import start_message from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Lib.Downloader import HLS_Downloader from StreamingCommunity.Lib.Downloader import HLS_Downloader
@ -28,6 +32,10 @@ from .util.ScrapeSerie import GetSerieInfo
from StreamingCommunity.Api.Player.supervideo import VideoSource from StreamingCommunity.Api.Player.supervideo import VideoSource
# Variable
msg = Prompt()
console = Console()
def download_video(index_season_selected: int, index_episode_selected: int, scape_info_serie: GetSerieInfo) -> Tuple[str,bool]: def download_video(index_season_selected: int, index_episode_selected: int, scape_info_serie: GetSerieInfo) -> Tuple[str,bool]:
""" """

View File

@ -2,14 +2,14 @@
import sys import sys
# External libraries # External libraries
import httpx import httpx
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent
from StreamingCommunity.Util.table import TVShowManager from StreamingCommunity.Util.table import TVShowManager
@ -21,11 +21,13 @@ from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
# Variable # Variable
console = Console()
media_search_manager = MediaManager() media_search_manager = MediaManager()
table_show_manager = TVShowManager() table_show_manager = TVShowManager()
max_timeout = config_manager.get_int("REQUESTS", "timeout") max_timeout = config_manager.get_int("REQUESTS", "timeout")
def title_search(word_to_search: str) -> int: def title_search(word_to_search: str) -> int:
""" """
Search for titles based on a search query. Search for titles based on a search query.

View File

@ -11,7 +11,7 @@ from bs4 import BeautifulSoup
# Internal utilities # Internal utilities
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent
from StreamingCommunity.Util._jsonConfig import config_manager from StreamingCommunity.Util.config_json import config_manager
# Logic class # Logic class

View File

@ -3,8 +3,9 @@
from urllib.parse import quote_plus from urllib.parse import quote_plus
# Internal utilities # External library
from StreamingCommunity.Util.console import console, msg from rich.console import Console
from rich.prompt import Prompt, Confirm
# Logic class # Logic class
@ -20,6 +21,9 @@ _deprecate = False
_priority = 2 _priority = 2
_engineDownload = "hls" _engineDownload = "hls"
msg = Prompt()
console = Console()
def search(string_to_search: str = None, get_onylDatabase: bool = False): def search(string_to_search: str = None, get_onylDatabase: bool = False):
""" """

View File

@ -7,14 +7,14 @@ import logging
# External libraries # External libraries
import httpx import httpx
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console from StreamingCommunity.Util.os import os_manager, get_call_stack
from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Util.message import start_message from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent
from StreamingCommunity.Util.table import TVShowManager, get_call_stack from StreamingCommunity.Util.table import TVShowManager
from StreamingCommunity.Lib.Downloader import HLS_Downloader from StreamingCommunity.Lib.Downloader import HLS_Downloader
@ -27,6 +27,10 @@ from StreamingCommunity.Api.Template.config_loader import site_constant
from StreamingCommunity.Lib.TMBD import Json_film from StreamingCommunity.Lib.TMBD import Json_film
# Variable
console = Console()
def download_film(movie_details: Json_film) -> str: def download_film(movie_details: Json_film) -> str:
""" """
Downloads a film using the provided tmbd id. Downloads a film using the provided tmbd id.

View File

@ -5,8 +5,12 @@ import subprocess
from urllib.parse import quote_plus from urllib.parse import quote_plus
# External library
from rich.console import Console
from rich.prompt import Prompt
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Api.Template import get_select_title from StreamingCommunity.Api.Template import get_select_title
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
@ -25,6 +29,9 @@ _deprecate = False
_priority = 1 _priority = 1
_engineDownload = "hls" _engineDownload = "hls"
msg = Prompt()
console = Console()
def search(string_to_search: str = None, get_onylDatabase: bool = False): def search(string_to_search: str = None, get_onylDatabase: bool = False):
""" """

View File

@ -3,8 +3,11 @@
import os import os
# External library
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util.os import os_manager from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Util.message import start_message from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Lib.Downloader import HLS_Downloader from StreamingCommunity.Lib.Downloader import HLS_Downloader
@ -20,6 +23,10 @@ from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Api.Player.vixcloud import VideoSource from StreamingCommunity.Api.Player.vixcloud import VideoSource
# Variable
console = Console()
def download_film(select_title: MediaItem) -> str: def download_film(select_title: MediaItem) -> str:
""" """
Downloads a film using the provided film ID, title name, and domain. Downloads a film using the provided film ID, title name, and domain.

View File

@ -4,8 +4,12 @@ import os
from typing import Tuple from typing import Tuple
# External library
from rich.console import Console
from rich.prompt import Prompt, Confirm
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Util.message import start_message from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Lib.Downloader import HLS_Downloader from StreamingCommunity.Lib.Downloader import HLS_Downloader
from StreamingCommunity.TelegramHelp.telegram_bot import TelegramSession, get_bot_instance from StreamingCommunity.TelegramHelp.telegram_bot import TelegramSession, get_bot_instance
@ -28,6 +32,11 @@ from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
from StreamingCommunity.Api.Player.vixcloud import VideoSource from StreamingCommunity.Api.Player.vixcloud import VideoSource
# Variable
msg = Prompt()
console = Console()
def download_video(index_season_selected: int, index_episode_selected: int, scrape_serie: ScrapeSerie, video_source: VideoSource) -> Tuple[str,bool]: def download_video(index_season_selected: int, index_episode_selected: int, scrape_serie: ScrapeSerie, video_source: VideoSource) -> Tuple[str,bool]:
""" """
Download a single episode video. Download a single episode video.

View File

@ -5,11 +5,11 @@ import sys
# External libraries # External libraries
import httpx import httpx
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent
from StreamingCommunity.Util.table import TVShowManager from StreamingCommunity.Util.table import TVShowManager
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
@ -21,8 +21,8 @@ from StreamingCommunity.Api.Template.Util import search_domain
from StreamingCommunity.Api.Template.Class.SearchType import MediaManager from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
# Variable # Variable
console = Console()
media_search_manager = MediaManager() media_search_manager = MediaManager()
table_show_manager = TVShowManager() table_show_manager = TVShowManager()
max_timeout = config_manager.get_int("REQUESTS", "timeout") max_timeout = config_manager.get_int("REQUESTS", "timeout")

View File

@ -11,7 +11,7 @@ from bs4 import BeautifulSoup
# Internal utilities # Internal utilities
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent
from StreamingCommunity.Util._jsonConfig import config_manager from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Api.Player.Helper.Vixcloud.util import Season, EpisodeManager from StreamingCommunity.Api.Player.Helper.Vixcloud.util import Season, EpisodeManager

View File

@ -7,15 +7,16 @@ from urllib.parse import urlparse, unquote
# External libraries # External libraries
import httpx import httpx
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.headers import get_headers from StreamingCommunity.Util.headers import get_headers
from StreamingCommunity.Util.console import console from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
# Variable # Variable
console = Console()
VERIFY = config_manager.get("REQUESTS", "verify") VERIFY = config_manager.get("REQUESTS", "verify")

View File

@ -5,14 +5,20 @@ import logging
from typing import List from typing import List
# External library
from rich.console import Console
from rich.prompt import Prompt
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console, msg
from StreamingCommunity.Util.os import os_manager from StreamingCommunity.Util.os import os_manager
from StreamingCommunity.Util._jsonConfig import config_manager from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util.table import TVShowManager from StreamingCommunity.Util.table import TVShowManager
# Config # Variable
msg = Prompt()
console = Console()
MAP_EPISODE = config_manager.get('OUT_FOLDER', 'map_episode_name') MAP_EPISODE = config_manager.get('OUT_FOLDER', 'map_episode_name')
@ -195,7 +201,6 @@ def display_episodes_list(episodes_manager) -> str:
""" """
# Set up table for displaying episodes # Set up table for displaying episodes
table_show_manager = TVShowManager() table_show_manager = TVShowManager()
table_show_manager.set_slice_end(10)
# Add columns to the table # Add columns to the table
column_info = { column_info = {

View File

@ -5,7 +5,7 @@ import inspect
# Internal utilities # Internal utilities
from StreamingCommunity.Util._jsonConfig import config_manager from StreamingCommunity.Util.config_json import config_manager
def get_site_name_from_stack(): def get_site_name_from_stack():

View File

@ -3,11 +3,12 @@
import sys import sys
# Internal utilities # External library
from StreamingCommunity.Util.console import console from rich.console import Console
# Variable # Variable
console = Console()
available_colors = ['red', 'magenta', 'yellow', 'cyan', 'green', 'blue', 'white'] available_colors = ['red', 'magenta', 'yellow', 'cyan', 'green', 'blue', 'white']
column_to_hide = ['Slug', 'Sub_ita', 'Last_air_date', 'Seasons_count', 'Url'] column_to_hide = ['Slug', 'Sub_ita', 'Last_air_date', 'Seasons_count', 'Url']
@ -19,10 +20,6 @@ def get_select_title(table_show_manager, media_search_manager):
Returns: Returns:
MediaItem: The selected media item. MediaItem: The selected media item.
""" """
# Set up table for displaying titles
table_show_manager.set_slice_end(10)
# Determine column_info dynamically for (search site) # Determine column_info dynamically for (search site)
if not media_search_manager.media_list: if not media_search_manager.media_list:
console.print("\n[red]No media items available.") console.print("\n[red]No media items available.")

View File

@ -10,17 +10,14 @@ from typing import Any, Dict, List, Optional
# External libraries # External libraries
import httpx import httpx
from rich.console import Console
from rich.panel import Panel
# Internal utilities # Internal utilities
from StreamingCommunity.Util._jsonConfig import config_manager from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent
from StreamingCommunity.Util.console import console, Panel from StreamingCommunity.Util.os import compute_sha1_hash, os_manager, internet_manager
from StreamingCommunity.Util.os import (
compute_sha1_hash,
os_manager,
internet_manager
)
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
@ -49,6 +46,7 @@ RETRY_LIMIT = config_manager.get_int('REQUESTS', 'max_retry')
MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout") MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout")
TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot') TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot')
console = Console()
class HLSClient: class HLSClient:
@ -192,7 +190,7 @@ class M3U8Manager:
list_available_resolution = [f"{r[0]}x{r[1]}" for r in tuple_available_resolution] list_available_resolution = [f"{r[0]}x{r[1]}" for r in tuple_available_resolution]
console.print( console.print(
f"[cyan bold]Video [/cyan bold] [green]Available:[/green] [purple]{', '.join(list_available_resolution)}[/purple] | " f"[cyan bold]Video [/cyan bold] [green]Available:[/green] [purple]{', '.join(list_available_resolution)}[/purple] | "
f"[red]Set:[/red] [purple]{FILTER_CUSTOM_REOLUTION}[/purple] | " f"[red]Set:[/red] [purple]{FILTER_CUSTOM_REOLUTION}[/purple] | "
f"[yellow]Downloadable:[/yellow] [purple]{self.video_res[0]}x{self.video_res[1]}[/purple]" f"[yellow]Downloadable:[/yellow] [purple]{self.video_res[0]}x{self.video_res[1]}[/purple]"
) )
@ -207,7 +205,7 @@ class M3U8Manager:
set_codec_info = available_codec_info if config_manager.get_bool("M3U8_CONVERSION", "use_codec") else "[purple]copy[/purple]" set_codec_info = available_codec_info if config_manager.get_bool("M3U8_CONVERSION", "use_codec") else "[purple]copy[/purple]"
console.print( console.print(
f"[bold cyan]Codec [/bold cyan] [green]Available:[/green] {available_codec_info} | " f"[bold cyan]Codec [/bold cyan] [green]Available:[/green] {available_codec_info} | "
f"[red]Set:[/red] {set_codec_info}" f"[red]Set:[/red] {set_codec_info}"
) )
@ -216,7 +214,7 @@ class M3U8Manager:
downloadable_sub_languages = list(set(available_sub_languages) & set(DOWNLOAD_SPECIFIC_SUBTITLE)) downloadable_sub_languages = list(set(available_sub_languages) & set(DOWNLOAD_SPECIFIC_SUBTITLE))
if available_sub_languages: if available_sub_languages:
console.print( console.print(
f"[cyan bold]Subtitle [/cyan bold] [green]Available:[/green] [purple]{', '.join(available_sub_languages)}[/purple] | " f"[cyan bold]Subtitle [/cyan bold] [green]Available:[/green] [purple]{', '.join(available_sub_languages)}[/purple] | "
f"[red]Set:[/red] [purple]{', '.join(DOWNLOAD_SPECIFIC_SUBTITLE)}[/purple] | " f"[red]Set:[/red] [purple]{', '.join(DOWNLOAD_SPECIFIC_SUBTITLE)}[/purple] | "
f"[yellow]Downloadable:[/yellow] [purple]{', '.join(downloadable_sub_languages)}[/purple]" f"[yellow]Downloadable:[/yellow] [purple]{', '.join(downloadable_sub_languages)}[/purple]"
) )
@ -226,7 +224,7 @@ class M3U8Manager:
downloadable_audio_languages = list(set(available_audio_languages) & set(DOWNLOAD_SPECIFIC_AUDIO)) downloadable_audio_languages = list(set(available_audio_languages) & set(DOWNLOAD_SPECIFIC_AUDIO))
if available_audio_languages: if available_audio_languages:
console.print( console.print(
f"[cyan bold]Audio [/cyan bold] [green]Available:[/green] [purple]{', '.join(available_audio_languages)}[/purple] | " f"[cyan bold]Audio [/cyan bold] [green]Available:[/green] [purple]{', '.join(available_audio_languages)}[/purple] | "
f"[red]Set:[/red] [purple]{', '.join(DOWNLOAD_SPECIFIC_AUDIO)}[/purple] | " f"[red]Set:[/red] [purple]{', '.join(DOWNLOAD_SPECIFIC_AUDIO)}[/purple] | "
f"[yellow]Downloadable:[/yellow] [purple]{', '.join(downloadable_audio_languages)}[/purple]" f"[yellow]Downloadable:[/yellow] [purple]{', '.join(downloadable_audio_languages)}[/purple]"
) )

View File

@ -17,14 +17,13 @@ from typing import Dict
# External libraries # External libraries
import httpx import httpx
from tqdm import tqdm from tqdm import tqdm
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.color import Colors from StreamingCommunity.Util.color import Colors
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent
from StreamingCommunity.Util._jsonConfig import config_manager from StreamingCommunity.Util.config_json import config_manager, get_use_large_bar
from StreamingCommunity.Util.os import os_manager
# Logic class # Logic class
@ -37,7 +36,6 @@ from ...M3U8 import (
# Config # Config
TQDM_DELAY_WORKER = config_manager.get_float('M3U8_DOWNLOAD', 'tqdm_delay') TQDM_DELAY_WORKER = config_manager.get_float('M3U8_DOWNLOAD', 'tqdm_delay')
USE_LARGE_BAR = not ("android" in sys.platform or "ios" in sys.platform)
REQUEST_MAX_RETRY = config_manager.get_int('REQUESTS', 'max_retry') REQUEST_MAX_RETRY = config_manager.get_int('REQUESTS', 'max_retry')
REQUEST_VERIFY = config_manager.get_int('REQUESTS', 'verify') REQUEST_VERIFY = config_manager.get_int('REQUESTS', 'verify')
DEFAULT_VIDEO_WORKERS = config_manager.get_int('M3U8_DOWNLOAD', 'default_video_workser') DEFAULT_VIDEO_WORKERS = config_manager.get_int('M3U8_DOWNLOAD', 'default_video_workser')
@ -48,6 +46,9 @@ SEGMENT_MAX_TIMEOUT = config_manager.get_int("M3U8_DOWNLOAD", "segment_timeout")
TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot') TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot')
# Variable
console = Console()
class M3U8_Segments: class M3U8_Segments:
def __init__(self, url: str, tmp_folder: str, is_index_url: bool = True): def __init__(self, url: str, tmp_folder: str, is_index_url: bool = True):
@ -386,7 +387,7 @@ class M3U8_Segments:
""" """
Generate platform-appropriate progress bar format. Generate platform-appropriate progress bar format.
""" """
if not USE_LARGE_BAR: if not get_use_large_bar():
return ( return (
f"{Colors.YELLOW}Proc{Colors.WHITE}: " f"{Colors.YELLOW}Proc{Colors.WHITE}: "
f"{Colors.RED}{{percentage:.2f}}% " f"{Colors.RED}{{percentage:.2f}}% "

View File

@ -12,13 +12,15 @@ from functools import partial
# External libraries # External libraries
import httpx import httpx
from tqdm import tqdm from tqdm import tqdm
from rich.console import Console
from rich.prompt import Prompt
from rich.panel import Panel
# Internal utilities # Internal utilities
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent
from StreamingCommunity.Util.color import Colors from StreamingCommunity.Util.color import Colors
from StreamingCommunity.Util.console import console, Panel from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.os import internet_manager from StreamingCommunity.Util.os import internet_manager
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
@ -34,6 +36,10 @@ REQUEST_TIMEOUT = config_manager.get_float('REQUESTS', 'timeout')
TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot') TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot')
# Variable
msg = Prompt()
console = Console()
class InterruptHandler: class InterruptHandler:
def __init__(self): def __init__(self):

View File

@ -9,11 +9,14 @@ import psutil
import logging import logging
# External library
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.color import Colors from StreamingCommunity.Util.color import Colors
from StreamingCommunity.Util.os import internet_manager from StreamingCommunity.Util.os import internet_manager
from StreamingCommunity.Util.console import console from StreamingCommunity.Util.config_json import config_manager, get_use_large_bar
from StreamingCommunity.Util._jsonConfig import config_manager
# External libraries # External libraries
@ -28,10 +31,9 @@ USERNAME = config_manager.get_dict('QBIT_CONFIG', 'user')
PASSWORD = config_manager.get_dict('QBIT_CONFIG', 'pass') PASSWORD = config_manager.get_dict('QBIT_CONFIG', 'pass')
# Config # Variable
USE_LARGE_BAR = not ("android" in sys.platform or "ios" in sys.platform)
REQUEST_TIMEOUT = config_manager.get_float('REQUESTS', 'timeout') REQUEST_TIMEOUT = config_manager.get_float('REQUESTS', 'timeout')
console = Console()
class TOR_downloader: class TOR_downloader:
@ -160,7 +162,7 @@ class TOR_downloader:
try: try:
# Custom progress bar for mobile and PC # Custom progress bar for mobile and PC
if USE_LARGE_BAR: if get_use_large_bar():
bar_format = ( bar_format = (
f"{Colors.YELLOW}[TOR] {Colors.WHITE}({Colors.CYAN}video{Colors.WHITE}): " f"{Colors.YELLOW}[TOR] {Colors.WHITE}({Colors.CYAN}video{Colors.WHITE}): "
f"{Colors.RED}{{percentage:.2f}}% {Colors.MAGENTA}{{bar}} {Colors.WHITE}[ " f"{Colors.RED}{{percentage:.2f}}% {Colors.MAGENTA}{{bar}} {Colors.WHITE}[ "
@ -221,7 +223,7 @@ class TOR_downloader:
average_internet = average_internet_str average_internet = average_internet_str
average_internet_unit = "" average_internet_unit = ""
if USE_LARGE_BAR: if get_use_large_bar():
pbar.set_postfix_str( pbar.set_postfix_str(
f"{Colors.WHITE}[ {Colors.GREEN}{downloaded_size} {Colors.WHITE}< {Colors.GREEN}{total_size} {Colors.RED}{total_size_unit} " f"{Colors.WHITE}[ {Colors.GREEN}{downloaded_size} {Colors.WHITE}< {Colors.GREEN}{total_size} {Colors.RED}{total_size_unit} "
f"{Colors.WHITE}| {Colors.CYAN}{average_internet} {Colors.RED}{average_internet_unit}" f"{Colors.WHITE}| {Colors.CYAN}{average_internet} {Colors.RED}{average_internet_unit}"

View File

@ -6,12 +6,16 @@ import threading
import subprocess import subprocess
# External library
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console
from StreamingCommunity.Util.os import internet_manager from StreamingCommunity.Util.os import internet_manager
# Variable # Variable
console = Console()
terminate_flag = threading.Event() terminate_flag = threading.Event()
@ -57,7 +61,7 @@ def capture_output(process: subprocess.Popen, description: str) -> None:
# Construct the progress string with formatted output information # Construct the progress string with formatted output information
progress_string = (f" {description}[white]: " progress_string = (f" {description}[white]: "
f"([green]'speed': [yellow]{data.get('speed', 'N/A')}[white], " f"([green]'speed': [yellow]{data.get('speed', 'N/A')}[white], "
f"[green]'size': [yellow]{internet_manager.format_file_size(byte_size)}[white])") f"[green]'size': [yellow]{internet_manager.format_file_size(byte_size)}[white])")
max_length = max(max_length, len(progress_string)) max_length = max(max_length, len(progress_string))

View File

@ -6,10 +6,13 @@ import subprocess
from typing import List, Dict, Tuple, Optional from typing import List, Dict, Tuple, Optional
# External library
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util._jsonConfig import config_manager from StreamingCommunity.Util.config_json import config_manager, get_use_large_bar
from StreamingCommunity.Util.os import os_manager, os_summary, suppress_output from StreamingCommunity.Util.os import os_manager, suppress_output, get_ffmpeg_path
from StreamingCommunity.Util.console import console
# Logic class # Logic class
@ -30,9 +33,7 @@ FFMPEG_DEFAULT_PRESET = config_manager.get("M3U8_CONVERSION", "default_preset")
# Variable # Variable
USE_LARGE_BAR = not ("android" in sys.platform or "ios" in sys.platform) console = Console()
FFMPEG_PATH = os_summary.ffmpeg_path
def check_subtitle_encoders() -> Tuple[Optional[bool], Optional[bool]]: def check_subtitle_encoders() -> Tuple[Optional[bool], Optional[bool]]:
@ -45,7 +46,7 @@ def check_subtitle_encoders() -> Tuple[Optional[bool], Optional[bool]]:
""" """
try: try:
result = subprocess.run( result = subprocess.run(
[FFMPEG_PATH, '-encoders'], [get_ffmpeg_path(), '-encoders'],
capture_output=True, capture_output=True,
text=True, text=True,
check=True check=True
@ -99,7 +100,7 @@ def join_video(video_path: str, out_path: str, codec: M3U8_Codec = None):
- out_path (str): The path to save the output file. - out_path (str): The path to save the output file.
- codec (M3U8_Codec): The video codec to use. Defaults to 'copy'. - codec (M3U8_Codec): The video codec to use. Defaults to 'copy'.
""" """
ffmpeg_cmd = [FFMPEG_PATH] ffmpeg_cmd = [get_ffmpeg_path()]
# Enabled the use of gpu # Enabled the use of gpu
if USE_GPU: if USE_GPU:
@ -156,7 +157,7 @@ def join_video(video_path: str, out_path: str, codec: M3U8_Codec = None):
subprocess.run(ffmpeg_cmd, check=True) subprocess.run(ffmpeg_cmd, check=True)
else: else:
if USE_LARGE_BAR: if get_use_large_bar():
capture_ffmpeg_real_time(ffmpeg_cmd, "[cyan]Join video") capture_ffmpeg_real_time(ffmpeg_cmd, "[cyan]Join video")
print() print()
@ -182,7 +183,7 @@ def join_audios(video_path: str, audio_tracks: List[Dict[str, str]], out_path: s
video_audio_same_duration = check_duration_v_a(video_path, audio_tracks[0].get('path')) video_audio_same_duration = check_duration_v_a(video_path, audio_tracks[0].get('path'))
# Start command with locate ffmpeg # Start command with locate ffmpeg
ffmpeg_cmd = [FFMPEG_PATH] ffmpeg_cmd = [get_ffmpeg_path()]
# Enabled the use of gpu # Enabled the use of gpu
if USE_GPU: if USE_GPU:
@ -252,7 +253,7 @@ def join_audios(video_path: str, audio_tracks: List[Dict[str, str]], out_path: s
subprocess.run(ffmpeg_cmd, check=True) subprocess.run(ffmpeg_cmd, check=True)
else: else:
if USE_LARGE_BAR: if get_use_large_bar():
capture_ffmpeg_real_time(ffmpeg_cmd, "[cyan]Join audio") capture_ffmpeg_real_time(ffmpeg_cmd, "[cyan]Join audio")
print() print()
@ -275,7 +276,7 @@ def join_subtitle(video_path: str, subtitles_list: List[Dict[str, str]], out_pat
Each dictionary should contain the 'path' key with the path to the subtitle file and the 'name' key with the name of the subtitle. Each dictionary should contain the 'path' key with the path to the subtitle file and the 'name' key with the name of the subtitle.
- out_path (str): The path to save the output file. - out_path (str): The path to save the output file.
""" """
ffmpeg_cmd = [FFMPEG_PATH, "-i", video_path] ffmpeg_cmd = [get_ffmpeg_path(), "-i", video_path]
# Add subtitle input files first # Add subtitle input files first
for subtitle in subtitles_list: for subtitle in subtitles_list:
@ -305,9 +306,9 @@ def join_subtitle(video_path: str, subtitles_list: List[Dict[str, str]], out_pat
# Run join # Run join
if DEBUG_MODE: if DEBUG_MODE:
subprocess.run(ffmpeg_cmd, check=True) subprocess.run(ffmpeg_cmd, check=True)
else:
if USE_LARGE_BAR: else:
if get_use_large_bar():
capture_ffmpeg_real_time(ffmpeg_cmd, "[cyan]Join subtitle") capture_ffmpeg_real_time(ffmpeg_cmd, "[cyan]Join subtitle")
print() print()

View File

@ -8,14 +8,16 @@ import logging
from typing import Tuple from typing import Tuple
# External library
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console from StreamingCommunity.Util.os import get_ffprobe_path
from StreamingCommunity.Util.os import os_summary
# Variable # Variable
FFPROB_PATH = os_summary.ffprobe_path console = Console()
def has_audio_stream(video_path: str) -> bool: def has_audio_stream(video_path: str) -> bool:
@ -29,7 +31,7 @@ def has_audio_stream(video_path: str) -> bool:
has_audio (bool): True if the input video has an audio stream, False otherwise. has_audio (bool): True if the input video has an audio stream, False otherwise.
""" """
try: try:
ffprobe_cmd = [FFPROB_PATH, '-v', 'error', '-print_format', 'json', '-select_streams', 'a', '-show_streams', video_path] ffprobe_cmd = [get_ffprobe_path(), '-v', 'error', '-print_format', 'json', '-select_streams', 'a', '-show_streams', video_path]
logging.info(f"FFmpeg command: {ffprobe_cmd}") logging.info(f"FFmpeg command: {ffprobe_cmd}")
with subprocess.Popen(ffprobe_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) as proc: with subprocess.Popen(ffprobe_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) as proc:
@ -57,7 +59,7 @@ def get_video_duration(file_path: str) -> float:
""" """
try: try:
ffprobe_cmd = [FFPROB_PATH, '-v', 'error', '-show_format', '-print_format', 'json', file_path] ffprobe_cmd = [get_ffprobe_path(), '-v', 'error', '-show_format', '-print_format', 'json', file_path]
logging.info(f"FFmpeg command: {ffprobe_cmd}") logging.info(f"FFmpeg command: {ffprobe_cmd}")
# Use a with statement to ensure the subprocess is cleaned up properly # Use a with statement to ensure the subprocess is cleaned up properly
@ -141,7 +143,7 @@ def get_ffprobe_info(file_path):
""" """
try: try:
result = subprocess.run( result = subprocess.run(
[FFPROB_PATH, '-v', 'error', '-show_format', '-show_streams', '-print_format', 'json', file_path], [get_ffprobe_path(), '-v', 'error', '-show_format', '-show_streams', '-print_format', 'json', file_path],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=True stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=True
) )
output = result.stdout output = result.stdout

View File

@ -6,11 +6,12 @@ import logging
import importlib.util import importlib.util
# Internal utilities # External library
from StreamingCommunity.Util.console import console from rich.console import Console
# Check if Cryptodome module is installed # Check if Cryptodome module is installed
console = Console()
crypto_spec = importlib.util.find_spec("Cryptodome") crypto_spec = importlib.util.find_spec("Cryptodome")
crypto_installed = crypto_spec is not None crypto_installed = crypto_spec is not None

View File

@ -14,13 +14,10 @@ from tqdm import tqdm
# Internal utilities # Internal utilities
from StreamingCommunity.Util.color import Colors from StreamingCommunity.Util.color import Colors
from StreamingCommunity.Util.config_json import get_use_large_bar
from StreamingCommunity.Util.os import internet_manager from StreamingCommunity.Util.os import internet_manager
# Variable
USE_LARGE_BAR = not ("android" in sys.platform or "ios" in sys.platform)
class M3U8_Ts_Estimator: class M3U8_Ts_Estimator:
def __init__(self, total_segments: int, segments_instance=None): def __init__(self, total_segments: int, segments_instance=None):
""" """
@ -36,7 +33,7 @@ class M3U8_Ts_Estimator:
self.lock = threading.Lock() self.lock = threading.Lock()
self.speed = {"upload": "N/A", "download": "N/A"} self.speed = {"upload": "N/A", "download": "N/A"}
if USE_LARGE_BAR: if get_use_large_bar():
logging.debug("USE_LARGE_BAR is True, starting speed capture thread") logging.debug("USE_LARGE_BAR is True, starting speed capture thread")
self.speed_thread = threading.Thread(target=self.capture_speed) self.speed_thread = threading.Thread(target=self.capture_speed)
self.speed_thread.daemon = True self.speed_thread.daemon = True
@ -110,7 +107,7 @@ class M3U8_Ts_Estimator:
number_file_total_size = file_total_size.split(' ')[0] number_file_total_size = file_total_size.split(' ')[0]
units_file_total_size = file_total_size.split(' ')[1] units_file_total_size = file_total_size.split(' ')[1]
if USE_LARGE_BAR: if get_use_large_bar():
speed_data = self.speed['download'].split(" ") speed_data = self.speed['download'].split(" ")
if len(speed_data) >= 2: if len(speed_data) >= 2:
@ -122,16 +119,16 @@ class M3U8_Ts_Estimator:
retry_count = self.segments_instance.active_retries if self.segments_instance else 0 retry_count = self.segments_instance.active_retries if self.segments_instance else 0
progress_str = ( progress_str = (
f"{Colors.GREEN}{number_file_total_size} {Colors.RED}{units_file_total_size}" f"{Colors.GREEN}{number_file_total_size} {Colors.WHITE}< {Colors.RED}{units_file_total_size}"
f"{Colors.WHITE} {Colors.CYAN}{average_internet_speed} {Colors.RED}{average_internet_unit}" f"{Colors.WHITE} {Colors.CYAN}{average_internet_speed} {Colors.RED}{average_internet_unit}"
f"{Colors.WHITE} {Colors.GREEN}CRR {Colors.RED}{retry_count} " f"{Colors.WHITE}, {Colors.GREEN}CRR {Colors.RED}{retry_count} "
) )
else: else:
retry_count = self.segments_instance.active_retries if self.segments_instance else 0 retry_count = self.segments_instance.active_retries if self.segments_instance else 0
progress_str = ( progress_str = (
f"{Colors.GREEN}{number_file_total_size} {Colors.RED}{units_file_total_size}" f"{Colors.GREEN}{number_file_total_size} {Colors.WHITE}< {Colors.RED}{units_file_total_size}"
f"{Colors.WHITE} {Colors.GREEN}CRR {Colors.RED}{retry_count} " f"{Colors.WHITE}, {Colors.GREEN}CRR {Colors.RED}{retry_count} "
) )
progress_counter.set_postfix_str(progress_str) progress_counter.set_postfix_str(progress_str)

View File

@ -6,22 +6,22 @@ from typing import Dict
# External libraries # External libraries
import httpx import httpx
from rich.console import Console
# Internal utilities # Internal utilities
from .obj_tmbd import Json_film from .obj_tmbd import Json_film
from StreamingCommunity.Util.console import console from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.table import TVShowManager from StreamingCommunity.Util.table import TVShowManager
# Variable # Variable
console = Console()
table_show_manager = TVShowManager() table_show_manager = TVShowManager()
api_key = "a800ed6c93274fb857ea61bd9e7256c5" api_key = "a800ed6c93274fb857ea61bd9e7256c5"
MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout") MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout")
def get_select_title(table_show_manager, generic_obj): def get_select_title(table_show_manager, generic_obj):
""" """
Display a selection of titles and prompt the user to choose one. Display a selection of titles and prompt the user to choose one.
@ -29,11 +29,6 @@ def get_select_title(table_show_manager, generic_obj):
Returns: Returns:
dict: The selected media item. dict: The selected media item.
""" """
# Set up table for displaying titles
table_show_manager.set_slice_end(10)
# Check if the generic_obj list is empty
if not generic_obj: if not generic_obj:
console.print("\n[red]No media items available.") console.print("\n[red]No media items available.")
return None return None
@ -158,7 +153,7 @@ class TheMovieDB:
# Join with colored arrows and print with proper category label # Join with colored arrows and print with proper category label
console.print( console.print(
f"[bold purple]{category}:[/] {' [red][/] '.join(colored_items)}" f"[bold purple]{category}:[/] {' [red][/] '.join(colored_items)}"
) )
def display_trending_tv_shows(self): def display_trending_tv_shows(self):

View File

@ -7,12 +7,12 @@ import time
# External library # External library
import httpx import httpx
from rich.console import Console
# Internal utilities # Internal utilities
from .version import __version__, __author__, __title__ from .version import __version__, __author__, __title__
from StreamingCommunity.Util.console import console from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.headers import get_userAgent from StreamingCommunity.Util.headers import get_userAgent
@ -22,6 +22,7 @@ if getattr(sys, 'frozen', False): # Modalità PyInstaller
base_path = os.path.join(sys._MEIPASS, "StreamingCommunity") base_path = os.path.join(sys._MEIPASS, "StreamingCommunity")
else: else:
base_path = os.path.dirname(__file__) base_path = os.path.dirname(__file__)
console = Console()
def update(): def update():

View File

@ -1,42 +0,0 @@
# 21.06.24
import os
import inspect
def get_call_stack():
"""
Retrieves the current call stack with details about each call.
This function inspects the current call stack and returns a list of dictionaries,
where each dictionary contains details about a function call in the stack.
Returns:
list: A list of dictionaries, each containing the following keys:
- function (str): The name of the function.
- folder (str): The directory path of the script containing the function.
- folder_base (str): The base name of the directory path.
- script (str): The name of the script file containing the function.
- line (int): The line number in the script where the function is defined.
"""
stack = inspect.stack()
call_stack = []
for frame_info in stack:
function_name = frame_info.function
filename = frame_info.filename
lineno = frame_info.lineno
folder_name = os.path.dirname(filename)
folder_base = os.path.basename(folder_name)
script_name = os.path.basename(filename)
call_stack.append({
"function": function_name,
"folder": folder_name,
"folder_base": folder_base,
"script": script_name,
"line": lineno
})
return call_stack

View File

@ -405,4 +405,17 @@ class ConfigManager:
config_manager = ConfigManager() config_manager = ConfigManager()
config_manager.read_config() config_manager.read_config()
import sys
def get_use_large_bar():
"""
Determines whether the large bar feature should be enabled.
Returns:
bool: True if running on a PC (Windows, macOS, Linux),
False if running on Android or iOS.
"""
return not any(platform in sys.platform for platform in ("android", "ios"))

View File

@ -1,12 +0,0 @@
# 24.02.24
from rich.console import Console
from rich.prompt import Prompt, Confirm
from rich.panel import Panel
from rich.table import Table
from rich.text import Text
# Variable
msg = Prompt()
console = Console()

View File

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

View File

@ -3,12 +3,17 @@
import os import os
import platform import platform
# External library
from rich.console import Console
# Internal utilities # Internal utilities
from StreamingCommunity.Util.console import console from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
# Variable # Variable
console = Console()
CLEAN = config_manager.get_bool('DEFAULT', 'clean_console') CLEAN = config_manager.get_bool('DEFAULT', 'clean_console')
SHOW = config_manager.get_bool('DEFAULT', 'show_message') SHOW = config_manager.get_bool('DEFAULT', 'show_message')

View File

@ -9,6 +9,7 @@ import shutil
import hashlib import hashlib
import logging import logging
import platform import platform
import inspect
import subprocess import subprocess
import contextlib import contextlib
import importlib.metadata import importlib.metadata
@ -18,14 +19,19 @@ from pathlib import Path
# External library # External library
import httpx import httpx
from unidecode import unidecode from unidecode import unidecode
from rich.console import Console
from rich.prompt import Prompt
from pathvalidate import sanitize_filename, sanitize_filepath from pathvalidate import sanitize_filename, sanitize_filepath
# Internal utilities # Internal utilities
from .ffmpeg_installer import check_ffmpeg from .ffmpeg_installer import check_ffmpeg
from StreamingCommunity.Util.console import console, msg
# Variable
msg = Prompt()
console = Console()
class OsManager: class OsManager:
def __init__(self): def __init__(self):
@ -488,17 +494,36 @@ def suppress_output():
yield yield
def compute_sha1_hash(input_string: str) -> str: def compute_sha1_hash(input_string: str) -> str:
""" """Computes the SHA-1 hash of the input string."""
Computes the SHA-1 hash of the input string. return hashlib.sha1(input_string.encode()).hexdigest()
Parameters: def get_call_stack():
- input_string (str): The string to be hashed. """Retrieves the current call stack with details about each call."""
stack = inspect.stack()
call_stack = []
Returns: for frame_info in stack:
str: The SHA-1 hash of the input string. function_name = frame_info.function
""" filename = frame_info.filename
# Compute the SHA-1 hash lineno = frame_info.lineno
hashed_string = hashlib.sha1(input_string.encode()).hexdigest() folder_name = os.path.dirname(filename)
folder_base = os.path.basename(folder_name)
script_name = os.path.basename(filename)
# Return the hashed string call_stack.append({
return hashed_string "function": function_name,
"folder": folder_name,
"folder_base": folder_base,
"script": script_name,
"line": lineno
})
return call_stack
def get_ffmpeg_path():
"""Returns the path of FFmpeg."""
return os_summary.ffmpeg_path
def get_ffprobe_path():
"""Returns the path of FFprobe."""
return os_summary.ffprobe_path

View File

@ -16,13 +16,13 @@ from rich.style import Style
# Internal utilities # Internal utilities
from .os import get_call_stack
from .message import start_message from .message import start_message
from .call_stack import get_call_stack
# Telegram bot instance # Telegram bot instance
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
from StreamingCommunity.Util._jsonConfig import config_manager from StreamingCommunity.Util.config_json import config_manager
TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot') TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot')
@ -32,21 +32,11 @@ class TVShowManager:
"""Initialize TVShowManager with default values.""" """Initialize TVShowManager with default values."""
self.console = Console() self.console = Console()
self.tv_shows: List[Dict[str, Any]] = [] self.tv_shows: List[Dict[str, Any]] = []
self.slice_start: int = 0 self.slice_start = 0
self.slice_end: int = 5 self.slice_end = 10
self.step: int = self.slice_end self.step = self.slice_end
self.column_info = [] self.column_info = []
def set_slice_end(self, new_slice: int) -> None:
"""
Set the end of the slice for displaying TV shows.
Parameters:
- new_slice (int): The new value for the slice end.
"""
self.slice_end = new_slice
self.step = new_slice
def add_column(self, column_info: Dict[str, Dict[str, str]]) -> None: def add_column(self, column_info: Dict[str, Dict[str, str]]) -> None:
""" """
Add column information. Add column information.

View File

@ -12,17 +12,18 @@ import threading, asyncio
from typing import Callable from typing import Callable
# External library
from rich.console import Console
from rich.prompt import Prompt
# Internal utilities # Internal utilities
from StreamingCommunity.Util.message import start_message from StreamingCommunity.Util.message import start_message
from StreamingCommunity.Util.console import console, msg from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.Util._jsonConfig import config_manager
from StreamingCommunity.Util.os import os_summary from StreamingCommunity.Util.os import os_summary
from StreamingCommunity.Util.logger import Logger from StreamingCommunity.Util.logger import Logger
from StreamingCommunity.Upload.update import update as git_update from StreamingCommunity.Upload.update import update as git_update
from StreamingCommunity.Lib.TMBD import tmdb from StreamingCommunity.Lib.TMBD import tmdb
# Telegram util
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance, TelegramSession from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance, TelegramSession
@ -32,6 +33,10 @@ CLOSE_CONSOLE = config_manager.get_bool('DEFAULT', 'not_close')
TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot') TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot')
# Variable
console = Console()
msg = Prompt()
def run_function(func: Callable[..., None], close_console: bool = False, search_terms: str = None) -> None: def run_function(func: Callable[..., None], close_console: bool = False, search_terms: str = None) -> None:
""" """

View File

@ -5,7 +5,7 @@ import sys
# Internal utilities # Internal utilities
from StreamingCommunity.run import main from StreamingCommunity.run import main
from StreamingCommunity.Util._jsonConfig import config_manager from StreamingCommunity.Util.config_json import config_manager
from StreamingCommunity.TelegramHelp.telegram_bot import TelegramRequestManager, TelegramSession from StreamingCommunity.TelegramHelp.telegram_bot import TelegramRequestManager, TelegramSession

View File

@ -16,7 +16,7 @@ from rich.table import Table
# Variable # Variable
max_timeout = 20 max_timeout = 15
console = Console() console = Console()
local_path = os.path.join(".") local_path = os.path.join(".")
from StreamingCommunity.Upload.version import __author__, __title__ from StreamingCommunity.Upload.version import __author__, __title__