def __compute_and_append( self , at , file_name ): duration = StructDuration() #( dr14, dB_peak, dB_rms ) = self.compute_dr.compute( at.Y , at.Fs ) ( dr14, dB_peak, dB_rms ) = compute_dr14( at.Y , at.Fs , duration ) sha1 = sha1_track_v1( at.Y , at.get_file_ext_code() ) self.dr14 = self.dr14 + dr14 res = { 'file_name': file_name , 'dr14': dr14 , 'dB_peak': dB_peak , 'dB_rms': dB_rms , 'duration': duration.to_str() , 'sha1': sha1 } self.res_list.append(res) print_msg( file_name + ": \t DR " + str( int(dr14) ) )
def __compute_and_append(self, at, file_name): duration = StructDuration() #( dr14, dB_peak, dB_rms ) = self.compute_dr.compute( at.Y , at.Fs ) (dr14, dB_peak, dB_rms) = compute_dr14(at.Y, at.Fs, duration) sha1 = sha1_track_v1(at.Y, at.get_file_ext_code()) self.dr14 = self.dr14 + dr14 res = {'file_name': file_name, 'dr14': dr14, 'dB_peak': dB_peak, 'dB_rms': dB_rms, 'duration': duration.to_str(), 'sha1': sha1} self.res_list.append(res) print_msg(file_name + ": \t DR " + str(int(dr14)))
def run_mp( self , job_queue_sh , res_queue_sh ): at = AudioTrack() duration = StructDuration() #print_msg("start .... ") while True: if job_queue_sh.empty() : return job = job_queue_sh.get() full_file = os.path.join( job.dir_name , job.file_name ) #print ( full_file ) if at.open( full_file ): ( dr14, dB_peak, dB_rms ) = compute_dr14( at.Y , at.Fs , duration ) sha1 = sha1_track_v1( at.Y , at.get_file_ext_code() ) print_msg( job.file_name + ": \t DR " + str( int(dr14) ) ) flush_msg() job.dr14 = dr14 job.dB_peak = dB_peak job.dB_rms = dB_rms job.duration = duration.to_float() job.sha1 = sha1 else: job.fail = True print_msg( "- fail - " + full_file ) res_queue_sh.put( job ) job_queue_sh.task_done()
def run_mp(self, job_queue_sh, res_queue_sh): at = AudioTrack() duration = StructDuration() #print_msg("start .... ") while True: if job_queue_sh.empty(): return job = job_queue_sh.get() full_file = os.path.join(job.dir_name, job.file_name) #print ( full_file ) if at.open(full_file): (dr14, dB_peak, dB_rms) = compute_dr14(at.Y, at.Fs, duration) sha1 = sha1_track_v1(at.Y, at.get_file_ext_code()) print_msg(job.file_name + ": \t DR " + str(int(dr14))) flush_msg() job.dr14 = dr14 job.dB_peak = dB_peak job.dB_rms = dB_rms job.duration = duration.to_float() job.sha1 = sha1 else: job.fail = True print_msg("- fail - " + full_file) res_queue_sh.put(job) job_queue_sh.task_done()