Example #1
0
File: ice.py Project: PiotrWpl/Ice
def main():
    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")
Example #2
0
 def _download_(self):
     emulators_dir = filesystem_helper.downloaded_emulators_directory()
     zips_dir = filesystem_helper.downloaded_zips_directory()
     # Make sure the directorys exists
     filesystem_helper.create_directory_if_needed(emulators_dir)
     filesystem_helper.create_directory_if_needed(zips_dir)
     url = self._download_location_
     zip_path = os.path.join(filesystem_helper.downloaded_zips_directory(),os.path.basename(url))
     # If we have downloaded (and therefore extracted) the zip file before,
     # there is no reason to do it again
     if os.path.exists(zip_path):
         log_file("Found zip file %s" % os.path.basename(url))
     else:
         log_both("Downloading %s" % url)
         (downloaded_path,headers) = urllib.urlretrieve(url)
         log_both("Finished downloading %s" % url)
         shutil.copyfile(downloaded_path,zip_path)
         self._unzip_(downloaded_path,emulators_dir)
     self.location = os.path.join(emulators_dir,self._relative_exe_path_)
     self.directory = os.path.join(emulators_dir,self._directory_name_)
Example #3
0
 def _download_(self):
     emulators_dir = filesystem_helper.downloaded_emulators_directory()
     zips_dir = filesystem_helper.downloaded_zips_directory()
     # Make sure the directorys exists
     filesystem_helper.create_directory_if_needed(emulators_dir)
     filesystem_helper.create_directory_if_needed(zips_dir)
     url = self._download_location_
     zip_path = os.path.join(filesystem_helper.downloaded_zips_directory(),
                             os.path.basename(url))
     # If we have downloaded (and therefore extracted) the zip file before,
     # there is no reason to do it again
     if os.path.exists(zip_path):
         log_file("Found zip file %s" % os.path.basename(url))
     else:
         log_both("Downloading %s" % url)
         (downloaded_path, headers) = urllib.urlretrieve(url)
         log_both("Finished downloading %s" % url)
         shutil.copyfile(downloaded_path, zip_path)
         self._unzip_(downloaded_path, emulators_dir)
     self.location = os.path.join(emulators_dir, self._relative_exe_path_)
     self.directory = os.path.join(emulators_dir, self._directory_name_)