aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAche <ache@ache.one>2016-09-29 06:47:17 +0200
committerAche <ache@ache.one>2016-09-29 06:47:17 +0200
commit63655138e90b01af0f21893c2f21c1cc05e2313e (patch)
tree49e85ad99b939b2bb5e528877cb82d6b1bf92b5f
parentFirst script (diff)
Init with more scripts
-rwxr-xr-xautoWall54
-rwxr-xr-ximg2pdf.sh18
-rwxr-xr-xtrack.py64
3 files changed, 136 insertions, 0 deletions
diff --git a/autoWall b/autoWall
new file mode 100755
index 0000000..5ec78f1
--- /dev/null
+++ b/autoWall
@@ -0,0 +1,54 @@
+#!/usr/bin/bash
+
+wallDir=~/Bureau/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: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
diff --git a/img2pdf.sh b/img2pdf.sh
new file mode 100755
index 0000000..502b218
--- /dev/null
+++ b/img2pdf.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+if [ $# -ne 2 ] ; then
+ echo "img2pdf (png,jpg,tiff,...) (output)"
+ exit
+fi
+
+for img in *."$1" ; do
+ echo Traitement de "$img"
+ convert "$img" "${img:0:-4}.pdf"
+done;
+
+rm "$2"
+gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile="$2" `ls -v | grep .pdf$`
+
+for img in *."$1" ; do
+ rm "${img:0:-4}.pdf"
+done;
diff --git a/track.py b/track.py
new file mode 100755
index 0000000..c1b58b1
--- /dev/null
+++ b/track.py
@@ -0,0 +1,64 @@
+#!/usr/bin/python
+#-*-coding:utf-8 -*
+
+import re, os, time, sys
+
+motif = sys.argv[1]
+fileName = sys.argv[2]
+titre = fileName[0:fileName.rindex('.')]
+
+l = [""]
+i = 0
+
+while i < len(motif) :
+ if motif[i] == '%' :
+ l.append(motif[i:i+2])
+ l.append("")
+ i+=2
+ else:
+ l[-1] += motif[i]
+ i+=1
+
+if l[-1] == "" :
+ l = l[0:len(l)-1]
+if l[0] == "" :
+ l = l[1:]
+
+regexString = "^"
+
+for t in l :
+ if t[0] == '%':
+ regexString += "(.*?)"
+ else:
+ regexString += t
+
+regexString += "$"
+
+reg = re.search(regexString, titre)
+
+if reg :
+ print(reg.group(0))
+ print(reg.group(1))
+ print(reg.group(2))
+ k = 1
+ option = { "%t":"title", "%a":"artist", "%A":"album", "%y":"year", "%n":"track", "%c":"comment"}
+ tag = { "title":"", "artist":"", "album":"", "year":"", "track":"", "comment":""}
+ optionEyeD3 = {"title":"-t", "artist":"-a", "album":"-A", "year":"-Y", "track":"-n", "comment":"-c"}
+ for i in range(len(l)):
+ if l[i] in option :
+ tag[option[l[i]]] = reg.group(k);
+ k+=1
+
+ cmdLine = "eyeD3 \"" + fileName + "\" "
+ for key, value in [ (x,y) for x,y in tag.items() if y != ""]:
+ cmdLine += optionEyeD3[key] + " \"" + value + "\" "
+ print(cmdLine)
+ os.system(cmdLine)
+
+
+else:
+ print("Didn't match");
+
+
+
+