feat: added age ratings and icons to the game controller
BIN
gaseous-server/Assets/Ratings/ACB/ACB_G.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
gaseous-server/Assets/Ratings/ACB/ACB_M.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
gaseous-server/Assets/Ratings/ACB/ACB_MA15.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
gaseous-server/Assets/Ratings/ACB/ACB_PG.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
gaseous-server/Assets/Ratings/ACB/ACB_R18.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
gaseous-server/Assets/Ratings/ACB/ACB_RC.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
1
gaseous-server/Assets/Ratings/ESRB/AO.svg
Normal file
After Width: | Height: | Size: 9.7 KiB |
1
gaseous-server/Assets/Ratings/ESRB/E.svg
Normal file
After Width: | Height: | Size: 5.6 KiB |
1
gaseous-server/Assets/Ratings/ESRB/E10.svg
Normal file
After Width: | Height: | Size: 7.7 KiB |
1
gaseous-server/Assets/Ratings/ESRB/M.svg
Normal file
After Width: | Height: | Size: 5.5 KiB |
1
gaseous-server/Assets/Ratings/ESRB/RP-LM17-English.svg
Normal file
After Width: | Height: | Size: 8.5 KiB |
1
gaseous-server/Assets/Ratings/ESRB/RP.svg
Normal file
After Width: | Height: | Size: 9.1 KiB |
1
gaseous-server/Assets/Ratings/ESRB/T.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> <svg xmlns="http://www.w3.org/2000/svg" width="60.42" height="90.628" viewBox="0 0 60.42 90.628"><g id="Group_404" data-name="Group 404" transform="translate(-960 -867)"><g id="Group_275" data-name="Group 275" transform="translate(960 867)"><path id="Path_243" data-name="Path 243" d="M217.98,513.479H157.561v90.628H217.98V513.479Z" transform="translate(-157.561 -513.479)" fill="#fff"></path><g id="Group_257" data-name="Group 257" transform="translate(0.878 0.972)"><g id="Group_254" data-name="Group 254"><path id="Path_244" data-name="Path 244" d="M216.8,514.118V602.8H158.138V514.118H216.8" transform="translate(-158.138 -514.118)" fill="#1a1818"></path></g><rect id="Rectangle_182" data-name="Rectangle 182" width="52.336" height="14.704" transform="translate(2.952 3.152)" fill="#fff"></rect><rect id="Rectangle_183" data-name="Rectangle 183" width="52.366" height="54.062" transform="translate(2.928 21.065)" fill="#fff"></rect><g id="Group_255" data-name="Group 255" transform="translate(2.939 78.13)"><path id="Path_245" data-name="Path 245" d="M160.068,572.732v-7.178h10.513v1.68h-6.29v1.026h5.323v1.674h-5.323v1.124h6.534v1.674Z" transform="translate(-160.068 -565.375)" fill="#fff"></path><path id="Path_246" data-name="Path 246" d="M175.532,567.706a.794.794,0,0,0-.609-.486,3.842,3.842,0,0,0-1.092-.132c-.929,0-1.344.151-1.344.419,0,1.061,7.414.4,7.414,3.007,0,1.661-2.494,2.474-6.034,2.474-3.4,0-5.621-1.107-5.711-2.4H172.2a1.033,1.033,0,0,0,.7.566,3.823,3.823,0,0,0,1.2.181c1.055,0,1.758-.187,1.758-.527,0-1.088-7.419-.342-7.419-3.078,0-1.524,2.364-2.29,5.589-2.29,3.576,0,5.208,1.015,5.516,2.27Z" transform="translate(-155.842 -565.436)" fill="#fff"></path><path id="Path_247" data-name="Path 247" d="M181.473,568.667h1.661c1.308,0,2.01-.19,2.01-.685s-.716-.749-1.7-.749h-1.969Zm0,1.564v2.5H177.25v-7.178h6.088c4.29,0,5.708.656,5.708,2.051,0,.83-.661,1.519-2.165,1.761,1.36.273,2.185.443,2.185,1.891,0,.933-.055,1.258.446,1.258v.218h-4.283a2.793,2.793,0,0,1-.212-1.256c0-.942-.286-1.245-2.255-1.245Z" transform="translate(-151.092 -565.374)" fill="#fff"></path><path id="Path_248" data-name="Path 248" d="M190.925,567.233v1.2h1.76c.842,0,1.452-.216,1.452-.627,0-.562-.833-.574-1.72-.574Zm0,2.5v1.323h1.842c1.047,0,1.833-.122,1.833-.658,0-.627-.982-.665-2.332-.665Zm-4.222,3v-7.178h6.161c2.9,0,5.211.39,5.211,1.81,0,.74-.863,1.279-1.684,1.559,1.395.2,2.144.874,2.144,1.644,0,1.6-2.2,2.165-5.551,2.165Z" transform="translate(-146.153 -565.374)" fill="#fff"></path></g><path id="Path_249" data-name="Path 249" d="M162.932,540.039l40.512-10.1,3.116,10.8-13.017,3.244,8.729,30.336-14.484,3.613-8.735-30.336-13.01,3.247Z" transform="translate(-155.634 -505.854)" fill="#1a1818"></path><g id="Group_256" data-name="Group 256" transform="translate(4.406 6.337)"><path id="Path_250" data-name="Path 250" d="M186.381,518.28h3.44l3.991,4.544-.138-1.9V518.28h3.518v8.32h-3.436l-4-4.532.067,1.964.074,2.568h-3.518Z" transform="translate(-147.788 -518.28)" fill="#1a1818"></path><path id="Path_251" data-name="Path 251" d="M178.241,518.28h9.123v1.933h-5.458v1.2h4.618v1.942h-4.618v1.3h5.675V526.6h-9.34Z" transform="translate(-152.04 -518.28)" fill="#1a1818"></path><path id="Path_252" data-name="Path 252" d="M169.818,518.28h9.125v1.933h-5.458v1.2H178.1v1.942h-4.616v1.3h5.679V526.6h-9.346Z" transform="translate(-156.441 -518.28)" fill="#1a1818"></path><path id="Path_253" data-name="Path 253" d="M161.032,518.28h10.26v2.183H168V526.6h-3.675v-6.137h-3.294Z" transform="translate(-161.032 -518.28)" fill="#1a1818"></path></g></g></g></g></svg>
|
After Width: | Height: | Size: 3.5 KiB |
BIN
gaseous-server/Assets/Ratings/PEGI/Eighteen.jpg
Normal file
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 16 KiB |
BIN
gaseous-server/Assets/Ratings/PEGI/Seven.jpg
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
gaseous-server/Assets/Ratings/PEGI/Sixteen.jpg
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
gaseous-server/Assets/Ratings/PEGI/Three.jpg
Normal file
After Width: | Height: | Size: 63 KiB |
BIN
gaseous-server/Assets/Ratings/PEGI/Twelve.jpg
Normal file
After Width: | Height: | Size: 66 KiB |
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using gaseous_tools;
|
||||
using IGDB;
|
||||
using IGDB.Models;
|
||||
@@ -115,6 +116,37 @@ namespace gaseous_server.Classes.Metadata
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static GameAgeRating GetConsolidatedAgeRating(long RatingId)
|
||||
{
|
||||
GameAgeRating gameAgeRating = new GameAgeRating();
|
||||
|
||||
AgeRating ageRating = GetAgeRatings(RatingId);
|
||||
gameAgeRating.Id = (long)ageRating.Id;
|
||||
gameAgeRating.RatingBoard = (AgeRatingCategory)ageRating.Category;
|
||||
gameAgeRating.RatingTitle = (AgeRatingTitle)ageRating.Rating;
|
||||
|
||||
List<string> descriptions = new List<string>();
|
||||
if (ageRating.ContentDescriptions != null)
|
||||
{
|
||||
foreach (long ContentId in ageRating.ContentDescriptions.Ids)
|
||||
{
|
||||
AgeRatingContentDescription ageRatingContentDescription = AgeRatingContentDescriptions.GetAgeRatingContentDescriptions(ContentId);
|
||||
descriptions.Add(ageRatingContentDescription.Description);
|
||||
}
|
||||
}
|
||||
gameAgeRating.Descriptions = descriptions.ToArray();
|
||||
|
||||
return gameAgeRating;
|
||||
}
|
||||
|
||||
public class GameAgeRating
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public AgeRatingCategory RatingBoard { get; set; }
|
||||
public AgeRatingTitle RatingTitle { get; set; }
|
||||
public string[] Descriptions { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -231,6 +231,9 @@ namespace gaseous_server.Classes.Metadata
|
||||
break;
|
||||
case "artwork":
|
||||
objectToStore = new IdentitiesOrValues<Artwork>(ids: fromJsonObject);
|
||||
break;
|
||||
case "ageratingcontentdescription":
|
||||
objectToStore = new IdentitiesOrValues<AgeRatingContentDescription>(ids: fromJsonObject);
|
||||
break;
|
||||
case "game":
|
||||
objectToStore = new IdentitiesOrValues<Game>(ids: fromJsonObject);
|
||||
@@ -313,6 +316,9 @@ namespace gaseous_server.Classes.Metadata
|
||||
case "[igdb.models.ageratingcategory":
|
||||
property.SetValue(EndpointType, (AgeRatingCategory)dataRow[property.Name]);
|
||||
break;
|
||||
case "[igdb.models.ageratingcontentdescriptioncategory":
|
||||
property.SetValue(EndpointType, (AgeRatingContentDescriptionCategory)dataRow[property.Name]);
|
||||
break;
|
||||
case "[igdb.models.ageratingtitle":
|
||||
property.SetValue(EndpointType, (AgeRatingTitle)dataRow[property.Name]);
|
||||
break;
|
||||
|
@@ -1,14 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using gaseous_server.Classes.Metadata;
|
||||
using gaseous_tools;
|
||||
using IGDB.Models;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
using Microsoft.CodeAnalysis.Scripting;
|
||||
using static gaseous_server.Classes.Metadata.AgeRatings;
|
||||
|
||||
namespace gaseous_server.Controllers
|
||||
{
|
||||
[Route("api/v1/[controller]")]
|
||||
@@ -154,39 +158,23 @@ namespace gaseous_server.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("{GameId}/artwork")]
|
||||
[ProducesResponseType(typeof(List<Artwork>), StatusCodes.Status200OK)]
|
||||
public ActionResult GameArtwork(long GameId)
|
||||
{
|
||||
Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false);
|
||||
|
||||
List<Artwork> artworks = new List<Artwork>();
|
||||
if (gameObject.Artworks != null)
|
||||
{
|
||||
foreach (long ArtworkId in gameObject.Artworks.Ids)
|
||||
{
|
||||
Artwork GameArtwork = Artworks.GetArtwork(ArtworkId, Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject));
|
||||
artworks.Add(GameArtwork);
|
||||
}
|
||||
}
|
||||
|
||||
return Ok(artworks);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("{GameId}/artwork/{ArtworkId}")]
|
||||
[ProducesResponseType(typeof(Artwork), StatusCodes.Status200OK)]
|
||||
[Route("{GameId}/agerating")]
|
||||
[ProducesResponseType(typeof(List<AgeRatings.GameAgeRating>), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public ActionResult GameArtwork(long GameId, long ArtworkId)
|
||||
public ActionResult GameAgeClassification(long GameId)
|
||||
{
|
||||
IGDB.Models.Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false);
|
||||
|
||||
try
|
||||
{
|
||||
IGDB.Models.Artwork artworkObject = Artworks.GetArtwork(ArtworkId, Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject));
|
||||
if (artworkObject != null)
|
||||
Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false);
|
||||
|
||||
if (gameObject.AgeRatings != null)
|
||||
{
|
||||
return Ok(artworkObject);
|
||||
List<AgeRatings.GameAgeRating> ageRatings = new List<AgeRatings.GameAgeRating>();
|
||||
foreach (long ageRatingId in gameObject.AgeRatings.Ids)
|
||||
{
|
||||
ageRatings.Add(AgeRatings.GetConsolidatedAgeRating(ageRatingId));
|
||||
}
|
||||
return Ok(ageRatings);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -197,28 +185,50 @@ namespace gaseous_server.Controllers
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("{GameId}/artwork/{ArtworkId}/image")]
|
||||
[ProducesResponseType(typeof(FileStreamResult), StatusCodes.Status200OK)]
|
||||
[Route("{GameId}/agerating/{RatingId}/image")]
|
||||
[ProducesResponseType(typeof(FileContentResult), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public ActionResult GameCoverImage(long GameId, long ArtworkId)
|
||||
public ActionResult GameAgeClassification(long GameId, long RatingId)
|
||||
{
|
||||
IGDB.Models.Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false);
|
||||
|
||||
try
|
||||
{
|
||||
IGDB.Models.Artwork artworkObject = Artworks.GetArtwork(ArtworkId, Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject));
|
||||
if (artworkObject != null) {
|
||||
string coverFilePath = Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject), "Artwork", artworkObject.ImageId + ".png");
|
||||
if (System.IO.File.Exists(coverFilePath))
|
||||
GameAgeRating gameAgeRating = GetConsolidatedAgeRating(RatingId);
|
||||
|
||||
string fileExtension = "";
|
||||
string fileType = "";
|
||||
switch (gameAgeRating.RatingBoard)
|
||||
{
|
||||
case AgeRatingCategory.ESRB:
|
||||
fileExtension = "svg";
|
||||
fileType = "image/svg+xml";
|
||||
break;
|
||||
case AgeRatingCategory.PEGI:
|
||||
fileExtension = "jpg";
|
||||
fileType = "image/jpg";
|
||||
break;
|
||||
case AgeRatingCategory.ACB:
|
||||
fileExtension = "png";
|
||||
fileType = "image/png";
|
||||
break;
|
||||
}
|
||||
|
||||
string resourceName = "gaseous_server.Assets.Ratings." + gameAgeRating.RatingBoard.ToString() + "." + gameAgeRating.RatingTitle.ToString() + "." + fileExtension;
|
||||
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
string[] resources = assembly.GetManifestResourceNames();
|
||||
if (resources.Contains(resourceName))
|
||||
{
|
||||
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
string filename = artworkObject.ImageId + ".png";
|
||||
string filepath = coverFilePath;
|
||||
byte[] filedata = System.IO.File.ReadAllBytes(filepath);
|
||||
string contentType = "image/png";
|
||||
byte[] filedata = new byte[stream.Length];
|
||||
stream.Read(filedata, 0, filedata.Length);
|
||||
|
||||
string filename = gameAgeRating.RatingBoard.ToString() + "-" + gameAgeRating.RatingTitle.ToString() + "." + fileExtension;
|
||||
string contentType = fileType;
|
||||
|
||||
var cd = new System.Net.Mime.ContentDisposition
|
||||
{
|
||||
@@ -230,12 +240,119 @@ namespace gaseous_server.Controllers
|
||||
|
||||
return File(filedata, contentType);
|
||||
}
|
||||
}
|
||||
return NotFound();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("{GameId}/artwork")]
|
||||
[ProducesResponseType(typeof(List<Artwork>), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public ActionResult GameArtwork(long GameId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false);
|
||||
|
||||
List<Artwork> artworks = new List<Artwork>();
|
||||
if (gameObject.Artworks != null)
|
||||
{
|
||||
foreach (long ArtworkId in gameObject.Artworks.Ids)
|
||||
{
|
||||
Artwork GameArtwork = Artworks.GetArtwork(ArtworkId, Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject));
|
||||
artworks.Add(GameArtwork);
|
||||
}
|
||||
}
|
||||
|
||||
return Ok(artworks);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("{GameId}/artwork/{ArtworkId}")]
|
||||
[ProducesResponseType(typeof(Artwork), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public ActionResult GameArtwork(long GameId, long ArtworkId)
|
||||
{
|
||||
try
|
||||
{
|
||||
IGDB.Models.Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false);
|
||||
|
||||
try
|
||||
{
|
||||
IGDB.Models.Artwork artworkObject = Artworks.GetArtwork(ArtworkId, Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject));
|
||||
if (artworkObject != null)
|
||||
{
|
||||
return Ok(artworkObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
else
|
||||
catch
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("{GameId}/artwork/{ArtworkId}/image")]
|
||||
[ProducesResponseType(typeof(FileStreamResult), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public ActionResult GameCoverImage(long GameId, long ArtworkId)
|
||||
{
|
||||
try
|
||||
{
|
||||
IGDB.Models.Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false);
|
||||
|
||||
try
|
||||
{
|
||||
IGDB.Models.Artwork artworkObject = Artworks.GetArtwork(ArtworkId, Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject));
|
||||
if (artworkObject != null) {
|
||||
string coverFilePath = Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject), "Artwork", artworkObject.ImageId + ".png");
|
||||
if (System.IO.File.Exists(coverFilePath))
|
||||
{
|
||||
string filename = artworkObject.ImageId + ".png";
|
||||
string filepath = coverFilePath;
|
||||
byte[] filedata = System.IO.File.ReadAllBytes(filepath);
|
||||
string contentType = "image/png";
|
||||
|
||||
var cd = new System.Net.Mime.ContentDisposition
|
||||
{
|
||||
FileName = filename,
|
||||
Inline = true,
|
||||
};
|
||||
|
||||
Response.Headers.Add("Content-Disposition", cd.ToString());
|
||||
|
||||
return File(filedata, contentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -284,26 +401,33 @@ namespace gaseous_server.Controllers
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public ActionResult GameCoverImage(long GameId)
|
||||
{
|
||||
IGDB.Models.Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false);
|
||||
try
|
||||
{
|
||||
IGDB.Models.Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false);
|
||||
|
||||
string coverFilePath = Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject), "Cover.png");
|
||||
if (System.IO.File.Exists(coverFilePath)) {
|
||||
string filename = "Cover.png";
|
||||
string filepath = coverFilePath;
|
||||
byte[] filedata = System.IO.File.ReadAllBytes(filepath);
|
||||
string contentType = "image/png";
|
||||
string coverFilePath = Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject), "Cover.png");
|
||||
if (System.IO.File.Exists(coverFilePath)) {
|
||||
string filename = "Cover.png";
|
||||
string filepath = coverFilePath;
|
||||
byte[] filedata = System.IO.File.ReadAllBytes(filepath);
|
||||
string contentType = "image/png";
|
||||
|
||||
var cd = new System.Net.Mime.ContentDisposition
|
||||
var cd = new System.Net.Mime.ContentDisposition
|
||||
{
|
||||
FileName = filename,
|
||||
Inline = true,
|
||||
};
|
||||
|
||||
Response.Headers.Add("Content-Disposition", cd.ToString());
|
||||
|
||||
return File(filedata, contentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
FileName = filename,
|
||||
Inline = true,
|
||||
};
|
||||
|
||||
Response.Headers.Add("Content-Disposition", cd.ToString());
|
||||
|
||||
return File(filedata, contentType);
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
else
|
||||
catch
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -312,21 +436,29 @@ namespace gaseous_server.Controllers
|
||||
[HttpGet]
|
||||
[Route("{GameId}/screenshots")]
|
||||
[ProducesResponseType(typeof(List<Screenshot>), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public ActionResult GameScreenshot(long GameId)
|
||||
{
|
||||
Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false);
|
||||
|
||||
List<Screenshot> screenshots = new List<Screenshot>();
|
||||
if (gameObject.Screenshots != null)
|
||||
try
|
||||
{
|
||||
foreach (long ScreenshotId in gameObject.Screenshots.Ids)
|
||||
{
|
||||
Screenshot GameScreenshot = Screenshots.GetScreenshot(ScreenshotId, Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject));
|
||||
screenshots.Add(GameScreenshot);
|
||||
}
|
||||
}
|
||||
Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false);
|
||||
|
||||
return Ok(screenshots);
|
||||
List<Screenshot> screenshots = new List<Screenshot>();
|
||||
if (gameObject.Screenshots != null)
|
||||
{
|
||||
foreach (long ScreenshotId in gameObject.Screenshots.Ids)
|
||||
{
|
||||
Screenshot GameScreenshot = Screenshots.GetScreenshot(ScreenshotId, Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject));
|
||||
screenshots.Add(GameScreenshot);
|
||||
}
|
||||
}
|
||||
|
||||
return Ok(screenshots);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -366,29 +498,36 @@ namespace gaseous_server.Controllers
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public ActionResult GameScreenshotImage(long GameId, long ScreenshotId)
|
||||
{
|
||||
IGDB.Models.Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false);
|
||||
|
||||
IGDB.Models.Screenshot screenshotObject = Screenshots.GetScreenshot(ScreenshotId, Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject));
|
||||
|
||||
string coverFilePath = Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject), "Screenshots", screenshotObject.ImageId + ".png");
|
||||
if (System.IO.File.Exists(coverFilePath))
|
||||
try
|
||||
{
|
||||
string filename = screenshotObject.ImageId + ".png";
|
||||
string filepath = coverFilePath;
|
||||
byte[] filedata = System.IO.File.ReadAllBytes(filepath);
|
||||
string contentType = "image/png";
|
||||
IGDB.Models.Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false);
|
||||
|
||||
var cd = new System.Net.Mime.ContentDisposition
|
||||
IGDB.Models.Screenshot screenshotObject = Screenshots.GetScreenshot(ScreenshotId, Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject));
|
||||
|
||||
string coverFilePath = Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject), "Screenshots", screenshotObject.ImageId + ".png");
|
||||
if (System.IO.File.Exists(coverFilePath))
|
||||
{
|
||||
FileName = filename,
|
||||
Inline = true,
|
||||
};
|
||||
string filename = screenshotObject.ImageId + ".png";
|
||||
string filepath = coverFilePath;
|
||||
byte[] filedata = System.IO.File.ReadAllBytes(filepath);
|
||||
string contentType = "image/png";
|
||||
|
||||
Response.Headers.Add("Content-Disposition", cd.ToString());
|
||||
var cd = new System.Net.Mime.ContentDisposition
|
||||
{
|
||||
FileName = filename,
|
||||
Inline = true,
|
||||
};
|
||||
|
||||
return File(filedata, contentType);
|
||||
Response.Headers.Add("Content-Disposition", cd.ToString());
|
||||
|
||||
return File(filedata, contentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
else
|
||||
catch
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
@@ -397,21 +536,29 @@ namespace gaseous_server.Controllers
|
||||
[HttpGet]
|
||||
[Route("{GameId}/videos")]
|
||||
[ProducesResponseType(typeof(List<GameVideo>), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public ActionResult GameVideo(long GameId)
|
||||
{
|
||||
Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false);
|
||||
|
||||
List<GameVideo> videos = new List<GameVideo>();
|
||||
if (gameObject.Videos != null)
|
||||
try
|
||||
{
|
||||
foreach (long VideoId in gameObject.Videos.Ids)
|
||||
{
|
||||
GameVideo gameVideo = GamesVideos.GetGame_Videos(VideoId);
|
||||
videos.Add(gameVideo);
|
||||
}
|
||||
}
|
||||
Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false);
|
||||
|
||||
return Ok(videos);
|
||||
List<GameVideo> videos = new List<GameVideo>();
|
||||
if (gameObject.Videos != null)
|
||||
{
|
||||
foreach (long VideoId in gameObject.Videos.Ids)
|
||||
{
|
||||
GameVideo gameVideo = GamesVideos.GetGame_Videos(VideoId);
|
||||
videos.Add(gameVideo);
|
||||
}
|
||||
}
|
||||
|
||||
return Ok(videos);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -24,6 +24,30 @@
|
||||
<None Remove="Classes\SignatureIngestors\" />
|
||||
<None Remove="Support\" />
|
||||
<None Remove="Classes\Metadata\" />
|
||||
<None Remove="Assets\" />
|
||||
<None Remove="Assets\Ratings\" />
|
||||
<None Remove="Assets\Ratings\ESRB\" />
|
||||
<None Remove="Assets\Ratings\ACB\" />
|
||||
<None Remove="Assets\Ratings\PEGI\" />
|
||||
<None Remove="Assets\Ratings\ESRB\AO.svg" />
|
||||
<None Remove="Assets\Ratings\ESRB\E.svg" />
|
||||
<None Remove="Assets\Ratings\ESRB\E10plus.svg" />
|
||||
<None Remove="Assets\Ratings\ESRB\M.svg" />
|
||||
<None Remove="Assets\Ratings\ESRB\RP.svg" />
|
||||
<None Remove="Assets\Ratings\ESRB\RP-LM17-English.svg" />
|
||||
<None Remove="Assets\Ratings\ESRB\T.svg" />
|
||||
<None Remove="Assets\Ratings\PEGI\Eighteen.jpg" />
|
||||
<None Remove="Assets\Ratings\PEGI\PEGI_Parental_Guidance_Recommended.png" />
|
||||
<None Remove="Assets\Ratings\PEGI\Seven.jpg" />
|
||||
<None Remove="Assets\Ratings\PEGI\Sixteen.jpg" />
|
||||
<None Remove="Assets\Ratings\PEGI\Three.jpg" />
|
||||
<None Remove="Assets\Ratings\PEGI\Twelve.jpg" />
|
||||
<None Remove="Assets\Ratings\ACB\ACB_G.png" />
|
||||
<None Remove="Assets\Ratings\ACB\ACB_M.png" />
|
||||
<None Remove="Assets\Ratings\ACB\ACB_MA15.png" />
|
||||
<None Remove="Assets\Ratings\ACB\ACB_PG.png" />
|
||||
<None Remove="Assets\Ratings\ACB\ACB_R18.png" />
|
||||
<None Remove="Assets\Ratings\ACB\ACB_RC.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Controllers\" />
|
||||
@@ -33,6 +57,11 @@
|
||||
<Folder Include="Support\" />
|
||||
<Folder Include="wwwroot\" />
|
||||
<Folder Include="Classes\Metadata\" />
|
||||
<Folder Include="Assets\" />
|
||||
<Folder Include="Assets\Ratings\" />
|
||||
<Folder Include="Assets\Ratings\ESRB\" />
|
||||
<Folder Include="Assets\Ratings\ACB\" />
|
||||
<Folder Include="Assets\Ratings\PEGI\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\gaseous-tools\gaseous-tools.csproj">
|
||||
@@ -55,6 +84,25 @@
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Assets\Ratings\ESRB\AO.svg" />
|
||||
<EmbeddedResource Include="Assets\Ratings\ESRB\E.svg" />
|
||||
<EmbeddedResource Include="Assets\Ratings\ESRB\E10.svg" />
|
||||
<EmbeddedResource Include="Assets\Ratings\ESRB\M.svg" />
|
||||
<EmbeddedResource Include="Assets\Ratings\ESRB\RP.svg" />
|
||||
<EmbeddedResource Include="Assets\Ratings\ESRB\RP-LM17-English.svg" />
|
||||
<EmbeddedResource Include="Assets\Ratings\ESRB\T.svg" />
|
||||
<EmbeddedResource Include="Assets\Ratings\PEGI\Eighteen.jpg" />
|
||||
<EmbeddedResource Include="Assets\Ratings\PEGI\PEGI_Parental_Guidance_Recommended.png" />
|
||||
<EmbeddedResource Include="Assets\Ratings\PEGI\Seven.jpg" />
|
||||
<EmbeddedResource Include="Assets\Ratings\PEGI\Sixteen.jpg" />
|
||||
<EmbeddedResource Include="Assets\Ratings\PEGI\Three.jpg" />
|
||||
<EmbeddedResource Include="Assets\Ratings\PEGI\Twelve.jpg" />
|
||||
<EmbeddedResource Include="Assets\Ratings\ACB\ACB_G.png" />
|
||||
<EmbeddedResource Include="Assets\Ratings\ACB\ACB_M.png" />
|
||||
<EmbeddedResource Include="Assets\Ratings\ACB\ACB_MA15.png" />
|
||||
<EmbeddedResource Include="Assets\Ratings\ACB\ACB_PG.png" />
|
||||
<EmbeddedResource Include="Assets\Ratings\ACB\ACB_R18.png" />
|
||||
<EmbeddedResource Include="Assets\Ratings\ACB\ACB_RC.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="wwwroot\index.html" />
|
||||
|