summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHorus32014-03-06 16:38:32 +0100
committerHorus32014-03-06 16:38:32 +0100
commitb8ffde3db1f2f1f51f19341eef8313f552682495 (patch)
treed9ad860794224d14accaddf9698e87e8baa9815e
parentd8b0667d46667a54e1093019b283404fa6410dd5 (diff)
downloaddotfiles-b8ffde3db1f2f1f51f19341eef8313f552682495.tar.gz
-y
-rwxr-xr-xplay54
1 files changed, 32 insertions, 22 deletions
diff --git a/play b/play
index 2738725..7f95020 100755
--- a/play
+++ b/play
@@ -2,10 +2,18 @@
# bash script to play files from a slow network ressource using mpv
# 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
+
file="$@"
if [ ! -d $ARCHIV ]; then
@@ -38,31 +46,33 @@ mpv $tmp/"$file"
if [ $? -eq 0 ]; then
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 -v $tmp/"$file" "$ARCHIV"
+ 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 $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 ] && [ -w $path ]; then
+ echo "Moving to $path."
+ mv -v $tmp/"$file" "$path"
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 ] && [ -w $path ]; then
- echo "Moving to $path."
- 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. Only removing files from $tmp."
- rm -v $tmp/"$file"
+ rm -v "$file"
+ fi
else
- echo "Okay, don't touching the files."
+ 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 $tmp/"$file"
+ 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