Annonce

>>> Bienvenue sur codelab! >>> Première visite ? >>> quelques mots sur codelab //// une carte des membres//// (apéros) codelab


#1 2012-02-12 13:35:14 [python,mplayer,linux] JKP - Mosaic de Vidéos

Hans Cenhalan
membre
Date d'inscription: 2011-12-16
Messages: 86

[python,mplayer,linux] JKP - Mosaic de Vidéos



http://jkp.antisocial.be/images/JKP-Mosaic-Mplayer.png


Mosaique de Vidéos en mode Random avec mplayer

il faut
Python + Linux + Mplayer

import subprocess
import sys
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
	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
	for element in tabwidth:
		args = "find " + chemin + " -type f | mplayer -playlist - -geometry " + str((int(output[0])/4)) + "x" + str((int(output[1])/4)) + "+" + str(tabwidth[i]) + "+" + str(tabheight[i]) + " -vo xv -noborder -shuffle -loop 0 &";
		try:
			subprocess.Popen([args],shell=True)
		except:
			raise
		i +=1

Bizarrement il y a des carrés non carrés.
avec une autre techno wmtctrl

il faut
Python + Linux + Mplayer +Wmctrl

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

Dernière modification par Hans Cenhalan (2012-02-12 13:36:51)

Hors ligne

 

fil rss de cette discussion : rss

Pied de page des forums

Powered by FluxBB

codelab, graphisme & code : emoc / 2008-2024