summaryrefslogtreecommitdiff
path: root/play
diff options
context:
space:
mode:
authorHorus32014-03-08 19:58:06 +0100
committerHorus32014-03-08 19:58:06 +0100
commit9f4b3494700eeb2061dfd840e8d030f66088b173 (patch)
tree248d041cb87ddb2debd2b926e2d095144a719b80 /play
parent2c0e3234808dccbd7c622be7c4250ea405f3e166 (diff)
downloaddotfiles-9f4b3494700eeb2061dfd840e8d030f66088b173.tar.gz
structure
Diffstat (limited to 'play')
-rwxr-xr-xplay122
1 files changed, 0 insertions, 122 deletions
diff --git a/play b/play
deleted file mode 100755
index a42a67f..0000000
--- a/play
+++ /dev/null
@@ -1,122 +0,0 @@
-#!/bin/bash
-
-# bash script to play files from a slow network ressource, FTP folder, samba share or network drive etc.
-# caches the file in /tmp and moves to $ARCHIV
-# -y to skip verification
-# export global variable $ARCHIV
-# set the exit code right for quitting
-# echo "q quit 255" >> ~/.mpv/input.conf
-
-
-if [ "$1" = "-y" ] || [ "$1" = "y" ] || [ "$1" = "Y" ] || [ "$1" = "-Y" ]; then
- verify="yes"
- shift
-else
- verify=0
-fi
-
-player[0]=$(command -v mpv) #media player of choice
-player[1]=$(command -v mplayer)
-player[2]=$(command -v vlc) #you shouldn't use vlc
-
-for i in "${player[@]}"; do
- if [ ! $i = "" ]; then
- player=$i
- break
- fi
-done
-
-if [ ! $player ]; then
- echo "No media player found. Please edit this script manually. I recommend the mpv. http://mpv.io"
- exit 1
-fi
-
-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."
- read -p "You can export it temporarily. If you do, just type the path to the folder , if you don't, leave it empty. " path
- if [ $path ] && [ -d $path ] && [ -w $path ]; then
- export ARCHIV=$path
- echo "Roger that!"
- fi
-fi
-
-pwd=$(pwd)
-
-if [ -d /tmp ] && [ -w /tmp ]; then
- tmp="/tmp"
-else
- read -p "Please name the directory to cache the file: " tmp
- if [ ! -d $tmp ] || [ ! -w $tmp ]; then
- echo "Directory doesn't exist or you don't have write permission."
- exit 1
- fi
-fi
-
-if [[ "$@" =~ ^https?://.* ]]; then
- read -p "Detected hyperlink. Should we try to download (caching)? Type something random to play direct with the mpv. [y/N] " download
- if [ $download = "ja" ] || [ $download = "yes" ] || [ $download = "j" ] || [ $download = "y" ] || [ $download = "Y" ]; then
- cd "$tmp"
- wget "$@" &
- elif [ $player =~ .*/mpv$ ] && [ $download ] && ( [ ! $download = "n" ] || [ ! $download = "N" ] || [ ! $download = "no" ] || [ ! $download = "nein" ] || [ ! $download = "NO" ]); then
- echo "Playing directly using mpv."
- mpv "$@"
- exit 0
- else
- echo "This script is designed to cache media files from a FTP share or network drive. Exiting. "
- exit 1
- fi
-else
- cp "$@" $tmp &
-fi
-
-echo -n "Preparing the awesome! Starting playback in.."
-echo -n " 2,"
-sleep 1
-echo -n " 1"
-sleep 1
-echo " Start!"
-
-cd $tmp
-$player "$@"
-if [ $? -eq 0 ]; then
- if [ -d $ARCHIV ] && [ -w $ARCHIV ]; then
- echo "Finished $@ succesfull."
- if [ $verify -eq 0 ]; then
- read -p "Should we move everything to the Archiv? ($ARCHIV) [Y/n/rm/other] " verify
- fi
- if [ ! $verify ] || [ $verify = "ja" ] || [ $verify = "yes" ] || [ $verify = "j" ] || [ $verify = "y" ] || [ $verify = "Y" ]; then
- echo "Moving the stuff to $ARCHIV."
- mv -v "$@" "$ARCHIV"
- if [ $? -eq 0 ]; then
- cd $pwd
- rm -v "$@"
- fi
- elif [ $verify = "other" ] || [ $verify = "o" ] || [ $verify = "O" ] || [ $verify = "OTHER" ]; then
- read -p "Please tell us the absolute path: " path
- if [ -d $path ] && [ -w $path ]; then
- echo "Moving to $path."
- mv -v "$@" "$path"
- if [ $? -eq 0 ]; then
- cd $pwd
- rm -v "$@"
- 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. Only removing files from $tmp."
- rm -v "$@"
- else
- echo "Okay, don't touching the files."
- fi
- else
- echo "Can't move to \"$ARCHIV\". Directory doesn't exist or you don't have write permission."
- exit 1
- fi
-else
- echo "Something is broken with the media player!"
- exit 1
-fi
-
-echo "Have a nice day!"