Added "isStatistic" property to MDDs.

If true, ignore scraper values for this value.
This keeps scraping from overwriting playcount and lastplaytime.
This commit is contained in:
Aloshi 2013-09-28 11:38:31 -05:00
parent cfd63c74db
commit 7bd34ec62a
4 changed files with 16 additions and 9 deletions

View file

@ -18,14 +18,14 @@ MetaDataList::MetaDataList(const std::vector<MetaDataDecl>& mdd)
std::vector<MetaDataDecl> 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<MetaDataDecl> mdd(decls, decls + sizeof(decls) / sizeof(decls[0]));

View file

@ -25,6 +25,7 @@ struct MetaDataDecl
std::string key;
MetaDataType type;
std::string defaultValue;
bool isStatistic;
};
class MetaDataList

View file

@ -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
};
}

View file

@ -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));
}