xml.dom.ext.PrettyPrint(doc, xml_file)
xml_file.close()
- def pre_process(self, item_id, source, metadata, ext, cache_dir, options):
+ def pre_process(self, item_id, source, metadata, ext,
+ cache_dir, options=None):
""" Pre processing of the core. Prepare the export path and
return it"""
self.item_id = str(item_id)
file_name = get_file_name(self.source)
file_name_wo_ext, file_ext = split_file_name(file_name)
self.cache_dir = cache_dir
- self.options = options
self.metadata = metadata
#self.collection = self.metadata['Collection']
return self.dest
- def post_process(self, item_id, source, metadata, ext, cache_dir, options):
+ def post_process(self, item_id, source, metadata, ext,
+ cache_dir, options=None):
""" Post processing of the Core. Print infos, etc..."""
- if 'verbose' in self.options and self.options['verbose'] != '0':
- print self.dest
- print self.get_file_info()
+ if not options is None:
+ if 'verbose' in self.options and self.options['verbose'] != '0':
+ print self.dest
+ print self.get_file_info()
# External functions
media[tag] = str(self.metadata[tag])
media.save()
- def process(self, item_id, source, metadata, options):
+ def process(self, item_id, source, metadata, options=None):
self.item_id = item_id
self.source = source
self.metadata = metadata
- self.options = options
-
- if 'flac_quality' in self.options and \
- self.options['flac_quality'] != '':
- args = '-f -V -'+self.options['flac_quality']
- else:
- args = '-f -V -'+self.quality_default
-
- if 'verbose' in self.options and self.options['verbose'] != '0':
- args = args
+ args = ''
+
+ if not options is None:
+ self.options = options
+ if 'verbose' in self.options and self.options['verbose'] != '0':
+ args = args
+ else:
+ args = args + ' -s '
+
+ if 'flac_quality' in self.options:
+ args = args+' -f -V -'+self.options['flac_quality']
+ else:
+ args = args+' -f -V -'+self.quality_default
else:
- args = args+' -s '
+ args = args+' -s -f -V -'+self.quality_default
try:
# Pre-proccessing (core)
id3.add(frame)
id3.save()
- def process(self, item_id, source, metadata, options):
+ def process(self, item_id, source, metadata, options=None):
self.item_id = item_id
self.source = source
self.metadata = metadata
- self.options = options
-
- if 'mp3_bitrate' in self.options:
- args = '-b '+self.options['mp3_bitrate']
- else:
- args = '-b '+self.bitrate_default
+ args = ''
+
+ if not options is None:
+ self.options = options
- args = args + '-c -o '
-
- if 'verbose' in self.options and self.options['verbose'] != '0':
- args = args
+ if 'verbose' in self.options and self.options['verbose'] != '0':
+ args = args
+ else:
+ args= args + '-S '
+
+ if 'mp3_bitrate' in self.options:
+ args = args+'-b '+self.options['mp3_bitrate']
+ else:
+ args = args+'-b '+self.bitrate_default
+
+ #Copyrights, etc..
+ args = args + ' -c -o '
else:
- args = args + '-S '
+ args = args + ' -S -c -o '
if os.path.exists(self.source) and not iswav16(self.source):
self.source = self.decode()
media[tag] = str(self.metadata[tag])
media.save()
- def process(self, item_id, source, metadata, options):
+ def process(self, item_id, source, metadata, options=None):
self.item_id = item_id
self.source = source
self.metadata = metadata
- self.options = options
+ args = ''
+
+ if not options is None:
+ self.options = options
+ if 'verbose' in self.options and self.options['verbose'] != '0':
+ args = args
+ else:
+ args = args + ' -Q '
+ if 'ogg_bitrate' in self.options:
+ args = '-b '+self.options['ogg_bitrate']
+ elif 'ogg_quality' in self.options:
+ args = '-q '+self.options['ogg_quality']
+ else:
+ args = '-b '+self.bitrate_default
- if 'ogg_bitrate' in self.options:
- args = '-b '+self.options['ogg_bitrate']
- elif 'ogg_quality' in self.options:
- args = '-q '+self.options['ogg_quality']
else:
- args = '-b '+self.bitrate_default
+ args = '-Q -b '+self.bitrate_default
- if 'verbose' in self.options and self.options['verbose'] != '0':
- args = args
- else:
- args = args + ' -Q '
-
if os.path.exists(self.source) and not iswav16(self.source):
self.source = self.decode()
except IOError:
return 'Exporter error: Cannot create the par2 key...'
- def process(self, item_id, source, metadata, options):
+ def process(self, item_id, source, metadata, options=None):
self.item_id = item_id
self.source = source
self.metadata = metadata
- self.options = options
-
+ if not options is None:
+ self.options = options
try:
# Pre-proccessing (core)
self.ext = self.get_file_extension()
exporters = ExtensionPoint(IExporter)
def run(self):
+ verbose = '1'
for exporter in self.exporters:
format = exporter.get_format()
- if 'verbose' in options and options['verbose'] != '0':
+ if verbose != '0':
print "\n+------------------------------------------"
print '| Testing exporter format: ' + format
print "+------------------------------------------"
exporter.set_cache_dir(cache_dir)
exporter.process(item_id,source,metadata,options)
+ #exporter.process(item_id,source,metadata)
compmgr = ComponentManager()