aboutsummaryrefslogtreecommitdiff
path: root/autoWall
diff options
context:
space:
mode:
Diffstat (limited to 'autoWall')
-rwxr-xr-xautoWall64
1 files changed, 64 insertions, 0 deletions
diff --git a/autoWall b/autoWall
new file mode 100755
index 0000000..8b709ed
--- /dev/null
+++ b/autoWall
@@ -0,0 +1,64 @@
+#!/usr/bin/bash
+
+wallDir=/media/Wall
+
+for action in $@
+do
+ if [ ${action:0:1} = "+" ]
+ then
+ if [ -d ${wallDir}/${action:1} ]
+ then
+ echo ${action:1}/ >> ${wallDir}/listDirWall
+ fi
+ fi
+ if [ ${action} = "list" ]
+ then
+ for d in `ls ${wallDir}`
+ do
+ if [ -d "${wallDir}/${d}" ]; then
+ echo "$d/"
+ fi
+ done
+ echo
+ fi
+ if [ ${action:0:1} = "-" ]
+ then
+ if [ -d ${wallDir}/${action:1} ]
+ then
+ sed -i "/${action:1}/d" ${wallDir}/listDirWall
+ fi
+ fi
+ if [ ${action:0:1} = "=" ]
+ then
+ if [ -d ${wallDir}/${action:1} ]
+ then
+ sed -i "/^${action:1}\/$/d" ${wallDir}/listDirWall
+ fi
+ fi
+done
+
+cmpWall=0
+
+for ligne in `cat ${wallDir}/listDirWall`
+do
+ cmpWall=$(( cmpWall + `ls "${wallDir}/$ligne" | wc -l` ))
+ echo "$ligne : "
+done
+
+randWall=$[( $RANDOM % $cmpWall )]
+
+
+for ligne in `cat ${wallDir}/listDirWall`
+do
+ if [ `ls "${wallDir}/$ligne" | wc -l` -gt $randWall ]
+ then
+ echo ${wallDir}/$ligne`ls ${wallDir}/$ligne | head -n $randWall | tail -n 1` > ~/.actWall
+ nitrogen --set-zoom-fill ${wallDir}/$ligne`ls ${wallDir}/$ligne | head -n $randWall | tail -n 1`
+ echo "Wall set " ${wallDir}/$ligne`ls ${wallDir}/$ligne | head -n $randWall | tail -n 1`
+ break
+ else
+ randWall=$(( randWall - `ls "${wallDir}/$ligne" | wc -l` ))
+ fi
+done
+
+echo $cmpWall