Less const variable

This commit is contained in:
Lovi 2024-12-01 14:45:47 +01:00
parent eeb60d989a
commit a5566ae537
6 changed files with 65 additions and 46 deletions

View File

@ -10,6 +10,8 @@ Chat, contribute, and have fun in our **Git_StreamingCommunity** Discord [Server
## 📋 Table of Contents
- [Website available](#-website-status)
- [Release files](#-release-files)
- [Installation](#installation)
- [PyPI Installation](#pypi-installation)
- [Automatic Installation](#automatic-installation)
@ -21,6 +23,7 @@ Chat, contribute, and have fun in our **Git_StreamingCommunity** Discord [Server
- [Tutorial](#tutorial)
- [To Do](#to-do)
## 💻 Installation
### 1. PyPI Installation
@ -146,6 +149,15 @@ python update.py
python3 update.py
```
## 📂 Release files
| **File** | **Description** |
|------------------------------|----------------------------------------------------------------------------|
| `StreamingCommunity.exe` | Windows (Win10+) standalone executable (recommended for Windows). |
| `StreamingCommunity-main.zip`| Source code and resources |
## Configuration ⚙️
You can change some behaviors by tweaking the configuration file.
@ -157,6 +169,8 @@ The configuration file is divided into several main sections:
```json
{
"root_path": "Video",
"movie_folder_name": "Movie",
"serie_folder_name": "TV",
"map_episode_name": "%(tv_name)_S%(season)E%(episode)_%(episode_name)",
"not_close": false,
"show_trending": false
@ -166,11 +180,13 @@ The configuration file is divided into several main sections:
- `root_path`: Directory where all videos will be saved
#### Path examples:
* Windows: `C:\\MyLibrary\\Folder` or `\\\\MyServer\\MyLibrary` (if you want to use a network folder)
* Linux/MacOS: `Desktop/MyLibrary/Folder`
`<br/><br/>`
- `movie_folder_name`: The name of the subdirectory where movies will be stored.
- `serie_folder_name`: The name of the subdirectory where TV series will be stored.
- `map_episode_name`: Template for TV series episode filenames
#### Episode name usage:
@ -277,6 +293,18 @@ forced-ita hin - Hindi pol - Polish tur - Turkish
> "specific_list_subtitles": ["ita", "eng", "spa"]
> ```
### M3U8_PARSER Settings
```json
{
"force_resolution": -1,
"get_only_link": false
}
```
- `force_resolution`: Force specific resolution (-1 for best available, or specify 1080, 720, 360)
- `get_only_link`: Return M3U8 playlist/index URL instead of downloading
## Docker 🐳
You can run the script in a docker container, to build the image just run
@ -310,19 +338,6 @@ 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
{
"force_resolution": -1,
"get_only_link": false
}
```
- `force_resolution`: Force specific resolution (-1 for best available, or specify 1080, 720, 360)
- `get_only_link`: Return M3U8 playlist/index URL instead of downloading
## 🌐 Website Status
| Website | Status |
@ -355,3 +370,7 @@ Contributions are welcome! Steps:
3. Commit changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to branch (`git push origin feature/AmazingFeature`)
5. Open Pull Request
## 🛡️ Disclaimer
This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.

View File

@ -24,11 +24,10 @@ from StreamingCommunity.Api.Player.vixcloud import VideoSourceAnime
# Variable
from .costant import ROOT_PATH, SITE_NAME, SERIES_FOLDER, MOVIE_FOLDER
scrape_serie = ScrapeSerieAnime(SITE_NAME)
video_source = VideoSourceAnime(SITE_NAME)
def download_episode(index_select: int):
def download_episode(index_select: int, scrape_serie: ScrapeSerieAnime, video_source: VideoSourceAnime):
"""
Downloads the selected episode.
@ -47,12 +46,6 @@ def download_episode(index_select: int):
# Collect mp4 url
video_source.get_embed(obj_episode.id)
# Get the js script from the episode
#js_script = video_source.get_embed(obj_episode.id)
# Parse parameter in embed text
#video_source.parse_script(js_script)
# Create output path
title_name = f"{obj_episode.number}.mp4"
@ -90,6 +83,8 @@ def download_series(select_title: MediaItem):
- tv_id (int): The ID of the TV series.
- tv_name (str): The name of the TV series.
"""
scrape_serie = ScrapeSerieAnime(SITE_NAME)
video_source = VideoSourceAnime(SITE_NAME)
# Set up video source
scrape_serie.setup(None, select_title.id, select_title.slug)
@ -106,12 +101,12 @@ def download_series(select_title: MediaItem):
# Download selected episodes
if len(list_episode_select) == 1 and last_command != "*":
download_episode(list_episode_select[0]-1)
download_episode(list_episode_select[0]-1, scrape_serie, video_source)
# Download all other episodes selecter
else:
for i_episode in list_episode_select:
download_episode(i_episode-1)
download_episode(i_episode-1, scrape_serie, video_source)
def download_film(select_title: MediaItem):
@ -123,9 +118,13 @@ def download_film(select_title: MediaItem):
- title_name (str): The title of the film.
"""
# Init class
scrape_serie = ScrapeSerieAnime(SITE_NAME)
video_source = VideoSourceAnime(SITE_NAME)
# Set up video source
scrape_serie.setup(None, select_title.id, select_title.slug)
scrape_serie.is_series = False
# Start download
download_episode(0)
download_episode(0, scrape_serie, video_source)

View File

@ -26,11 +26,10 @@ from StreamingCommunity.Api.Player.ddl import VideoSource
# Variable
from .costant import ROOT_PATH, SITE_NAME, SERIES_FOLDER
table_show_manager = TVShowManager()
video_source = VideoSource()
def download_video(scape_info_serie: GetSerieInfo, index_episode_selected: int) -> None:
def download_video(index_episode_selected: int, scape_info_serie: GetSerieInfo, video_source: VideoSource) -> None:
"""
Download a single episode video.
@ -86,6 +85,7 @@ def download_thread(dict_serie: MediaItem):
# Init class
scape_info_serie = GetSerieInfo(dict_serie)
video_source = VideoSource()
# Collect information about thread
list_dict_episode = scape_info_serie.get_episode_number()
@ -103,8 +103,7 @@ def download_thread(dict_serie: MediaItem):
# Download selected episodes
for i_episode in list_episode_select:
download_video(scape_info_serie, i_episode)
download_video(i_episode, scape_info_serie, video_source)
def display_episodes_list(obj_episode_manager) -> str:

View File

@ -29,7 +29,7 @@ table_show_manager = TVShowManager()
def download_video(scape_info_serie: GetSerieInfo, index_season_selected: int, index_episode_selected: int) -> None:
def download_video(index_season_selected: int, index_episode_selected: int, scape_info_serie: GetSerieInfo) -> None:
"""
Download a single episode video.
@ -95,7 +95,7 @@ def download_episode(scape_info_serie: GetSerieInfo, index_season_selected: int,
# Download all episodes without asking
for i_episode in range(1, episodes_count + 1):
download_video(scape_info_serie, index_season_selected, i_episode)
download_video(index_season_selected, i_episode, scape_info_serie)
console.print(f"\n[red]End downloaded [yellow]season: [red]{index_season_selected}.")
else:
@ -112,7 +112,7 @@ def download_episode(scape_info_serie: GetSerieInfo, index_season_selected: int,
# Download selected episodes
for i_episode in list_episode_select:
download_video(scape_info_serie, index_season_selected, i_episode)
download_video(index_season_selected, i_episode, scape_info_serie)
def download_series(dict_serie: MediaItem) -> None:

View File

@ -23,7 +23,6 @@ from StreamingCommunity.Api.Player.vixcloud import VideoSource
# Variable
from .costant import ROOT_PATH, SITE_NAME, MOVIE_FOLDER
video_source = VideoSource(SITE_NAME, False)
def download_film(select_title: MediaItem):
@ -39,7 +38,8 @@ def download_film(select_title: MediaItem):
start_message()
console.print(f"[yellow]Download: [red]{select_title.slug} \n")
# Set domain and media ID for the video source
# Init class
video_source = VideoSource(SITE_NAME, False)
video_source.setup(select_title.id)
# Retrieve scws and if available master playlist

View File

@ -25,13 +25,11 @@ from StreamingCommunity.Api.Player.vixcloud import VideoSource
# Variable
from .costant import ROOT_PATH, SITE_NAME, SERIES_FOLDER
scrape_serie = ScrapeSerie(SITE_NAME)
video_source = VideoSource(SITE_NAME, True)
table_show_manager = TVShowManager()
def download_video(tv_name: str, index_season_selected: int, index_episode_selected: int) -> None:
def download_video(tv_name: str, index_season_selected: int, index_episode_selected: int, scrape_serie: ScrapeSerie, video_source: VideoSource) -> None:
"""
Download a single episode video.
@ -75,7 +73,7 @@ def download_video(tv_name: str, index_season_selected: int, index_episode_selec
console.print("[green]Result: ")
console.print(r_proc)
def download_episode(tv_name: str, index_season_selected: int, download_all: bool = False) -> None:
def download_episode(tv_name: str, index_season_selected: int, scrape_serie: ScrapeSerie, video_source: VideoSource, download_all: bool = False) -> None:
"""
Download episodes of a selected season.
@ -98,13 +96,13 @@ def download_episode(tv_name: str, index_season_selected: int, download_all: boo
# Download all episodes without asking
for i_episode in range(1, episodes_count + 1):
download_video(tv_name, index_season_selected, i_episode)
download_video(tv_name, index_season_selected, i_episode, scrape_serie, video_source)
console.print(f"\n[red]End downloaded [yellow]season: [red]{index_season_selected}.")
else:
# Display episodes list and manage user selection
last_command = display_episodes_list()
last_command = display_episodes_list(scrape_serie)
list_episode_select = manage_selection(last_command, episodes_count)
try:
@ -115,7 +113,7 @@ def download_episode(tv_name: str, index_season_selected: int, download_all: boo
# Download selected episodes
for i_episode in list_episode_select:
download_video(tv_name, index_season_selected, i_episode)
download_video(tv_name, index_season_selected, i_episode, scrape_serie, video_source)
def download_series(select_season: MediaItem, version: str) -> None:
"""
@ -130,6 +128,10 @@ def download_series(select_season: MediaItem, version: str) -> None:
# Start message and set up video source
start_message()
# Init class
scrape_serie = ScrapeSerie(SITE_NAME)
video_source = VideoSource(SITE_NAME, True)
# Setup video source
scrape_serie.setup(version, select_season.id, select_season.slug)
video_source.setup(select_season.id)
@ -159,14 +161,14 @@ def download_series(select_season: MediaItem, version: str) -> None:
if len(list_season_select) > 1 or index_season_selected == "*":
# Download all episodes if multiple seasons are selected or if '*' is used
download_episode(select_season.slug, i_season, download_all=True)
download_episode(select_season.slug, i_season, scrape_serie, video_source, download_all=True)
else:
# Otherwise, let the user select specific episodes for the single season
download_episode(select_season.slug, i_season, download_all=False)
download_episode(select_season.slug, i_season, scrape_serie, video_source, download_all=False)
def display_episodes_list() -> str:
def display_episodes_list(scrape_serie) -> str:
"""
Display episodes list and handle user input.