Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save loshlee/59936434a6f47996ef5c445ca1443a62 to your computer and use it in GitHub Desktop.
Save loshlee/59936434a6f47996ef5c445ca1443a62 to your computer and use it in GitHub Desktop.
Select VOBs from a ripped DVD's VIDEO_TS folder that comprise the title you want, drop it on the application saved from this script as source, and you'll have a single VOB concatenated and saved to your Desktop.
on run
display dialog "Drop some VOB files onto me to combine them into one mpeg file." buttons {"OK"} default button 1 with icon note giving up after 10
end run
on open itms
set y to itms
if y = {} then
display dialog "Please, choose files/folders before running this script..." buttons {"OK"} default button 1 with icon note giving up after 10
error number -128
else
repeat with i from 1 to y's length
set y's item i to ((quoted form of (POSIX path of y's item i)) as Unicode text)
end repeat
end if
set y to my selectionSort(y)
set AppleScript's text item delimiters to space
set copycat to ("cat" & space & y & space & ">" & space)
set Locpart to quoted form of ((POSIX path of ((path to desktop) as Unicode text)) & text returned of (display dialog "Enter a name for the output file." default answer "video") & ".VOB")
set wholecommand to copycat & Locpart
set AppleScript's text item delimiters to {""}
do shell script wholecommand
end open
on selectionSort(sortItems) --> credits to... Kai Edwards? Arthur J. Knapp?
set j to sortItems's length
repeat while j is greater than 1
set targetIndex to j
set j to j - 1
repeat with i from 1 to j
if ((item i of sortItems) > (item targetIndex of sortItems)) then set targetIndex to i
end repeat
if (targetIndex ≤ j) then
set tempVar to (item targetIndex of sortItems)
set (item targetIndex of sortItems) to (item (j + 1) of sortItems)
set (item (j + 1) of sortItems) to tempVar
end if
end repeat
return sortItems
end selectionSort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment