diff options
| author | Horus3 | 2014-03-06 16:09:15 +0100 |
|---|---|---|
| committer | Horus3 | 2014-03-06 16:09:15 +0100 |
| commit | d8b0667d46667a54e1093019b283404fa6410dd5 (patch) | |
| tree | deda6f76aa9e8acf23e6101991e913f60987159d | |
| parent | ae1c2c9c9213c7a95590512ac06da4647ad235c8 (diff) | |
| download | dotfiles-d8b0667d46667a54e1093019b283404fa6410dd5.tar.gz | |
mpv
| -rw-r--r-- | config | 13 | ||||
| -rw-r--r-- | input.conf | 2 | ||||
| -rwxr-xr-x | play | 59 |
3 files changed, 49 insertions, 25 deletions
@@ -0,0 +1,13 @@ +# Write your default config options here! +# Play German audio if available, fall back to Japanese or English otherwise. +alang = de,jpn,en +# Subtitles +#slang = de,en + +# Keep the player window on top of all other windows. +#ontop=yes + +screenshot-format=png +screenshot-png-compression=9 +screenshot-template="/home/horus/.mpv/screenshot/%f - %p" +--audio-display=no diff --git a/input.conf b/input.conf new file mode 100644 index 0000000..199c9bd --- /dev/null +++ b/input.conf @@ -0,0 +1,2 @@ +q quit 255 +Q quit_watch_later @@ -6,21 +6,26 @@ # 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." - fi +file="$@" + +if [ ! -d $ARCHIV ]; then + echo "Note: Variable \$ARCHIV couldn't be found. It will play the file fine, but you should consider to organize your collection." +fi + +if [ -d /tmp ] && [ -w /tmp ]; then + tmp="/tmp" + cp "$file" /tmp & +else + read -p "Please name the directory (without the trailing slash!) to cache the file: " tmp + if [ -d $tmp ] && [ -w $tmp ]; then + cp "$file" "$tmp" & else - rm -v "$1" + echo "Directory doesn't exist or you don't have write permission." + exit 1 fi -} +fi -cp "$@" /tmp & -echo -n "Preparing the awesomeness! Starting playback in.." +echo -n "Preparing the awesome! Starting playback in.." echo -n " 3" sleep 1 echo -n " 2" @@ -29,33 +34,37 @@ echo -n " 1" sleep 1 echo " Start!" -mpv /tmp/"$@" +mpv $tmp/"$file" if [ $? -eq 0 ]; then - if [ -d $ARCHIV ]; then - echo "Finished $@ succesfull." - read -p "Should we move to the Archiv? ($ARCHIV) [Y/n/rm/other] " verify + if [ -d $ARCHIV ] && [ -w $ARCHIV ]; then + echo "Finished $file succesfull." + read -p "Should we move everything to the Archiv? ($ARCHIV) [Y/n/rm/other] " verify if [ ! $verify ] || [ $verify = "ja" ] || [ $verify = "yes" ] || [ $verify = "j" ] || [ $verify = "y" ] || [ $verify = "Y" ]; then - echo "Moving the stuff to $ARCHIV" - mv /tmp/"$@" "$ARCHIV" - remove "$@" "verify" + echo "Moving the stuff to $ARCHIV." + mv -v $tmp/"$file" "$ARCHIV" + if [ $? -eq 0 ]; then + rm -v "$file" + fi elif [ $verify = "other" ] || [ $verify = "o" ] || [ $verify = "O" ] || [ $verify = "OTHER" ]; then read -p "Please tell us the absolute path: " path - if [ -d $path ]; then + if [ -d $path ] && [ -w $path ]; then echo "Moving to $path." - mv /tmp/"$@" "$path" - remove "$@" + mv -v $tmp/"$file" "$path" + if [ $? -eq 0 ]; then + rm -v "$file" + fi 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/"$@" + echo "Cleaning the mess up. Only removing files from $tmp." + rm -v $tmp/"$file" else echo "Okay, don't touching the files." fi else - echo "Can't move to \"$ARCHIV\". Directory doesn't exist." + echo "Can't move to \"$ARCHIV\". Directory doesn't exist or you don't have write permission." exit 1 fi else |
