from telemeta.export.api import *
from telemeta.export.core import *
-#from telemeta.export.ogg import *
-#from telemeta.export.flac import *
-#from telemeta.export.wav import *
+from telemeta.export.ogg import *
+from telemeta.export.flac import *
+from telemeta.export.wav import *
from telemeta.export.mp3 import *
\ No newline at end of file
self.dest = ''
self.metadata = []
self.cache_dir = 'cache'
+ self.buffer_size = 0xFFFF
def set_cache_dir(self,path):
self.cache_dir = path
import os
import string
+import subprocess
from telemeta.export.core import *
from telemeta.export.api import IExporter
self.dest = ''
self.quality_default = '5'
self.info = []
+ self.buffer_size = 0xFFFF
def get_format(self):
return 'FLAC'
self.cache_dir,
self.options)
+ # Initializing
+ chunk = 0
+ file_out = open(self.dest,'w')
+
+ proc = subprocess.Popen( \
+ 'sox "'+self.source+'" -w -r 44100 -t wav -c2 - '+
+ '| flac '+args+' -c -',
+ shell=True,
+ bufsize=self.buffer_size,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ close_fds=True)
+
+ chunk = proc.stdout.read(self.buffer_size)
+ yield chunk
+ file_out.write(chunk)
+
+ # Processing
+ while chunk:
+ chunk = proc.stdout.read(self.buffer_size)
+ yield chunk
+ file_out.write(chunk)
+
+ file_out.close()
+
+
# Encoding
- os.system('flac '+args+' -o "'+self.dest+'" "'+ \
- self.source+'" > /dev/null')
+ #os.system('flac '+args+' -o "'+self.dest+'" "'+ \
+ # self.source+'" > /dev/null')
# Post-proccessing (self)
self.write_tags()
self.options)
# Output
- return self.dest
+ #return self.dest
except IOError:
- return 'ExporterError [3]: source file does not exist.'
+ yield 'ExporterError [3]: source file does not exist.'
file_out = open(self.dest,'w')
proc = subprocess.Popen( \
- #'sox "'+self.source+'" -w -r 44100 -t wav -c2 - '+
- #'| lame '+args+' --tc "default" -',
- 'lame '+args+' --tc "default" "'+self.source+'" -',
+ 'sox "'+self.source+'" -w -r 44100 -t wav -c2 - '+
+ '| lame '+args+' --tc "default" - -',
shell=True,
bufsize=self.buffer_size,
stdin=subprocess.PIPE,
self.source = ''
self.dest = ''
self.options = {}
+ self.buffer_size = 0xFFFF
def get_format(self):
return 'WAV'
self.cache_dir,
self.options)
+ # Initializing
+ chunk = 0
+ file_in = open(self.source,'rb')
+ file_out = open(self.dest,'w')
+
+ chunk = file_in.read(self.buffer_size)
+ yield chunk
+ file_out.write(chunk)
+
+ # Processing
+ while chunk:
+ chunk = file_in.read(self.buffer_size)
+ yield chunk
+ file_out.write(chunk)
+
+ file_in.close()
+ file_out.close()
+
#if self.compare_md5_key():
- os.system('cp -a "'+self.source+'" "'+ self.dest+'"')
+ #os.system('cp -a "'+self.source+'" "'+ self.dest+'"')
#print 'COPIED'
# Pre-proccessing (self)
self.options)
# Output
- return self.dest
+ #return self.dest
except IOError:
- return 'ExporterError [3]: source file does not exist.'
+ yield 'ExporterError [3]: source file does not exist.'
from telemeta.core import ComponentManager
cache_dir = 'cache/'
-source = 'samples/wav/The Chicken-James Brown.wav'
-#source = 'samples/wav/Cellar - Show Me - 02.wav'
+#source = 'samples/wav/The Chicken-James Brown.wav'
+source = 'samples/wav/Cellar - Show Me - 02.wav'
item_id = '10'
metadata = {'identifier': 'Test', #collection
'title': 'Show Me',