WIP
This commit is contained in:
		| @@ -37,7 +37,8 @@ | |||||||
| 				"Zignd.html-css-class-completion", | 				"Zignd.html-css-class-completion", | ||||||
| 				"PWABuilder.pwa-studio", | 				"PWABuilder.pwa-studio", | ||||||
| 				"ms-azuretools.vscode-docker", | 				"ms-azuretools.vscode-docker", | ||||||
| 				"SonarSource.sonarlint-vscode" | 				"SonarSource.sonarlint-vscode", | ||||||
|  | 				"oderwat.indent-rainbow" | ||||||
| 			] | 			] | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -24,8 +24,7 @@ namespace gaseous_server.Classes | |||||||
|                 ageRestriction_Generic += " OR view_Games.AgeGroupId IS NULL"; |                 ageRestriction_Generic += " OR view_Games.AgeGroupId IS NULL"; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             string sql = "SELECT Platform.Id, Platform.`Name`, COUNT(Game.Id) AS GameCount FROM (SELECT DISTINCT Game.Id, view_Games_Roms.PlatformId, COUNT(view_Games_Roms.Id) AS RomCount FROM Game LEFT JOIN AgeGroup ON Game.Id = AgeGroup.GameId LEFT JOIN view_Games_Roms ON Game.Id = view_Games_Roms.GameId WHERE (" + ageRestriction_Platform + ") GROUP BY Game.Id , view_Games_Roms.PlatformId HAVING RomCount > 0) Game JOIN Platform ON Game.PlatformId = Platform.Id GROUP BY Platform.`Name`;"; |             string sql = "SELECT Platform.Id, Platform.`Name`, COUNT(Game.Id) AS GameCount FROM (SELECT DISTINCT Game.Id, view_Games_Roms.PlatformId, COUNT(view_Games_Roms.Id) AS RomCount FROM Game LEFT JOIN AgeGroup ON Game.Id = AgeGroup.GameId LEFT JOIN view_Games_Roms ON Game.Id = view_Games_Roms.GameId WHERE (" + ageRestriction_Platform + ") GROUP BY Game.Id , view_Games_Roms.PlatformId HAVING RomCount > 0) Game JOIN Platform ON Game.PlatformId = Platform.Id AND Platform.SourceId = 0 GROUP BY Platform.`Name`;"; | ||||||
|             Console.WriteLine(sql); |  | ||||||
|  |  | ||||||
|             DataTable dbResponse = db.ExecuteCMD(sql, new Database.DatabaseMemoryCacheOptions(CacheEnabled: true, ExpirationSeconds: 300)); |             DataTable dbResponse = db.ExecuteCMD(sql, new Database.DatabaseMemoryCacheOptions(CacheEnabled: true, ExpirationSeconds: 300)); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1108,21 +1108,21 @@ namespace gaseous_server.Classes.Metadata | |||||||
|             return false; |             return false; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public async Task<string> GetSpecificImageFromServer(string ImagePath, string ImageId, IGDBAPI_ImageSize size, List<IGDBAPI_ImageSize>? FallbackSizes = null) |         public async Task<string> GetSpecificImageFromServer(HasheousClient.Models.MetadataSources SourceType, string ImagePath, string ImageId, IGDBAPI_ImageSize size, List<IGDBAPI_ImageSize>? FallbackSizes = null) | ||||||
|         { |         { | ||||||
|             string originalPath = Path.Combine(ImagePath, _MetadataSource.ToString(), IGDBAPI_ImageSize.original.ToString()); |             string originalPath = Path.Combine(ImagePath, SourceType.ToString(), IGDBAPI_ImageSize.original.ToString()); | ||||||
|             string originalFilePath = Path.Combine(originalPath, ImageId); |             string originalFilePath = Path.Combine(originalPath, ImageId); | ||||||
|             string requestedPath = Path.Combine(ImagePath, _MetadataSource.ToString(), size.ToString()); |             string requestedPath = Path.Combine(ImagePath, SourceType.ToString(), size.ToString()); | ||||||
|             string requestedFilePath = Path.Combine(requestedPath, ImageId); |             string requestedFilePath = Path.Combine(requestedPath, ImageId); | ||||||
|  |  | ||||||
|             // create the directory if it doesn't exist |             // create the directory if it doesn't exist | ||||||
|             if (!Directory.Exists(Path.GetDirectoryName(originalPath))) |             if (!Directory.Exists(originalPath)) | ||||||
|             { |             { | ||||||
|                 Directory.CreateDirectory(Path.GetDirectoryName(originalPath)); |                 Directory.CreateDirectory(originalPath); | ||||||
|             } |             } | ||||||
|             if (!Directory.Exists(Path.GetDirectoryName(requestedPath))) |             if (!Directory.Exists(requestedPath)) | ||||||
|             { |             { | ||||||
|                 Directory.CreateDirectory(Path.GetDirectoryName(requestedPath)); |                 Directory.CreateDirectory(requestedPath); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             // get the resolution attribute for enum size |             // get the resolution attribute for enum size | ||||||
| @@ -1147,7 +1147,7 @@ namespace gaseous_server.Classes.Metadata | |||||||
|  |  | ||||||
|                 // get the original image |                 // get the original image | ||||||
|                 Communications comms = new Communications(); |                 Communications comms = new Communications(); | ||||||
|                 switch (_MetadataSource) |                 switch (SourceType) | ||||||
|                 { |                 { | ||||||
|                     case HasheousClient.Models.MetadataSources.None: |                     case HasheousClient.Models.MetadataSources.None: | ||||||
|                         await comms.API_GetURL(ImageId, originalPath); |                         await comms.API_GetURL(ImageId, originalPath); | ||||||
| @@ -1180,7 +1180,7 @@ namespace gaseous_server.Classes.Metadata | |||||||
|                 { |                 { | ||||||
|                     image.Resize(resolution.X, resolution.Y); |                     image.Resize(resolution.X, resolution.Y); | ||||||
|                     image.Strip(); |                     image.Strip(); | ||||||
|                     image.Write(requestedPath); |                     image.Write(requestedFilePath); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -578,7 +578,7 @@ namespace gaseous_server.Controllers | |||||||
|                 if (!System.IO.File.Exists(imagePath)) |                 if (!System.IO.File.Exists(imagePath)) | ||||||
|                 { |                 { | ||||||
|                     Communications comms = new Communications(); |                     Communications comms = new Communications(); | ||||||
|                     Task<string> ImgFetch = comms.GetSpecificImageFromServer(Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Game(game), imageTypePath), imageId, size, new List<Communications.IGDBAPI_ImageSize> { Communications.IGDBAPI_ImageSize.cover_big, Communications.IGDBAPI_ImageSize.original }); |                     Task<string> ImgFetch = comms.GetSpecificImageFromServer(game.MetadataSource, Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Game(game), imageTypePath), imageId, size, new List<Communications.IGDBAPI_ImageSize> { Communications.IGDBAPI_ImageSize.cover_big, Communications.IGDBAPI_ImageSize.original }); | ||||||
|  |  | ||||||
|                     imagePath = ImgFetch.Result; |                     imagePath = ImgFetch.Result; | ||||||
|                 } |                 } | ||||||
| @@ -586,7 +586,7 @@ namespace gaseous_server.Controllers | |||||||
|                 if (!System.IO.File.Exists(imagePath)) |                 if (!System.IO.File.Exists(imagePath)) | ||||||
|                 { |                 { | ||||||
|                     Communications comms = new Communications(); |                     Communications comms = new Communications(); | ||||||
|                     Task<string> ImgFetch = comms.GetSpecificImageFromServer(basePath, imageId, size, new List<Communications.IGDBAPI_ImageSize> { Communications.IGDBAPI_ImageSize.cover_big, Communications.IGDBAPI_ImageSize.original }); |                     Task<string> ImgFetch = comms.GetSpecificImageFromServer(game.MetadataSource, basePath, imageId, size, new List<Communications.IGDBAPI_ImageSize> { Communications.IGDBAPI_ImageSize.cover_big, Communications.IGDBAPI_ImageSize.original }); | ||||||
|  |  | ||||||
|                     imagePath = ImgFetch.Result; |                     imagePath = ImgFetch.Result; | ||||||
|                 } |                 } | ||||||
|   | |||||||
| @@ -155,7 +155,7 @@ namespace gaseous_server.Controllers | |||||||
|                 if (!System.IO.File.Exists(imagePath)) |                 if (!System.IO.File.Exists(imagePath)) | ||||||
|                 { |                 { | ||||||
|                     Communications comms = new Communications(); |                     Communications comms = new Communications(); | ||||||
|                     Task<string> ImgFetch = comms.GetSpecificImageFromServer(Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Platform(platformObject)), logoObject.ImageId, size, new List<Communications.IGDBAPI_ImageSize> { Communications.IGDBAPI_ImageSize.cover_big, Communications.IGDBAPI_ImageSize.original }); |                     Task<string> ImgFetch = comms.GetSpecificImageFromServer(Communications.MetadataSource, Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Platform(platformObject)), logoObject.ImageId, size, new List<Communications.IGDBAPI_ImageSize> { Communications.IGDBAPI_ImageSize.cover_big, Communications.IGDBAPI_ImageSize.original }); | ||||||
|  |  | ||||||
|                     imagePath = ImgFetch.Result; |                     imagePath = ImgFetch.Result; | ||||||
|                 } |                 } | ||||||
| @@ -163,7 +163,7 @@ namespace gaseous_server.Controllers | |||||||
|                 if (!System.IO.File.Exists(imagePath)) |                 if (!System.IO.File.Exists(imagePath)) | ||||||
|                 { |                 { | ||||||
|                     Communications comms = new Communications(); |                     Communications comms = new Communications(); | ||||||
|                     Task<string> ImgFetch = comms.GetSpecificImageFromServer(basePath, logoObject.ImageId, size, new List<Communications.IGDBAPI_ImageSize> { Communications.IGDBAPI_ImageSize.cover_big, Communications.IGDBAPI_ImageSize.original }); |                     Task<string> ImgFetch = comms.GetSpecificImageFromServer(Communications.MetadataSource, basePath, logoObject.ImageId, size, new List<Communications.IGDBAPI_ImageSize> { Communications.IGDBAPI_ImageSize.cover_big, Communications.IGDBAPI_ImageSize.original }); | ||||||
|  |  | ||||||
|                     imagePath = ImgFetch.Result; |                     imagePath = ImgFetch.Result; | ||||||
|                 } |                 } | ||||||
|   | |||||||
| @@ -51,7 +51,19 @@ namespace gaseous_server.Controllers | |||||||
|             ReturnValue.DatabaseSize = (long)(System.Decimal)dbResponse.Rows[0][1]; |             ReturnValue.DatabaseSize = (long)(System.Decimal)dbResponse.Rows[0][1]; | ||||||
|  |  | ||||||
|             // platform statistics |             // platform statistics | ||||||
|             sql = "SELECT Platform.`name`, grc.Count, grs.Size FROM Platform INNER JOIN (SELECT Platform.`name` AS `Name`, SUM(grs.Size) AS Size FROM Platform JOIN view_Games_Roms AS grs ON (grs.PlatformId = Platform.Id) GROUP BY Platform.`name`) grs ON (grs.`Name` = Platform.`name`) INNER JOIN (SELECT Platform.`name` AS `Name`, COUNT(grc.Size) AS Count FROM Platform JOIN view_Games_Roms AS grc ON (grc.PlatformId = Platform.Id) GROUP BY Platform.`name`) grc ON (grc.`Name` = Platform.`name`) ORDER BY Platform.`name`;"; |             sql = @" | ||||||
|  | SELECT  | ||||||
|  |     view_Games_Roms.PlatformId, | ||||||
|  |     Platform.`Name`, | ||||||
|  |     SUM(view_Games_Roms.Size) AS Size, | ||||||
|  |     COUNT(view_Games_Roms.`Id`) AS Count | ||||||
|  | FROM | ||||||
|  |     view_Games_Roms | ||||||
|  |         LEFT JOIN | ||||||
|  |     Platform ON view_Games_Roms.PlatformId = Platform.`Id` | ||||||
|  |         AND Platform.SourceId = 0 | ||||||
|  | GROUP BY Platform.`Name` | ||||||
|  | ORDER BY Platform.`Name`; "; | ||||||
|             dbResponse = db.ExecuteCMD(sql); |             dbResponse = db.ExecuteCMD(sql); | ||||||
|             ReturnValue.PlatformStatistics = new List<SystemInfo.PlatformStatisticsItem>(); |             ReturnValue.PlatformStatistics = new List<SystemInfo.PlatformStatisticsItem>(); | ||||||
|             foreach (DataRow dr in dbResponse.Rows) |             foreach (DataRow dr in dbResponse.Rows) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Green
					Michael Green