Probleme mit Parametern und Programmausführung
Verfasst: Montag 21. Mai 2007, 20:04
Hallo,
im Augenblick versuche ich ein kleines Script zu schreiben, was eine Audiodatei, die mit einem lossless Codec enkodiert ist, mit dem entsprechenden Programm dekodiert und dann mit einem anderen Tool die Qualität des Ausgangsmaterials bewertet.
Das habe ich bisher:
Sehr einfach, funktioniert aber nicht. Das Programm, das ich per os.popen aufrufe, wird scheinbar nicht gestartet.
Kann mir vielleicht jemand erklären, warum nicht?
Danke schonmal
im Augenblick versuche ich ein kleines Script zu schreiben, was eine Audiodatei, die mit einem lossless Codec enkodiert ist, mit dem entsprechenden Programm dekodiert und dann mit einem anderen Tool die Qualität des Ausgangsmaterials bewertet.
Das habe ich bisher:
Code: Alles auswählen
# -*- coding: utf-8 -*-
import sys,os
def get_random_string(length):
import random
string = ''
for x in range(length):
digit = random.randint(48,122)
while (digit in range(58,65)) or (digit in range(91,97)):
digit = random.randint(48,122)
string = string + chr(digit)
return string
flac_path = ur'E:\Downloads\FLAC\flac'
monkeysaudio_path = ur"e:\temp"
aucdtect_path = ur'E:\Downloads\auCDtect\auCDtect-0.8'
audio_file = os.path.abspath(sys.argv[1].decode(sys.getfilesystemencoding()))
audio_file_path = os.path.split(audio_file)[0]
flac_exe = os.path.join(flac_path,'flac.exe')
monkeysaudio_exe = os.path.join(monkeysaudio_path,'MAC.exe')
aucdtect_exe = os.path.join(aucdtect_path,'auCDtect.exe')
rand_name = get_random_string(15)
wav_file = os.path.join(audio_file_path,rand_name+'.wav')
if audio_file.endswith('.flac'):
string = '"%s" -o "%s" -d "%s"' % (flac_exe,wav_file,audio_file)
string = string.encode(sys.stdout.encoding)
os.popen(string)
elif audio_file.endswith('.ape'):
string = '"%s" "%s" "%s" -d' % (monkeysaudio_exe,audio_file,wav_file)
string = string.encode(sys.stdout.encoding)
os.popen(string)
#test with aucd
Kann mir vielleicht jemand erklären, warum nicht?
Danke schonmal