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

@ -83,15 +83,8 @@ int main(int argc, char** argv){
DTSC::File source = DTSC::File(conf.getString("filename"));
in_out.SendNow(source.getMeta().toNetPacked());
if ( !(source.getMeta().isMember("keytime") && source.getMeta().isMember("keybpos") && source.getMeta().isMember("keynum") && source.getMeta().isMember("keylen") && source.getMeta().isMember("frags"))
&& source.getMeta().isMember("video")){
//file needs to be DTSCFix'ed! Run MistDTSCFix executable on it first
std::cerr << "Calculating / writing / updating VoD metadata..." << std::endl;
Util::Procs::Start("Fixer", Util::getMyPath() + "MistDTSCFix " + conf.getString("filename"));
while (Util::Procs::isActive("Fixer")){
Util::sleep(5000);
}
std::cerr << "Done! Aborting this request to make sure all goes well." << std::endl;
if (DTSC::isFixed(source.getMeta())){
std::cerr << "Encountered a non-fixed file." << std::endl;
return 1;
}

View file

@ -2,6 +2,7 @@
#include <mist/config.h>
#include <mist/timing.h>
#include <mist/stream.h>
#include <mist/dtsc.h>
#include "controller_streams.h"
#include "controller_storage.h"
#include <sys/stat.h>
@ -67,6 +68,11 @@ namespace Controller {
tmp_cmd[1] = (char*)URL.c_str();
data["meta"] = JSON::fromString(Util::Procs::getOutputOf(tmp_cmd));
}
if ( !DTSC::isFixed(data["meta"])){
char * tmp_cmd[3] = {0, 0, 0};
std::string mistfix = Util::getMyPath() + "MistDTSCFix " + URL;
Util::Procs::Start("MistFixer", mistfix);
}
if (Util::epoch() - lastBuffer[name] > 5){
data["error"] = "Available";
data["online"] = 2;

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){