public bool DownloadSteamLogo(Game game, bool overwrite, bool isBackgroundDownload) { logger.Debug($"DownloadSteamLogo starting for game {game.Name}"); var logoPath = extraMetadataHelper.GetGameLogoPath(game, true); if (File.Exists(logoPath) && !overwrite) { logger.Debug("Logo exists and overwrite is set to false, skipping"); return(true); } var steamId = string.Empty; if (SteamCommon.IsGameSteamGame(game)) { logger.Debug("Steam id found for Steam game"); steamId = game.GameId; } else if (!settings.SteamDlOnlyProcessPcGames || extraMetadataHelper.IsGamePcGame(game)) { steamId = extraMetadataHelper.GetSteamIdFromSearch(game, isBackgroundDownload); } else { logger.Debug("Game is not a PC game and execution is only allowed for PC games"); return(false); } if (steamId.IsNullOrEmpty()) { logger.Debug("Steam id not found"); return(false); } var steamUri = string.Format(steamLogoUriTemplate, steamId); var success = HttpDownloader.DownloadFileAsync(steamUri, logoPath).GetAwaiter().GetResult(); if (success && settings.ProcessLogosOnDownload) { ProcessLogoImage(logoPath); } return(success); }
public bool DownloadSteamVideo(Game game, bool overwrite, bool isBackgroundDownload, bool downloadVideo = false, bool downloadVideoMicro = false) { logger.Debug($"DownloadSteamVideo starting for game {game.Name}"); var videoPath = extraMetadataHelper.GetGameVideoPath(game, true); var videoMicroPath = extraMetadataHelper.GetGameVideoMicroPath(game, true); if (File.Exists(videoPath) && !overwrite) { downloadVideo = false; } if (File.Exists(videoMicroPath) && !overwrite) { downloadVideoMicro = false; } if (!downloadVideo && !downloadVideoMicro) { return(true); } var steamId = string.Empty; if (SteamCommon.IsGameSteamGame(game)) { logger.Debug("Steam id found for Steam game"); steamId = game.GameId; } else if (!settings.SteamDlOnlyProcessPcGames || extraMetadataHelper.IsGamePcGame(game)) { steamId = extraMetadataHelper.GetSteamIdFromSearch(game, isBackgroundDownload); } else { logger.Debug("Game is not a PC game and execution is only allowed for PC games"); return(false); } if (steamId.IsNullOrEmpty()) { logger.Debug("Steam id not found"); return(false); } var steamAppDetails = SteamCommon.GetSteamAppDetails(steamId); if (steamAppDetails == null || steamAppDetails.data.Movies == null || steamAppDetails.data.Movies.Count == 0) { return(false); } if (downloadVideo) { var videoUrl = steamAppDetails.data.Movies[0].Mp4.Q480; if (settings.VideoSteamDownloadHdQuality) { videoUrl = steamAppDetails.data.Movies[0].Mp4.Max; } var success = HttpDownloader.DownloadFileAsync(videoUrl.ToString(), tempDownloadPath).GetAwaiter().GetResult(); if (success) { GetVideoInformation(tempDownloadPath); ProcessVideo(tempDownloadPath, videoPath, false, true); } } if (downloadVideoMicro) { var videoUrl = string.Format(steamMicrotrailerUrlTemplate, steamAppDetails.data.Movies[0].Id); var success = HttpDownloader.DownloadFileAsync(videoUrl.ToString(), tempDownloadPath).GetAwaiter().GetResult(); if (success) { ProcessVideo(tempDownloadPath, videoMicroPath, false, true); } } return(true); }