diff --git a/gaseous-server/Classes/Metadata/Metadata.cs b/gaseous-server/Classes/Metadata/Metadata.cs index 1610275..df673e6 100644 --- a/gaseous-server/Classes/Metadata/Metadata.cs +++ b/gaseous-server/Classes/Metadata/Metadata.cs @@ -138,27 +138,43 @@ namespace gaseous_server.Classes.Metadata break; case Storage.CacheStatus.Expired: - if (idType == IdType.Long) + try { - metadata = GetMetadataFromServer(SourceType, (long)Id).Result; + if (idType == IdType.Long) + { + metadata = GetMetadataFromServer(SourceType, (long)Id).Result; + } + else + { + metadata = GetMetadataFromServer(SourceType, (string)Id).Result; + } + Storage.NewCacheValue(SourceType, metadata, true); } - else + catch (Exception e) { - metadata = GetMetadataFromServer(SourceType, (string)Id).Result; + Logging.Log(Logging.LogType.Warning, "Fetch Metadata", "Failed to fetch metadata from source: " + SourceType + " for id: " + Id + " of type: " + type + ". Error: " + e.Message); + metadata = null; } - Storage.NewCacheValue(SourceType, metadata, true); break; case Storage.CacheStatus.NotPresent: - if (idType == IdType.Long) + try { - metadata = GetMetadataFromServer(SourceType, (long)Id).Result; + if (idType == IdType.Long) + { + metadata = GetMetadataFromServer(SourceType, (long)Id).Result; + } + else + { + metadata = GetMetadataFromServer(SourceType, (string)Id).Result; + } + Storage.NewCacheValue(SourceType, metadata, false); } - else + catch (Exception e) { - metadata = GetMetadataFromServer(SourceType, (string)Id).Result; + Logging.Log(Logging.LogType.Warning, "Fetch Metadata", "Failed to fetch metadata from source: " + SourceType + " for id: " + Id + " of type: " + type + ". Error: " + e.Message); + metadata = null; } - Storage.NewCacheValue(SourceType, metadata, false); break; } diff --git a/gaseous-server/Controllers/V1.0/GamesController.cs b/gaseous-server/Controllers/V1.0/GamesController.cs index 6066182..982ec62 100644 --- a/gaseous-server/Controllers/V1.0/GamesController.cs +++ b/gaseous-server/Controllers/V1.0/GamesController.cs @@ -808,6 +808,9 @@ namespace gaseous_server.Controllers MetadataMap filteredMetadataMap = new MetadataMap(); filteredMetadataMap.MetadataMapItems = metadataMap.MetadataMapItems.Where(x => x.SourceType != HasheousClient.Models.MetadataSources.TheGamesDb).ToList(); + // further filter out metadataMapItems where sourceId = 0 + filteredMetadataMap.MetadataMapItems = filteredMetadataMap.MetadataMapItems.Where(x => x.SourceId != 0).ToList(); + metadataMap.MetadataMapItems = filteredMetadataMap.MetadataMapItems; return Ok(metadataMap);