#!/usr/bin/python import os import optparse import urlparse import subprocess parser = optparse.OptionParser() options, args = parser.parse_args() for filename in args: files_to_get = open(filename, 'r').readlines() print filename print files_to_get for url in files_to_get: this_filename = urlparse.urlsplit(url)[2].split('/')[-1] subprocess.Popen(['wget', url]).wait() if not os.path.exists(this_filename): print "**** Hm, couldn't open: %s" % this_filename continue mp3_filename = this_filename.split('.')[0] + '.mp3' os.popen( ('gst-launch filesrc location=%s ' '! rmdemux ! ffdec_cook ! lame ! ' 'filesink location=%s') % ( this_filename, mp3_filename))