mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 12:05:35 +00:00
fix update
This commit is contained in:
parent
448be26caf
commit
5300ed9fb5
37
README.md
37
README.md
@ -2,24 +2,29 @@
|
|||||||
<img src="Src/Assets/min_logo.png" style="max-width: 55%;" alt="video working" />
|
<img src="Src/Assets/min_logo.png" style="max-width: 55%;" alt="video working" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## StreamingCommunity Downloader
|
## Overview.
|
||||||
<p align="center">
|
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.
|
||||||
<img src="Src/Assets/run.gif" style="max-width: 55%;" alt="video working" />
|
|
||||||
</p>
|
|
||||||
|
|
||||||
## Join us
|
## Join us
|
||||||
You can chat, help improve this repo, or just hang around for some fun in the **Git_StreamingCommunity** Discord Server: https://discord.gg/RtHRvRXU
|
You can chat, help improve this repo, or just hang around for some fun in the **Git_StreamingCommunity** Discord Server: https://discord.gg/RtHRvRXU
|
||||||
|
|
||||||
## Overview.
|
# Table of Contents
|
||||||
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.
|
* [INSTALLATION](#installation)
|
||||||
|
* [Requirement](#requirement)
|
||||||
|
* [Usage](#usage)
|
||||||
|
* [Update](#update)
|
||||||
|
|
||||||
|
* [FEATURES](#features)
|
||||||
|
* [USAGE AND OPTIONS](#options)
|
||||||
|
* [TUTORIAL](#tutorial)
|
||||||
|
|
||||||
## Requirement
|
## Requirement
|
||||||
Make sure you have the following prerequisites installed on your system:
|
Make sure you have the following prerequisites installed on your system:
|
||||||
|
|
||||||
* python > [3.11](https://www.python.org/downloads/)
|
* python > [3.11](https://www.python.org/downloads/)
|
||||||
* ffmpeg [win](https://www.gyan.dev/ffmpeg/builds/)
|
* ffmpeg [win](https://www.gyan.dev/ffmpeg/builds/)
|
||||||
|
|
||||||
## Installation library
|
|
||||||
|
## Installation
|
||||||
Install the required Python libraries using the following command:
|
Install the required Python libraries using the following command:
|
||||||
```
|
```
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
@ -27,6 +32,7 @@ pip install -r requirements.txt
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
Run the script with the following command:
|
Run the script with the following command:
|
||||||
|
|
||||||
#### On Windows:
|
#### On Windows:
|
||||||
```powershell
|
```powershell
|
||||||
python run.py
|
python run.py
|
||||||
@ -37,28 +43,28 @@ python run.py
|
|||||||
python3 run.py
|
python3 run.py
|
||||||
```
|
```
|
||||||
|
|
||||||
## Auto Update
|
|
||||||
|
## Update
|
||||||
Keep your script up to date with the latest features by running:
|
Keep your script up to date with the latest features by running:
|
||||||
|
|
||||||
#### On Windows:
|
#### On Windows:
|
||||||
```powershell
|
```powershell
|
||||||
python update.py
|
python update.py
|
||||||
```
|
```
|
||||||
|
|
||||||
#### On Linux/MacOS:
|
#### On Linux/MacOS:
|
||||||
```bash
|
```bash
|
||||||
python3 update.py
|
python3 update.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
- Download Single Film: Easily download individual movies with a simple command.
|
- Download Single Film: Easily download individual movies with a simple command.
|
||||||
|
|
||||||
- Download Specific Episodes or Entire Series: Seamlessly retrieve specific episodes or entire series using intuitive commands. Specify a range of episodes with square brackets notation, e.g., [5-7], or download all episodes with an asterisk (*).
|
- Download Specific Episodes or Entire Series: Seamlessly retrieve specific episodes or entire series using intuitive commands. Specify a range of episodes with square brackets notation, e.g., [5-7], or download all episodes with an asterisk (*).
|
||||||
|
|
||||||
- Download Subtitles: Automatically fetch subtitles if available for downloaded content. (Note: To disable this feature, see [Configuration](#configuration))
|
- Download Subtitles: Automatically fetch subtitles if available for downloaded content. (Note: To disable this feature, see [Configuration](#configuration))
|
||||||
|
|
||||||
- Sync Audio and Video: Ensure perfect synchronization between audio and video during the download process for an enhanced viewing experience.
|
- Sync Audio and Video: Ensure perfect synchronization between audio and video during the download process for an enhanced viewing experience.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
You can change some behaviors by tweaking the configuration file.
|
You can change some behaviors by tweaking the configuration file.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@ -71,6 +77,7 @@ You can change some behaviors by tweaking the configuration file.
|
|||||||
"selected_language": "English",
|
"selected_language": "English",
|
||||||
"max_worker": 20
|
"max_worker": 20
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
#### Options
|
#### Options
|
||||||
| Key | Default Value | Description | Value Example |
|
| Key | Default Value | Description | Value Example |
|
||||||
@ -89,11 +96,7 @@ You can change some behaviors by tweaking the configuration file.
|
|||||||
#### Path examples:
|
#### Path examples:
|
||||||
|
|
||||||
* Windows: `C:\\MyLibrary\\Folder` or `\\\\MyServer\\MyLibrary` (if you want to use a network folder).
|
* Windows: `C:\\MyLibrary\\Folder` or `\\\\MyServer\\MyLibrary` (if you want to use a network folder).
|
||||||
|
|
||||||
* Linux/MacOS: `Desktop/MyLibrary/Folder`
|
* Linux/MacOS: `Desktop/MyLibrary/Folder`
|
||||||
|
|
||||||
## Tutorial
|
## Tutorial
|
||||||
For a detailed walkthrough, refer to the [video tutorial](https://www.youtube.com/watch?v=Ok7hQCgxqLg&ab_channel=Nothing)
|
For a detailed walkthrough, refer to the [video tutorial](https://www.youtube.com/watch?v=Ok7hQCgxqLg&ab_channel=Nothing)
|
||||||
|
|
||||||
## Authors
|
|
||||||
- [@Ghost6446](https://www.github.com/Ghost6446)
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 7.1 MiB |
@ -1,5 +1,5 @@
|
|||||||
__title__ = 'Streaming_community'
|
__title__ = 'Streaming_community'
|
||||||
__version__ = 'v0.9.0'
|
__version__ = 'v0.9.1'
|
||||||
__author__ = 'Ghost6446'
|
__author__ = 'Ghost6446'
|
||||||
__description__ = 'A command-line program to download film'
|
__description__ = 'A command-line program to download film'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
38
update.py
38
update.py
@ -10,32 +10,27 @@ from rich.console import Console
|
|||||||
console = Console()
|
console = Console()
|
||||||
local_path = os.path.join(".")
|
local_path = os.path.join(".")
|
||||||
|
|
||||||
def move_content(source, destination):
|
def move_content(source: str, destination: str) :
|
||||||
|
|
||||||
os.makedirs(destination, exist_ok=True)
|
os.makedirs(destination, exist_ok=True)
|
||||||
|
|
||||||
# Iterate through all elements in the source folder
|
|
||||||
for element in os.listdir(source):
|
for element in os.listdir(source):
|
||||||
source_path = os.path.join(source, element)
|
source_path = os.path.join(source, element)
|
||||||
destination_path = os.path.join(destination, element)
|
destination_path = os.path.join(destination, element)
|
||||||
|
|
||||||
# If it's a directory, recursively call the function
|
|
||||||
if os.path.isdir(source_path):
|
if os.path.isdir(source_path):
|
||||||
move_content(source_path, destination_path)
|
move_content(source_path, destination_path)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Otherwise, move the file, replacing if it already exists
|
|
||||||
shutil.move(source_path, destination_path)
|
shutil.move(source_path, destination_path)
|
||||||
|
|
||||||
def keep_specific_items(directory, keep_folder, keep_file):
|
def keep_specific_items(directory: str, keep_folder: str, keep_file: str):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not os.path.exists(directory) or not os.path.isdir(directory):
|
if not os.path.exists(directory) or not os.path.isdir(directory):
|
||||||
raise ValueError(f"Error: '{directory}' is not a valid directory.")
|
raise ValueError(f"Error: '{directory}' is not a valid directory.")
|
||||||
|
|
||||||
# Iterate through items in the directory
|
|
||||||
for item in os.listdir(directory):
|
for item in os.listdir(directory):
|
||||||
item_path = os.path.join(directory, item)
|
item_path = os.path.join(directory, item)
|
||||||
|
|
||||||
# Check if the item is the specified folder or file
|
|
||||||
if os.path.isdir(item_path) and item != keep_folder:
|
if os.path.isdir(item_path) and item != keep_folder:
|
||||||
shutil.rmtree(item_path)
|
shutil.rmtree(item_path)
|
||||||
elif os.path.isfile(item_path) and item != keep_file:
|
elif os.path.isfile(item_path) and item != keep_file:
|
||||||
@ -43,60 +38,49 @@ def keep_specific_items(directory, keep_folder, keep_file):
|
|||||||
|
|
||||||
except PermissionError as pe:
|
except PermissionError as pe:
|
||||||
print(f"PermissionError: {pe}. Check permissions and try running the script with admin privileges.")
|
print(f"PermissionError: {pe}. Check permissions and try running the script with admin privileges.")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error: {e}")
|
print(f"Error: {e}")
|
||||||
|
|
||||||
def download_and_extract_latest_commit(author, repo_name):
|
def download_and_extract_latest_commit(author: str, repo_name: str):
|
||||||
|
|
||||||
# Get the latest commit information using GitHub API
|
|
||||||
api_url = f'https://api.github.com/repos/{author}/{repo_name}/commits?per_page=1'
|
api_url = f'https://api.github.com/repos/{author}/{repo_name}/commits?per_page=1'
|
||||||
response = requests.get(api_url)
|
response = requests.get(api_url)
|
||||||
console.log("[green]Making a request to GitHub repository...")
|
console.log("[green]Making a request to GitHub repository...")
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.ok:
|
||||||
commit_info = response.json()[0]
|
commit_info = response.json()[0]
|
||||||
commit_sha = commit_info['sha']
|
commit_sha = commit_info['sha']
|
||||||
zipball_url = f'https://github.com/{author}/{repo_name}/archive/{commit_sha}.zip'
|
zipball_url = f'https://github.com/{author}/{repo_name}/archive/{commit_sha}.zip'
|
||||||
console.log("[green]Getting zip file from repository...")
|
console.log("[green]Getting zip file from repository...")
|
||||||
|
|
||||||
# Download the zipball
|
|
||||||
response = requests.get(zipball_url)
|
response = requests.get(zipball_url)
|
||||||
|
|
||||||
# Extract the content of the zipball into a temporary folder
|
|
||||||
temp_path = os.path.join(os.path.dirname(os.getcwd()), 'temp_extracted')
|
temp_path = os.path.join(os.path.dirname(os.getcwd()), 'temp_extracted')
|
||||||
with ZipFile(BytesIO(response.content)) as zip_ref:
|
with ZipFile(BytesIO(response.content)) as zip_ref:
|
||||||
zip_ref.extractall(temp_path)
|
zip_ref.extractall(temp_path)
|
||||||
console.log("[green]Extracting file ...")
|
console.log("[green]Extracting file ...")
|
||||||
|
|
||||||
|
|
||||||
# Move files from the temporary folder to the current folder
|
|
||||||
for item in os.listdir(temp_path):
|
for item in os.listdir(temp_path):
|
||||||
item_path = os.path.join(temp_path, item)
|
item_path = os.path.join(temp_path, item)
|
||||||
destination_path = os.path.join(local_path, item)
|
destination_path = os.path.join(local_path, item)
|
||||||
shutil.move(item_path, destination_path)
|
shutil.move(item_path, destination_path)
|
||||||
|
|
||||||
# Remove the temporary folder
|
|
||||||
shutil.rmtree(temp_path)
|
shutil.rmtree(temp_path)
|
||||||
|
|
||||||
# Move all folder to main folder
|
|
||||||
new_folder_name = f"{repo_name}-{commit_sha}"
|
new_folder_name = f"{repo_name}-{commit_sha}"
|
||||||
move_content(new_folder_name, ".")
|
move_content(new_folder_name, ".")
|
||||||
|
|
||||||
# Remove old temp folder
|
|
||||||
shutil.rmtree(new_folder_name)
|
shutil.rmtree(new_folder_name)
|
||||||
|
|
||||||
console.log(f"[cyan]Latest commit downloaded and extracted successfully.")
|
console.log(f"[cyan]Latest commit downloaded and extracted successfully.")
|
||||||
else:
|
else:
|
||||||
console.log(f"[red]Failed to fetch commit information. Status code: {response.status_code}")
|
console.log(f"[red]Failed to fetch commit information. Status code: {response.status_code}")
|
||||||
|
|
||||||
def main_upload():
|
def main_upload():
|
||||||
|
|
||||||
repository_owner = 'Ghost6446'
|
repository_owner = 'Ghost6446'
|
||||||
repository_name = 'StreamingCommunity_api'
|
repository_name = 'StreamingCommunity_api'
|
||||||
|
|
||||||
# Remove all old file
|
cmd_insert = input("Are you sure you want to delete all files? (Only videos folder will remain) [yes/no]: ")
|
||||||
keep_specific_items(".", "videos", "upload.py")
|
|
||||||
|
|
||||||
download_and_extract_latest_commit(repository_owner, repository_name)
|
if cmd_insert == "yes":
|
||||||
|
keep_specific_items(".", "videos", "upload.py")
|
||||||
|
download_and_extract_latest_commit(repository_owner, repository_name)
|
||||||
|
|
||||||
main_upload()
|
main_upload()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user