Guest User

Untitled

a guest
Jul 5th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- evetaku maintainer vars --
  2. set episode_patches to {"[EveTaku] Inu x Boku SS - 01 (1280x720 x264 AAC) PATCH.xdelta", "[EveTaku] Inu x Boku SS - 02 (1280x720 x264 AAC) PATCH.xdelta", "[EveTaku] Inu x Boku SS - 03 (1280x720 x264 AAC) PATCH.xdelta", "[EveTaku] Inu x Boku SS - 04 (1280x720 x264 AAC) PATCH.xdelta", "[EveTaku] Inu x Boku SS - 05 (1280x720 x264 AAC) PATCH.xdelta", "[EveTaku] Inu x Boku SS - 06 (1280x720 x264 AAC) PATCH.xdelta", "[EveTaku] Inu x Boku SS - 01 (1280x720 x264-Hi10P AAC) PATCH.xdelta", "[EveTaku] Inu x Boku SS - 02 (1280x720 x264-Hi10P AAC) PATCH.xdelta", "[EveTaku] Inu x Boku SS - 03 (1280x720 x264-Hi10P AAC) PATCH.xdelta", "[EveTaku] Inu x Boku SS - 04 (1280x720 x264-Hi10P AAC) PATCH.xdelta", "[EveTaku] Inu x Boku SS - 05 (1280x720 x264-Hi10P AAC) PATCH.xdelta", "[EveTaku] Inu x Boku SS - 06 (1280x720 x264-Hi10P AAC) PATCH.xdelta"}
  3.  
  4. set episode_default_names to {"[EveTaku] Inu x Boku SS - 01v2 (1280x720 x264 AAC)[60294F71].mkv", "[EveTaku] Inu x Boku SS - 02v2 (1280x720 x264 AAC)[454DBD7E].mkv", "[EveTaku] Inu x Boku SS - 03v2 (1280x720 x264 AAC)[ADDB54E6].mkv", "[EveTaku] Inu x Boku SS - 04v2 (1280x720 x264 AAC)[32262CE0].mkv", "[EveTaku] Inu x Boku SS - 05v2 (1280x720 x264 AAC)[40BBDCFD].mkv", "[EveTaku] Inu x Boku SS - 06v2 (1280x720 x264 AAC)[41C07CCB].mkv", "[EveTaku] Inu x Boku SS - 01v2 (1280x720 x264-Hi10P AAC)[4CFEFD1C].mkv", "[EveTaku] Inu x Boku SS - 02v2 (1280x720 x264-Hi10P AAC)[52C6C01B].mkv", "[EveTaku] Inu x Boku SS - 03v2 (1280x720 x264-Hi10P AAC)[74B9971C].mkv", "[EveTaku] Inu x Boku SS - 04v2 (1280x720 x264-Hi10P AAC)[02A80390].mkv", "[EveTaku] Inu x Boku SS - 05v2 (1280x720 x264-Hi10P AAC)[A6F08EDA].mkv", "[EveTaku] Inu x Boku SS - 06v2 (1280x720 x264-Hi10P AAC)[101973E6].mkv"}
  5.  
  6. -- end maintainter vars --
  7.  
  8. to numsFromChoice(aList, aPrompt, aTitle, mults, CancelText, OKText)
  9.     -- aList is the original list to be numbered, aPrompt is the prompt text, aTitle is the choose from list window title, mults is true for multiple choices allowed and false for single choices, CancelText and OKText set the labels you want to appear on the Cancel and OK buttons.
  10.     set numList to {}
  11.     set chosen to {}
  12.     -- Make a numbered list from the original in "numList".
  13.     repeat with k from 1 to count aList
  14.         set end of numList to (k as text) & ") " & item k of aList
  15.     end repeat
  16.     -- Offer a choice from the numbered list
  17.     set choices to choose from list numList with prompt aPrompt multiple selections allowed mults with title aTitle cancel button name CancelText OK button name OKText
  18.     if choices is not false then -- i.e., something was chosen (empty selection defaults to false)
  19.         -- Extract the numbers only from the choices found in list "choices".
  20.         repeat with j from 1 to count choices
  21.             tell choices to set end of chosen to (text 1 thru ((my (offset of ")" in item j)) - 1) of item j) as integer
  22.         end repeat
  23.         return chosen -- Return a list of item numbers for chosen list items
  24.     else -- choices was false, the CancelText button was chosen (always returns false no matter what it is called).
  25.         return false -- pass back the false
  26.     end if
  27. end numsFromChoice
  28.  
  29. set patchfile_number to numsFromChoice(episode_patches, "Choose a patch.", "Patch Picker", false, "Cancel", "Okay")
  30.  
  31. set patchfile_name to item patchfile_number of episode_patches
  32. set episode_out_name to item patchfile_number of episode_default_names
  33.  
  34. set episode_in_apple_path to choose file with prompt "Please open the corrisponding episode for " & patchfile_name
  35. set episode_in_path to the quoted form of the POSIX path of episode_in_apple_path as string
  36. set episode_out_apple_path to choose file name default name episode_out_name with prompt "Choose episode destination:"
  37. set episode_out_path to the quoted form of the POSIX path of episode_out_apple_path as string
  38. set xdelta_apple_path to path to resource "xdelta3"
  39. set patch_apple_path to path to resource patchfile_name
  40. set xdelta_path to the quoted form of the POSIX path of xdelta_apple_path as string
  41. set patch_path to the quoted form of the POSIX path of patch_apple_path as string
  42. set script_code to xdelta_path & " -d -s " & episode_in_path & " " & patch_path & " " & episode_out_path as string
  43. do shell script script_code
Add Comment
Please, Sign In to add comment