bragir translator cli
Project description
Bragir
Description
The bragir CLI is a command-line application built using Click. Its primary purpose is to handle and generate SubRip Subtitle (SRT) files using ChatGPT and Whisper from Openai.
Features
- Translation: Translate the content of SRT files from one language to another using ChatGPT.
- Transcription: Trancribe the content of video and audio files from one language to another using Whisper.
- Batch Processing: Process a single file, multiple files, or an entire directory, providing flexibility and efficiency.
- Easy-to-Use Interface: Utilize a user-friendly command-line interface powered by Click, making translation tasks straightforward.
Table of Contents
Installation
In order to use the full potential of Bragir, FFmpeg is needed to be installed on the system and you need to obtain an Openai key.
FFmpeg
Macos
Using brew
brew update && brew install ffmpeg
Linux
Update avaiable linux packages
sudo apt update
Install ffmpeg
sudo apt install ffmpeg
Windows
Download the .exe from official ffmpeg-website
Extract the contents of the zip file and rename the file to FFmpeg.
Move the folder into the main drive (Usually c:/)
Open command prompt as administrator, and add FFmpeg to your system path
setx /m PATH "C:\ffmpeg\bin;%PATH%"
Verifyting the installation In order to see if the installation of FFmpeg is correct, run the following command
ffmpeg --version
If a version is displayed, then FFmpeg is installed correctly.
OpenAI
Currently, this tool relise on OpenAIs API. That means that an OpenAI api-key is crucial. See the following resource of how to get an OpenAI api-key
Bragir
Use pip to install Bragir
pip install bragir
Check if installation is complete
bragir --version
If a version is displayed, then Bragir is installed correctly.
Usage
Bragir comes with two commands, transcribe and translate. Transcribe will always generate an file with extension .srt
. The translate command has only been tested with SRT-files, however other files would work. However, Bragir is not intended to translate other file types
In order to use bragir, the api key can be loaded into the session or saved in the config.ini file (Default at ~/.bragir/cli/config.ini
).
Load Openai key as an enviroment variable into current session
export OPENAI_KEY=<VALUE>
Examples
Translate a single file to one language:
bragir translate <FILE_PATH> --language French
Translate one file to multiple languages:
bragir translate <FILE_PATH> --language French --language German
Translate files in a directory to multiple languages:
bragir translate <DIRECTORY_PATH> --language French --language German
Transcribe file:
bragir transcribe <FILE_PATH>
Transcribe files in a directory:
bragir transcribe <DIRECTORY_PATH>
Contributing
If you want to contribute to this project, please use the following steps:
- Fork the project.
- Create a new branch (git checkout -b feature/awesome-feature).
- Commit your changes (git commit -m 'Add some feature').
- Push to the branch (git push origin feature/awesome-feature).
- Open a pull request.
Commit Message Structure
This projects aims to follow the Conventional Commits guidelines.
When writing commit messages, use one of the following categories to clearly describe the purpose of your commit:
- feat / feature: ✨ Introducing new features
- fix / bugfix: 🐛 Addressing bug fixes
- perf: 🚀 Enhancing performance
- refactor: 🔄 Refactoring code - Not displayed in CHANGELOG
- test / tests: ✅ Adding or updating tests - Not displayed in CHANGELOG
- build / ci: 🛠️ Build system or CI/CD updates - Not displayed in CHANGELOG
- doc / docs: 📚 Documentation changes - Not displayed in CHANGELOG
- style: 🎨 Code style or formatting changes - Not displayed in CHANGELOG
- chore: 🔧 Miscellaneous chores
- other: 🌟 Other significant changes
Example Commit Messages
feat: Add cool new feature
fix: Resolve unexpected behavior with translation
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bragir-1.4.0.tar.gz
.
File metadata
- Download URL: bragir-1.4.0.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e7584334114f4c2f7c58a46b67ee22ea07e8f4c7a7703df1db3a43db8bb32e8 |
|
MD5 | 6bc678ccffdef6adfafebb24f706dddf |
|
BLAKE2b-256 | ef593bcbedfc41efa0bb36510588a64311bd1ce9c82190c8d5ac84c8653cc479 |
Provenance
The following attestation bundles were made for bragir-1.4.0.tar.gz
:
Publisher:
release.yaml
on ArjanCodes/bragir
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
bragir-1.4.0.tar.gz
- Subject digest:
7e7584334114f4c2f7c58a46b67ee22ea07e8f4c7a7703df1db3a43db8bb32e8
- Sigstore transparency entry: 147555729
- Sigstore integration time:
- Predicate type:
File details
Details for the file bragir-1.4.0-py3-none-any.whl
.
File metadata
- Download URL: bragir-1.4.0-py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffbb829c45e11953bd2a1115ed2c1fac1f89ed29cfa34f86e18a083095839057 |
|
MD5 | 309e3ce78cab5b56adfe63a505815704 |
|
BLAKE2b-256 | d43d183d0562b28862bf42d82199a830bb68cf5b413e5b5417c7dc69e795a389 |
Provenance
The following attestation bundles were made for bragir-1.4.0-py3-none-any.whl
:
Publisher:
release.yaml
on ArjanCodes/bragir
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
bragir-1.4.0-py3-none-any.whl
- Subject digest:
ffbb829c45e11953bd2a1115ed2c1fac1f89ed29cfa34f86e18a083095839057
- Sigstore transparency entry: 147555731
- Sigstore integration time:
- Predicate type: