[tv/vignettes] Génération correcte des vignettes sur mdr
darcs-hash:20090127010817-ffbb2-adf72d26035341af8126abe8a0f1b9e4d05dd905.gz
This commit is contained in:
parent
7ec2264051
commit
6f16c368d1
1 changed files with 62 additions and 62 deletions
|
@ -63,81 +63,81 @@ def vignettes() :
|
||||||
os.system('sort /tmp/chaines_recup_sap.txt> /tmp/chaines_recup_sap_triees.txt')
|
os.system('sort /tmp/chaines_recup_sap.txt> /tmp/chaines_recup_sap_triees.txt')
|
||||||
data = open('/tmp/chaines_recup_sap_triees.txt','r').readlines()
|
data = open('/tmp/chaines_recup_sap_triees.txt','r').readlines()
|
||||||
|
|
||||||
return
|
# return
|
||||||
|
|
||||||
for line in data :
|
for line in data :
|
||||||
|
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
nom=line.split(':')[0]
|
nom=line.split(':')[0]
|
||||||
ip=line.split(':')[1]
|
ip=line.split(':')[-1]
|
||||||
#on évite les radios, peu de debit et pas de vignettes
|
#on évite les radios, peu de debit et pas de vignettes
|
||||||
if nom[0:3]=='rad' :
|
if nom[0:3]=='rad' :
|
||||||
#C'est une radio on cherche un logo
|
#C'est une radio on cherche un logo
|
||||||
ok=0 #désolé vince j'ai essayé les exceptions mois c pas si simple
|
ok=0 #désolé vince j'ai essayé les exceptions mois c pas si simple
|
||||||
nom_court=(' '.join(nom.split(' ')[2:])).lower()
|
nom_court=(' '.join(nom.split(' ')[2:])).lower()
|
||||||
print "On s'occupe de la radio %s" % nom_court
|
print "On s'occupe de la radio %s" % nom_court
|
||||||
for file in os.listdir('/var/www/images/logos_radios'):
|
for file in os.listdir('/var/www/images/logos_radios'):
|
||||||
if file.startswith(nom_court):
|
if file.startswith(nom_court):
|
||||||
os.system('cp /var/www/images/logos_radios/\"%s\" /var/www/images/%s.jpg' % (file,ip))
|
os.system('cp /var/www/images/logos_radios/\"%s\" /var/www/images/%s.jpg' % (file,ip))
|
||||||
os.system('cp /var/www/images/logos_radios/\"%s\" /var/www/images/%s_petites.jpg' % (file,ip))
|
os.system('cp /var/www/images/logos_radios/\"%s\" /var/www/images/%s_petites.jpg' % (file,ip))
|
||||||
if col == 2 :
|
if col == 2 :
|
||||||
col = 1
|
col = 1
|
||||||
html.write('</tr><tr>\n')
|
html.write('</tr><tr>\n')
|
||||||
else :
|
else :
|
||||||
col += 1
|
col += 1
|
||||||
if col_petites == 3:
|
if col_petites == 3:
|
||||||
col_petites = 1
|
col_petites = 1
|
||||||
html_petites.write('</tr><tr>\n')
|
html_petites.write('</tr><tr>\n')
|
||||||
else :
|
else :
|
||||||
col_petites += 1
|
col_petites += 1
|
||||||
ajoute_image(nom,ip,html,html_petites)
|
ajoute_image(nom,ip,html,html_petites)
|
||||||
ok=1 #désolé vince j'ai essayé les exceptions mois c pas si simple
|
ok=1 #désolé vince j'ai essayé les exceptions mois c pas si simple
|
||||||
if not ok:
|
if not ok:
|
||||||
#il n'y a pas de logo :-(
|
#il n'y a pas de logo :-(
|
||||||
chaines_probleamatiques.append('<b><u>Chaine :</u></b> %s<br><b><u>IP :</u></b> %s:1234<br><br>\n' %(nom,ip))
|
chaines_probleamatiques.append('<b><u>Chaine :</u></b> %s<br><b><u>IP :</u></b> %s:1234<br><br>\n' %(nom,ip))
|
||||||
print "\t Fait"
|
print "\t Fait"
|
||||||
continue
|
continue
|
||||||
print 'on s\'occupe de %s %s' % (ip,nom)
|
print 'on s\'occupe de %s %s' % (ip,nom)
|
||||||
print '\trecuperation du flux'
|
print '\trecuperation du flux'
|
||||||
#ip port duree
|
#ip port duree
|
||||||
os.system('dumpudp %s 1234 2 > /tmp/%s.ts 2>/dev/null &' % (ip,ip))
|
os.system('/usr/scripts/tv/dumpudp %s 1234 2 > /tmp/%s.ts 2>/dev/null &' % (ip,ip))
|
||||||
print '\tconversion en mpeg1'
|
print '\tconversion en mpeg1'
|
||||||
os.system('rm /tmp/%s.mpg 2>/dev/null 1> /dev/null' % (ip)) #eviter le message demandant l'ecrasement
|
os.system('rm /tmp/%s.mpg 2>/dev/null 1> /dev/null' % (ip)) #eviter le message demandant l'ecrasement
|
||||||
os.system('ffmpeg -deinterlace -an -i /tmp/%s.ts /tmp/%s.mpg 2>/dev/null 1> /dev/null' % (ip,ip))
|
os.system('ffmpeg -deinterlace -an -i /tmp/%s.ts /tmp/%s.mpg 2>/dev/null 1> /dev/null' % (ip,ip))
|
||||||
if not os.path.exists('/tmp/%s.mpg' % (ip)) or not os.stat('/tmp/%s.mpg' % (ip))[6] :
|
if not os.path.exists('/tmp/%s.mpg' % (ip)) or not os.stat('/tmp/%s.mpg' % (ip))[6] :
|
||||||
print '\tOn retente'
|
print '\tOn retente'
|
||||||
if os.path.exists('/tmp/%s.mpg' % (ip)) and os.stat('/tmp/%s.mpg' % (ip))[6] :
|
if os.path.exists('/tmp/%s.mpg' % (ip)) and os.stat('/tmp/%s.mpg' % (ip))[6] :
|
||||||
print 'FICIHER VIDE'
|
print 'FICIHER VIDE'
|
||||||
os.system('dumpudp %s 1234 2 > /tmp/%s.ts ' % (ip,ip))
|
os.system('/usr/scripts/tv/dumpudp %s 1234 2 > /tmp/%s.ts ' % (ip,ip))
|
||||||
print '\t\tconversion en mpeg1'
|
print '\t\tconversion en mpeg1'
|
||||||
os.system('ffmpeg -y -deinterlace -an -i /tmp/%s.ts /tmp/%s.mpg 2>/dev/null 1> /dev/null' % (ip,ip))
|
os.system('ffmpeg -y -deinterlace -an -i /tmp/%s.ts /tmp/%s.mpg 2>/dev/null 1> /dev/null' % (ip,ip))
|
||||||
print '\tconversion en ppm de la frame 11'
|
print '\tconversion en ppm de la frame 11'
|
||||||
os.system('rm /tmp/image_%s*ppm 2>/dev/null 2> /dev/null 1> /dev/null' % (ip)) #eviter le message demandant l'ecrasement
|
os.system('rm /tmp/image_%s*ppm 2>/dev/null 2> /dev/null 1> /dev/null' % (ip)) #eviter le message demandant l'ecrasement
|
||||||
os.system('transcode -q 0 -i /tmp/%s.mpg -x mpeg2,null -y ppm,null -c 10-11 -o /tmp/image_%s 2>/dev/null 1>/dev/null' % (ip,ip))
|
os.system('transcode -q 0 -i /tmp/%s.mpg -x mpeg2,null -y ppm,null -c 10-11 -o /tmp/image_%s 2>/dev/null 1>/dev/null' % (ip,ip))
|
||||||
print '\tconversion en jpg\n'
|
print '\tconversion en jpg\n'
|
||||||
os.system('convert -geometry \'400x300 !\' /tmp/image_%s*ppm /var/www/images/%s.jpg 2>/dev/null 1>/dev/null' % (ip,ip))
|
os.system('convert -geometry \'400x300 !\' /tmp/image_%s*ppm /var/www/images/%s.jpg 2>/dev/null 1>/dev/null' % (ip,ip))
|
||||||
os.system('convert -geometry \'200x150 !\' /tmp/image_%s*ppm /var/www/images/%s_petites.jpg 2>/dev/null 1>/dev/null' % (ip,ip))
|
os.system('convert -geometry \'200x150 !\' /tmp/image_%s*ppm /var/www/images/%s_petites.jpg 2>/dev/null 1>/dev/null' % (ip,ip))
|
||||||
|
|
||||||
if os.path.exists('/tmp/%s.mpg' % (ip)) and os.stat('/tmp/%s.mpg' % (ip))[6] : #on teste sur le mpg car il est enleve a chaque fois
|
if os.path.exists('/tmp/%s.mpg' % (ip)) and os.stat('/tmp/%s.mpg' % (ip))[6] : #on teste sur le mpg car il est enleve a chaque fois
|
||||||
if col == 2 :
|
if col == 2 :
|
||||||
col = 1
|
col = 1
|
||||||
html.write('</tr><tr>\n')
|
html.write('</tr><tr>\n')
|
||||||
else :
|
else :
|
||||||
col += 1
|
col += 1
|
||||||
if col_petites == 3:
|
if col_petites == 3:
|
||||||
col_petites = 1
|
col_petites = 1
|
||||||
html_petites.write('</tr><tr>\n')
|
html_petites.write('</tr><tr>\n')
|
||||||
else :
|
else :
|
||||||
col_petites += 1
|
col_petites += 1
|
||||||
ajoute_image(nom,ip,html,html_petites)
|
ajoute_image(nom,ip,html,html_petites)
|
||||||
print "--------------- Ok %s" % ip
|
print "--------------- Ok %s" % ip
|
||||||
else :
|
else :
|
||||||
chaines_probleamatiques.append('<b><u>Chaine :</u></b> %s<br><b><u>IP :</u></b> %s:1234<br><br>\n' %(nom,ip))
|
chaines_probleamatiques.append('<b><u>Chaine :</u></b> %s<br><b><u>IP :</u></b> %s:1234<br><br>\n' %(nom,ip))
|
||||||
print "--------------- Problematique %s ..." % ip
|
print "--------------- Problematique %s ..." % ip
|
||||||
os.system('rm /var/www/images/%s.jpg' % (ip))
|
os.system('rm /var/www/images/%s.jpg' % (ip))
|
||||||
os.system('rm /var/www/images/%s_petites.jpg' % (ip))
|
os.system('rm /var/www/images/%s_petites.jpg' % (ip))
|
||||||
|
|
||||||
os.system('rm /tmp/%s.ts /tmp/%s.mpg /tmp/image_%s*ppm' % (ip,ip,ip))
|
os.system('rm /tmp/%s.ts /tmp/%s.mpg /tmp/image_%s*ppm' % (ip,ip,ip))
|
||||||
|
|
||||||
|
|
||||||
html.write(table_piedpage)
|
html.write(table_piedpage)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue