Fixed an issue where entries were unnecessarily saved to the gamelist.xml files during multi-scraping.

Also changed the gamelist write logging from Info to Debug and removed the superfluous saving timer.
This commit is contained in:
Leon Styhre 2020-10-18 12:42:37 +02:00
parent 82759fb2ce
commit 66bab7386b
2 changed files with 4 additions and 10 deletions

View file

@ -784,7 +784,7 @@ Can be set to Disabled, Default, Enhanced or Instant. Set to Disabled by default
**When to save metadata**
The metadata for a game is updated both by scraping and modifying data in the metadata editor, but also when launching a game, as the play count and last played date is then updated. This settings enabled you to define when to write such metadata changes to the gamelist.xml files. Setting the option to "Never" will disable writing to these files altogether, except for some special conditions such as when a game is manually deleted using the metadata editor. In theory "On exit" will give some performance gains, but it's normally recommended to leave the setting at its default value which is "Always".
The metadata for a game is updated both by scraping and modifying data in the metadata editor, but also when launching a game, as the play count and last played date is then updated. This setting enables you to define when to write such metadata changes to the gamelist.xml files. Setting the option to "Never" will disable writing to these files altogether, except for some special conditions such as when a game is manually deleted using the metadata editor, or when scraping using the multi-scraper (the multi-scraper will always save any updates immediately to the gamelist.xml files). In theory "On exit" will give some performance gains, but it's normally recommended to leave the setting at its default value which is "Always". Note that with the settings set to "Never", any updates such as the last played date will still be shown on screen, however during the next application startup, any values previously saved to the gamelist.xml files will be read in again.
**Game media directory**

View file

@ -275,20 +275,19 @@ void updateGamelist(SystemData* system)
// Add the game to the file, unless it's flagged for deletion.
if (!(*fit)->getDeletionFlag()) {
addFileDataNode(root, *fit, tag, system);
(*fit)->metadata.resetChangedFlag();
++numUpdated;
}
}
// Now write the file.
if (numUpdated > 0) {
const auto startTs = std::chrono::system_clock::now();
// Make sure the folders leading up to this path exist (or the write will fail).
std::string xmlWritePath(system->getGamelistPath(true));
Utils::FileSystem::createDirectory(Utils::FileSystem::getParent(xmlWritePath));
LOG(LogInfo) << "Added/Updated " << numUpdated <<
" entities in '" << xmlReadPath << "'";
LOG(LogDebug) << "Gamelist::updateGamelist(): Added/updated " << numUpdated <<
(numUpdated == 1 ? " entity in '" : " entities in '") << xmlReadPath << "'";
#if defined(_WIN64)
if (!doc.save_file(Utils::String::stringToWideString(xmlWritePath).c_str())) {
@ -298,11 +297,6 @@ void updateGamelist(SystemData* system)
LOG(LogError) << "Error saving gamelist.xml to \"" <<
xmlWritePath << "\" (for system " << system->getName() << ")!";
}
const auto endTs = std::chrono::system_clock::now();
LOG(LogInfo) << "Saved gamelist.xml for system \"" << system->getName() << "\" in " <<
std::chrono::duration_cast<std::chrono::milliseconds>
(endTs - startTs).count() << " ms";
}
}
else {