示例#1
0
    def create_waveform_image(self):

        if self.master:
            tmp_directory = tempfile.mkdtemp()

            src_path = self.master.path;
            tmp_path = os.path.join(tmp_directory, 'tmp.wav')
            dst_path = os.path.join(self.get_folder_path('cache'), 'waveform.png')
            
            audiotools.open(src_path).convert(tmp_path, audiotools.WaveAudio)
            
            args = (tmp_path, dst_path, None, 1800, 301, 2048)
            create_wave_images(*args)
            
            try:
                shutil.rmtree(tmp_directory)
            except Exception, e:
                print e
示例#2
0
    def create_waveform_image(self):

        if self.master:
            tmp_directory = tempfile.mkdtemp()

            src_path = self.master.path
            tmp_path = os.path.join(tmp_directory, 'tmp.wav')
            dst_path = os.path.join(self.get_folder_path('cache'),
                                    'waveform.png')

            audiotools.open(src_path).convert(tmp_path, audiotools.WaveAudio)

            args = (tmp_path, dst_path, None, 1800, 301, 2048)
            create_wave_images(*args)

            try:
                shutil.rmtree(tmp_directory)
            except Exception, e:
                print e
示例#3
0
    def create_waveform_image(self):

        if self.master:
            tmp_directory = tempfile.mkdtemp()

            src_path = self.master.path
            tmp_path = os.path.join(tmp_directory, "tmp.wav")
            dst_path = os.path.join(self.get_folder_path("cache"), "waveform.png")

            print "create waveform"
            print "src_path: %s" % src_path
            print "tmp_path: %s" % tmp_path
            print "dst_path: %s" % dst_path

            audiotools.open(src_path).convert(tmp_path, audiotools.WaveAudio)

            args = (tmp_path, dst_path, None, 1800, 301, 2048)
            create_wave_images(*args)

            try:
                shutil.rmtree(tmp_directory)
            except Exception, e:
                print e
示例#4
0
         print 'post audiotools'
     
         # waveform
         wav_path = str(tmp_path)
         img_w = str(tmp_path) + '_w' + '.png' 
         img_s = str(tmp_path) + '_s' +'.png' 
 
         args = (wav_path, img_w, img_s, 1800, 301, 2048, self.progress_callback)
         
         print '----------------------------------'
         print 'WAVEGRAPHER!!!'
         print '----------------------------------'
         try:
             print 'trying to create waveform image:',
             print img_w
             create_wave_images(*args)
             print 'create_wave_images - done'
         except Exception, e:
             print "Error running wav2png: ", e
             
         try: 
             # file.Image.objects.get(original_filename='waveform.png', folder=self.folder)
             # os.remove(file.path)
             # file.delete()
             # delete all images in cache folder
             for img in self.folder.files.instance_of(Image):
                 os.remove(img.path)
                 img.delete()
                           
         except Exception, e:
             print 'unable to delete:',
示例#5
0
                # waveform
                wav_path = str(tmp_path)
                img_w = str(tmp_path) + '_w' + '.png'
                img_s = str(tmp_path) + '_s' + '.png'

                args = (wav_path, img_w, img_s, 1800, 301, 2048,
                        self.progress_callback)

                print '----------------------------------'
                print 'WAVEGRAPHER!!!'
                print '----------------------------------'
                try:
                    print 'trying to create waveform image:',
                    print img_w
                    create_wave_images(*args)
                    print 'create_wave_images - done'
                except Exception, e:
                    print "Error running wav2png: ", e

                try:
                    # file.Image.objects.get(original_filename='waveform.png', folder=self.folder)
                    # os.remove(file.path)
                    # file.delete()
                    # delete all images in cache folder
                    for img in self.folder.files.instance_of(Image):
                        os.remove(img.path)
                        img.delete()

                except Exception, e:
                    print 'unable to delete:',