Ejemplo n.º 1
0
 def __load_file(self, input_name):
     logging.info('Parsing file %s' % input_name)
     try:
         fin = file(input_name, 'r')
         song_data = parse(fin)
         fin.close()
     except:
         logging.exception("Unable to open '" + input_name + "' for input")
         return None
     return song_data
Ejemplo n.º 2
0
 def __parseGrooves(self, file_name):
     song_data = None
     logging.debug("Opening groove file '%s'" % file_name)
     try:
         mma_file = file(file_name, 'r')
         try:
             song_data = parse(mma_file)
         except ValueError:
             logging.exception("Failed to parse the file.")
         mma_file.close()
     except:
         logging.exception("Failed to load grooves from file '" + file_name + "'")
     return song_data
Ejemplo n.º 3
0
 def __parseGrooves(self, file_name):
     song_data = None
     logging.debug("Opening groove file '%s'" % file_name)
     try:
         mma_file = file(file_name, 'r')
         try:
             song_data = parse(mma_file)
         except ValueError:
             logging.exception("Failed to parse the file.")
         mma_file.close()
     except:
         logging.exception("Failed to load grooves from file '" + file_name + "'")
     return song_data
Ejemplo n.º 4
0
 def __do_compile(self, mma_data):
     res = self.__last_compile_result = self.__midi_generator.check_mma_syntax(mma_data)
     if res == 0:
         mma_file = cStringIO.StringIO(mma_data)
         try:
             self.__song_data = parse(mma_file)
         except ValueError:
             logging.exception("Failed to parse the file.")
             res = -1
         mma_file.close()
     if res > 0 or res == -1:
         self.__clear_song()
         self.__invalid_mma_data = mma_data
         self.__song_data.set_save_needed(True)
     else:
         self.__invalid_mma_data = None
     return res