mirror of
https://github.com/lutris/lutris
synced 2024-10-14 19:53:53 +00:00
Move steam game playtime transfer code down to the steam service.
It makes GOG crash, and probably other services too!
This commit is contained in:
parent
0cca6e1bd5
commit
30b62ab94a
|
@ -1,5 +1,4 @@
|
|||
"""Generic service utilities"""
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
from gettext import gettext as _
|
||||
|
@ -219,12 +218,6 @@ class BaseService(GObject.Object):
|
|||
conditions={"id": game["id"]}
|
||||
)
|
||||
|
||||
# Copy playtimes from Steam's data
|
||||
for game in get_games(filters={"service": self.id, "service_id": service_game["appid"]}):
|
||||
steam_game_playtime = json.loads(service_game["details"]).get("playtime_forever")
|
||||
playtime = steam_game_playtime / 60
|
||||
sql.db_update(PGA_DB, "games", {"playtime": playtime}, conditions={"id": game["id"]})
|
||||
|
||||
def match_games(self):
|
||||
"""Matching of service games to lutris games"""
|
||||
service_games = {
|
||||
|
|
|
@ -8,6 +8,7 @@ from gi.repository import Gio
|
|||
|
||||
from lutris import settings
|
||||
from lutris.config import LutrisConfig, write_game_config
|
||||
from lutris.database import sql
|
||||
from lutris.database.games import add_game, get_game_by_field, get_games
|
||||
from lutris.database.services import ServiceGameCollection
|
||||
from lutris.game import Game
|
||||
|
@ -21,6 +22,8 @@ from lutris.util.steam.appmanifest import AppManifest, get_appmanifests
|
|||
from lutris.util.steam.config import get_active_steamid64, get_steam_library, get_steamapps_dirs
|
||||
from lutris.util.strings import slugify
|
||||
|
||||
PGA_DB = settings.PGA_DB
|
||||
|
||||
|
||||
class SteamBanner(ServiceMedia):
|
||||
service = "steam"
|
||||
|
@ -107,6 +110,15 @@ class SteamService(BaseService):
|
|||
self.match_games()
|
||||
return steam_games
|
||||
|
||||
def match_game(self, service_game, lutris_game):
|
||||
super().match_game(service_game, lutris_game)
|
||||
|
||||
# Copy playtimes from Steam's data
|
||||
for game in get_games(filters={"service": self.id, "service_id": service_game["appid"]}):
|
||||
steam_game_playtime = json.loads(service_game["details"]).get("playtime_forever")
|
||||
playtime = steam_game_playtime / 60
|
||||
sql.db_update(PGA_DB, "games", {"playtime": playtime}, conditions={"id": game["id"]})
|
||||
|
||||
def get_installer_files(self, installer, _installer_file_id, _selected_extras):
|
||||
steam_uri = "$STEAM:%s:."
|
||||
appid = str(installer.script["game"]["appid"])
|
||||
|
|
Loading…
Reference in a new issue