def __init__(self, message, command, subprocess):
self.message = message
- self.command = command
+ self.command = str(command)
self.subprocess = subprocess
def __str__(self):
- error = self.subprocess.stderr.read()
+ if self.subprocess.stderr != None:
+ error = self.subprocess.stderr.read()
+ else:
+ error = ''
return "%s ; command: %s; error: %s" % (self.message,
self.command,
error)
-
-
\ No newline at end of file
def post_process(self, item_id, source, metadata, ext,
cache_dir, options=None):
""" Post processing : write tags, print infos, etc..."""
- #self.write_tags()
+ self.write_tags()
if not options is None:
if 'verbose' in self.options and self.options['verbose'] != '0':
print self.dest
self.metadata = metadata
self.args = self.get_args(options)
self.ext = self.get_file_extension()
- self.command = 'sox "'+self.source+'" -q -w -r 44100 -t wav -c2 - '+ \
- '| flac '+self.args+' -c -'
+ self.command = 'flac '+self.args+' "'+self.source+'" -c -'
# Pre-proccessing
self.dest = self.pre_process(self.item_id,
self.options)
# Processing (streaming + cache writing)
- stream = self.core_process(self.command,self.buffer_size,self.dest)
+ stream = self.core_process(self.command, self.buffer_size, self.dest)
for chunk in stream:
yield chunk
self.cache_dir,
self.options)
- # Encoding
- #os.system('flac '+args+' -o "'+self.dest+'" "'+ \
- # self.source+'" > /dev/null')
-
self.args = self.get_args(self.metadata,options)
self.ext = self.get_file_extension()
self.command = 'sox "'+self.source+'" -q -w -r 44100 -t wav -c2 - '+ \
- '| lame '+self.args+' - '
+ '| lame '+self.args+' --tc "default" - '
# Pre-proccessing
self.dest = self.pre_process(self.item_id,
for chunk in stream:
yield chunk
- # Post-proccessing
+ # Post-proccessing
self.post_process(self.item_id,
self.source,
self.metadata,
self.cache_dir,
self.options)
- # Encoding
- # os.system('lame '+args+' --tc "default" "'+self.source+
- # '" "'+self.dest+'"')
-
'| oggenc '+self.args+' -'
# Pre-proccessing
-
self.dest = self.pre_process(self.item_id,
self.source,
self.metadata,
self.cache_dir,
self.options)
- # Post-proccessing
- #os.system('sox "'+self.source+'" -w -r 44100 -t wav -c2 - \
- # | oggenc '+args+' -o "'+self.dest+'" -')
-