def simple_downloader(url, destination, callback, callback_args=None): """Default downloader used for runners""" if not callback_args: callback_args = {} dialog = DownloadDialog(url, destination) dialog.run() return callback(**callback_args)
def download_and_extract(self, tarball, dest=settings.RUNNER_DIR, **opts): runner_archive = os.path.join(settings.CACHE_DIR, tarball) merge_single = opts.get('merge_single', False) dialog = DownloadDialog(settings.RUNNERS_URL + tarball, runner_archive) dialog.run() extract_archive(runner_archive, dest, merge_single=merge_single) os.remove(runner_archive)
def download_and_extract(self, tarball): runner_archive = os.path.join(settings.CACHE_DIR, tarball) dialog = DownloadDialog(settings.RUNNERS_URL + tarball, runner_archive) dialog.run() extract_archive(runner_archive, settings.RUNNER_DIR, merge_single=False) os.remove(runner_archive)
def install(self): """Downloads deb package and installs it""" dest = os.path.join(CACHE_DIR, 'gens-gs.deb') package = 'http://segaretro.org/images/7/75/Gens_2.16.7_i386.deb' dialog = DownloadDialog(package, dest) dialog.run() subprocess.Popen(["software-center", dest], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
def download_steam(downloader=None, callback=None, callback_data=None): """Downloads steam with `downloader` then calls `callback`""" steam_installer_path = os.path.join(settings.TMP_PATH, "SteamInstall.msi") if not downloader: dialog = DownloadDialog(STEAM_INSTALLER_URL, steam_installer_path) dialog.run() else: downloader(STEAM_INSTALLER_URL, steam_installer_path, callback, callback_data) return steam_installer_path
def download_steam(downloader=None, callback=None, callback_data=None): """Downloads steam with `downloader` then calls `callback`""" steam_installer_path = get_steam_installer_dest() if not downloader: dialog = DownloadDialog(STEAM_INSTALLER_URL, steam_installer_path) dialog.run() else: downloader(STEAM_INSTALLER_URL, steam_installer_path, callback, callback_data) return steam_installer_path
def on_runner_installed(*args): config_path = system.create_folder("~/.atari800") bios_archive = os.path.join(config_path, "atari800-bioses.zip") dlg = DownloadDialog(self.bios_url, bios_archive) dlg.run() if not system.path_exists(bios_archive): ErrorDialog("Could not download Atari800 BIOS archive") return extract.extract_archive(bios_archive, config_path) os.remove(bios_archive) config = LutrisConfig(runner_slug="atari800") config.raw_runner_config.update({"bios_path": config_path}) config.save() if callback: callback()
def on_runner_installed(*args): config_path = system.create_folder("~/.atari800") bios_archive = os.path.join(config_path, 'atari800-bioses.zip') dlg = DownloadDialog(self.bios_url, bios_archive) dlg.run() if not system.path_exists(bios_archive): ErrorDialog("Could not download Atari800 BIOS archive") return extract.extract_archive(bios_archive, config_path) os.remove(bios_archive) config = LutrisConfig(runner_slug='atari800') config.raw_runner_config.update({'bios_path': config_path}) config.save() if callback: callback()
def install(self): success = super(atari800, self).install() if not success: return False config_path = os.path.expanduser("~/.atari800") if not os.path.exists(config_path): os.makedirs(config_path) bios_archive = os.path.join(config_path, 'atari800-bioses.zip') dlg = DownloadDialog(self.bios_url, bios_archive) dlg.run() if not os.path.exists(bios_archive): ErrorDialog("Could not download Atari800 BIOS archive") return extract.extract_archive(bios_archive, config_path) os.remove(bios_archive) config = LutrisConfig(runner_slug='atari800') config.raw_runner_config.update({'bios_path': config_path}) config.save()
def install(self): success = super(atari800, self).install() if not success: return False config_path = os.path.expanduser("~/.atari800") if not os.path.exists(config_path): os.makedirs(config_path) bios_archive = os.path.join(config_path, 'atari800-bioses.zip') dlg = DownloadDialog(self.bios_url, bios_archive) dlg.run() if not os.path.exists(bios_archive): ErrorDialog("Could not download Atari800 BIOS archive") return extract_archive(bios_archive, config_path) os.remove(bios_archive) runner_config = LutrisConfig(runner='atari800') runner_config.config_type = 'runner' runner_config.runner_config = {'atari800': {'bios_path': config_path}} runner_config.save()
def install(self, version=None, downloader=None, callback=None): installer_path = get_steam_installer_dest() def on_steam_downloaded(*args): prefix = self.get_or_create_default_prefix() self.msi_exec(installer_path, quiet=True, prefix=prefix, wine_path=self.get_executable(), working_dir="/tmp", blocking=True) if callback: callback() if downloader: downloader(STEAM_INSTALLER_URL, installer_path, on_steam_downloaded) else: dialog = DownloadDialog(STEAM_INSTALLER_URL, installer_path) dialog.run() on_steam_downloaded()