示例#1
0
文件: sync.py 项目: prettyv/lutris
    def sync_from_remote(self):
        """Synchronize from remote to local library.

        :return: The added and updated games (slugs)
        :rtype: tuple of sets
        """
        logger.debug("Syncing game library")
        # Get local library
        local_slugs = set([game['slug'] for game in self.library])
        logger.debug("%d games in local library", len(local_slugs))
        # Get remote library
        try:
            remote_library = api.get_library()
        except Exception as e:
            logger.debug("Error while downloading the remote library: %s" % e)
            remote_library = {}
        remote_slugs = set([game['slug'] for game in remote_library])
        logger.debug("%d games in remote library (inc. unpublished)",
                     len(remote_slugs))

        not_in_local = remote_slugs.difference(local_slugs)

        added = self.sync_missing_games(not_in_local, remote_library)
        updated = self.sync_game_details(remote_library)
        if added:
            self.library = pga.get_games()
        return (added, updated)
示例#2
0
文件: sync.py 项目: xordspar0/lutris
def sync_from_remote():
    """Synchronize from remote to local library.

    :return: The added and updated games (slugs)
    :rtype: tuple of sets, added games and updated games
    """

    remote_library = api.get_library()
    remote_slugs = {game["slug"] for game in remote_library}

    local_slugs = {game["slug"] for game in pga.get_games()}
    missing_slugs = remote_slugs.difference(local_slugs)

    added = sync_missing_games(missing_slugs, remote_library)
    updated = sync_game_details(remote_library)
    return added, updated
示例#3
0
def sync_from_remote():
    """Synchronize from remote to local library.

    :return: The added and updated games (slugs)
    :rtype: tuple of sets, added games and updated games
    """

    remote_library = api.get_library()
    remote_slugs = {game["slug"] for game in remote_library}

    local_slugs = {game["slug"] for game in pga.get_games()}
    missing_slugs = remote_slugs.difference(local_slugs)

    added = sync_missing_games(missing_slugs, remote_library)
    updated = sync_game_details(remote_library)
    return added, updated
示例#4
0
文件: sync.py 项目: Yilnis/lutris-1
def sync_from_remote():
    """Synchronize from remote to local library.

    :return: The added and updated games (slugs)
    :rtype: tuple of sets, added games and updated games
    """
    local_library = pga.get_games()
    local_slugs = set([game['slug'] for game in local_library])

    try:
        remote_library = api.get_library()
    except Exception as ex:
        logger.error("Error while downloading the remote library: %s" % ex)
        remote_library = {}
    remote_slugs = set([game['slug'] for game in remote_library])

    missing_slugs = remote_slugs.difference(local_slugs)

    added = sync_missing_games(missing_slugs, remote_library)
    updated = sync_game_details(remote_library)
    return (added, updated)
示例#5
0
文件: sync.py 项目: Freso/lutris
def sync_from_remote():
    """Synchronize from remote to local library.

    :return: The added and updated games (slugs)
    :rtype: tuple of sets, added games and updated games
    """
    local_library = pga.get_games()
    local_slugs = set([game['slug'] for game in local_library])

    try:
        remote_library = api.get_library()
    except Exception as ex:
        logger.error("Error while downloading the remote library: %s" % ex)
        remote_library = {}
    remote_slugs = set([game['slug'] for game in remote_library])

    missing_slugs = remote_slugs.difference(local_slugs)

    added = sync_missing_games(missing_slugs, remote_library)
    updated = sync_game_details(remote_library)
    return (added, updated)
示例#6
0
    def sync_from_remote(self, caller=None):
        """Synchronize from remote to local library.

        :param caller: The LutrisWindow object
        :return: The synchronized games (slugs)
        :rtype: set of strings
        """
        logger.debug("Syncing game library")
        # Get local library
        local_slugs = set([game['slug'] for game in self.library])
        logger.debug("%d games in local library", len(local_slugs))
        # Get remote library
        remote_library = api.get_library()
        remote_slugs = set([game['slug'] for game in remote_library])
        logger.debug("%d games in remote library (inc. unpublished)",
                     len(remote_slugs))

        not_in_local = remote_slugs.difference(local_slugs)

        added = self.sync_missing_games(not_in_local, remote_library, caller)
        updated = self.sync_game_details(remote_library, caller)
        return added.update(updated)