[font="Arial"]Hallo,[/font]
[font="Arial"]ich hab dieses Problem schon in "Multimedia" geschildert in meinem Projekt MP3-Player (CarPC)[/font]
[font="Arial"]und zwar habe ich meine Playlisten erstellt (Jede Playlist ein Album) und dann die Playlist-Dateien in eine Liste (Liste.pla) eingefügt und lese die im Array "playl" ein.. [/font]
[font="Arial"]So jetzt funzt alles, bis ich auf w oder s drücke, um die Playliste zu ändern (msp load *playlist)[/font]
[font="Arial"]hier zeigt er kurz an, dass er keine Playlist mit dem Namen finden kann.[/font]
[font="Arial"]ich habe auch den Print-befehl für den Code "mpc load " + playl[x])" (print [font="Arial"]mpc load " + playl[x]))[/font] eingetragen. Und er spuckt auch alles richtig aus. Ich habe auch versucht, dass ich den ausgegebenen Befehl einfach kopiere und in den Shell eintrage - hier funktioinierts.[/font]
[font="Arial"]Jetzt ist meine Frage, woran es hängt.[/font]
import sys, os
import termios, fcntl
import time
x=1
playl = open("Liste.pla").readlines()
fd = sys.stdin.fileno()
oldterm = termios.tcgetattr(fd)
newattr = termios.tcgetattr(fd)
newattr[3] = newattr[3] & ~termios.ICANON & ~termios.ECHO
termios.tcsetattr(fd, termios.TCSANOW, newattr)
oldflags = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, oldflags | os.O_NONBLOCK)
os.system("mpc play")
os.system("clear")
os.system("mpc")
try:
while 1:
try:
c = sys.stdin.read(1)
if c == 'w': x=x+1 ; os.system("mpc crop") ; os.system("mpc load " + playl[x])
if c == 's': x=x-1 ; os.system("mpc crop") ; os.system("mpc load " + playl[x])
if c == 'b': break
if c == 'q': os.system("mpc")
if c == 'a': os.system("mpc prev")
if c == 'd': os.system("mpc next")
if c == 'r': os.system("mpc random on")
if c == 't': os.system("mpc random off")
if c == 'x': os.system("mpc toggle")
if c == '+': os.system("mpc volume +2")
if c == '-': os.system("mpc volume -2")
os.system("clear")
os.system("mpc")
print "mpc load " + playl[x]
except IOError: pass
finally:
termios.tcsetattr(fd, termios.TCSAFLUSH, oldterm)
fcntl.fcntl(fd, fcntl.F_SETFL, oldflags)
Alles anzeigen
Gruß Chris