-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_usage.sh
More file actions
executable file
·107 lines (90 loc) · 3.23 KB
/
example_usage.sh
File metadata and controls
executable file
·107 lines (90 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
# SRT Translator - Example Usage Script
# This script demonstrates various ways to use the translate_srt.py tool
echo "======================================"
echo "SRT Translator - Example Usage"
echo "======================================"
echo ""
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "❌ Python 3 is not installed. Please install Python 3 first."
exit 1
fi
echo "✅ Python 3 is installed"
echo ""
# Check if requirements are installed
echo "Checking dependencies..."
if ! python3 -c "import requests" &> /dev/null; then
echo "📦 Installing requirements..."
pip3 install -r requirements.txt
else
echo "✅ Dependencies already installed"
fi
echo ""
echo "======================================"
echo "Example Usage Commands:"
echo "======================================"
echo ""
# Example 1: Basic usage
echo "1️⃣ Basic translation (auto-detect language to English):"
echo " python3 translate_srt.py \"input.srt\""
echo ""
# Example 2: With output file
echo "2️⃣ Specify output file:"
echo " python3 translate_srt.py \"input.srt\" -o \"output_english.srt\""
echo ""
# Example 3: Translate to Spanish
echo "3️⃣ Translate to Spanish:"
echo " python3 translate_srt.py \"input.srt\" -t es"
echo ""
# Example 4: Translate from English to French
echo "4️⃣ Translate from English to French:"
echo " python3 translate_srt.py \"input.srt\" -s en -t fr"
echo ""
# Example 5: With the actual file in the directory
echo "5️⃣ Translate the example file in this directory to Spanish:"
echo " python3 translate_srt.py \"One.Battle.After.Another.2025.1080p.AMZN.WEB-DL.DDP5.1.H.264-KyoGo.srt\" -t es -o \"One.Battle.After.Another.Spanish.srt\""
echo ""
# Example 6: With different model
echo "6️⃣ Use a different model:"
echo " python3 translate_srt.py \"input.srt\" --model openai"
echo ""
# Example 7: Adjust batch size for rate limiting
echo "7️⃣ Adjust batch size (useful for rate limiting):"
echo " python3 translate_srt.py \"input.srt\" --batch-size 10"
echo ""
echo "======================================"
echo "Common Language Codes:"
echo "======================================"
echo " en - English"
echo " es - Spanish"
echo " fr - French"
echo " de - German"
echo " it - Italian"
echo " pt - Portuguese"
echo " ja - Japanese"
echo " ko - Korean"
echo " zh - Chinese"
echo " auto - Auto-detect"
echo ""
echo "======================================"
echo "💡 Tips:"
echo "======================================"
echo " • No API key required - Pollinations AI is free!"
echo " • For faster processing, increase --batch-size"
echo " • For better rate limiting, decrease --batch-size"
echo " • Use -s auto to let the API detect the source language"
echo ""
# Offer to run a translation if the SRT file exists
SRT_FILE="One.Battle.After.Another.2025.1080p.AMZN.WEB-DL.DDP5.1.H.264-KyoGo.srt"
if [ -f "$SRT_FILE" ]; then
echo ""
echo "Found: $SRT_FILE"
read -p "Would you like to translate it to Spanish? (y/n) " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo ""
echo "🚀 Starting translation..."
python3 translate_srt.py "$SRT_FILE" -t es -o "One.Battle.After.Another.Spanish.srt"
fi
fi