diff options
| author | Horus3 | 2014-03-06 00:15:47 +0100 |
|---|---|---|
| committer | Horus3 | 2014-03-06 00:15:47 +0100 |
| commit | 10b232bc30bb024227cbdde2da477645aa8ad429 (patch) | |
| tree | 66072d054767dbdb64e5685a44fd206a6ee753bf /play | |
| parent | a9886e2f7e29c38dff61510babba4cc6991cf027 (diff) | |
| download | dotfiles-10b232bc30bb024227cbdde2da477645aa8ad429.tar.gz | |
My bash script for the mpv.
Diffstat (limited to 'play')
| -rwxr-xr-x | play | 68 |
1 files changed, 68 insertions, 0 deletions
@@ -0,0 +1,68 @@ +#!/bin/bash + +# bash script to play files from a slow network ressource with the mpv +# caches the file in /tmp, after finishing it asks to move to the archiv +# export global variable $ANIMEARCHIV +# set the exit code right for quitting +# echo "q quit 255" >> ~/.mpv/input.conf + +function remove(){ + if [ ! $2 ]; then + read -p "Removing the origin? [Y/n] " verify + if [ ! $verify ] || [ $verify = "ja" ] || [ $verify = "yes" ] || [ $verify = "j" ] || [ $verify = "y" ] || [ $verify = "Y" ]; then + rm -v "$1" + else + echo "Okay, we don't remove $1. We are currently on $pwd." + fi + else + rm -v "$1" + fi +} + +pwd=$(pwd) + +cp "$@" /tmp & +echo -n "Preparing the awesomeness! Starting playback in.." +echo -n " 3" +sleep 1 +echo -n " 2" +sleep 1 +echo -n " 1" +sleep 1 +echo " Start!" + +mpv /tmp/"$@" +if [ $? -eq 0 ]; then + if [ -d $ANIMEARCHIV ]; then + echo "Finished $@ succesfull." + read -p "Should we move to the Archiv? ($ANIMEARCHIV) [Y/n/rm/other] " verify + if [ ! $verify ] || [ $verify = "ja" ] || [ $verify = "yes" ] || [ $verify = "j" ] || [ $verify = "y" ] || [ $verify = "Y" ]; then + echo "Moving the stuff to $ANIMEARCHIV" + mv /tmp/"$@" "$ANIMEARCHIV" + remove "$@" "verify" + elif [ $verify = "other" ] || [ $verify = "o" ] || [ $verify = "O" ] || [ $verify = "OTHER" ]; then + read -p "Please tell us the absolute path: " path + if [ -d $path ]; then + echo "Moving to $path." + mv /tmp/"$@" "$path" + remove "$@" + else + echo "Sorry, \"$path\" doesn't exist." + exit 1 + fi + elif [ $verify = "r" ] || [ $verify = "rm" ] || [ $verify = "remove" ] || [ $verify = "RM" ] || [ $verify = "R" ]; then + echo "Cleaning the mess up. Removing file from /tmp." + rm -v /tmp/"$@" + else + echo "Okay, don't touching the files." + fi + else + echo "Can't move to \"$ANIMEARCHIV\". Directory doesn't exist." + exit 1 + fi +else + echo "Something is broken with the media player!" + exit 1 +fi + +echo "Have a nice day!" |
