Created
June 9, 2011 11:45
-
-
Save phondanai/1016571 to your computer and use it in GitHub Desktop.
Fix the length of song which download from Magnatune store.
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
#!/bin/bash | |
# Fix the length of song which download from Magnatune store. | |
# mag-fix.sh by Phondanai Khanti | |
# Work with .ogg only! | |
# Require package: vorbis-tools | |
# | |
# usage: mag-fix.sh /path/to/source.ogg | |
# For the whole directory example | |
# use: find . -iname '*.ogg' -print0 | xargs -0 -n 1 fix-mag | |
set -e | |
min=`ogginfo "$1" | grep Play | awk '{print $3}' | cut -d":" -f 1 | sed 's/m//g'` | |
secs=`ogginfo "$1" | grep Play | awk '{print $3}' | cut -d":" -f 2 | sed 's/s//g'` | |
cut_point=`echo "$(( min*60 )) + $secs - 9"|bc` | |
echo Fixing "$1" | |
echo $all | |
t=`mktemp` | |
# The out put will appear in outer current directory | |
vcut "$1" "$t" /dev/null +$cut_point && mv "$t" ../"$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment