diff --git a/gaseous-server/Classes/Database.cs b/gaseous-server/Classes/Database.cs index 2386689..4445cdd 100644 --- a/gaseous-server/Classes/Database.cs +++ b/gaseous-server/Classes/Database.cs @@ -329,38 +329,40 @@ namespace gaseous_server.Classes DataTable RetTable = new DataTable(); Logging.Log(Logging.LogType.Debug, "Database", "Connecting to database", null, true); - MySqlConnection conn = new MySqlConnection(DBConn); - conn.Open(); - - MySqlCommand cmd = new MySqlCommand + using (MySqlConnection conn = new MySqlConnection(DBConn)) { - Connection = conn, - CommandText = SQL, - CommandTimeout = Timeout - }; + conn.Open(); - foreach (string Parameter in Parameters.Keys) - { - cmd.Parameters.AddWithValue(Parameter, Parameters[Parameter]); - } - - try - { - Logging.Log(Logging.LogType.Debug, "Database", "Executing sql: '" + SQL + "'", null, true); - if (Parameters.Count > 0) + MySqlCommand cmd = new MySqlCommand { - string dictValues = string.Join(";", Parameters.Select(x => string.Join("=", x.Key, x.Value))); - Logging.Log(Logging.LogType.Debug, "Database", "Parameters: " + dictValues, null, true); - } - RetTable.Load(cmd.ExecuteReader()); - } catch (Exception ex) { - Logging.Log(Logging.LogType.Critical, "Database", "Error while executing '" + SQL + "'", ex); - Trace.WriteLine("Error executing " + SQL); - Trace.WriteLine("Full exception: " + ex.ToString()); - } + Connection = conn, + CommandText = SQL, + CommandTimeout = Timeout + }; - Logging.Log(Logging.LogType.Debug, "Database", "Closing database connection", null, true); - conn.Close(); + foreach (string Parameter in Parameters.Keys) + { + cmd.Parameters.AddWithValue(Parameter, Parameters[Parameter]); + } + + try + { + Logging.Log(Logging.LogType.Debug, "Database", "Executing sql: '" + SQL + "'", null, true); + if (Parameters.Count > 0) + { + string dictValues = string.Join(";", Parameters.Select(x => string.Join("=", x.Key, x.Value))); + Logging.Log(Logging.LogType.Debug, "Database", "Parameters: " + dictValues, null, true); + } + RetTable.Load(cmd.ExecuteReader()); + } catch (Exception ex) { + Logging.Log(Logging.LogType.Critical, "Database", "Error while executing '" + SQL + "'", ex); + Trace.WriteLine("Error executing " + SQL); + Trace.WriteLine("Full exception: " + ex.ToString()); + } + + Logging.Log(Logging.LogType.Debug, "Database", "Closing database connection", null, true); + conn.Close(); + } return RetTable; } @@ -370,60 +372,64 @@ namespace gaseous_server.Classes int result = 0; Logging.Log(Logging.LogType.Debug, "Database", "Connecting to database", null, true); - MySqlConnection conn = new MySqlConnection(DBConn); - conn.Open(); - - MySqlCommand cmd = new MySqlCommand + using (MySqlConnection conn = new MySqlConnection(DBConn)) { - Connection = conn, - CommandText = SQL, - CommandTimeout = Timeout - }; + conn.Open(); - foreach (string Parameter in Parameters.Keys) - { - cmd.Parameters.AddWithValue(Parameter, Parameters[Parameter]); - } - - try - { - Logging.Log(Logging.LogType.Debug, "Database", "Executing sql: '" + SQL + "'", null, true); - if (Parameters.Count > 0) + MySqlCommand cmd = new MySqlCommand { - string dictValues = string.Join(";", Parameters.Select(x => string.Join("=", x.Key, x.Value))); - Logging.Log(Logging.LogType.Debug, "Database", "Parameters: " + dictValues, null, true); - } - result = cmd.ExecuteNonQuery(); - } catch (Exception ex) { - Logging.Log(Logging.LogType.Critical, "Database", "Error while executing '" + SQL + "'", ex); - Trace.WriteLine("Error executing " + SQL); - Trace.WriteLine("Full exception: " + ex.ToString()); - } + Connection = conn, + CommandText = SQL, + CommandTimeout = Timeout + }; - Logging.Log(Logging.LogType.Debug, "Database", "Closing database connection", null, true); - conn.Close(); + foreach (string Parameter in Parameters.Keys) + { + cmd.Parameters.AddWithValue(Parameter, Parameters[Parameter]); + } + + try + { + Logging.Log(Logging.LogType.Debug, "Database", "Executing sql: '" + SQL + "'", null, true); + if (Parameters.Count > 0) + { + string dictValues = string.Join(";", Parameters.Select(x => string.Join("=", x.Key, x.Value))); + Logging.Log(Logging.LogType.Debug, "Database", "Parameters: " + dictValues, null, true); + } + result = cmd.ExecuteNonQuery(); + } catch (Exception ex) { + Logging.Log(Logging.LogType.Critical, "Database", "Error while executing '" + SQL + "'", ex); + Trace.WriteLine("Error executing " + SQL); + Trace.WriteLine("Full exception: " + ex.ToString()); + } + + Logging.Log(Logging.LogType.Debug, "Database", "Closing database connection", null, true); + conn.Close(); + } return result; } public void TransactionExecCMD(List> Parameters, int Timeout) { - var conn = new MySqlConnection(DBConn); - conn.Open(); - var command = conn.CreateCommand(); - MySqlTransaction transaction; - transaction = conn.BeginTransaction(); - command.Connection = conn; - command.Transaction = transaction; - foreach (Dictionary Parameter in Parameters) + using (MySqlConnection conn = new MySqlConnection(DBConn)) { - var cmd = buildcommand(conn, Parameter["sql"].ToString(), (Dictionary)Parameter["values"], Timeout); - cmd.Transaction = transaction; - cmd.ExecuteNonQuery(); - } + conn.Open(); + var command = conn.CreateCommand(); + MySqlTransaction transaction; + transaction = conn.BeginTransaction(); + command.Connection = conn; + command.Transaction = transaction; + foreach (Dictionary Parameter in Parameters) + { + var cmd = buildcommand(conn, Parameter["sql"].ToString(), (Dictionary)Parameter["values"], Timeout); + cmd.Transaction = transaction; + cmd.ExecuteNonQuery(); + } - transaction.Commit(); - conn.Close(); + transaction.Commit(); + conn.Close(); + } } private MySqlCommand buildcommand(MySqlConnection Conn, string SQL, Dictionary Parameters, int Timeout) @@ -449,16 +455,18 @@ namespace gaseous_server.Classes public bool TestConnection() { - MySqlConnection conn = new MySqlConnection(DBConn); - try + using (MySqlConnection conn = new MySqlConnection(DBConn)) { - conn.Open(); - conn.Close(); - return true; - } - catch - { - return false; + try + { + conn.Open(); + conn.Close(); + return true; + } + catch + { + return false; + } } } } diff --git a/gaseous-server/Classes/Metadata/Artworks.cs b/gaseous-server/Classes/Metadata/Artworks.cs index efbbfd8..0c61d7b 100644 --- a/gaseous-server/Classes/Metadata/Artworks.cs +++ b/gaseous-server/Classes/Metadata/Artworks.cs @@ -95,7 +95,8 @@ namespace gaseous_server.Classes.Metadata { Logging.Log(Logging.LogType.Information, "Metadata: " + returnValue.GetType().Name, "Artwork download forced."); - GetImageFromServer(ImagePath, returnValue.ImageId); + Communications comms = new Communications(); + comms.GetSpecificImageFromServer(ImagePath, returnValue.ImageId, Communications.IGDBAPI_ImageSize.original, null); } return returnValue; @@ -116,15 +117,6 @@ namespace gaseous_server.Classes.Metadata return result; } - - private static async void GetImageFromServer(string ImagePath, string ImageId) - { - Communications comms = new Communications(); - List imageSizes = new List(); - imageSizes.AddRange(Enum.GetValues(typeof(Communications.IGDBAPI_ImageSize)).Cast()); - - await comms.IGDBAPI_GetImage(imageSizes, ImageId, ImagePath); - } } } diff --git a/gaseous-server/Classes/Metadata/Communications.cs b/gaseous-server/Classes/Metadata/Communications.cs index 4a89556..752aa8f 100644 --- a/gaseous-server/Classes/Metadata/Communications.cs +++ b/gaseous-server/Classes/Metadata/Communications.cs @@ -11,13 +11,23 @@ namespace gaseous_server.Classes.Metadata /// public class Communications { + static Communications() + { + var handler = new HttpClientHandler(); + handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; + client = new HttpClient(handler); + + client.DefaultRequestHeaders.Add("Accept-Encoding", "gzip"); + client.DefaultRequestHeaders.Add("Accept-Encoding", "deflate"); + } + private static IGDBClient igdb = new IGDBClient( // Found in Twitch Developer portal for your app Config.IGDB.ClientId, Config.IGDB.Secret ); - private HttpClient client = new HttpClient(); + private static HttpClient client = new HttpClient(); /// /// Configure metadata API communications @@ -238,84 +248,101 @@ namespace gaseous_server.Classes.Metadata private async Task _DownloadFile(Uri uri, string DestinationFile) { string DestinationDirectory = new FileInfo(DestinationFile).Directory.FullName; + if (!Directory.Exists(DestinationDirectory)) + { + Directory.CreateDirectory(DestinationDirectory); + } Logging.Log(Logging.LogType.Information, "Communications", "Downloading from " + uri.ToString() + " to " + DestinationFile); try { - using (var s = client.GetStreamAsync(uri)) + using (HttpResponseMessage response = client.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead).Result) { - s.ConfigureAwait(false); + response.EnsureSuccessStatusCode(); - if (!Directory.Exists(DestinationDirectory)) - { - Directory.CreateDirectory(DestinationDirectory); - } - - using (var fs = new FileStream(DestinationFile, FileMode.OpenOrCreate)) + using (Stream contentStream = await response.Content.ReadAsStreamAsync(), fileStream = new FileStream(DestinationFile, FileMode.Create, FileAccess.Write, FileShare.None, 8192, true)) { - s.Result.CopyTo(fs); + var totalRead = 0L; + var totalReads = 0L; + var buffer = new byte[8192]; + var isMoreToRead = true; + + do + { + var read = await contentStream.ReadAsync(buffer, 0, buffer.Length); + if (read == 0) + { + isMoreToRead = false; + } + else + { + await fileStream.WriteAsync(buffer, 0, read); + + totalRead += read; + totalReads += 1; + + if (totalReads % 2000 == 0) + { + Console.WriteLine(string.Format("total bytes downloaded so far: {0:n0}", totalRead)); + } + } + } + while (isMoreToRead); } } - if (File.Exists(DestinationFile)) - { - FileInfo fi = new FileInfo(DestinationFile); - if (fi.Length > 0) - { - return true; - } - else - { - File.Delete(DestinationFile); - throw new Exception("Zero length file"); - } - } - else - { - throw new Exception("Zero length file"); - } + return true; } - catch (Exception ex) + catch (HttpRequestException ex) { - Logging.Log(Logging.LogType.Critical, "Communications", "Error while downloading from " + uri.ToString(), ex); + if (ex.StatusCode == HttpStatusCode.NotFound) + { + if (File.Exists(DestinationFile)) + { + FileInfo fi = new FileInfo(DestinationFile); + if (fi.Length == 0) + { + File.Delete(DestinationFile); + } + } + } - throw; + Logging.Log(Logging.LogType.Warning, "Download Images", "Error downloading file: ", ex); } return false; } - public static async Task GetSpecificImageFromServer(string ImagePath, string ImageId, IGDBAPI_ImageSize size, List? FallbackSizes = null) + public async Task GetSpecificImageFromServer(string ImagePath, string ImageId, IGDBAPI_ImageSize size, List? FallbackSizes = null) { + string returnPath = ""; + + if (RateLimitResumeTime > DateTime.UtcNow) + { + Logging.Log(Logging.LogType.Information, "API Connection", "IGDB rate limit hit. Pausing API communications until " + RateLimitResumeTime.ToString() + ". Attempt " + RetryAttempts + " of " + RetryAttemptsMax + " retries."); + Thread.Sleep(RateLimitRecoveryWaitTime); + } + + if (InRateLimitAvoidanceMode == true) + { + // sleep for a moment to help avoid hitting the rate limiter + Thread.Sleep(RateLimitAvoidanceWait); + } + Communications comms = new Communications(); List imageSizes = new List { size }; - string returnPath = ""; - FileInfo? fi; - // get the image try { returnPath = Path.Combine(ImagePath, size.ToString(), ImageId + ".jpg"); - if (!File.Exists(returnPath)) - { - await comms.IGDBAPI_GetImage(imageSizes, ImageId, ImagePath); - } - - if (File.Exists(returnPath)) - { - fi = new FileInfo(returnPath); - if (fi.Length == 0 || fi.LastWriteTimeUtc.AddDays(7) < DateTime.UtcNow) - { - File.Delete(returnPath); - await comms.IGDBAPI_GetImage(imageSizes, ImageId, ImagePath); - } - } + if (File.Exists(returnPath)) { File.Delete(returnPath); } + await comms.IGDBAPI_GetImage(imageSizes, ImageId, ImagePath); } catch (HttpRequestException ex) @@ -334,6 +361,9 @@ namespace gaseous_server.Classes.Metadata } } + // increment rate limiter avoidance call count + RateLimitAvoidanceCallCount += 1; + return returnPath; } @@ -351,8 +381,25 @@ namespace gaseous_server.Classes.Metadata string url = urlTemplate.Replace("{size}", Common.GetDescription(ImageSize)).Replace("{hash}", ImageId); string newOutputPath = Path.Combine(OutputPath, Common.GetDescription(ImageSize)); string OutputFile = ImageId + ".jpg"; + string fullPath = Path.Combine(newOutputPath, OutputFile); - await _DownloadFile(new Uri(url), Path.Combine(newOutputPath, OutputFile)); + bool AllowDownload = true; + + FileInfo fi; + if (File.Exists(fullPath)) + { + fi = new FileInfo(fullPath); + if (fi.LastWriteTimeUtc.AddDays(14) < DateTime.UtcNow) + { + File.Delete(fullPath); + AllowDownload = true; + } + } + + if (AllowDownload == true) + { + await _DownloadFile(new Uri(url), fullPath); + } } } diff --git a/gaseous-server/Classes/Metadata/CompanyLogos.cs b/gaseous-server/Classes/Metadata/CompanyLogos.cs index d200584..ac0f28d 100644 --- a/gaseous-server/Classes/Metadata/CompanyLogos.cs +++ b/gaseous-server/Classes/Metadata/CompanyLogos.cs @@ -97,7 +97,8 @@ namespace gaseous_server.Classes.Metadata { Logging.Log(Logging.LogType.Information, "Metadata: " + returnValue.GetType().Name, "Company logo download forced."); - GetImageFromServer(ImagePath, returnValue.ImageId); + Communications comms = new Communications(); + comms.GetSpecificImageFromServer(ImagePath, returnValue.ImageId, Communications.IGDBAPI_ImageSize.original, null); } return returnValue; @@ -118,15 +119,6 @@ namespace gaseous_server.Classes.Metadata return result; } - - private static async void GetImageFromServer(string ImagePath, string ImageId) - { - Communications comms = new Communications(); - List imageSizes = new List(); - imageSizes.AddRange(Enum.GetValues(typeof(Communications.IGDBAPI_ImageSize)).Cast()); - - await comms.IGDBAPI_GetImage(imageSizes, ImageId, ImagePath); - } } } diff --git a/gaseous-server/Classes/Metadata/Covers.cs b/gaseous-server/Classes/Metadata/Covers.cs index 16858c8..975e3f5 100644 --- a/gaseous-server/Classes/Metadata/Covers.cs +++ b/gaseous-server/Classes/Metadata/Covers.cs @@ -96,14 +96,19 @@ namespace gaseous_server.Classes.Metadata 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(); - imageSizes.AddRange(Enum.GetValues(typeof(Communications.IGDBAPI_ImageSize)).Cast()); + 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) { string localFile = Path.Combine(ImagePath, size.ToString(), returnValue.ImageId + ".jpg"); if ((!File.Exists(localFile)) || forceImageDownload == true) { - Communications.GetSpecificImageFromServer(ImagePath, returnValue.ImageId, size, null); + comms.GetSpecificImageFromServer(ImagePath, returnValue.ImageId, size, null); } } } @@ -126,15 +131,6 @@ namespace gaseous_server.Classes.Metadata return result; } - - public static async void GetImageFromServer(string ImagePath, string ImageId) - { - Communications comms = new Communications(); - List imageSizes = new List(); - imageSizes.AddRange(Enum.GetValues(typeof(Communications.IGDBAPI_ImageSize)).Cast()); - - await comms.IGDBAPI_GetImage(imageSizes, ImageId, ImagePath); - } } } diff --git a/gaseous-server/Classes/Metadata/PlatformLogos.cs b/gaseous-server/Classes/Metadata/PlatformLogos.cs index 4fc30fe..b9ae3d1 100644 --- a/gaseous-server/Classes/Metadata/PlatformLogos.cs +++ b/gaseous-server/Classes/Metadata/PlatformLogos.cs @@ -94,13 +94,14 @@ 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) - { - Logging.Log(Logging.LogType.Information, "Metadata: " + returnValue.GetType().Name, "Platform logo download forced."); + string localFile = Path.Combine(ImagePath, Communications.IGDBAPI_ImageSize.original.ToString(), returnValue.ImageId + ".jpg"); + if ((!File.Exists(localFile)) || forceImageDownload == true) + { + Logging.Log(Logging.LogType.Information, "Metadata: " + returnValue.GetType().Name, "Platform logo download forced."); - GetImageFromServer(ImagePath, returnValue.ImageId); - } + Communications comms = new Communications(); + comms.GetSpecificImageFromServer(ImagePath, returnValue.ImageId, Communications.IGDBAPI_ImageSize.original, null); + } } return returnValue; @@ -121,15 +122,6 @@ namespace gaseous_server.Classes.Metadata return result; } - - private static async void GetImageFromServer(string ImagePath, string ImageId) - { - Communications comms = new Communications(); - List imageSizes = new List(); - imageSizes.AddRange(Enum.GetValues(typeof(Communications.IGDBAPI_ImageSize)).Cast()); - - comms.IGDBAPI_GetImage(imageSizes, ImageId, ImagePath); - } } } diff --git a/gaseous-server/Classes/Metadata/Screenshots.cs b/gaseous-server/Classes/Metadata/Screenshots.cs index 9ece1ee..63cfa37 100644 --- a/gaseous-server/Classes/Metadata/Screenshots.cs +++ b/gaseous-server/Classes/Metadata/Screenshots.cs @@ -95,7 +95,8 @@ namespace gaseous_server.Classes.Metadata { Logging.Log(Logging.LogType.Information, "Metadata: " + returnValue.GetType().Name, "Screenshot download forced."); - GetImageFromServer(ImagePath, returnValue.ImageId); + Communications comms = new Communications(); + comms.GetSpecificImageFromServer(ImagePath, returnValue.ImageId, Communications.IGDBAPI_ImageSize.original, null); } return returnValue; @@ -116,16 +117,6 @@ namespace gaseous_server.Classes.Metadata return result; } - - private static async void GetImageFromServer(string ImagePath, string ImageId) - { - Communications comms = new Communications(); - List imageSizes = new List(); - imageSizes.Add(Communications.IGDBAPI_ImageSize.original); - imageSizes.Add(Communications.IGDBAPI_ImageSize.thumb); - - await comms.IGDBAPI_GetImage(imageSizes, ImageId, ImagePath); - } } } diff --git a/gaseous-server/Classes/MetadataManagement.cs b/gaseous-server/Classes/MetadataManagement.cs index 2865f33..281133f 100644 --- a/gaseous-server/Classes/MetadataManagement.cs +++ b/gaseous-server/Classes/MetadataManagement.cs @@ -13,7 +13,7 @@ namespace gaseous_server.Classes DataTable dt = new DataTable(); // disabling forceRefresh - forceRefresh = true; + forceRefresh = false; // update platforms sql = "SELECT Id, `Name` FROM Platform;"; diff --git a/gaseous-server/Controllers/V1.0/GamesController.cs b/gaseous-server/Controllers/V1.0/GamesController.cs index e825814..afe433d 100644 --- a/gaseous-server/Controllers/V1.0/GamesController.cs +++ b/gaseous-server/Controllers/V1.0/GamesController.cs @@ -537,8 +537,18 @@ namespace gaseous_server.Controllers 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", size.ToString(), artworkObject.ImageId + ".jpg"); + //string coverFilePath = Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject), "Artwork", size.ToString(), artworkObject.ImageId + ".jpg"); + + string basePath = Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject), "Artwork"); + + Communications comms = new Communications(); + Task ImgFetch = comms.GetSpecificImageFromServer(basePath, artworkObject.ImageId, size, new List{ Communications.IGDBAPI_ImageSize.original }); + + string coverFilePath = ImgFetch.Result; + + if (System.IO.File.Exists(coverFilePath)) { string filename = artworkObject.ImageId + ".jpg"; @@ -633,7 +643,8 @@ namespace gaseous_server.Controllers IGDB.Models.Cover cover = Classes.Metadata.Covers.GetCover(gameObject.Cover.Id, Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject), false); string basePath = Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject), "Covers"); - Task ImgFetch = Communications.GetSpecificImageFromServer(basePath, cover.ImageId, size, new List{ Communications.IGDBAPI_ImageSize.cover_big, Communications.IGDBAPI_ImageSize.original }); + Communications comms = new Communications(); + Task ImgFetch = comms.GetSpecificImageFromServer(basePath, cover.ImageId, size, new List{ Communications.IGDBAPI_ImageSize.cover_big, Communications.IGDBAPI_ImageSize.original }); string coverFilePath = ImgFetch.Result; @@ -1346,7 +1357,15 @@ namespace gaseous_server.Controllers IGDB.Models.Screenshot screenshotObject = Screenshots.GetScreenshot(ScreenshotId, Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject)); - string coverFilePath = Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject), "Screenshots", Size.ToString(), screenshotObject.ImageId + ".jpg"); + //string coverFilePath = Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject), "Screenshots", Size.ToString(), screenshotObject.ImageId + ".jpg"); + + string basePath = Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Game(gameObject), "Screenshots"); + + Communications comms = new Communications(); + Task ImgFetch = comms.GetSpecificImageFromServer(basePath, screenshotObject.ImageId, Size, new List{ Communications.IGDBAPI_ImageSize.original }); + + string coverFilePath = ImgFetch.Result; + if (System.IO.File.Exists(coverFilePath)) { string filename = screenshotObject.ImageId + ".jpg"; diff --git a/gaseous-server/wwwroot/pages/emulator.html b/gaseous-server/wwwroot/pages/emulator.html index 266bef8..fa3ca64 100644 --- a/gaseous-server/wwwroot/pages/emulator.html +++ b/gaseous-server/wwwroot/pages/emulator.html @@ -27,12 +27,12 @@ } else { if (result.cover) { var bg = document.getElementById('bgImage'); - bg.setAttribute('style', 'background-image: url("/api/v1.1/Games/' + gameId + '/cover/image"); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);'); + bg.setAttribute('style', 'background-image: url("/api/v1.1/Games/' + gameId + '/cover/image/original"); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);'); } } if (result.cover) { - emuBackground = '/api/v1.1/Games/' + gameId + '/cover/image'; + emuBackground = '/api/v1.1/Games/' + gameId + '/cover/image/original'; } emuGameTitle = gameData.name; @@ -59,7 +59,7 @@ artworksPosition = 0; } var bg = document.getElementById('bgImage'); - bg.setAttribute('style', 'background-image: url("/api/v1.1/Games/' + gameId + '/artwork/' + artworks[artworksPosition] + '/image"); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);'); + bg.setAttribute('style', 'background-image: url("/api/v1.1/Games/' + gameId + '/artwork/' + artworks[artworksPosition] + '/image/original"); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); -webkit-filter: blur(10px);'); } }