class ROMFinderTests(unittest.TestCase): def setUp(self): self.parser = ROMParser() @parameterized.expand([ ("The Legend of Zelda", "The Legend of Zelda"), ("/Some/Folder/Structure/The Legend of Zelda", "The Legend of Zelda"), ("The Legend of Zelda.nes", "The Legend of Zelda"), ("Super Metroid (JU) [!]", "Super Metroid"), ("Zelda II - The Adventure of Link (USA).nes", "Zelda II - The Adventure of Link"), ("Legend of Zelda, The - Ocarina of Time (Europe) (En,Fr,De).n64", "Legend of Zelda, The - Ocarina of Time"), ("Legend of Zelda, The - Ocarina of Time - Master Quest (USA) (Debug Edition).n64", "Legend of Zelda, The - Ocarina of Time - Master Quest"), ("Shenmue 2 (PAL).iso", "Shenmue 2"), ("Resident Evil Code Veronica (PAL) (UK).iso", "Resident Evil Code Veronica"), ("Chrono Trigger (USA).sfc", "Chrono Trigger"), # TODO(Wishlist): I'd like to be able to remove the `Rev 1` from the filename, but that is much # more complicated than our current strategy of just matching against everything not in parens # ("Super Mario World 2 - Yoshi's Island Rev 1 (1995)(Nintendo)(US).sfc", "Super Mario World 2 - Yoshi's Island"), ]) def test_parsing(self, input, expected): self.assertEquals(expected, self.parser.parse(input))
def __init__(self, config_override=None, consoles_override=None, emulators_override=None): self.validated_base_environment = False self.validated_configuration = False self.logger = IceLogger() self.logger.debug("Initializing Ice") config_data_path = _path_with_override(config_override, "config.txt") consoles_data_path = _path_with_override(consoles_override, "consoles.txt") emulators_data_path = _path_with_override(emulators_override, "emulators.txt") self.config = Configuration( ConfigFileBackingStore(config_data_path), ConfigFileBackingStore(consoles_data_path), ConfigFileBackingStore(emulators_data_path), ) self.steam = Steam() # TODO: Query the list of users some other way self.users = self.steam.local_users() filesystem = Filesystem() parser = ROMParser(self.logger) self.rom_finder = ROMFinder(self.config, filesystem, parser) archive_data_path = Configuration.path_for_data_file("archive.json") managed_rom_archive = ManagedROMArchive(archive_data_path) self.shortcut_synchronizer = SteamShortcutSynchronizer( managed_rom_archive, self.logger) provider = CombinedProvider( LocalProvider(self.logger), ConsoleGridProvider(self.logger), ) self.grid_updater = SteamGridUpdater(provider, self.logger)
def __init__(self, steam, filesystem, app_settings,options): self.app = Qt.QApplication(sys.argv) QtWidgets.QMainWindow.__init__(self) self.steam = steam self.filesystem = filesystem is_user_context = lambda context: context.user_id != 'anonymous' self.users = filter(is_user_context, steam_module.local_user_contexts(self.steam)) logger.debug("Initializing Ice") self.app_settings = app_settings parser = ROMParser() self.rom_finder = ROMFinder(app_settings.config, filesystem, parser) self.options = options
def __init__(self, steam, filesystem, app_settings): self.steam = steam self.filesystem = filesystem # We want to ignore the anonymous context, cause theres no reason to sync # ROMs for it since you cant log in as said user. is_user_context = lambda context: context.user_id != 'anonymous' self.users = filter(is_user_context, steam_module.local_user_contexts(self.steam)) logger.debug("Initializing Ice") self.app_settings = app_settings parser = ROMParser() self.rom_finder = ROMFinder(app_settings.config, filesystem, parser)
def __init__(self, steam, filesystem, options): """Valid options for creating an IceEngine are as follows: * config - The path to the config file to use. Searches the default paths for 'config.txt' otherwise * consoles - The path to the consoles file to use. Searches the default paths for 'consoles.txt' if none is provided * emulators - The path to the emulators file to use. Searches the default paths for 'emulators.txt' if none is provided """ self.validated_base_environment = False self.validated_configuration = False self.filesystem = filesystem logger.debug("Initializing Ice") config_data_path = _path_with_override(filesystem, options.config, "config.txt") consoles_data_path = _path_with_override(filesystem, options.consoles, "consoles.txt") emulators_data_path = _path_with_override(filesystem, options.emulators, "emulators.txt") self.config = Configuration( ConfigFileBackingStore(config_data_path), ConfigFileBackingStore(consoles_data_path), ConfigFileBackingStore(emulators_data_path), filesystem, ) self.steam = steam parser = ROMParser() self.rom_finder = ROMFinder(self.config, filesystem, parser) archive_data_path = paths.highest_precedent_data_file( filesystem, "archive.json") managed_rom_archive = ManagedROMArchive(archive_data_path) self.shortcut_synchronizer = SteamShortcutSynchronizer( managed_rom_archive) provider = CombinedProvider( LocalProvider(), ConsoleGridProvider(), ) self.grid_updater = SteamGridUpdater(provider)
def __init__(self, options): """Valid options for creating an IceEngine are as follows: * config - The path to the config file to use. Searches the default paths for 'config.txt' otherwise * consoles - The path to the consoles file to use. Searches the default paths for 'consoles.txt' if none is provided * emulators - The path to the emulators file to use. Searches the default paths for 'emulators.txt' if none is provided * verbose - Turn on debug logging. """ self.validated_base_environment = False self.validated_configuration = False self.logger = IceLogger(verbose=options.verbose) self.logger.debug("Initializing Ice") config_data_path = _path_with_override(options.config, "config.txt") consoles_data_path = _path_with_override(options.consoles, "consoles.txt") emulators_data_path = _path_with_override(options.emulators, "emulators.txt") self.config = Configuration( ConfigFileBackingStore(config_data_path), ConfigFileBackingStore(consoles_data_path), ConfigFileBackingStore(emulators_data_path), ) self.steam = Steam() # TODO: Query the list of users some other way self.users = self.steam.local_users() filesystem = Filesystem() parser = ROMParser(self.logger) self.rom_finder = ROMFinder(self.config, filesystem, parser) archive_data_path = Configuration.path_for_data_file("archive.json") managed_rom_archive = ManagedROMArchive(archive_data_path) self.shortcut_synchronizer = SteamShortcutSynchronizer( managed_rom_archive, self.logger) provider = CombinedProvider( LocalProvider(self.logger), ConsoleGridProvider(self.logger), ) self.grid_updater = SteamGridUpdater(provider, self.logger)
class ROMFinderTests(unittest.TestCase): def setUp(self): self.parser = ROMParser() @parameterized.expand([ ("The Legend of Zelda", "The Legend of Zelda"), ("/Some/Folder/Structure/The Legend of Zelda", "The Legend of Zelda"), ("The Legend of Zelda.nes", "The Legend of Zelda"), ("Super Metroid (JU) [!]" , "Super Metroid"), ("Zelda II - The Adventure of Link (USA).nes" , "Zelda II - The Adventure of Link"), ("Legend of Zelda, The - Ocarina of Time (Europe) (En,Fr,De).n64" , "Legend of Zelda, The - Ocarina of Time"), ("Legend of Zelda, The - Ocarina of Time - Master Quest (USA) (Debug Edition).n64" , "Legend of Zelda, The - Ocarina of Time - Master Quest"), ("Shenmue 2 (PAL).iso" , "Shenmue 2"), ("Resident Evil Code Veronica (PAL) (UK).iso" , "Resident Evil Code Veronica"), ("Chrono Trigger (USA).sfc", "Chrono Trigger"), # TODO(Wishlist): I'd like to be able to remove the `Rev 1` from the filename, but that is much # more complicated than our current strategy of just matching against everything not in parens # ("Super Mario World 2 - Yoshi's Island Rev 1 (1995)(Nintendo)(US).sfc", "Super Mario World 2 - Yoshi's Island"), ]) def test_parsing(self, input, expected): self.assertEquals(expected, self.parser.parse(input))
def __init__(self, filesystem): self.filesystem = filesystem self.rom_finder = ROMFinder(self.filesystem, ROMParser())
def setUp(self): self.parser = ROMParser()
def setUp(self): self.mock_logger = mock.MagicMock() self.parser = ROMParser(self.mock_logger)