]> git.parisson.com Git - telemeta.git/commitdiff
Fixed #26 partially for downloading but not for flash playing
authoryomguy <>
Wed, 23 May 2007 10:14:25 +0000 (10:14 +0000)
committeryomguy <>
Wed, 23 May 2007 10:14:25 +0000 (10:14 +0000)
debian/control
telemeta/export/core.py
telemeta/export/flac.py
telemeta/export/mp3.py
telemeta/export/ogg.py
telemeta/export/wav.py

index 76cddaf4536637b941fa4a264188fe4bc9b4e48d..4554d226c24553c27b164a26d6041ed6aad93e71 100644 (file)
@@ -9,7 +9,9 @@ XS-Python-Version: >= 2.3
 
 Package: telemeta
 Architecture: any
-Depends: python (>= 2.3.5-7), python-xml, python-central (>= 0.5), python-mutagen, sox, vorbis-tools, flac, lame, normalize-audio, ecasound, festival, par2
+Depends: python (>= 2.3.5-7), python-xml, python-central (>= 0.5),
+python-mutagen, python-django, sox, vorbis-tools, flac, lame, normalize-audio,
+ecasound, festival, par2, python-mysqldb, sqlite3 | mysql-server
 XB-Python-Version: ${python:Versions}
 Description: backups, transcodes, tags and marks any audio content with metadata
  Telemeta is an audio tool which creates audio transcoded databases fast from
index 8ad0fafe2b4b786f666eba235c2a25184c844196..e7666646b81cba6369ca474ed5f3da71b5001cca 100644 (file)
@@ -131,17 +131,20 @@ class ExporterCore(Component):
         # Define and create the destination path
         # At the moment, the target directory is built with this scheme in
         # the cache directory : ./%Format/%Collection/%Artist/
-        self.dest = self.cache_dir
+        self.cache_dir = os.path.join(self.cache_dir,'cache')
 
         #export_dir = os.path.join(self.ext,self.collection,self.artist)
-        export_dir = self.ext
-        if not os.path.exists(os.path.join(self.dest,export_dir)):
-            for _dir in export_dir.split(os.sep):
-                self.dest = os.path.join(self.dest,_dir)
-                if not os.path.exists(self.dest):
-                    os.mkdir(self.dest)
+        export_dir = os.path.join(self.cache_dir,self.ext)
+
+        if not os.path.exists(export_dir):
+            export_dir_split = export_dir.split(os.sep)
+            path = export_dir_split[0]
+            for _dir in export_dir_split[1:]:
+                path = os.path.join(path,_dir)
+                if not os.path.exists(path):
+                    os.mkdir(path)
         else:
-            self.dest = os.path.join(self.dest,export_dir)
+            self.dest = export_dir
 
         # Set the target file
         #target_file = file_name_wo_ext+'.'+self.ext
@@ -259,13 +262,17 @@ def split_file_name(file):
         return 'Exporter error [1]: path does not exist.'
 
 def clean_word(word) :
-    """ Return the word without excessive blank spaces and underscores """
+    """ Return the word without excessive blank spaces, underscores and
+    characters causing problem to exporters"""
     word = re.sub("^[^\w]+","",word)    #trim the beginning
     word = re.sub("[^\w]+$","",word)    #trim the end
-    #word = string.replace(word,' ','_')
     word = re.sub("_+","_",word)        #squeeze continuous _ to one _
     word = re.sub("^[^\w]+","",word)    #trim the beginning _
+    #word = string.replace(word,' ','_')
     #word = string.capitalize(word)
+    dict = '&[];"*'
+    for letter in dict:
+        word = string.replace(word,letter,'_')
     return word
 
 def recover_par_key(path):
index 827aa26b6e0b86de792b2e538154f3de91b0e5db..ddb9ad82809ac95c055bdb0c6f6ef2f88855f8f8 100644 (file)
@@ -111,15 +111,15 @@ class FlacExporter(ExporterCore):
                        '| flac '+self.args+' -c -'
 
         # Pre-proccessing
-        try:
-            self.dest = self.pre_process(self.item_id,
+        #try:
+        self.dest = self.pre_process(self.item_id,
                                          self.source,
                                          self.metadata,
                                          self.ext,
                                          self.cache_dir,
                                          self.options)
-        except:
-            yield 'ExporterError [3]: pre_process'
+        #except:
+            #raise 'ExporterError [3]: pre_process'
 
         # Processing (streaming + cache writing)
         try:
@@ -127,7 +127,7 @@ class FlacExporter(ExporterCore):
             for chunk in stream:
                 yield chunk
         except:
-            yield 'ExporterError: core_process'
+            raise 'ExporterError: core_process'
 
         # Post-proccessing
         try:
@@ -138,7 +138,7 @@ class FlacExporter(ExporterCore):
                          self.cache_dir,
                          self.options)
         except:
-            yield 'ExporterError: post_process'
+            raise 'ExporterError: post_process'
 
 
         # Encoding
index b56f5c10f8c8d293defa0f6b24b33a7f8828db72..0a0affa35a135907919a0241edff3850dffdf7e6 100644 (file)
@@ -114,11 +114,11 @@ class Mp3Exporter(ExporterCore):
         else:
             args = args + ' -S -c -o '
 
-        for tag in self.metadata.keys():
-            if tag in self.dub2args_dict.keys():
-                arg = self.dub2args_dict[tag]
-                value = self.metadata[tag]
-                args = args + ' --' + arg + ' "' +value +'" '
+        #for tag in self.metadata.keys():
+            #if tag in self.dub2args_dict.keys():
+                #arg = self.dub2args_dict[tag]
+                #value = clean_word(self.metadata[tag])
+                #args = args + ' --' + arg + ' "' +value +'" '
 
         return args
 
@@ -140,7 +140,7 @@ class Mp3Exporter(ExporterCore):
                                          self.cache_dir,
                                          self.options)
         except:
-            yield 'ExporterError [3]: pre_process'
+            raise 'ExporterError [3]: pre_process'
 
         # Processing (streaming + cache writing)
         try:
@@ -148,7 +148,7 @@ class Mp3Exporter(ExporterCore):
             for chunk in stream:
                 yield chunk
         except:
-            yield 'ExporterError: core_process'
+            raise 'ExporterError: core_process'
 
         # Post-proccessing
         try:       
@@ -159,7 +159,7 @@ class Mp3Exporter(ExporterCore):
                          self.cache_dir,
                          self.options)
         except:
-            yield 'ExporterError: post_process'
+            raise 'ExporterError: post_process'
     
         # Encoding
         # os.system('lame '+args+' --tc "default" "'+self.source+
index 48ac748793bed3f23f74bc0820f64d49f2ec8913..08e96607388e09f1bb5bf6926a3539b1f10719c7 100644 (file)
@@ -114,7 +114,7 @@ class OggExporter(ExporterCore):
                                          self.cache_dir,
                                          self.options)
         except:
-            yield 'ExporterError [3]: pre_process'
+            raise 'ExporterError [3]: pre_process'
 
         # Processing (streaming + cache writing)
         try:
@@ -122,7 +122,7 @@ class OggExporter(ExporterCore):
             for chunk in stream:
                 yield chunk
         except:
-            yield 'ExporterError: core_process'
+            raise 'ExporterError: core_process'
 
         # Post-proccessing
         try:
@@ -133,7 +133,7 @@ class OggExporter(ExporterCore):
                          self.cache_dir,
                          self.options)
         except:
-            yield 'ExporterError: post_process'
+            raise 'ExporterError: post_process'
 
 
 
index 5bb15d71e61c7aa0f3a62482a1c02b23e93987d9..3881787fdd5f6c87cb8aac8ce599230bd364fd4b 100644 (file)
@@ -151,7 +151,7 @@ class WavExporter(ExporterCore):
                          self.options)
 
         except IOError:
-            yield 'ExporterError [3]: source file does not exist.'
+            raise 'ExporterError [3]: source file does not exist.'