Skip to content

Instantly share code, notes, and snippets.

@jhorology
Created December 31, 2014 03:06
Show Gist options
  • Save jhorology/9307adbaa4a57ceaa423 to your computer and use it in GitHub Desktop.
Save jhorology/9307adbaa4a57ceaa423 to your computer and use it in GitHub Desktop.
Bulk decomplie Ableton Live MIDI remote script.
#!/bin/sh
# Decompile Ableton Live MIDI Remote Script.
# https://github.com/Mysterie/uncompyle2
#
IFS=$'\n'
MIDI_REMOTE_SCRIPTS='/Applications/Ableton Live 9 Suite.app/Contents/App-Resources/MIDI Remote Scripts'
cd `dirname $0`
for file in $(find ${MIDI_REMOTE_SCRIPTS} -type f)
do
filename=${file##*/}
filename_without_extension=${filename%.*}
extension=${file##*.}
source_folder_path=${file%/*}
new_folder_path=${source_folder_path#$MIDI_REMOTE_SCRIPTS/}
if [ my"$new_folder_path" != my -a ! -d "${new_folder_path}" ]; then
mkdir -p "${new_folder_path}"
fi
if [ $extension = "pyc" ]; then
if [ ! -f "${source_folder_path}/${filename_without_extension}.py" ]; then
uncompyle2 "$file" > "${new_folder_path}/${filename_without_extension}.py"
fi
else
cp -f "$file" "${new_folder_path}/${filename}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment