WIP
This commit is contained in:
@@ -246,6 +246,19 @@ namespace gaseous_server.Classes
|
||||
}
|
||||
}
|
||||
|
||||
// get all tables that have the prefix "Relation_" and drop them
|
||||
sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = @dbname AND table_name LIKE 'Relation_%';";
|
||||
dbDict = new Dictionary<string, object>
|
||||
{
|
||||
{ "dbname", Config.DatabaseConfiguration.DatabaseName }
|
||||
};
|
||||
data = db.ExecuteCMD(sql, dbDict);
|
||||
foreach (DataRow row in data.Rows)
|
||||
{
|
||||
sql = "DROP TABLE " + (string)row["table_name"] + ";";
|
||||
db.ExecuteNonQuery(sql);
|
||||
}
|
||||
|
||||
// migrating metadata is a safe background task
|
||||
BackgroundUpgradeTargetSchemaVersions.Add(1024);
|
||||
break;
|
||||
|
@@ -163,12 +163,14 @@ namespace gaseous_server.Classes
|
||||
Platform? determinedPlatform = Metadata.Platforms.GetPlatform((long)discoveredSignature.Flags.PlatformId);
|
||||
Models.Game? determinedGame = Metadata.Games.GetGame(discoveredSignature.Flags.GameMetadataSource, discoveredSignature.Flags.GameId);
|
||||
long RomId = StoreGame(GameLibrary.GetDefaultLibrary, Hash, discoveredSignature, determinedPlatform, FilePath, 0, true);
|
||||
Roms.GameRomItem romItem = Roms.GetRom(RomId);
|
||||
|
||||
// build return value
|
||||
GameFileInfo.Add("romid", RomId);
|
||||
GameFileInfo.Add("platform", determinedPlatform);
|
||||
GameFileInfo.Add("game", determinedGame);
|
||||
GameFileInfo.Add("signature", discoveredSignature);
|
||||
GameFileInfo.Add("rom", romItem);
|
||||
GameFileInfo.Add("status", "imported");
|
||||
}
|
||||
}
|
||||
@@ -248,7 +250,7 @@ namespace gaseous_server.Classes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// reload the map
|
||||
map = MetadataManagement.GetMetadataMap((long)map.Id);
|
||||
|
||||
@@ -479,8 +481,9 @@ namespace gaseous_server.Classes
|
||||
Classes.Roms.GameRomItem rom = Classes.Roms.GetRom(RomId);
|
||||
|
||||
// get metadata
|
||||
MetadataMap.MetadataMapItem metadataMap = Classes.MetadataManagement.GetMetadataMap(rom.MetadataMapId).PreferredMetadataMapItem;
|
||||
Platform? platform = gaseous_server.Classes.Metadata.Platforms.GetPlatform(rom.PlatformId);
|
||||
gaseous_server.Models.Game? game = gaseous_server.Classes.Metadata.Games.GetGame(Config.MetadataConfiguration.DefaultMetadataSource, rom.GameId);
|
||||
gaseous_server.Models.Game? game = Classes.Metadata.Games.GetGame(metadataMap.SourceType, metadataMap.SourceId);
|
||||
|
||||
// build path
|
||||
string platformSlug = "Unknown Platform";
|
||||
|
@@ -27,7 +27,7 @@ namespace gaseous_server.Classes.Metadata
|
||||
{
|
||||
Id = 0,
|
||||
Name = "Unknown Platform",
|
||||
Slug = "Unknown"
|
||||
Slug = "unknown"
|
||||
};
|
||||
Storage.NewCacheValue(Source, returnValue);
|
||||
|
||||
|
@@ -107,7 +107,10 @@ namespace gaseous_server.Models
|
||||
Storage.NewCacheValue(HasheousClient.Models.MetadataSources.None, platform);
|
||||
}
|
||||
|
||||
Communications.PopulateHasheousPlatformData(mapItem.IGDBId);
|
||||
if (Config.MetadataConfiguration.SignatureSource == HasheousClient.Models.MetadataModel.SignatureSources.Hasheous)
|
||||
{
|
||||
Communications.PopulateHasheousPlatformData(mapItem.IGDBId);
|
||||
}
|
||||
|
||||
if (Storage.GetCacheStatus(HasheousClient.Models.MetadataSources.IGDB, "Platform", mapItem.IGDBId) == Storage.CacheStatus.NotPresent)
|
||||
{
|
||||
@@ -318,15 +321,15 @@ namespace gaseous_server.Models
|
||||
|
||||
// get platform data
|
||||
Platform? platform = null;
|
||||
// if (Storage.GetCacheStatus(HasheousClient.Models.MetadataSources.None, "Platform", IGDBId) == Storage.CacheStatus.NotPresent)
|
||||
// {
|
||||
// //platform = Platforms.GetPlatform(IGDBId, false);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// platform = (Platform)Storage.GetCacheValue<Platform>(HasheousClient.Models.MetadataSources.None, new Platform(), "id", IGDBId);
|
||||
// }
|
||||
platform = Platforms.GetPlatform(IGDBId, HasheousClient.Models.MetadataSources.None);
|
||||
if (Storage.GetCacheStatus(HasheousClient.Models.MetadataSources.None, "Platform", IGDBId) == Storage.CacheStatus.NotPresent)
|
||||
{
|
||||
//platform = Platforms.GetPlatform(IGDBId, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// platform = (Platform)Storage.GetCacheValue<Platform>(HasheousClient.Models.MetadataSources.None, new Platform(), "id", IGDBId);
|
||||
platform = Platforms.GetPlatform(IGDBId, HasheousClient.Models.MetadataSources.None);
|
||||
}
|
||||
|
||||
if (platform != null)
|
||||
{
|
||||
|
@@ -11,6 +11,7 @@ using Authentication;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using gaseous_server.Classes.Metadata;
|
||||
using Asp.Versioning;
|
||||
using HasheousClient.Models.Metadata.IGDB;
|
||||
|
||||
Logging.WriteToDiskOnly = true;
|
||||
Logging.Log(Logging.LogType.Information, "Startup", "Starting Gaseous Server " + Assembly.GetExecutingAssembly().GetName().Version);
|
||||
@@ -329,6 +330,11 @@ app.Use(async (context, next) =>
|
||||
// setup library directories
|
||||
Config.LibraryConfiguration.InitLibrary();
|
||||
|
||||
// create unknown platform
|
||||
Platforms.GetPlatform(0, HasheousClient.Models.MetadataSources.None);
|
||||
Platforms.GetPlatform(0, HasheousClient.Models.MetadataSources.IGDB);
|
||||
Platforms.GetPlatform(0, HasheousClient.Models.MetadataSources.TheGamesDb);
|
||||
|
||||
// extract platform map if not present
|
||||
PlatformMapping.ExtractPlatformMap();
|
||||
|
||||
|
@@ -413,4 +413,4 @@ FROM (
|
||||
`Game`.`SourceId` = `view_MetadataMap`.`MetadataSourceType`
|
||||
AND `Game`.`Id` = `view_MetadataMap`.`MetadataSourceId`
|
||||
)
|
||||
);
|
||||
);
|
||||
|
@@ -109,6 +109,7 @@ class UploadRom {
|
||||
if (xhr.status === 200) {
|
||||
// process the results
|
||||
let response = JSON.parse(xhr.responseText);
|
||||
console.log(response);
|
||||
switch (response.type) {
|
||||
case 'rom':
|
||||
switch (response.status) {
|
||||
@@ -121,16 +122,21 @@ class UploadRom {
|
||||
uploadedItem.platformName = 'Unknown Platform';
|
||||
uploadedItem.gameId = 0;
|
||||
uploadedItem.gameName = 'Unknown Game';
|
||||
uploadedItem.gameData = response.game;
|
||||
uploadedItem.romId = response.romid;
|
||||
|
||||
if (response.game) {
|
||||
uploadedItem.gameId = response.game.metadataMapId;
|
||||
// game data was returned
|
||||
uploadedItem.gameId = response.rom.metadataMapId;
|
||||
uploadedItem.gameName = response.game.name;
|
||||
if (response.game.cover != null) {
|
||||
if (response.game.cover != null) {
|
||||
uploadedItem.coverId = response.game.cover;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// game has been deemed to be unknown
|
||||
uploadedItem.gameId = response.rom.metadataMapId;
|
||||
}
|
||||
|
||||
if (response.platform) {
|
||||
@@ -273,6 +279,7 @@ class UploadItem {
|
||||
platformName = null;
|
||||
gameId = null;
|
||||
gameName = null;
|
||||
gameData = null;
|
||||
coverId = null;
|
||||
romId = null;
|
||||
|
||||
@@ -319,7 +326,7 @@ class UploadItem {
|
||||
case 'rom':
|
||||
this.infoButton.style.display = 'block';
|
||||
|
||||
if (this.gameId === null || this.gameId === 0) {
|
||||
if (this.gameId === null || this.gameId === 0 || this.gameData === null) {
|
||||
this.coverArt.src = '/images/unknowngame.png';
|
||||
} else {
|
||||
this.coverArt.src = '/api/v1.1/Games/' + this.gameId + '/cover/' + this.coverId + '/image/cover_big/cover.jpg';
|
||||
|
Reference in New Issue
Block a user