diff --git a/README.md b/README.md index a27538b..28c64ca 100644 --- a/README.md +++ b/README.md @@ -2,24 +2,29 @@ video working

-## StreamingCommunity Downloader -

- video working -

+## 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.gg/RtHRvRXU -## 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. +# Table of Contents +* [INSTALLATION](#installation) + * [Requirement](#requirement) + * [Usage](#usage) + * [Update](#update) + +* [FEATURES](#features) +* [USAGE AND OPTIONS](#options) +* [TUTORIAL](#tutorial) ## 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/) -## Installation library + +## Installation Install the required Python libraries using the following command: ``` pip install -r requirements.txt @@ -27,6 +32,7 @@ pip install -r requirements.txt ## Usage Run the script with the following command: + #### On Windows: ```powershell python run.py @@ -37,28 +43,28 @@ python run.py python3 run.py ``` -## Auto Update + +## 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 ``` + ## Features - 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 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. ## Configuration - You can change some behaviors by tweaking the configuration file. ```json @@ -71,6 +77,7 @@ You can change some behaviors by tweaking the configuration file. "selected_language": "English", "max_worker": 20 } + ``` #### Options | Key | Default Value | Description | Value Example | @@ -89,11 +96,7 @@ You can change some behaviors by tweaking the configuration file. #### Path examples: * Windows: `C:\\MyLibrary\\Folder` or `\\\\MyServer\\MyLibrary` (if you want to use a network folder). - * Linux/MacOS: `Desktop/MyLibrary/Folder` ## Tutorial -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) +For a detailed walkthrough, refer to the [video tutorial](https://www.youtube.com/watch?v=Ok7hQCgxqLg&ab_channel=Nothing) \ No newline at end of file diff --git a/Src/Assets/run.gif b/Src/Assets/run.gif deleted file mode 100644 index 427b060..0000000 Binary files a/Src/Assets/run.gif and /dev/null differ diff --git a/Src/Upload/__version__.py b/Src/Upload/__version__.py index c1bde9b..0448e89 100644 --- a/Src/Upload/__version__.py +++ b/Src/Upload/__version__.py @@ -1,5 +1,5 @@ __title__ = 'Streaming_community' -__version__ = 'v0.9.0' +__version__ = 'v0.9.1' __author__ = 'Ghost6446' __description__ = 'A command-line program to download film' __license__ = 'MIT License' diff --git a/update.py b/update.py index e6789a9..9743ed8 100644 --- a/update.py +++ b/update.py @@ -10,32 +10,27 @@ from rich.console import Console console = Console() local_path = os.path.join(".") -def move_content(source, destination): - +def move_content(source: str, destination: str) : os.makedirs(destination, exist_ok=True) - # Iterate through all elements in the source folder for element in os.listdir(source): source_path = os.path.join(source, element) destination_path = os.path.join(destination, element) - # If it's a directory, recursively call the function if os.path.isdir(source_path): move_content(source_path, destination_path) + else: - # Otherwise, move the file, replacing if it already exists 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: if not os.path.exists(directory) or not os.path.isdir(directory): raise ValueError(f"Error: '{directory}' is not a valid directory.") - # Iterate through items in the directory for item in os.listdir(directory): 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: shutil.rmtree(item_path) 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: print(f"PermissionError: {pe}. Check permissions and try running the script with admin privileges.") + except Exception as 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' response = requests.get(api_url) console.log("[green]Making a request to GitHub repository...") - if response.status_code == 200: + if response.ok: commit_info = response.json()[0] commit_sha = commit_info['sha'] zipball_url = f'https://github.com/{author}/{repo_name}/archive/{commit_sha}.zip' console.log("[green]Getting zip file from repository...") - - # Download the zipball 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') with ZipFile(BytesIO(response.content)) as zip_ref: zip_ref.extractall(temp_path) console.log("[green]Extracting file ...") - - # Move files from the temporary folder to the current folder for item in os.listdir(temp_path): item_path = os.path.join(temp_path, item) destination_path = os.path.join(local_path, item) shutil.move(item_path, destination_path) - # Remove the temporary folder shutil.rmtree(temp_path) - - # Move all folder to main folder new_folder_name = f"{repo_name}-{commit_sha}" move_content(new_folder_name, ".") - - # Remove old temp folder shutil.rmtree(new_folder_name) - console.log(f"[cyan]Latest commit downloaded and extracted successfully.") else: console.log(f"[red]Failed to fetch commit information. Status code: {response.status_code}") def main_upload(): - repository_owner = 'Ghost6446' repository_name = 'StreamingCommunity_api' - # Remove all old file - keep_specific_items(".", "videos", "upload.py") + cmd_insert = input("Are you sure you want to delete all files? (Only videos folder will remain) [yes/no]: ") - 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()