Welcome to the Media Renamer project! This tool helps you rename media files (videos and subtitles) in a specified directory based on a format you provide. It also offers the option to delete obsolete files that aren't video or subtitle files. The renaming process utilizes the Gemini API to generate new names based on your specified format.
This repository also contains manual.py which can be used to rename your files manually without using any LLM API. The usage procedure for manual.py is same as Automated.py, except you don't need to install google-generativeai
Enjoy! ^-^
- Features
- Supported Formats
- Installation
- Usage
- Example
- Compatibility
- Issues
- Contributing
- Acknowledgements
- License
- Rename Media Files: Automatically rename video files in a directory based on your specified format.
- Delete Obsolete Files: Optionally delete files that are neither video nor subtitle files.
- User-Friendly Prompts: Interactive prompts guide you through the renaming process.
- Gemini API Integration: Utilizes Google Gemini API for accurate file renaming.
- Video Formats:
.mp4
,.avi
,.mkv
,.mov
,.wmv
,.flv
,.m4v
,.mpg
,.mpeg
,.3gp
,.3g2
,.webm
,.vob
,.ogv
,.ts
- Subtitle Formats:
.srt
,.vtt
,.sbv
,.sub
,.ass/.ssa
,.dfxp
Feel free to adjust these formats to suit your needs. Simply modify the format tuples in the beginning of the python script.
-
Clone the Repository
git clone https://github.com/yourusername/media-renamer.git cd media-renamer
-
Install Dependencies
pip install google-generativeai
-
Set Up Gemini API Key
Obtain your API key from Google Gemini and set it as an environment variable.
export GOOGLE_API_KEY='your_api_key_here' # On Windows use `set GOOGLE_API_KEY=your_api_key_here`
-
Run the Program
python Automated.py
-
Follow the Prompts
- Enter the directory containing the media files you want to rename.
- Provide the format for renaming the files.
- Give an example of a current file name and the desired output format for the new name.
- Decide whether to delete obsolete files or not.
Welcome to Media Renamer!
Please enter the directory to be renamed:
/path/to/your/directory
Please enter the format you would like the files to be renamed in:
{show name} SXXEXX {title name}
Enter an example name to be changed:
Thisshow.S1.EP20.ThisSource.1080pABC.mp4
Enter the accurate output desired for the given example:
This Show S01E20 That Source.mp4
File with name Thisshow.S1.EP20.ThisSource.1080pABC.mp4 renamed to This Show S01E20 That Source.mp4 successfully.
Do you want to delete obsolete files in this directory?
1. Yes
2. No
1
X files in the directory /path/to/your/directory renamed and Y obsolete files deleted successfully.
Do you want to rename any other directory?
1. Yes
2. No
2
Thank you for using Media Renamer! :)
It might look like its manual but once you have given an example, The rest of them will be renamed automatically.
- Operating Systems: Compatible with Windows, macOS, and Linux distributions.
- Python Versions: Supports Python 3.x and above.
- Dependencies: Requires
google-generativeai
library and Python standard libraries.
- Windows might face errors while renaming files if the directory has special characters in its name. Simply removing special characters from the directory/path solves the issue.
Feel free to fork this repository, make improvements, and submit pull requests. Contributions to enhance functionality or fix bugs are welcome.
We thank the Google Gemini API for its powerful renaming capabilities and all users for their support and feedback. Happy renaming!
This project is licensed under the MIT License. See the LICENSE file for more details.
Thank you for using Media Renamer! If you have any issues or suggestions, please open an issue on GitHub. ^-^