Let's kill Desura once and for all

This commit is contained in:
Mathieu Comandon 2017-02-06 21:07:48 -08:00
parent be7050eed4
commit 96c24cd5b4
3 changed files with 2 additions and 115 deletions

View file

@ -3,7 +3,7 @@
__all__ = (
# Native
"linux", "steam", "browser", "web", "desura",
"linux", "steam", "browser", "web",
# Microsoft based
"wine", "winesteam", "dosbox",
# Multi-system
@ -13,7 +13,7 @@ __all__ = (
# Atari
"stella", "atari800", "hatari", "virtualjaguar",
# Nintendo
"snes9x", "mupen64plus", "dolphin", "desmume", "citra",
"snes9x", "mupen64plus", "dolphin", "desmume", "citra",
# Sony
"pcsxr", "ppsspp", "pcsx2",
# Sega

View file

@ -1,113 +0,0 @@
# -*- coding: utf-8 -*-
"""Runner for Desura"""
import os
import subprocess
from lutris.runners.runner import Runner
from lutris.util.log import logger
from lutris.util import system
from lutris import settings
class desura(Runner):
human_name = "Desura"
description = "Runs Desura games (or mods, or tools)"
platform = "Desura"
runnable_alone = True
game_options = [
{
"option": "appid",
"label": "Application ID",
"type": "string",
'help': ("The application ID can be retrieved from the game's "
"page at desura.com. Example: dungeons-of-dremor is the "
"app ID in: \n"
"http://desura.com/games/<b>dungeons-of-dredmor</b>")
},
{
'option': 'section',
'label': "Section",
'type': 'choice',
'choices': [('games', 'games'),
('downloads', 'downloads'),
('mods', 'mods'),
('tools', 'tools')],
'default': 'games',
'help': ("This corresponds to the download's section at "
"desura.com. \n"
"Example: <b>games</b> is the section in: \n"
"http://desura.com/<b>games</b>/teenagent")
},
]
runner_options = [
{
"option": "desura_path",
"label": "Custom Desura location",
"type": "string",
'help': ("Leave blank to use the installation of Desura bundled "
"with Lutris.")
}
]
@property
def browse_dir(self):
"""Return the path to open with the Browse Files action."""
if not self.is_installed():
installed = self.install_dialog()
if not installed:
return False
return self.game_path
@property
def game_path(self):
"""Return game dir or Desura's main dir."""
appid = self.game_config.get('appid')
if os.path.exists(self.get_installed_app_path(appid)):
return self.get_installed_app_path(appid)
if os.path.exists(self.get_common_path()):
return self.get_common_path()
def get_desura_url(self, action, section, appid):
"""Return link for Desura game."""
section_choices = (k[0] for k in self.game_options[1]['choices'])
if section not in section_choices:
section = 'games'
url = ("desura://%(action)s/%(section)s/%(appid)s/" % locals())
logger.debug("Desura url: %s", url)
return url
def get_path(self):
return (self.runner_config.get('desura_path')
or os.path.join(settings.RUNNER_DIR, "desura"))
def get_executable(self):
return os.path.join(self.get_path(), "desura")
def get_common_path(self):
return os.path.join(self.get_path(), "common")
def get_installed_app_path(self, appid):
return os.path.join(self.get_common_path(), appid)
def install(self, version=None, downloader=None, callback=None):
if self.arch == "x86_64":
tarball = "desura-x86_64.tar.gz"
else:
tarball = "desura-i686.tar.gz"
url = "http://www.desura.com/" + tarball
self.download_and_extract(url)
if not self.is_installed():
return False
subprocess.Popen([self.get_executable()], cwd=os.path.expanduser('~'))
def is_installed(self):
return bool(system.find_executable(self.get_executable()))
def play(self):
return {"command": [
self.get_executable(),
self.get_desura_url("launch",
self.game_config.get('section'),
self.game_config.get('appid'))
]}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB