Skip to content

Commit

Permalink
Atto secondo ...
Browse files Browse the repository at this point in the history
  • Loading branch information
Lovi-0 committed May 23, 2024
1 parent 67bbb9a commit 129de75
Show file tree
Hide file tree
Showing 116 changed files with 7,901 additions and 3,811 deletions.
128 changes: 38 additions & 90 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
<p align="center" >
<img src="./Src/Assets/min_logo.png" title="SDWebImage logo" float=left>
<p align="center">
<img src="./Src/Assets/min_logo.png">
</p>

# Overview.

This repository provide a simple script designed to facilitate the downloading of films and series from a popular streaming community platform. The script allows users to download individual films, entire series, or specific episodes, providing a seamless experience for content consumers.

## Join us
You can chat, help improve this repo, or just hang around for some fun in the **Git_StreamingCommunity** Discord [Server](https://discord.com/invite/8vV68UGRc7)

You can chat, help improve this repo, or just hang around for some fun in the **Git_StreamingCommunity** Discord [Server](https://discord.gg/PtMX28v5)

# Table of Contents

* [INSTALLATION](#installation)
* [Requirement](#requirement)
* [Usage](#usage)
* [Update](#update)
* [Win 7](https://github.com/Ghost6446/StreamingCommunity_api/wiki/Installation#win-7)
* [CONFIGURATION](#Configuration)
* [DOCKER](#docker)
* [TUTORIAL](#tutorial)
* [TO DO](#to-do)

## Requirement

Make sure you have the following prerequisites installed on your system:

* python > [3.11](https://www.python.org/downloads/)
* ffmpeg [win](https://www.gyan.dev/ffmpeg/builds/)
* [python](https://www.python.org/downloads/) > 3.8
* [ffmpeg](https://www.gyan.dev/ffmpeg/builds/)

## Installation

Expand All @@ -51,124 +49,77 @@ python run.py
python3 run.py
```

## Update

Keep your script up to date with the latest features by running:

#### On Windows:

```powershell
python update.py
```

#### On Linux/MacOS:

```bash
python3 update.py
```

## Configuration

You can customize the behavior of the script by tweaking the configuration file.

---
You can change some behaviors by tweaking the configuration file.

### Options (DEFAULT)

- **get_moment_title**: Whether to fetch the title of the moment or not.
- **Default Value**: false

- **root_path**: Path where the script will add movies and TV series folders (see [Path Examples](#Path-examples)).
- **Default Value**: media/streamingcommunity

- **movies_folder_name**: The folder name where all the movies will be placed. Do not put a trailing slash.
- **Default Value**: Movies
* get_moment_title: Whether to fetch the title of the moment or not.
- Default Value: false

- **series_folder_name**: The folder name where all the TV series will be placed. Do not put a trailing slash.
- **Default Value**: Series
* root_path: Path where the script will add movies and TV series folders (see [Path Examples](#Path-examples)).
- Default Value: media/streamingcommunity

- **anime_folder_name**: The folder name where all the anime will be placed. Do not put a trailing slash.
- **Default Value**: Anime
* not_close: Whether to keep the application running after completion or not.
- Default Value: false

- **not_close**: Whether to keep the application running after completion or not.
- **Default Value**: false
* map_episode_name: Mapping to choose the name of all episodes of TV Shows (see [Episode Name Usage](#Episode-name-usage)).
- Default Value: %(episode_name)
- Example Value: %(tv_name) [S%(season)] [E%(episode)] %(episode_name)

---

### Options (M3U8)

- **tdqm_workers**: The number of workers that will cooperate to download .ts files. **A high value may slow down your PC**
- **Default Value**: 20
* tdqm_workers: The number of workers that will cooperate to download .ts files. **A high value may slow down your PC**
- Default Value: 20

- **tqdm_progress_timeout**: The timeout duration for progress display updates in seconds after quit download.
- **Default Value**: 10
* enable_time_quit: Whether to enable quitting the download after a certain time period.
- Default Value: false

- **use_openssl**: Indicates whether OpenSSL should be utilized for encryption during the conversion of TS files with key and IV.
- **Default Value**: false
* tqdm_show_progress: Whether to show progress during downloads or not.
- Default Value: true

- **use_codecs**: Specifies whether specific codecs (e.g., h264 for video, AAC for audio) should be used for converting TS files to MP4. **May slow down your PC**
- **Default Value**: false
* cleanup_tmp_folder: Whether to clean up temporary folders after processing or not.
- Default Value: true

- **enable_time_quit**: Whether to enable quitting the download after a certain time period.
- **Default Value**: false

- **tqdm_show_progress**: Whether to show progress during downloads or not. **May slow down your PC**
- **Default Value**: false

- **cleanup_tmp_folder**: Whether to clean up temporary folders after processing or not.
- **Default Value**: true

---
* fake_proxy: Speed up download for streaming film and series. **Dont work for anime, need to set to FALSE**
- Default Value: true

### Options (M3U8_OPTIONS)

- **download_audio**: Indicates whether audio files should be downloaded or not.
- **Default Value**: true

- **download_subtitles**: Indicates whether subtitles should be downloaded or not.
- **Default Value**: true

- **merge_subtitles**: Indicates if you want to merge subs in mp4 file or separate files .vtt
- **Default Value**: true

- **specific_list_audio**: A list of specific audio languages to download.
- **Default Value**: ["ita"]
- **Example Value**: ["eng", "fra"]

- **specific_list_subtitles**: A list of specific subtitle languages to download.
- **Default Value**: ["eng"]
- **Example Value**: ["spa", "por"]

- **map_episode_name**: Mapping to choose the name of all episodes of TV Shows (see [Episode Name Usage](#Episode-name-usage)).
- **Default Value**: %(tv_name)_S%(season)E%(episode)_%(episode_name)
- **Example Value**: %(tv_name) [S%(season)] [E%(episode)] %(episode_name)
* specific_list_audio: A list of specific audio languages to download.
- Example Value: ['ara', 'baq', 'cat', 'chi', 'cze', 'dan', 'dut', 'eng', 'fil', 'fin', 'forced-ita', 'fre', 'ger', 'glg', 'gre', 'heb', 'hin', 'hun', 'ind', 'ita', 'jpn', 'kan', 'kor', 'mal', 'may', 'nob', 'nor', 'pol', 'por', 'rum', 'rus', 'spa', 'swe', 'tam', 'tel', 'tha', 'tur', 'ukr', 'vie']

---

> [!IMPORTANT]
> If you're on **Windows**, you'll need to use double black slashes. On Linux/MacOS, one slash is fine.
> If you're on **Windows** you'll need to use double black slashes. On Linux/MacOS, one slash is fine.
#### Path examples:

* Windows: `C:\\MyLibrary\\Folder` or `\\\\MyServer\\MyLibrary` (if you want to use a network folder).
* Linux/MacOS: `Desktop/MyLibrary/Folder`

#### Episode name usage:

You can choose different vars:

* `%(tv_name)` : Is the name of TV Show
* `%(season)` : Is the number of the season
* `%(episode)` : Is the number of the episode
* `%(episode_name)` : Is the name of the episode
>NOTE: You don't need to add .mp4 at the end

> NOTE: You don't need to add .mp4 at the end
## 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
and to run it use

```
docker run -it -p 8000:8000 streaming-community-api
Expand All @@ -181,8 +132,5 @@ docker run -it -p 8000:8000 -v /path/to/download:/app/Video streaming-community-
```

## Tutorial
For a detailed walkthrough, refer to the [video tutorial](https://www.youtube.com/watch?v=Ok7hQCgxqLg&ab_channel=Nothing)

## To do
- Add a gui
- Add a website api
For a detailed walkthrough, refer to the [video tutorial](https://www.youtube.com/watch?v=Ok7hQCgxqLg&ab_channel=Nothing)
95 changes: 95 additions & 0 deletions Src/Api/Animeunity/Core/Class/EpisodeType.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# 03.03.24

from typing import Dict, Any, List


# Internal utilities
from Src.Util._jsonConfig import config_manager


# Config
SC_SITE_NAME = config_manager.get('SITE', 'streaming_site_name')
SC_DOMAIN_NOW = config_manager.get('SITE', 'streaming_domain')



class Image:
def __init__(self, image_data: Dict[str, Any]):
self.id: int = image_data.get('id', '')
self.filename: str = image_data.get('filename', '')
self.type: str = image_data.get('type', '')
self.imageable_type: str = image_data.get('imageable_type', '')
self.imageable_id: int = image_data.get('imageable_id', '')
self.created_at: str = image_data.get('created_at', '')
self.updated_at: str = image_data.get('updated_at', '')
self.original_url_field: str = image_data.get('original_url_field', '')
self.url: str = f"https://cdn.{SC_SITE_NAME}.{SC_DOMAIN_NOW}/images/{self.filename}"

def __str__(self):
return f"Image(id={self.id}, filename='{self.filename}', type='{self.type}', imageable_type='{self.imageable_type}', url='{self.url}')"


class Episode:
def __init__(self, data: Dict[str, Any]):
self.id: int = data.get('id', '')
self.number: int = data.get('number', '')
self.name: str = data.get('name', '')
self.plot: str = data.get('plot', '')
self.duration: int = data.get('duration', '')
self.scws_id: int = data.get('scws_id', '')
self.season_id: int = data.get('season_id', '')
self.created_by: str = data.get('created_by', '')
self.created_at: str = data.get('created_at', '')
self.updated_at: str = data.get('updated_at', '')
self.images: List[Image] = [Image(image_data) for image_data in data.get('images', [])]

def __str__(self):
return f"Episode(id={self.id}, number={self.number}, name='{self.name}', plot='{self.plot}', duration={self.duration} sec)"


class EpisodeManager:
def __init__(self):
self.episodes: List[Episode] = []

def add_episode(self, episode_data: Dict[str, Any]):
"""
Add a new episode to the manager.
Args:
- episode_data (Dict[str, Any]): A dictionary containing data for the new episode.
"""
episode = Episode(episode_data)
self.episodes.append(episode)

def get_episode_by_index(self, index: int) -> Episode:
"""
Get an episode by its index.
Args:
- index (int): Index of the episode to retrieve.
Returns:
Episode: The episode object.
"""
return self.episodes[index]

def get_length(self) -> int:
"""
Get the number of episodes in the manager.
Returns:
int: Number of episodes.
"""
return len(self.episodes)

def clear(self) -> None:
"""
This method clears the episodes list.
Args:
- self: The object instance.
"""
self.episodes.clear()

def __str__(self):
return f"EpisodeManager(num_episodes={len(self.episodes)})"
63 changes: 63 additions & 0 deletions Src/Api/Animeunity/Core/Class/PreviewType.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 12.04.24

class Preview:
def __init__(self, data):
self.id = data.get("id")
self.title_id = data.get("title_id")
self.created_at = data.get("created_at")
self.updated_at = data.get("updated_at")
self.video_id = data.get("video_id")
self.is_viewable = data.get("is_viewable")
self.zoom_factor = data.get("zoom_factor")
self.filename = data.get("filename")
self.embed_url = data.get("embed_url")

def __str__(self):
return f"Preview: ID={self.id}, Title ID={self.title_id}, Created At={self.created_at}, Updated At={self.updated_at}, Video ID={self.video_id}, Viewable={self.is_viewable}, Zoom Factor={self.zoom_factor}, Filename={self.filename}, Embed URL={self.embed_url}"

class Genre:
def __init__(self, data):
self.id = data.get("id")
self.name = data.get("name")
self.type = data.get("type")
self.hidden = data.get("hidden")
self.created_at = data.get("created_at")
self.updated_at = data.get("updated_at")
self.pivot = data.get("pivot")

def __str__(self):
return f"Genre: ID={self.id}, Name={self.name}, Type={self.type}, Hidden={self.hidden}, Created At={self.created_at}, Updated At={self.updated_at}, Pivot={self.pivot}"

class Image:
def __init__(self, data):
self.id = data.get("id")
self.filename = data.get("filename")
self.type = data.get("type")
self.imageable_type = data.get("imageable_type")
self.imageable_id = data.get("imageable_id")
self.created_at = data.get("created_at")
self.updated_at = data.get("updated_at")
self.original_url_field = data.get("original_url_field")

def __str__(self):
return f"Image: ID={self.id}, Filename={self.filename}, Type={self.type}, Imageable Type={self.imageable_type}, Imageable ID={self.imageable_id}, Created At={self.created_at}, Updated At={self.updated_at}, Original URL Field={self.original_url_field}"

class PreviewManager:
def __init__(self, json_data):
self.id = json_data.get("id")
self.type = json_data.get("type")
self.runtime = json_data.get("runtime")
self.release_date = json_data.get("release_date")
self.quality = json_data.get("quality")
self.plot = json_data.get("plot")
self.seasons_count = json_data.get("seasons_count")
self.genres = [Genre(genre_data) for genre_data in json_data.get("genres", [])]
self.preview = Preview(json_data.get("preview"))
self.images = [Image(image_data) for image_data in json_data.get("images", [])]

def __str__(self):
genres_str = "\n".join(str(genre) for genre in self.genres)
images_str = "\n".join(str(image) for image in self.images)
return f"Title: ID={self.id}, Type={self.type}, Runtime={self.runtime}, Release Date={self.release_date}, Quality={self.quality}, Plot={self.plot}, Seasons Count={self.seasons_count}\nGenres:\n{genres_str}\nPreview:\n{self.preview}\nImages:\n{images_str}"


Loading

0 comments on commit 129de75

Please sign in to comment.