def sync_missing_games(not_in_local, remote_library): """Get missing games in local library from remote library. :return: The slugs of the added games :rtype: set """ if not not_in_local: return set() missing_slugs = set() missing = [] for game in remote_library: slug = game["slug"] if slug in not_in_local: logger.debug("Adding to local library: %s", slug) missing_slugs.add(slug) missing.append( { "name": game["name"], "slug": slug, "year": game["year"], "updated": game["updated"], "steamid": game["steamid"], } ) pga.add_games_bulk(missing) logger.debug("%d games added", len(missing)) return missing_slugs
def sync_missing_games(not_in_local, remote_library): """Get missing games in local library from remote library. :return: A set of ids of the added games """ if not not_in_local: return set() missing = [] for remote_game in remote_library: slug = remote_game["slug"] if slug in not_in_local: logger.debug("Adding to local library: %s", slug) missing.append( { "name": remote_game["name"], "slug": slug, "year": remote_game["year"], "updated": remote_game["updated"], "steamid": remote_game["steamid"], } ) missing_ids = pga.add_games_bulk(missing) logger.debug("%d games added", len(missing)) return set(missing_ids)
def sync_missing_games(not_in_local, remote_library): """Get missing games in local library from remote library. :return: A set of ids of the added games """ if not not_in_local: return set() missing = [] for remote_game in remote_library: slug = remote_game['slug'] if slug in not_in_local: logger.debug("Adding to local library: %s", slug) missing.append({ 'name': remote_game['name'], 'slug': slug, 'year': remote_game['year'], 'updated': remote_game['updated'], 'steamid': remote_game['steamid'] }) missing_ids = pga.add_games_bulk(missing) logger.debug("%d games added", len(missing)) return set(missing_ids)