Added automated fixing on the correct places.

This commit is contained in:
Erik Zandvliet 2013-10-10 09:10:06 +02:00 committed by Thulinma
parent 1b9e594a8f
commit 41142e681c
4 changed files with 20 additions and 22 deletions

View file

@ -36,19 +36,9 @@ namespace Converters {
std::cerr << "This file is too old to fix - please reconvert." << std::endl;
return 1;
}
if (oriheader["moreheader"].asInt() > 0 && !conf.getBool("force")){
if (meta.isMember("tracks") && meta["tracks"].size() > 0){
bool isFixed = true;
for ( JSON::ObjIter trackIt = meta["tracks"].ObjBegin(); trackIt != meta["tracks"].ObjEnd(); trackIt ++) {
if ( !trackIt->second.isMember("frags") || !trackIt->second.isMember("keynum")){
isFixed = false;
}
}
if (isFixed){
std::cerr << "This file was already fixed or doesn't need fixing - cancelling." << std::endl;
return 0;
}
}
if (DTSC::isFixed(meta) && !conf.getBool("force")){
std::cerr << "This file was already fixed or doesn't need fixing - cancelling." << std::endl;
return 0;
}
meta.removeMember("isFixed");
meta.removeMember("keytime");

View file

@ -56,6 +56,11 @@ namespace Converters {
if (tmpFileName == outFileName){
fullSort = false;
}else{
DTSC::File F(tmpFileName);
if (!DTSC::isFixed(F.getMeta())){
std::cerr << tmpFileName << " has not been run through DTSCFix yet." << std::endl;
return 1;
}
inFiles.insert(std::pair<std::string,DTSC::File>(tmpFileName,DTSC::File(tmpFileName)));
}
}
@ -64,6 +69,10 @@ namespace Converters {
outFile = DTSC::File(outFileName, true);
}else{
outFile = DTSC::File(outFileName);
if (!DTSC::isFixed(outFile.getMeta())){
std::cerr << outFileName << " has not been run through DTSCFix yet." << std::endl;
return 1;
}
meta = outFile.getMeta();
newMeta = meta;
if (meta.isMember("tracks") && meta["tracks"].size() > 0){