コード例 #1
0
 def gameFromRow(self, row):
     game = Game(row['name'], int(row['wos_id']))
     game.setPublisher(row['publisher'])
     if 'author' in row.keys():
         game.setAuthor(row['author'])
     game.setYear(row['year'])
     game.setGenre(row['genre'])
     game.setNumberOfPlayers(row['number_of_players'])
     game.setMachineType(row['machine_type'])
     game.setLanguage(row['language'])
     game.setAvailability(row['availability'])
     game.x_rated = row['x_rated']
     game.addRelease(self.releaseFromRow(row, game))
     if 'multiplayer_type' in row.keys():
         game.setMultiplayerType(row['multiplayer_type'])
     if 'tipshop_page' in row.keys():
         game.tipshop_page = row['tipshop_page']
         game.tipshop_multiface_pokes_section = row[
             'tipshop_multiface_pokes_section']
     if game.tipshop_page or row['pok_file_contents']:
         game.importPokFile(text=str(row['pok_file_contents']))
     if row['md5']:
         file = self.fileFromRow(row)
         game.addFile(file)
         if file.part > game.parts:
             game.parts = file.part
     return game
コード例 #2
0
 def gameFromRow(self, row):
     # print(row['name'])
     # print('game_name=', row.get('tosec_compliant_name', row['name']))
     game_name = row.get('tosec_compliant_name', '').strip()
     if not game_name:
         game_name = row['name']
     game_name = self.sanitizeAlias(game_name)
     game = Game(game_name, int(row['zxdb_id']))
     publisher = self.publisherNameFromRow(row)
     game.setPublisher(publisher)
     try:
         author = self.authorNameFromRow(row)
     except:
         print(traceback.format_exc())
         print("author=", row['author'])
     game.setAuthor(author)
     game.setYear(row['year'])
     pok_file_path = self.pok_file_paths.get(game.zxdb_id)
     if pok_file_path:
         game.importPokFile(file_path=pok_file_path)
     #TEMPORARY
     if not row['genre']:
         if game.zxdb_id in (32168, 32169, 32170, 32171, 32172, 32173,
                             32174, 32180, 30349, 32176, 32201, 32175,
                             34322, 35847, 35826, 34775, 35829, 35782,
                             35783, 36477, 36372, 35874, 35883, 35827):
             game.setGenre('Various Games')
         elif game.zxdb_id in (32176, ):
             game.setGenre('Utilities - Screen')
         elif game.zxdb_id in (32257, 32258, 32259):
             game.setGenre('Utilities')
         elif game.zxdb_id in (27590, 1000246):
             game.setGenre('Firmware')
         elif game.zxdb_id in (36062, ):
             game.setGenre('Emulator')
     elif game.zxdb_id in (8100, ):
         game.setGenre('Compilation - Educational')
     else:
         game.setGenre(row['genre'])
     game.x_rated = row['x_rated']
     game.setNumberOfPlayers(row['number_of_players'])
     game.setMachineType(row['machine_type'])
     if row['language']:
         if row['language'] in IDIOM_IDS_TO_TOSEC_LANGS:
             game.setLanguage(IDIOM_IDS_TO_TOSEC_LANGS[row['language']])
         else:
             game.setLanguage(row['language'])
     game.setAvailability(row['availability'])
     game.tipshop_page = row['tipshop_page']
     game.raw_publisher, game.raw_author = [row['publisher']
                                            ], [row['author']]
     return game
コード例 #3
0
 def test_jet_set_willy(self):
     game = Game(name="Jet Set WIlly", zxdb_id=2589)
     self.ts.scrapePokes(game)
     game.exportPokFile('test.pok')
     game.importPokFile('test.pok')