-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker package ? #150
Comments
I don't know much about docker, you'll have to give me more details :-) |
I'm afraid i can't. I'm just a basic user.... |
I could consider doing this. No promises, but I'll keep it in mind. |
Any wishes on how it would operate? Via as a permament service, http-API or via just running docker-image as a task? |
Well, for unraid, a docker image seems the better way, don't you think so ? |
Well, yes, but I don't have any idea what kind of API Bazarr expects from the image |
I asked about it here ! |
Bazarr is written in Python and this is the file for Whisper AI, which I believe will be similar to GPT |
Just checking if the project is still on track. |
ok so, i've asked GPT-4TO how to install GPT-subtrans onto an an uraid server, and use it inside Bazarr ? Here is his answer. It may be a good base, but i've tried and get an error when creating the container (entering Github link)
dockerfile
o Build the Docker image:
o Run the container: docker run -d -p 8501:8501 --name=gpt-subtrans-gui -v /mnt/user/appdata/gpt-subtrans/config:/app/config -v /mnt/user/appdata/gpt-subtrans/subtitles:/app/subtitles gpt-subtrans-gui Verify Container Logs 1. Check Container Logs for Errors: docker logs gpt-subtrans-gui
#!/bin/bash SUBTITLES_DIR="/mnt/user/appdata/bazarr/subtitles" detect_language() { file_path = sys.argv[1] def read_subtitle_file(file_path): try: END inotifywait -m -e create "$SUBTITLES_DIR" | while read path action file; do
done Integrate with Bazarr 1. Configure Bazarr to Use the Subtitles Directory: Example requirements.txt Add other necessary dependencies hereBy following these steps, you should be able to install and run GPT-Subtrans with its GUI on Unraid and integrate it with Bazarr using a post-processing script. If you encounter any errors, check the container logs for more information and adjust the script accordingly. If you need further assistance with specific errors, please provide the error messages for more detailed help. |
Why not just call "python3 batch_process.py" with added IF statement ointing to his video folder, from Bazarr post procesing? If all required stuff is installed, and as Bazarr is written in Python, I guess that will work just fine. Remember to edit that file to your setup |
my skills are very limited. To if you could elaborate a bit on that, what would be great |
i've asked GPT about that. Below is tutorial. Any errors ? Tutorial: Integrate GPT Subtrans with Bazarr Using a Post-Processing Script Configure Bazarr to automatically execute batch_process.py after subtitle downloads, with a condition that checks if the video file is located in a specific folder. Step 1: Prerequisites The batch_process.py script is functional and executable from the command line. 3.1. Create the bazarr_postprocess.sh Script Create a file named bazarr_postprocess.sh in a directory accessible by Bazarr, for example, /usr/local/bin/bazarr_postprocess.sh. Script Content: bash Paths passed as arguments by BazarrSUBTITLE_PATH="$1" Path to the target video folderTARGET_VIDEO_FOLDER="/path/to/your/video/folder" Check if the video file is in the target folderif [[ "$VIDEO_PATH" == "$TARGET_VIDEO_FOLDER"* ]]; then
else Replace /path/to/your/video/folder with the actual path to your video folder. Replace /path/to/batch_process.py with the actual path to your batch_process.py script. Ensure that the batch_process.py script is executable and works correctly. Make the script executable: bash Open Bazarr's web interface. Enable the "Post-Processing Scripts" option. In the "Post-Processing Script" field, enter the path to your script: bash perl Save the Settings: Click "Save" to apply your changes. Run the script from the command line to ensure it works correctly: bash Test with Bazarr: Download a subtitle via Bazarr for a video file located in the target folder. Ensure that the user running Bazarr has the necessary permissions to: Execute the bazarr_postprocess.sh script. If GPT Subtrans requires environment variables (e.g., an OpenAI API key), ensure they are available in the environment where the script runs. You can export these variables at the beginning of the script: bash To facilitate debugging, you can redirect the script's output to a log file: bash Add to your scriptLOG_FILE="/path/to/bazarr_postprocess.log" Step 7: Complete Example of the Script with Logging Paths passed as arguments by BazarrSUBTITLE_PATH="$1" Path to the target video folderTARGET_VIDEO_FOLDER="/path/to/your/video/folder" Log fileLOG_FILE="/path/to/bazarr_postprocess.log" Log the date and timeecho "-----------------------------------" >> "$LOG_FILE" Check if the video file is in the target folderif [[ "$VIDEO_PATH" == "$TARGET_VIDEO_FOLDER"* ]]; then
else |
To make things easier you can use "python3 /path/to/batch_process.py {{subtitles}} Below are the arguments Bazarr can use directory Full path of the episode file parent directory |
i've tried with that (giving these arguments to GPT). But until now, could not get it work. Here is a detailed step-by-step guide for installing GPT-Subtrans with Bazarr, including configuration for automatic subtitle translation and manual subtitle selection using a GUI or frontend. Step 1: Setting up the Environment
bash bash dockerfile Install git, fluxbox, xvfb, and other dependencies for GUIRUN apt-get update && apt-get install -y git fluxbox x11vnc xvfb Clone the GPT-Subtrans repositoryRUN git clone https://github.com/machinewrapped/gpt-subtrans.git /app/gpt-subtrans Install GPT-Subtrans dependenciesWORKDIR /app/gpt-subtrans Install Flask for frontend (optional)RUN pip install flask Install necessary translation SDKsRUN pip install openai google.generativeai anthropic Start a VNC server to allow GUI accessCMD ["bash", "-c", "xvfb-run -s '-screen 0 1024x768x16' python3 gui-subtrans.py"]
bash bash Option 1: Use a .env File for the API Key bash bash Option 2: Pass the API Key as an Environment Variable
If you used the .env file for the API key: bash bash bash Use a VNC client (e.g., RealVNC or TightVNC) to connect to your unRAID server at <unRAID_IP>:5900.
bash bash Environment variables passed by BazarrSUBTITLE_PATH="${SUBTITLE_PATH}" echo "Subtitle file path: $SUBTITLE_PATH" if [[ "$SUBTITLE_LANGUAGE_CODE3" == "fre" ]]; then bash Go to Settings > Processing > Post-Processing Scripts. Add the path to the post-processing script: bash Optional: Set Up a Frontend for Subtitle Selection
bash bash python app = Flask(name) @app.route('/') @app.route('/translate', methods=['POST']) if name == 'main': bash html Available Subtitles
bash The Flask app will be available at http://<unRAID_IP>:5000, allowing you to select subtitles manually for translation. |
there is now a docker for unraid on its app page. |
Wondering if i could manage to install it on unraid for Bazarr....
The text was updated successfully, but these errors were encountered: