Esempio n. 1
0
 def update_user_images(self, user_id, roms):
     """
     Sets a suitable grid image for every rom in 'roms' for the user defined
     by 'user_id'
     """
     grid = steam_grid.SteamGrid(
         steam_user_manager.userdata_directory_for_user_id(user_id))
     for rom in roms:
         shortcut = rom.to_shortcut()
         if not grid.existing_image_for_filename(
                 grid.filename_for_shortcut(shortcut.appname,
                                            shortcut.exe)):
             image = self.find_image_for_rom(rom)
             # Game not found
             if image is None:
                 log_file("No game found for %s on %s" %
                          (rom.name(), rom.console.fullname))
                 log_user(
                     "The image provider has no game called %s for %s. Try going to the provider and submittng the game yourself"
                     % (rom.name(), rom.console.fullname))
             # Game found, but there is no picture
             elif image == "":
                 log_file(
                     "No image found for %s. The URL checked was '%s'" %
                     (rom.name(), self.url_for_rom(rom)))
                 log_user(
                     "We couldn't find an image for %s. If you find one you like, upload it to %s, and next time Ice runs it will use it"
                     % (rom.name(), self.host_for_image_source()))
             # Game found, AND there is a picture there
             else:
                 log_file("Setting custom image for %s" % rom.name())
                 image_path = self.download_image(image)
                 grid.set_image_for_shortcut(image_path, shortcut.appname,
                                             shortcut.exe)
Esempio n. 2
0
def lookup_emulator(platform,console):
    emulators_key = platform + ' Emulators' # ex: "Windows Emulators"
    console_key = console.shortname.lower()
    try:
        user_supplied_name = settings.config()[emulators_key][console_key]
        if not user_supplied_name:
            log_file("No user supplied name for %s" % console.shortname)
            return None
        name = emulator_platform_prefix(platform) + user_supplied_name
        return emulator_from_name(name)(console.shortname)
    except KeyError as e:
        # TODO(#28) Throw a ConfigError once it will be caught...
        log_file("Configuration missing key for %s on %s" % (console.shortname, platform))
        return None
    except AttributeError as e:
        # TODO(#28) Throw a ConfigError once it will be caught...
        log_user("Cannot load emulator for %s. Check that your spelling is correct, and that the emulator you request is supported" % console.shortname)
        log_file("Error loading [%s] %s" % (emulator_key, console_key))
        return None
Esempio n. 3
0
File: gui.py Progetto: PiotrWpl/Ice
 def startIce(self):
     # very similar to the one in ice.py
     try:
         if steam_is_running():
             log_both("Ice cannot be run while Steam is open. Please close Steam and try again")
             return
         log_both("=========================Starting Ice")
         fs.create_directory_if_needed(fs.roms_directory(), log="Creating ROMs directory at %s" % fs.roms_directory())
         # Find all of the ROMs that are currently in the designated folders
         roms = console.find_all_roms()
         # Find the Steam Account that the user would like to add ROMs for
         user_ids = steam_user_manager.user_ids_on_this_machine()
         grid_manager = IceGridImageManager()
         for user_id in user_ids:
             log_both("---------------Running for user %s" % str(user_id))
             # Load their shortcuts into a SteamShortcutManager object
             shortcuts_path = steam_user_manager.shortcuts_file_for_user_id(user_id)
             shortcuts_manager = SteamShortcutManager(shortcuts_path)
             rom_manager = IceROMManager(shortcuts_manager)
             # Add the new ROMs in each folder to our Shortcut Manager
             rom_manager.sync_roms(roms)
             # Generate a new shortcuts.vdf file with all of the new additions
             shortcuts_manager.save()
             if IceGridImageManager.should_download_images():
                 log_both("---Downloading grid images")
                 grid_manager.update_user_images(user_id,roms)
             else:
                 log_both("Skipping 'Download Image' step")
         log_both("=========================Finished")
     except ConfigError as error:
         log_user("=========================Stopping\n")
         log_config_error(error)
         log_exception()
         log_file("!!!")
     except StandardError as error:
         log_both("####################################")
         log_both("An Error has occurred:")
         log_both(error)
         log_exception()
         log_both("####################################")
Esempio n. 4
0
def lookup_emulator(platform, console):
    emulators_key = platform + ' Emulators'  # ex: "Windows Emulators"
    console_key = console.shortname.lower()
    try:
        user_supplied_name = settings.config()[emulators_key][console_key]
        if not user_supplied_name:
            log_file("No user supplied name for %s" % console.shortname)
            return None
        name = emulator_platform_prefix(platform) + user_supplied_name
        return emulator_from_name(name)(console.shortname)
    except KeyError as e:
        # TODO(#28) Throw a ConfigError once it will be caught...
        log_file("Configuration missing key for %s on %s" %
                 (console.shortname, platform))
        return None
    except AttributeError as e:
        # TODO(#28) Throw a ConfigError once it will be caught...
        log_user(
            "Cannot load emulator for %s. Check that your spelling is correct, and that the emulator you request is supported"
            % console.shortname)
        log_file("Error loading [%s] %s" % (emulator_key, console_key))
        return None
Esempio n. 5
0
 def update_user_images(self,user_id,roms):
     """
     Sets a suitable grid image for every rom in 'roms' for the user defined
     by 'user_id'
     """
     grid = steam_grid.SteamGrid(steam_user_manager.userdata_directory_for_user_id(user_id))
     for rom in roms:
         shortcut = rom.to_shortcut()
         if not grid.existing_image_for_filename(grid.filename_for_shortcut(shortcut.appname,shortcut.exe)):
             image = self.find_image_for_rom(rom)
             # Game not found
             if image is None:
                 log_file("No game found for %s on %s" % (rom.name(),rom.console.fullname))
                 log_user("The image provider has no game called %s for %s. Try going to %s and submittng the game yourself" % (rom.name(),rom.console.fullname, self.host_for_image_source()))
             # Game found, but there is no picture
             elif image == "":
                 log_file("No image found for %s. The URL checked was '%s'" % (rom.name(),self.url_for_rom(rom)))
                 log_user("We couldn't find an image for %s. If you find one you like, upload it to %s, and next time Ice runs it will use it" % (rom.name(),self.host_for_image_source()))
             # Game found, AND there is a picture there
             else:
                 log_file("Setting custom image for %s" % rom.name())
                 image_path = self.download_image(image)
                 grid.set_image_for_shortcut(image_path,shortcut.appname,shortcut.exe)