Last active
August 29, 2015 14:25
-
-
Save TrevorBasinger/d257544ec0ac392c2492 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| function detectBin { | |
| which $1 > /dev/null | |
| RET=$? | |
| if [ $RET = "1" ]; then | |
| echo "You need to install $1" | |
| exit -1 | |
| fi | |
| } | |
| detectBin youtube-dl | |
| detectBin ffmpeg | |
| detectBin aws | |
| TMP=/tmp/`date +%s` | |
| ### | |
| # Usage: | |
| # ythelper outfile.mp3 youtubeurl startingtime secondsafterstartingtime | |
| # | |
| # Example | |
| # ythelper wtf.mp3 https://youtu.be/oXYZttxunPw 00:00:08.0 2.0 | |
| ## | |
| youtube-dl -x --audio-format mp3 -o "$TMP.%(ext)s" $2 >> /dev/null && \ | |
| ffmpeg -ss $3 -t $4 -i "$TMP.mp3" $1 >> /dev/null && \ | |
| aws s3 cp $1 s3://flobot-sounds/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment