WIP
This commit is contained in:
@@ -2,7 +2,7 @@ using System.Collections.Concurrent;
|
||||
using System.IO.Compression;
|
||||
using System.Net;
|
||||
using gaseous_server.Classes.Metadata;
|
||||
using HasheousClient.Models;
|
||||
using gaseous_server.Models;
|
||||
using HasheousClient.Models.Metadata.IGDB;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using NuGet.Common;
|
||||
@@ -199,7 +199,7 @@ namespace gaseous_server.Classes
|
||||
else
|
||||
{
|
||||
determinedPlatform = Metadata.Platforms.GetPlatform((long)library.DefaultPlatformId);
|
||||
discoveredSignature.MetadataSources.AddPlatform((long)determinedPlatform.Id, determinedPlatform.Name, MetadataSources.None);
|
||||
discoveredSignature.MetadataSources.AddPlatform((long)determinedPlatform.Id, determinedPlatform.Name, HasheousClient.Models.MetadataSources.None);
|
||||
}
|
||||
|
||||
return discoveredSignature;
|
||||
@@ -308,10 +308,10 @@ namespace gaseous_server.Classes
|
||||
{
|
||||
HasheousClient.Hasheous hasheous = new HasheousClient.Hasheous();
|
||||
Console.WriteLine(HasheousClient.WebApp.HttpHelper.BaseUri);
|
||||
LookupItemModel? HasheousResult = null;
|
||||
HasheousClient.Models.LookupItemModel? HasheousResult = null;
|
||||
try
|
||||
{
|
||||
HasheousResult = hasheous.RetrieveFromHasheous(new HashLookupModel
|
||||
HasheousResult = hasheous.RetrieveFromHasheous(new HasheousClient.Models.HashLookupModel
|
||||
{
|
||||
MD5 = hash.md5hash,
|
||||
SHA1 = hash.sha1hash
|
||||
@@ -334,10 +334,14 @@ namespace gaseous_server.Classes
|
||||
{
|
||||
foreach (HasheousClient.Models.MetadataItem metadataResult in HasheousResult.Platform.metadata)
|
||||
{
|
||||
if (metadataResult.Id.Length > 0)
|
||||
// only IGDB metadata is supported
|
||||
if (metadataResult.Source == HasheousClient.Models.MetadataSources.IGDB)
|
||||
{
|
||||
Platform hasheousPlatform = Platforms.GetPlatform(metadataResult.Id);
|
||||
signature.MetadataSources.AddPlatform((long)hasheousPlatform.Id, hasheousPlatform.Name, metadataResult.Source);
|
||||
if (metadataResult.Id.Length > 0)
|
||||
{
|
||||
Platform hasheousPlatform = Platforms.GetPlatform(metadataResult.Id);
|
||||
signature.MetadataSources.AddPlatform((long)hasheousPlatform.Id, hasheousPlatform.Name, metadataResult.Source);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -350,10 +354,14 @@ namespace gaseous_server.Classes
|
||||
{
|
||||
foreach (HasheousClient.Models.MetadataItem metadataResult in HasheousResult.Metadata)
|
||||
{
|
||||
if (metadataResult.Id.Length > 0)
|
||||
// only IGDB metadata is supported
|
||||
if (metadataResult.Source == HasheousClient.Models.MetadataSources.IGDB)
|
||||
{
|
||||
Game hasheousGame = Games.GetGame(MetadataSources.IGDB, metadataResult.Id);
|
||||
signature.MetadataSources.AddGame((long)hasheousGame.Id, hasheousGame.Name, metadataResult.Source);
|
||||
if (metadataResult.Id.Length > 0)
|
||||
{
|
||||
gaseous_server.Models.Game hasheousGame = Games.GetGame(HasheousClient.Models.MetadataSources.IGDB, metadataResult.Id);
|
||||
signature.MetadataSources.AddGame((long)hasheousGame.Id, hasheousGame.Name, metadataResult.Source);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,8 @@ namespace gaseous_server.Classes
|
||||
{
|
||||
public class MetadataManagement : QueueItemStatus
|
||||
{
|
||||
private static bool Processing = false;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new metadata map, if one with the same platformId and name does not already exist.
|
||||
/// </summary>
|
||||
@@ -23,6 +25,16 @@ namespace gaseous_server.Classes
|
||||
/// </returns>
|
||||
public static MetadataMap? NewMetadataMap(long platformId, string name)
|
||||
{
|
||||
if (Processing == true)
|
||||
{
|
||||
// loop until processing = false
|
||||
while (Processing == true)
|
||||
{
|
||||
System.Threading.Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
Processing = true;
|
||||
|
||||
Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
|
||||
string sql = "";
|
||||
Dictionary<string, object> dbDict = new Dictionary<string, object>()
|
||||
@@ -36,6 +48,7 @@ namespace gaseous_server.Classes
|
||||
MetadataMap? existingMetadataMap = GetMetadataMap(platformId, name);
|
||||
if (existingMetadataMap != null)
|
||||
{
|
||||
Processing = false;
|
||||
return existingMetadataMap;
|
||||
}
|
||||
|
||||
@@ -62,7 +75,9 @@ namespace gaseous_server.Classes
|
||||
AddMetadataMapItem(metadataMapId, HasheousClient.Models.MetadataSources.None, gameId, true);
|
||||
|
||||
// return the new metadata map
|
||||
return GetMetadataMap(metadataMapId);
|
||||
MetadataMap RetVal = GetMetadataMap(metadataMapId);
|
||||
Processing = false;
|
||||
return RetVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -129,7 +144,7 @@ namespace gaseous_server.Classes
|
||||
Dictionary<string, object> dbDict = new Dictionary<string, object>()
|
||||
{
|
||||
{ "@platformId", platformId },
|
||||
{ "@name", name }
|
||||
{ "@name", name.Trim() }
|
||||
};
|
||||
DataTable dt = new DataTable();
|
||||
|
||||
|
@@ -550,7 +550,7 @@ FROM
|
||||
LEFT JOIN
|
||||
Relation_Game_Themes ON Game.Id = Relation_Game_Themes.GameId
|
||||
LEFT JOIN
|
||||
Favourites ON Game.Id = Favourites.GameId AND Favourites.UserId = @userid " + whereClause + " " + havingClause + " " + orderByClause;
|
||||
Favourites ON Game.MetadataMapId = Favourites.GameId AND Favourites.UserId = @userid " + whereClause + " " + havingClause + " " + orderByClause;
|
||||
List<Games.MinimalGameItem> RetVal = new List<Games.MinimalGameItem>();
|
||||
|
||||
DataTable dbResponse = db.ExecuteCMD(sql, whereParams, new Database.DatabaseMemoryCacheOptions(CacheEnabled: true, ExpirationSeconds: 60));
|
||||
|
@@ -20,7 +20,7 @@
|
||||
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
|
||||
<PackageReference Include="gaseous-signature-parser" Version="2.3.0" />
|
||||
<PackageReference Include="gaseous.IGDB" Version="1.0.2" />
|
||||
<PackageReference Include="hasheous-client" Version="1.2.0" />
|
||||
<PackageReference Include="hasheous-client" Version="1.2.1" />
|
||||
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="13.8.0" />
|
||||
<PackageReference Include="sharpcompress" Version="0.37.2" />
|
||||
<PackageReference Include="Squid-Box.SevenZipSharp" Version="1.6.2.24" />
|
||||
|
@@ -405,8 +405,6 @@ function renderGameIcon(gameObject, showTitle, showRatings, showClassification,
|
||||
showFavourite = true;
|
||||
}
|
||||
|
||||
console.log(gameObject);
|
||||
|
||||
let classes = getViewModeClasses(listView);
|
||||
|
||||
let gameBox = document.createElement('div');
|
||||
@@ -532,7 +530,7 @@ function renderGameIcon(gameObject, showTitle, showRatings, showClassification,
|
||||
gameObject.isFavourite = true;
|
||||
}
|
||||
|
||||
fetch('/api/v1.1/Games/' + gameObject.metaDataMapId + '/favourite?favourite=' + gameObject.isFavourite, {
|
||||
fetch('/api/v1.1/Games/' + gameObject.metadataMapId + '/favourite?favourite=' + gameObject.isFavourite, {
|
||||
method: 'POST'
|
||||
}).then(response => {
|
||||
if (response.ok) {
|
||||
|
@@ -124,11 +124,11 @@ class UploadRom {
|
||||
uploadedItem.romId = response.romid;
|
||||
|
||||
if (response.game) {
|
||||
uploadedItem.gameId = response.game.id;
|
||||
uploadedItem.gameId = response.game.metadataMapId;
|
||||
uploadedItem.gameName = response.game.name;
|
||||
if (response.game.cover != null) {
|
||||
if (response.game.cover.id != null) {
|
||||
uploadedItem.coverId = response.game.cover.id;
|
||||
if (response.game.cover != null) {
|
||||
uploadedItem.coverId = response.game.cover;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user