From 53c79287a9fd730d63d0f9168e9c560b3c742a1c Mon Sep 17 00:00:00 2001 From: Michael Green <84688932+michael-j-green@users.noreply.github.com> Date: Sun, 20 Oct 2024 12:14:13 +1100 Subject: [PATCH] WIP - Bug hunting --- gaseous-server/Classes/Metadata/Artworks.cs | 4 +--- .../Classes/Metadata/Communications.cs | 6 +++--- .../Classes/Metadata/CompanyLogos.cs | 4 +--- gaseous-server/Classes/Metadata/Covers.cs | 19 ++----------------- gaseous-server/Classes/Metadata/Games.cs | 14 +++++++------- .../Classes/Metadata/PlatformLogos.cs | 4 +--- .../Classes/Metadata/Screenshots.cs | 4 +--- 7 files changed, 16 insertions(+), 39 deletions(-) diff --git a/gaseous-server/Classes/Metadata/Artworks.cs b/gaseous-server/Classes/Metadata/Artworks.cs index 2c1be5f..982a8b4 100644 --- a/gaseous-server/Classes/Metadata/Artworks.cs +++ b/gaseous-server/Classes/Metadata/Artworks.cs @@ -67,11 +67,9 @@ namespace gaseous_server.Classes.Metadata throw new Exception("How did you get here?"); } - // check for presence of "original" quality file - download if absent or force download is true - string localFile = Path.Combine(ImagePath, Communications.IGDBAPI_ImageSize.original.ToString(), returnValue.ImageId + ".jpg"); if (GetImages == true) { - if ((!File.Exists(localFile)) || forceImageDownload == true) + if (forceImageDownload == true) { Logging.Log(Logging.LogType.Information, "Metadata: " + returnValue.GetType().Name, "Artwork download forced."); diff --git a/gaseous-server/Classes/Metadata/Communications.cs b/gaseous-server/Classes/Metadata/Communications.cs index c6c6480..afa96ba 100644 --- a/gaseous-server/Classes/Metadata/Communications.cs +++ b/gaseous-server/Classes/Metadata/Communications.cs @@ -70,8 +70,8 @@ namespace gaseous_server.Classes.Metadata case HasheousClient.Models.MetadataModel.MetadataSources.Hasheous: // set rate limiter avoidance values - RateLimitAvoidanceWait = 250; - RateLimitAvoidanceThreshold = 10; + RateLimitAvoidanceWait = 1500; + RateLimitAvoidanceThreshold = 6; RateLimitAvoidancePeriod = 1; // set rate limiter recovery values @@ -1059,7 +1059,7 @@ namespace gaseous_server.Classes.Metadata } if (!Directory.Exists(Path.GetDirectoryName(requestedPath))) { - Directory.CreateDirectory(Path.GetDirectoryName(originalPath)); + Directory.CreateDirectory(Path.GetDirectoryName(requestedPath)); } // get the resolution attribute for enum size diff --git a/gaseous-server/Classes/Metadata/CompanyLogos.cs b/gaseous-server/Classes/Metadata/CompanyLogos.cs index b82a8a3..6de72fe 100644 --- a/gaseous-server/Classes/Metadata/CompanyLogos.cs +++ b/gaseous-server/Classes/Metadata/CompanyLogos.cs @@ -69,9 +69,7 @@ namespace gaseous_server.Classes.Metadata throw new Exception("How did you get here?"); } - // check for presence of "original" quality file - download if absent or force download is true - string localFile = Path.Combine(ImagePath, Communications.IGDBAPI_ImageSize.original.ToString(), returnValue.ImageId + ".jpg"); - if ((!File.Exists(localFile)) || forceImageDownload == true) + if (forceImageDownload == true) { Logging.Log(Logging.LogType.Information, "Metadata: " + returnValue.GetType().Name, "Company logo download forced."); diff --git a/gaseous-server/Classes/Metadata/Covers.cs b/gaseous-server/Classes/Metadata/Covers.cs index b5bc9da..d567374 100644 --- a/gaseous-server/Classes/Metadata/Covers.cs +++ b/gaseous-server/Classes/Metadata/Covers.cs @@ -69,29 +69,14 @@ namespace gaseous_server.Classes.Metadata throw new Exception("How did you get here?"); } - string localFile = Path.Combine(ImagePath, Communications.IGDBAPI_ImageSize.original.ToString(), returnValue.ImageId + ".jpg"); if (GetImages == true) { - if ((!File.Exists(localFile)) || forceImageDownload == true) + if (forceImageDownload == true) { Logging.Log(Logging.LogType.Information, "Metadata: " + returnValue.GetType().Name, "Cover download forced."); - // check for presence of image file - download if absent or force download is true - List imageSizes = new List{ - Communications.IGDBAPI_ImageSize.cover_big, - Communications.IGDBAPI_ImageSize.cover_small, - Communications.IGDBAPI_ImageSize.original - }; - Communications comms = new Communications(); - foreach (Communications.IGDBAPI_ImageSize size in imageSizes) - { - localFile = Path.Combine(ImagePath, size.ToString(), returnValue.ImageId + ".jpg"); - if ((!File.Exists(localFile)) || forceImageDownload == true) - { - comms.GetSpecificImageFromServer(ImagePath, returnValue.ImageId, size, null); - } - } + comms.GetSpecificImageFromServer(ImagePath, returnValue.ImageId, Communications.IGDBAPI_ImageSize.original, null); } } diff --git a/gaseous-server/Classes/Metadata/Games.cs b/gaseous-server/Classes/Metadata/Games.cs index 20ed86c..516a43a 100644 --- a/gaseous-server/Classes/Metadata/Games.cs +++ b/gaseous-server/Classes/Metadata/Games.cs @@ -243,13 +243,13 @@ namespace gaseous_server.Classes.Metadata Collection GameCollection = Collections.GetCollections(Game.Collection.Id); } - if (Game.ExternalGames != null) - { - foreach (long ExternalGameId in Game.ExternalGames.Ids) - { - ExternalGame GameExternalGame = ExternalGames.GetExternalGames(ExternalGameId); - } - } + // if (Game.ExternalGames != null) + // { + // foreach (long ExternalGameId in Game.ExternalGames.Ids) + // { + // ExternalGame GameExternalGame = ExternalGames.GetExternalGames(ExternalGameId); + // } + // } if (Game.Franchise != null) { diff --git a/gaseous-server/Classes/Metadata/PlatformLogos.cs b/gaseous-server/Classes/Metadata/PlatformLogos.cs index 68fc5ad..f5ae9f7 100644 --- a/gaseous-server/Classes/Metadata/PlatformLogos.cs +++ b/gaseous-server/Classes/Metadata/PlatformLogos.cs @@ -71,9 +71,7 @@ namespace gaseous_server.Classes.Metadata if (returnValue != null) { - // check for presence of "original" quality file - download if absent or force download is true - string localFile = Path.Combine(ImagePath, Communications.IGDBAPI_ImageSize.original.ToString(), returnValue.ImageId + ".jpg"); - if ((!File.Exists(localFile)) || forceImageDownload == true) + if (forceImageDownload == true) { Logging.Log(Logging.LogType.Information, "Metadata: " + returnValue.GetType().Name, "Platform logo download forced."); diff --git a/gaseous-server/Classes/Metadata/Screenshots.cs b/gaseous-server/Classes/Metadata/Screenshots.cs index 7bc3087..4dac114 100644 --- a/gaseous-server/Classes/Metadata/Screenshots.cs +++ b/gaseous-server/Classes/Metadata/Screenshots.cs @@ -67,11 +67,9 @@ namespace gaseous_server.Classes.Metadata throw new Exception("How did you get here?"); } - // check for presence of "original" quality file - download if absent or force download is true - string localFile = Path.Combine(ImagePath, Communications.IGDBAPI_ImageSize.original.ToString(), returnValue.ImageId + ".jpg"); if (GetImages == true) { - if ((!File.Exists(localFile)) || forceImageDownload == true) + if (forceImageDownload == true) { Logging.Log(Logging.LogType.Information, "Metadata: " + returnValue.GetType().Name, "Screenshot download forced.");