OSDN Git Service

Soft Subs Part 2: Auto-detect CC during scan, add CC to subtitle list in title, if...
[handbrake-jp/handbrake-jp-git.git] / scripts / manicure.rb
index 3e9467e..ce5c63f 100755 (executable)
@@ -310,6 +310,8 @@ class Display
         commandString << " -r " << "23.976"
       elsif hash["VideoFramerate"] == "29.97 (NTSC Video)"
         commandString << " -r " << "29.97"
+      elsif hash["VideoFramerate"] == "25 (PAL Film/Video)"
+        commandString << " -r " << "25"
       else
         commandString << " -r " << hash["VideoFramerate"]
       end
@@ -524,8 +526,12 @@ class Display
     
     #Subtitles
     if hash["Subtitles"] != "None"
-      commandString << " -s "
-      commandString << hash["Subtitles"]
+      if hash["Subtitles"] == "Autoselect"
+        commandString << " --subtitle-scan"
+      else
+        commandString << " -s "
+        commandString << hash["Subtitles"]
+      end
     end
 
     #Video Filters
@@ -643,6 +649,8 @@ class Display
         commandString << " -r " << "23.976"
       elsif hash["VideoFramerate"] == "29.97 (NTSC Video)"
         commandString << " -r " << "29.97"
+      elsif hash["VideoFramerate"] == "25 (PAL Film/Video)"
+        commandString << " -r " << "25"
       else
         commandString << " -r " << hash["VideoFramerate"]
       end
@@ -858,8 +866,12 @@ class Display
     
     #Subtitles
     if hash["Subtitles"] != "None"
-      commandString << " -s "
-      commandString << hash["Subtitles"]
+      if hash["Subtitles"] == "Autoselect"
+        commandString << " --subtitle-scan"
+      else
+        commandString << " -s "
+        commandString << hash["Subtitles"]
+      end
     end
     
     #Video Filters
@@ -972,13 +984,17 @@ class Display
         commandString << "job->vrate_base = " << "1126125;\n    "
       elsif hash["VideoFramerate"] == "29.97 (NTSC Video)"
         commandString << "job->vrate_base = " << "900900;\n    "
+      elsif hash["VideoFramerate"] == "25 (PAL Film/Video)"
+        commandString << "job->vrate_base = " << "1080000\n    "
       # Gotta add the rest of the framerates for completion's sake.
       end
       commandString << "job->cfr = 1;\n    "
     end
     
     #Audio tracks
-    commandString << "atracks = strdup(\""
+    commandString << "if( !atracks )\n    "
+    commandString << "{\n    "
+    commandString << "    atracks = strdup(\""
     commandString << hash["Audio1Track"].to_s
     if hash["Audio2Track"]
       commandString << "," << hash["Audio2Track"].to_s
@@ -990,9 +1006,12 @@ class Display
       commandString << "," << hash["Audio4Track"].to_s
     end
     commandString << "\");\n    "
+    commandString << "}\n    "
     
     # Audio bitrate
-    commandString << "abitrates = strdup(\""
+    commandString << "if( !abitrates )\n    "
+    commandString << "{\n    "
+    commandString << "    abitrates = strdup(\""
     if hash["Audio1Encoder"] != "AC3 Passthru"
       commandString << hash["Audio1Bitrate"]
     else
@@ -1020,9 +1039,12 @@ class Display
       end
     end
     commandString << "\");\n    "
+    commandString << "}\n    "
         
     #Audio samplerate
-    commandString << "arates = strdup(\""
+    commandString << "if( !arates )\n    "
+    commandString << "{\n    "
+    commandString << "    arates = strdup(\""
     commandString << hash["Audio1Samplerate"]
     if hash["Audio2Samplerate"]
       commandString << "," << hash["Audio2Samplerate"]
@@ -1034,9 +1056,12 @@ class Display
       commandString << "," << hash["Audio4Samplerate"]
     end
     commandString << "\");\n    "
+    commandString << "}\n    "
       
     #Audio encoder
-    commandString << "acodecs = strdup(\""
+    commandString << "if( !acodecs )\n    "
+    commandString << "{\n    "
+    commandString << "    acodecs = strdup(\""
     case hash["Audio1Encoder"]
     when /AC3/
       commandString << "ac3"
@@ -1078,9 +1103,12 @@ class Display
       commandString << ",lame"
     end
     commandString << "\");\n    "
+    commandString << "}\n    "
     
     #Audio mixdowns
-    commandString << "mixdowns = strdup(\""
+    commandString << "if( !mixdowns )\n    "
+    commandString << "{\n    "
+    commandString << "    mixdowns = strdup(\""
     case hash["Audio1Mixdown"]
     when /Mono/
       commandString << "mono"
@@ -1144,6 +1172,7 @@ class Display
       end
     end
     commandString << "\");\n    "
+    commandString << "}\n    "
     
     #Cropping
     if hash["PictureAutoCrop"] == 0
@@ -1165,14 +1194,21 @@ class Display
     
     #Subtitles
     if hash["Subtitles"] != "None"
-      commandString << "job->subtitle = "
-      commandString << ( hash["Subtitles"].to_i - 1).to_s << ";\n    "
+      if hash["Subtitles"] == "Autoselect"
+        commandString << "subtitle_scan = 1;\n    "
+      else
+        commandString << "job->subtitle = "
+        commandString << ( hash["Subtitles"].to_i - 1).to_s << ";\n    "
+      end
     end
     
     #x264 Options
     if hash["x264Option"] != ""
-      commandString << "x264opts = strdup(\""
+      commandString << "if( !x264opts )\n    "
+      commandString << "{\n    "
+      commandString << "    x264opts = strdup(\""
       commandString << hash["x264Option"] << "\");\n    "
+      commandString << "}\n    "
     end
     
     #Video Filters
@@ -1298,6 +1334,8 @@ class Display
         commandString << " -r " << "23.976"
       elsif hash["VideoFramerate"] == "29.97 (NTSC Video)"
         commandString << " -r " << "29.97"
+      elsif hash["VideoFramerate"] == "25 (PAL Film/Video)"
+        commandString << " -r " << "25"
       else
         commandString << " -r " << hash["VideoFramerate"]
       end
@@ -1512,8 +1550,12 @@ class Display
     
     #Subtitles
     if hash["Subtitles"] != "None"
-      commandString << " -s "
-      commandString << hash["Subtitles"]
+      if hash["Subtitles"] == "Autoselect"
+        commandString << " --subtitle-scan"
+      else
+        commandString << " -s "
+        commandString << hash["Subtitles"]
+      end
     end
     
     #Video Filters