Merge pull request #109 from pjft/RetroPie-master-videofolders

Adding metadata to folders
This commit is contained in:
Jools Wills 2017-04-24 23:30:09 +01:00 committed by GitHub
commit 9864c4c44c
5 changed files with 43 additions and 37 deletions

View file

@ -83,28 +83,12 @@ const std::string& FileData::getThumbnailPath() const
const std::string& FileData::getVideoPath() const const std::string& FileData::getVideoPath() const
{ {
if (mType == GAME) return metadata.get("video");
{
return metadata.get("video");
}
else
{
static std::string empty;
return empty;
}
} }
const std::string& FileData::getMarqueePath() const const std::string& FileData::getMarqueePath() const
{ {
if (mType == GAME) return metadata.get("marquee");
{
return metadata.get("marquee");
}
else
{
static std::string empty;
return empty;
}
} }

View file

@ -25,10 +25,18 @@ MetaDataDecl gameDecls[] = {
const std::vector<MetaDataDecl> gameMDD(gameDecls, gameDecls + sizeof(gameDecls) / sizeof(gameDecls[0])); const std::vector<MetaDataDecl> gameMDD(gameDecls, gameDecls + sizeof(gameDecls) / sizeof(gameDecls[0]));
MetaDataDecl folderDecls[] = { MetaDataDecl folderDecls[] = {
{"name", MD_STRING, "", false}, {"name", MD_STRING, "", false, "name", "enter game name"},
{"desc", MD_MULTILINE_STRING, "", false}, {"desc", MD_MULTILINE_STRING, "", false, "description", "enter description"},
{"image", MD_PATH, "", false}, {"image", MD_PATH, "", false, "image", "enter path to image"},
{"thumbnail", MD_PATH, "", false}, {"thumbnail", MD_PATH, "", false, "thumbnail", "enter path to thumbnail"},
{"video", MD_PATH, "", false, "video", "enter path to video"},
{"marquee", MD_PATH, "", false, "marquee", "enter path to marquee"},
{"rating", MD_RATING, "0.000000", false, "rating", "enter rating"},
{"releasedate", MD_DATE, "not-a-date-time", false, "release date", "enter release date"},
{"developer", MD_STRING, "unknown", false, "developer", "enter game developer"},
{"publisher", MD_STRING, "unknown", false, "publisher", "enter game publisher"},
{"genre", MD_STRING, "unknown", false, "genre", "enter game genre"},
{"players", MD_INT, "1", false, "players", "enter number of players"}
}; };
const std::vector<MetaDataDecl> folderMDD(folderDecls, folderDecls + sizeof(folderDecls) / sizeof(folderDecls[0])); const std::vector<MetaDataDecl> folderMDD(folderDecls, folderDecls + sizeof(folderDecls) / sizeof(folderDecls[0]));

View file

@ -74,10 +74,22 @@ void GuiGamelistOptions::openMetaDataEd()
ScraperSearchParams p; ScraperSearchParams p;
p.game = file; p.game = file;
p.system = file->getSystem(); p.system = file->getSystem();
mWindow->pushGui(new GuiMetaDataEd(mWindow, &file->metadata, file->metadata.getMDD(), p, file->getPath().filename().string(),
std::bind(&IGameListView::onFileChanged, getGamelist(), file, FILE_METADATA_CHANGED), [this, file] { std::function<void()> deleteBtnFunc;
if (file->getType() == FOLDER)
{
deleteBtnFunc = NULL;
}
else
{
deleteBtnFunc = [this, file] {
getGamelist()->remove(file); getGamelist()->remove(file);
})); };
}
mWindow->pushGui(new GuiMetaDataEd(mWindow, &file->metadata, file->metadata.getMDD(), p, file->getPath().filename().string(),
std::bind(&IGameListView::onFileChanged, getGamelist(), file, FILE_METADATA_CHANGED), deleteBtnFunc));
} }
void GuiGamelistOptions::jumpToLetter() void GuiGamelistOptions::jumpToLetter()

View file

@ -192,14 +192,15 @@ void DetailedGameListView::updateInfoPanel()
mDescription.setText(file->metadata.get("desc")); mDescription.setText(file->metadata.get("desc"));
mDescContainer.reset(); mDescContainer.reset();
mRating.setValue(file->metadata.get("rating"));
mReleaseDate.setValue(file->metadata.get("releasedate"));
mDeveloper.setValue(file->metadata.get("developer"));
mPublisher.setValue(file->metadata.get("publisher"));
mGenre.setValue(file->metadata.get("genre"));
mPlayers.setValue(file->metadata.get("players"));
if(file->getType() == GAME) if(file->getType() == GAME)
{ {
mRating.setValue(file->metadata.get("rating"));
mReleaseDate.setValue(file->metadata.get("releasedate"));
mDeveloper.setValue(file->metadata.get("developer"));
mPublisher.setValue(file->metadata.get("publisher"));
mGenre.setValue(file->metadata.get("genre"));
mPlayers.setValue(file->metadata.get("players"));
mLastPlayed.setValue(file->metadata.get("lastplayed")); mLastPlayed.setValue(file->metadata.get("lastplayed"));
mPlayCount.setValue(file->metadata.get("playcount")); mPlayCount.setValue(file->metadata.get("playcount"));
} }

View file

@ -258,14 +258,15 @@ void VideoGameListView::updateInfoPanel()
mDescription.setText(file->metadata.get("desc")); mDescription.setText(file->metadata.get("desc"));
mDescContainer.reset(); mDescContainer.reset();
mRating.setValue(file->metadata.get("rating"));
mReleaseDate.setValue(file->metadata.get("releasedate"));
mDeveloper.setValue(file->metadata.get("developer"));
mPublisher.setValue(file->metadata.get("publisher"));
mGenre.setValue(file->metadata.get("genre"));
mPlayers.setValue(file->metadata.get("players"));
if(file->getType() == GAME) if(file->getType() == GAME)
{ {
mRating.setValue(file->metadata.get("rating"));
mReleaseDate.setValue(file->metadata.get("releasedate"));
mDeveloper.setValue(file->metadata.get("developer"));
mPublisher.setValue(file->metadata.get("publisher"));
mGenre.setValue(file->metadata.get("genre"));
mPlayers.setValue(file->metadata.get("players"));
mLastPlayed.setValue(file->metadata.get("lastplayed")); mLastPlayed.setValue(file->metadata.get("lastplayed"));
mPlayCount.setValue(file->metadata.get("playcount")); mPlayCount.setValue(file->metadata.get("playcount"));
} }