From 7bd34ec62a179bff95d1151a48298d887a3312e6 Mon Sep 17 00:00:00 2001 From: Aloshi Date: Sat, 28 Sep 2013 11:38:31 -0500 Subject: [PATCH] Added "isStatistic" property to MDDs. If true, ignore scraper values for this value. This keeps scraping from overwriting playcount and lastplaytime. --- src/MetaData.cpp | 16 ++++++++-------- src/MetaData.h | 1 + src/PlatformId.h | 4 +++- src/components/GuiMetaDataEd.cpp | 4 ++++ 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/MetaData.cpp b/src/MetaData.cpp index c966364e8..2aaadd284 100644 --- a/src/MetaData.cpp +++ b/src/MetaData.cpp @@ -18,14 +18,14 @@ MetaDataList::MetaDataList(const std::vector& mdd) std::vector MetaDataList::getDefaultGameMDD() { MetaDataDecl decls[] = { - {"name", MD_STRING, ""}, - {"desc", MD_MULTILINE_STRING, ""}, - {"image", MD_IMAGE_PATH, ""}, - {"thumbnail", MD_IMAGE_PATH, ""}, - {"rating", MD_RATING, "0"}, - {"releasedate", MD_TIME, "0"}, - {"playcount", MD_INT, "0"}, - {"lastplayed", MD_TIME, "0"} + {"name", MD_STRING, "", false}, + {"desc", MD_MULTILINE_STRING, "", false}, + {"image", MD_IMAGE_PATH, "", false}, + {"thumbnail", MD_IMAGE_PATH, "", false}, + {"rating", MD_RATING, "0", false}, + {"releasedate", MD_TIME, "0", false}, + {"playcount", MD_INT, "0", true}, + {"lastplayed", MD_TIME, "0", true} }; std::vector mdd(decls, decls + sizeof(decls) / sizeof(decls[0])); diff --git a/src/MetaData.h b/src/MetaData.h index 38e5393f9..13e8c98d7 100644 --- a/src/MetaData.h +++ b/src/MetaData.h @@ -25,6 +25,7 @@ struct MetaDataDecl std::string key; MetaDataType type; std::string defaultValue; + bool isStatistic; }; class MetaDataList diff --git a/src/PlatformId.h b/src/PlatformId.h index bfdc37b12..40483dbb3 100644 --- a/src/PlatformId.h +++ b/src/PlatformId.h @@ -5,7 +5,8 @@ namespace PlatformIds enum PlatformId : unsigned int { PLATFORM_UNKNOWN = 0, - THREEDO = 1, //can't start with a constant + + THREEDO = 1, //name can't start with a constant AMIGA = 2, ARCADE = 3, ATARI_2600 = 4, @@ -48,6 +49,7 @@ namespace PlatformIds PLAYSTATION_PORTABLE = 41, SUPER_NINTENDO = 42, TURBOGRAFX_16 = 43, + PLATFORM_COUNT = 44 }; } diff --git a/src/components/GuiMetaDataEd.cpp b/src/components/GuiMetaDataEd.cpp index 9b7226768..bac78d6e9 100644 --- a/src/components/GuiMetaDataEd.cpp +++ b/src/components/GuiMetaDataEd.cpp @@ -127,6 +127,10 @@ void GuiMetaDataEd::fetchDone(MetaDataList result) { for(unsigned int i = 0; i < mEditors.size(); i++) { + //don't overwrite statistics + if(mMetaDataDecl.at(i).isStatistic) + continue; + const std::string key = mMetaDataDecl.at(i).key; mEditors.at(i)->setValue(result.get(key)); }