import subprocess import sys import time if __name__ == "__main__": if len(sys.argv) < 1: print >> sys.stderr, "Usage: %s chemin" % (sys.argv[0],) sys.exit(1) chemin = sys.argv[1] tabwidth = []; tabheight = []; try: output = subprocess.Popen('xrandr | grep "\*" | cut -d" " -f4',shell=True, stdout=subprocess.PIPE).communicate()[0].split("x"); except: raise for x in range(16): try: subprocess.Popen("find " + chemin + " -type f | mplayer -playlist - -noborder -shuffle -loop 0 &", shell=True) except: raise valeur = 0 for i in range(4): for j in range(4): tabwidth.append(str(valeur)) valeur += int(output[0])/4 valeur = 0 for i in range(4): for j in range(4): tabheight.append(str(valeur)) valeur += int(output[1])/4 valeur = 0 i = 0 time.sleep(1) try: p = subprocess.check_output("wmctrl" + " -l | grep MPlayer | cut -f1 -d\" \"", shell=True) except: raise resultat = p.split("\n") for element in resultat: args = "wmctrl -i -r " + element + " -e 0," + str(tabwidth[i]) + "," + str(tabheight[i]) + "," + str((int(output[0])/4)) + "," + str((int(output[1])/4)) try: subprocess.Popen([args],shell=True) except: raise i +=1