Advertisement
Siapran

MLPsub aegisub automation

Apr 22nd, 2014
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.10 KB | None | 0 0
  1. script_name="Credits pour MLP Subtitles"
  2. script_description="Rajoute les crédits à la fin des sous-titres"
  3. script_author = "Max le Fou, fix by Siapran"
  4. script_version = "1.0"
  5.  
  6.  
  7. function macro_function(subtitle, selected)
  8.  
  9.     dialog_config=
  10.     {
  11.         {
  12.             class="dropdown", name="lang",
  13.             x=0, y=0, width=1, height=1,
  14.             items={"English", "French"},
  15.             value="Langage"
  16.         },
  17.         {
  18.             class="stringedit", name="transcript",
  19.             x=0, y=1, width=1, height=1,
  20.             value="entrer noms ici"
  21.         },
  22.         {
  23.             class="stringedit", name="traduc",
  24.             x=0, y=2, width=1, height=1,
  25.             value="entrer noms ici"
  26.         },
  27.         {
  28.             class="stringedit", name="sync",
  29.             x=0, y=3, width=1, height=1,
  30.             value="entrer noms ici"
  31.         },
  32.         {
  33.             class="stringedit", name="misc",
  34.             x=0, y=4, width=1, height=1,
  35.             value="GoFish, Shujaa"
  36.         },
  37.         {
  38.             class="floatedit", name="temps",
  39.             x=0, y=5, width=1, height=1,
  40.             value=0
  41.         }
  42.     }
  43.  
  44.     local meta, styles = karaskel.collect_head(subtitles, false)
  45.     local num_lines = #subtitles
  46.  
  47.     pressed, results = aegisub.dialog.display(dialog_config)
  48.  
  49.     if pressed=="Cancel" then
  50.         aegisub.cancel()
  51.     end
  52.  
  53.  
  54.     if lang=="English" then
  55.         begintitle = "Subtitled by MLPSubtitles"
  56.         transtitle = "Transcript:"
  57.         tradtitle = "Translation:"
  58.         synctitle = "Synchronization:"
  59.         misctitle = "Misc:"
  60.     else
  61.         begintitle = "Sous-titré par MLPSubtitles"
  62.         transtitle = "Transcription :"
  63.         tradtitle = "Traduction :"
  64.         synctitle = "Synchronisation :"
  65.         misctitle = "Autres :"
  66.     end
  67.  
  68.     lineText = {
  69.         begintitle,
  70.         "http://www.mlpsubtitles.com/",
  71.         transtitle .. " " .. results["transcript"],
  72.         tradtitle .. " " .. results["traduc"],
  73.         synctitle .. " " .. results["sync"],
  74.         misctitle .. " " .. results["misc"]
  75.     }
  76.  
  77.     local line
  78.  
  79.     for i=1, #lineText do
  80.         karaskel.preproc_line(subtitles, meta, styles, line)
  81.         line.start_time = results["temps"] + (i-1)*2000
  82.         line.end_time = results["temps"] + i*2000-100
  83.         line.text = lineText[i]
  84.         subtitles.append(line)
  85.     end
  86.  
  87.     aegisub.set_undo_point(credits_MLP)
  88.  
  89.     return selected
  90.  
  91. end
  92.    
  93. aegisub.register_macro(script_name, script_description, macro_function)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement