Exemplo n.º 1
0
 def process_non_expected_files(self, non_expected_files, target_path):
     for non_expected_file in non_expected_files:
         if non_expected_file['data']['consider']:
             try: 
                 self.copy_file(non_expected_file['data']['path'], os.path.join(target_path, non_expected_file['filename']))
                 print "[ii] filename %s was copied correctly." %(unicoder(os.path.basename(non_expected_file['filename'])))
             except PyD3Error as e: 
                 print "[ee] %s" %(unicoder(e.msg))
Exemplo n.º 2
0
 def process_apic_images(self, apic_images, target_path):
     for key in apic_images.keys():
         if apic_images[key]:
             image_file = apic_images[key]['file']
             try:
                 (filename, extension)  = self.image_types[key]['filename'][0], os.path.splitext(image_file)[1]
                 self.copy_file(image_file, os.path.join(target_path, filename+extension))
                 print "[ii] apic image %s was copied correctly." %(unicoder(os.path.basename(filename+extension)))
             except PyD3Error as e: 
                 print "[ee] %s" %(unicoder(e.msg))
Exemplo n.º 3
0
 def process_tunes(self, tunes, trackn_max_digits, target_path, apic_images):
     for tune in tunes:
         target_filename = self.get_tunned_filename(tune['filename']['source'], tune['id3'], trackn_max_digits)
         tune['filename']['target'] = os.path.abspath(os.path.join(target_path, target_filename))
         try:
             self.copy_file(tune['filename']['source'], tune['filename']['target'])
             self.save_id3_data(tune['filename']['target'], tune['id3'], apic_images)
             print "[ii] tune %s was processed correctly." %(unicoder(os.path.basename(tune['filename']['source'])))
         except PyD3Error as e:
             print "[ee] %s" %(unicoder(e.msg))
Exemplo n.º 4
0
 def get_text_tune_id3(self, id3):
     l = []
     l.append("Track#: %s" %(unicoder(id3.get('trackn', ''))))
     l.append("Album : %s" %(unicoder(id3.get('album',  ''))))
     l.append("Artist: %s" %(unicoder(id3.get('artist', ''))))
     l.append("Title : %s" %(unicoder(id3.get('title',  ''))))
     l.append("Genre : %s" %(unicoder(id3.get('genre',  ''))))
     l.append("Year  : %s" %(unicoder(id3.get('year',   ''))))
     return os.linesep.join(l)
Exemplo n.º 5
0
 def print_source_path_was(self):
     raw_input("%s path was processed. Please, press a key to continue." %(unicoder(self.paths['source_path'])))
Exemplo n.º 6
0
 def get_text_going_to_copied_in(self, path):
     return "Files are going to be copied in %s path." %(unicoder(path))
Exemplo n.º 7
0
 def print_tune_info(self, tune_data, image=None):
     print unicoder(self.get_text_tune_filename(tune_data['filename']['source']))
     print unicoder(self.get_text_tune_id3(tune_data['id3']))
     print unicoder(self.get_text_attached_images(image))
Exemplo n.º 8
0
 def print_dir_info(self, folder_summary):
     print unicoder("%s (%s)" %(unicoder(self.get_text_source_path_is()), self.get_text_n_tunes(folder_summary['files']['tune'])))
     print unicoder(self.get_text_line_block())
     print unicoder(self.get_text_line_block("AUDIO DATA"))
     print unicoder(self.get_text_tunes_audio(folder_summary['audio']))
     print unicoder(self.get_text_line_block())
     print unicoder(self.get_text_line_block("ID3 DATA"))
     print unicoder(self.get_text_tunes_id3(folder_summary['id3']))
     print unicoder(self.get_text_line_block())
     print unicoder(self.get_text_line_block("ATTACHED IMAGES (ID3)"))
     print unicoder(self.get_text_attached_images(folder_summary['image']))
     print unicoder(self.get_text_line_block())
     print unicoder(self.get_text_line_block("PATHS"))
     print unicoder(self.get_text_current_dir(folder_summary['path']['source_dir']))
     print unicoder(self.get_text_target_dir(folder_summary['path']['target_dir']))
     print unicoder(self.get_text_line_block())
     if len(folder_summary['non_expected_files'])>0:
         print unicoder(self.get_text_line_block("NON EXPECTED FILES"))
         print unicoder(self.get_text_non_expected_files(folder_summary['non_expected_files']))
     print unicoder(self.get_text_line_block())
Exemplo n.º 9
0
 def get_text_non_expected_files(self, files):
     if len(files) is 0: return
     tf  = lambda v: 'Included' if v is True else 'Excluded'
     fnc = lambda f: '%s [%s]' %(unicoder(f['filename']), tf(f['data']['consider']))
     return "%s" %(', '.join(fnc(f) for f in files))