def init(self): self.encoders = { 'audio/x-vorbis': self.add_oggvorbis_encoder, 'audio/x-flac': self.add_flac_encoder, 'audio/x-wav': self.add_wav_encoder, 'audio/mpeg': self.add_mp3_encoder, 'audio/x-m4a': self.add_aac_encoder, 'gst-profile': self.add_audio_profile, } self.add_command('audiorate') self.add_command('audioresample') self.add_command('audioconvert') # audio resampling support if self.output_resample: self.add_command('audio/x-raw-int,rate=%d' % self.resample_rate) self.add_command('audioresample') self.add_command('audioconvert') if self.force_mono: self.add_command('audio/x-raw-int,channels=1') self.add_command('audioconvert') encoder = self.encoders[self.output_type]() if not encoder: # TODO: is this used ? # TODO: add proper error management when an encoder cannot be created dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, _("Cannot create a decoder for \'%s\' format.") % \ self.output_type) dialog.run() dialog.hide() return self.add_command(encoder) uri = gnomevfs.URI(self.output_filename) dirname = uri.parent if dirname and not gnomevfs.exists(dirname): log('Creating folder: \'%s\'' % dirname) if not vfs_makedirs(str(dirname)): # TODO add better error management dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, _("Cannot create \'%s\' folder.") % \ dirname) dialog.run() dialog.hide() return self.add_command('%s location="%s"' % ( gstreamer_sink, encode_filename(self.output_filename))) if self.overwrite and vfs_exists(self.output_filename): log('overwriting \'%s\'' % self.output_filename) vfs_unlink(self.output_filename)
def init(self): self.encoders = { 'audio/x-vorbis': self.add_oggvorbis_encoder, 'audio/x-flac': self.add_flac_encoder, 'audio/x-wav': self.add_wav_encoder, 'audio/mpeg': self.add_mp3_encoder, 'audio/x-m4a': self.add_aac_encoder, 'audio/ogg; codecs=opus': self.add_opus_encoder, 'gst-profile': self.add_audio_profile, } self.add_command('audiorate tolerance=10000000') self.add_command('audioconvert') self.add_command('audioresample') # audio resampling support if self.output_resample: self.add_command('audio/x-raw-int,rate=%d' % self.resample_rate) self.add_command('audioconvert') self.add_command('audioresample') if self.force_mono: self.add_command('audio/x-raw-int,channels=1') self.add_command('audioconvert') encoder = self.encoders[self.output_type]() if not encoder: # TODO: is this used ? # TODO: add proper error management when an encoder cannot be created show_error( _('Error', "Cannot create a decoder for \'%s\' format.") % self.output_type) return self.add_command(encoder) uri = gnomevfs.URI(self.output_filename) dirname = uri.parent if dirname and not gnomevfs.exists(dirname): log('Creating folder: \'%s\'' % dirname) if not vfs_makedirs(str(dirname)): show_error('Error', _("Cannot create \'%s\' folder.") % dirname) return self.add_command( '%s location="%s"' % (gstreamer_sink, encode_filename(self.output_filename)))
def init(self): self.encoders = { 'audio/x-vorbis': self.add_oggvorbis_encoder, 'audio/x-flac': self.add_flac_encoder, 'audio/x-wav': self.add_wav_encoder, 'audio/mpeg': self.add_mp3_encoder, 'audio/x-m4a': self.add_aac_encoder, 'audio/ogg; codecs=opus': self.add_opus_encoder, 'gst-profile': self.add_audio_profile, } self.add_command('audiorate') self.add_command('audioconvert') self.add_command('audioresample') # audio resampling support if self.output_resample: self.add_command('audio/x-raw-int,rate=%d' % self.resample_rate) self.add_command('audioconvert') self.add_command('audioresample') if self.force_mono: self.add_command('audio/x-raw-int,channels=1') self.add_command('audioconvert') encoder = self.encoders[self.output_type]() if not encoder: # TODO: is this used ? # TODO: add proper error management when an encoder cannot be created show_error(_('Error', "Cannot create a decoder for \'%s\' format.") % self.output_type) return self.add_command(encoder) uri = gnomevfs.URI(self.output_filename) dirname = uri.parent if dirname and not gnomevfs.exists(dirname): log('Creating folder: \'%s\'' % dirname) if not vfs_makedirs(str(dirname)): show_error('Error', _("Cannot create \'%s\' folder.") % dirname) return self.add_command('%s location="%s"' % ( gstreamer_sink, encode_filename(self.output_filename))) if self.overwrite and vfs_exists(self.output_filename): log('overwriting \'%s\'' % beautify_uri(self.output_filename)) vfs_unlink(self.output_filename)