-
-
Save aliva/6907133 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
[email protected] | |
YD_DIR="app-root/data" | |
DIR="video" | |
if [ "$1" == "install" ] | |
then | |
# SSH To Server | |
ssh $SSH_ACCOUNT 'bash -s'<<<" | |
wget https://yt-dl.org/downloads/2013.10.07/youtube-dl -O \$OPENSHIFT_HOMEDIR/$YD_DIR/youtube-dl --no-check-certificate | |
chmod +x \$OPENSHIFT_HOMEDIR/$YD_DIR/youtube-dl | |
" | |
exit | |
fi | |
# SSH To Server | |
ssh $SSH_ACCOUNT 'bash -s'<<ENDSSH | |
# Get File Name | |
filename=\`"\$OPENSHIFT_HOMEDIR/$YD_DIR/youtube-dl" --get-filename \ | |
-o "\$OPENSHIFT_HOMEDIR/app-root/runtime/repo/diy/%(id)s.%(ext)s" $1\` | |
# Get Video | |
"\$OPENSHIFT_HOMEDIR/$YD_DIR/youtube-dl" \ | |
-o "\$OPENSHIFT_HOMEDIR/app-root/runtime/repo/diy/$DIR/%(id)s.%(ext)s" $1 | |
# Gives Full URL | |
echo "http://\$OPENSHIFT_APP_DNS/$DIR/\$(basename "\$filename")" | |
ENDSSH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment