def fileFromRow(self, row): if not row['md5']: return None file = GameFile() if 'wos_name' in row.keys(): file.wos_name = row['wos_name'] file.wos_path = row['wos_path'] if 'tosec_path' in row.keys(): file.tosec_path = row['tosec_path'] file.format = row['format'] file.size = row['size'] file.content_desc = row['content_desc'] file.release_date = row['release_date'] file.is_demo = row['is_demo'] file.setMachineType(row['file_machine_type']) file.part = row['part'] file.side = row['side'] file.language = row['file_language'] file.mod_flags = row['mod_flags'] file.notes = row['notes'] file.md5 = row['md5'] file.crc32 = row['crc32'] file.sha1 = row['sha1'] return file
file.wos_path = row['wos_path'] if 'tosec_path' in row.keys(): file.tosec_path = row['tosec_path'] file.format = row['format'] file.size = row['size'] file.content_desc = row['content_desc'] file.release_date = row['release_date'] file.is_demo = row['is_demo'] file.setMachineType(row['file_machine_type']) file.part = row['part'] file.side = row['side'] file.language = row['file_language'] file.mod_flags = row['mod_flags'] file.notes = row['notes'] file.md5 = row['md5'] file.crc32 = row['crc32'] file.sha1 = row['sha1'] return file if __name__ == '__main__': os.chdir('..') from scripts.restore_db import * restoreDB() db = Database() game_file = GameFile( "Sinclair ZX Spectrum\Games\[TAP]\Robin of the Wood (1985)(Odin Computer Graphics).tap" ) game_file.md5 = "f16538ac3cb55bbbb878c42c04b17de5" game = db.getGameByFile(game_file) print(game)