Last active
December 16, 2015 12:58
-
-
Save Tatsh/5438156 to your computer and use it in GitHub Desktop.
Weird, ugly Bash stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IFS=$'\n'; for i in $(find -iname '*.mp3'); do | |
fn=$(echo "$i" | cut -b 3- | cut -d '/' -f 1,2 | sed -e 's#/#-#g').zip | |
dir=$(echo "$i" | cut -b 3- | cut -d '/' -f 1,2) | |
top=$(echo "$i" | cut -b 3- | cut -d '/' -f 1) | |
in=$(echo "$i" | cut -b 3- | cut -d '/' -f 2) | |
pushd "$top" | |
zip -r "$PWD/../$fn" "$in" | |
popd | |
done | |
IFS=$'\n'; for i in $(find -iname '*.ogg'); do | |
fn=$(echo "$i" | cut -b 3- | cut -d '/' -f 1,2 | sed -e 's#/#-#g')-mp3.zip | |
dir=$(echo "$i" | cut -b 3- | cut -d '/' -f 1,2) | |
top=$(echo "$i" | cut -b 3- | cut -d '/' -f 1) | |
in=$(echo "$i" | cut -b 3- | cut -d '/' -f 2) | |
pushd "$top" | |
ogg2mp3 --verbose "$in" | |
zip -x \*.ogg -r "$PWD/../$fn" "$in" | |
popd | |
done | |
for host in tatshphone tatshpad; do | |
for i in *.zip; do | |
curl -L -X POST --form file="@${i}" http://$host:9002/filepost | |
done | |
done | |
for i in *.vob; do crop=$(mplayer -vo null -ss 200 -frames 30 -vf cropdetect "$i" 2>&1 | grep crop= | cut -d '(' -f 2 | uniq | sed -r -e 's/^\-vf\ //' -e 's/\)\.$//' | tail -n 1) && echo "crop_filters['${i%.*}']=$crop"; done | |
# For Python OrderedDict | |
for i in *.vob; do crop=$(mplayer -ao null -vo null -ss 200 -frames 30 -vf cropdetect "$i" 2>&1 | grep crop= | cut -d '(' -f 2 | uniq | sed -r -e 's/^\-vf\ //' -e 's/\)\.$//' | tail -n 1) && echo " ('${i%.*}', '$crop'),"; done | |
dvd-title-count() { mplayer -vo null -frames 2 -dvd-device "$1" dvd:// 2>&1 | grep -s -E 'There are [0-9]+ titles on this DVD\.' | cut -d ' ' -f 3 } | |
for i in *.iso; do for j in $(seq 1 $(dvd-title-count "$i")); do mplayer -dumpstream -dumpfile "${i%.*}-title-$j.vob" -dvd-device "$i" dvd://$j; done; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment