A collection of powerful Termux scripts for downloading and managing audio and video content from YouTube. The scripts provide efficient tools for extracting media, compressing files, and keeping everything organized.
- Audio Extraction: Download audio in MP3 format from YouTube playlists.
- Video Download: Fetch entire videos from YouTube.
- Auto-Updating: Keep scripts and required dependencies up-to-date.
- File Compression: Zip downloaded media files for easy sharing.
- Organized Logs: Track successes and failures with detailed logs.
- Automated Cleanup: Remove old logs and temporary files to save space.
Downloads audio files from a YouTube playlist in MP3 format, organizes them into directories, and optionally compresses the files into a ZIP archive. It leverages Termux notifications for real-time user feedback and maintains detailed logs.
Features:
-
Audio Download:
- Extracts MP3 audio from a given YouTube playlist using yt-dlp.
- Ensures efficient downloads with parallel connections (up to 4 at a time).
-
File Compression:
- Prompts the user to zip the downloaded MP3 files into a single archive.
- Deletes original MP3 files after successful compression to conserve storage.
-
Dependency Management:
- Verifies required dependencies (yt-dlp, python, ffmpeg, zip, etc.).
- Automatically installs missing tools.
-
Logs and Notifications:
- Logs successful operations, errors, and failures in separate log files (download.log, failed.log).
- Sends real-time Termux notifications for progress, errors, and task completion.
-
Customizable Directories:
- Allows users to specify base and playlist directories.
- Automatically creates missing directories during execution.
-
File Cleanup:
- Removes logs older than 30 days and unused temporary files.
Usage:
-
Run the script:
./Extractor.sh
-
Enter the following details:
- Base directory (default:
/data/data/com.termux/files/home/storage/music/termux
) - Playlist directory name (default:
Beat_That
) - YouTube playlist URL (default: provided example URL)
- Base directory (default:
-
Choose whether to compress downloaded MP3 files.
-
The script will:
- Download MP3 files into the specified playlist directory.
- Zip the files if prompted.
Dependencies: The script installs and checks for the following tools:
- yt-dlp
- python and pip
- ffmpeg
- zip
- termux-api
Logs: Log Directory: Located in the playlist folder under logs/. Log Files:
download.log:
Tracks all script operations.failed.log:
Logs any failed downloads or tasks.error_summary.log:
Summarizes critical errors for review.
Termux Notifications:
- Real-Time Updates: Notifications during downloads, errors, and file compression.
- Interactive Buttons: Quick actions like viewing logs or dismissing notifications.
Ensures that Git is installed and up-to-date on your Termux environment, retrieves the latest changes from the Termux-Audio-Extractor- repository, and updates local scripts for immediate use. It also sets up the Termux Shortcuts directory for quick script execution.
Features:
-
Git Installation and Update:
- Checks if Git is installed.
- Installs Git if missing.
- Updates Git to the latest version.
-
Repository Management:
- Pulls the latest changes from the Termux-Audio-Extractor- repository.
- Discards any local changes to specific scripts (Extractor.sh, updaterX.sh, vidX.sh, zipX.sh) to ensure compatibility with the repository.
-
Shortcuts Setup:
- Copies updated scripts to the
~/.shortcuts/
directory. - Makes all scripts in the shortcuts directory executable.
- Copies updated scripts to the
-
Storage Permissions:
- Ensures Termux has proper storage permissions to manage files.
Usage:
-
Run the script:
./updaterX.sh
-
The script performs the following tasks:
- Installs or updates Git.
- Verifies the Git version.
- Navigates to the Termux-Audio-Extractor- repository directory.
- Retrieves the latest updates from the repository.
- Copies scripts to the Termux Shortcuts directory.
- Ensures all scripts are executable.
-
Storage Setup: If not already configured, grants Termux storage access using
termux-setup-storage
.
Key Directories and Files:
-
Repository Directory:
~/Termux-Audio-Extractor-
- This is the local clone of the GitHub repository.
-
Shortcuts Directory:
~/.shortcuts/
- Contains the updated scripts for quick access via Termux shortcuts.
-
Scripts Updated:
- Extractor.sh
- updaterX.sh
- vidX.sh
- zipX.sh
Dependencies:
- Git: Used to pull the latest repository changes.
Permissions:
- Grants storage access via Termux for managing files in shared directories.
- Ensures all scripts are executable for direct usage.
Downloads videos from a specified YouTube playlist in MP4 format, organizes them into directories, and optionally compresses the files into a ZIP archive. It includes detailed logging and Termux notifications for seamless user interaction.
Features:
-
Video Download:
- Downloads videos in MP4 format using yt-dlp.
- Supports parallel downloads for improved speed.
-
Optional File Compression:
- Prompts the user to ZIP the downloaded MP4 files.
- Deletes original MP4 files after successful compression to save space.
-
Detailed Logging:
- Logs all actions, including successful downloads, errors, and zipping, in timestamped log files.
- Maintains separate logs for general events (download.log) and failed operations (failed.log).
-
Termux Notifications:
- Sends real-time notifications for progress updates, errors, and completion of tasks.
- Includes interactive buttons for quick actions, such as viewing logs or dismissing notifications.
-
Automatic Dependency Management:
- Checks for and installs required packages (e.g., yt-dlp, python, ffmpeg, zip).
- Installs yt-dlp via pip or downloads it directly from GitHub if needed.
-
Customizable Directories:
- Allows users to specify base and playlist directories during setup.
- Creates directories automatically if they do not exist.
-
File Cleanup:
- Automatically removes logs older than 30 days and unused temporary files.
Usage:
-
Run the script:
./vidX.sh
-
Enter the following when prompted:
- Base directory for storing videos (default:
/data/data/com.termux/files/home/storage/movies/termux
) - Playlist directory name (default:
Beat_That
) - YouTube playlist URL (default: a sample playlist URL)
- Base directory for storing videos (default:
-
Choose whether to compress downloaded MP4 files into a ZIP archive.
Dependencies: The script installs and checks for the following tools:
- yt-dlp
- python and pip
- ffmpeg
- zip
- termux-api
Logs:
Logs are saved in a logs
subdirectory within the playlist folder:
download.log:
Tracks all script activities.failed.log:
Records any failed downloads or tasks.
Termux Notifications: Notifications highlight critical events like downloads, errors, and file compression. Notifications include interactive buttons for quick log access or dismissal.
Provides a tool for managing and extracting files from ZIP archives in predefined directories.
Features:
- Search for ZIP Files: Automatically scans specified directories for ZIP archives.
- List ZIP Contents: Displays the contents of selected ZIP files for review.
- Selective Extraction: Allows users to extract specific files from a ZIP archive into the same directory.
- Logging: Records actions, including successful and failed operations, in a log file located in the same directory as the selected ZIP file.
Usage:
- Run the script:
./zipX.sh
- Select a ZIP file from the list displayed.
- View the contents of the selected ZIP file.
- Choose specific files to extract by entering their corresponding numbers.
- Extracted files will be saved in the same directory as the ZIP archive.
Predefined Directories:
/data/data/com.termux/files/home/storage/movies/termux
/data/data/com.termux/files/home/storage/music/termux
- Termux: Installed on your Android device.
- Permissions: Storage permissions enabled for Termux.
- Internet Connection: Required for downloading media and dependencies.
A versatile script for compressing directories in specified locations using various formats (ZIP, TAR.GZ, 7Z) and compression levels.
-
Directory Selection
- Automatically lists and allows selection of directories for compression within predefined base directories.
- Base directories include music and movies storage locations.
-
Compression Options
- Supports multiple compression formats: ZIP, TAR.GZ, and 7Z.
- Offers three compression levels: low, medium, and high, to balance between speed and file size.
-
Dependency Management
- Ensures required tools (zip, tar, 7z) are installed. Installs missing dependencies automatically.
-
Decompression Handling
- Detects and decompresses existing compressed files within the selected directory before proceeding with new compression.
-
Logging
- Maintains detailed logs of actions, errors, and progress in a designated log file (
compressX.log
).
- Maintains detailed logs of actions, errors, and progress in a designated log file (
-
Error Handling
- Robust error handling and logging to ensure smooth operation.
-
Run the script:
./CompressX.sh
-
Follow the prompts to:
- Select the directory to compress from the listed options.
- Choose the compression format (ZIP, TAR.GZ, 7Z).
- Select the desired compression level (low, medium, high).
-
The script will:
- Ensure all necessary tools are installed.
- Decompress any existing compressed files in the selected directory.
- Compress the selected directory according to the chosen format and compression level.
- Log all actions in
compressX.log
.
- Location:
$HOME/compressX.log
- Contents: Includes timestamps, messages about dependency checks, directory selections, compression actions, and error details.
- zip
- tar
- 7z
- termux-api (for Termux notifications)
A script for decompressing various formats (ZIP, TAR.GZ, 7Z) in specified directories, with robust logging and error handling.
-
Directory Selection
- Lists and allows selection of directories for decompression within predefined base directories.
- Base directories include music and movies storage locations.
-
Decompression Options
- Supports multiple decompression formats: ZIP, TAR.GZ, and 7Z.
- Lists compressed files in the selected directory for user selection.
-
Dependency Management
- Ensures required tools (unzip, tar, 7z) are installed. Installs missing dependencies automatically.
-
Logging
- Maintains detailed logs of actions, errors, and progress in a designated log file (
decompressX.log
).
- Maintains detailed logs of actions, errors, and progress in a designated log file (
-
Error Handling
- Robust error handling and logging to ensure smooth operation.
-
Run the script:
./DcomX.sh
-
Follow the prompts to:
- Select the directory to decompress from the listed options.
- Choose the compressed file to decompress.
-
The script will:
- Ensure all necessary tools are installed.
- List available compressed files for selection.
- Decompress the selected file into the directory.
- Log all actions in
decompressX.log
.
- Location:
$HOME/decompressX.log
- Contents: Includes timestamps, messages about dependency checks, directory selections, decompression actions, and error details.
- unzip
- tar
- 7z
- termux-api (for Termux notifications)
These formatted sections should be ready to integrate into your GitHub repository. If you need further adjustments or additional formatting, feel free to ask!
-
Clone the repository:
git clone https://github.com/podcastmatt0285/Termux-Audio-Extractor-.git
-
Navigate to the folder:
cd Termux-Audio-Extractor-
-
Make all scripts executable:
chmod +x *.sh
Use Extractor.sh
to download audio files from YouTube playlists:
./Extractor.sh
Follow the prompts to:
- Set the base directory for downloads.
- Name the playlist folder.
- Provide the YouTube playlist URL.
- Optionally zip the audio files after downloading.
Keep scripts and packages up to date with updaterX.sh
:
./updaterX.sh
Use vidX.sh
to download videos from YouTube playlists:
./vidX.sh
Use zipX.sh
to compress downloaded media into a ZIP file:
./zipX.sh
Logs are saved in the logs
directory within your chosen playlist folder:
download.log:
Records successful downloads.failed.log:
Logs failed downloads.
Automatically deletes old logs and temporary files (older than 30 days) during script execution. Manual cleanup can be performed by running the appropriate functions in the scripts.
This project is licensed under the MIT License.