Added automated fixing on the correct places.
This commit is contained in:
parent
1b9e594a8f
commit
41142e681c
4 changed files with 20 additions and 22 deletions
|
@ -83,15 +83,8 @@ int main(int argc, char** argv){
|
||||||
DTSC::File source = DTSC::File(conf.getString("filename"));
|
DTSC::File source = DTSC::File(conf.getString("filename"));
|
||||||
in_out.SendNow(source.getMeta().toNetPacked());
|
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"))
|
if (DTSC::isFixed(source.getMeta())){
|
||||||
&& source.getMeta().isMember("video")){
|
std::cerr << "Encountered a non-fixed file." << std::endl;
|
||||||
//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;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <mist/config.h>
|
#include <mist/config.h>
|
||||||
#include <mist/timing.h>
|
#include <mist/timing.h>
|
||||||
#include <mist/stream.h>
|
#include <mist/stream.h>
|
||||||
|
#include <mist/dtsc.h>
|
||||||
#include "controller_streams.h"
|
#include "controller_streams.h"
|
||||||
#include "controller_storage.h"
|
#include "controller_storage.h"
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -67,6 +68,11 @@ namespace Controller {
|
||||||
tmp_cmd[1] = (char*)URL.c_str();
|
tmp_cmd[1] = (char*)URL.c_str();
|
||||||
data["meta"] = JSON::fromString(Util::Procs::getOutputOf(tmp_cmd));
|
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){
|
if (Util::epoch() - lastBuffer[name] > 5){
|
||||||
data["error"] = "Available";
|
data["error"] = "Available";
|
||||||
data["online"] = 2;
|
data["online"] = 2;
|
||||||
|
|
|
@ -36,20 +36,10 @@ namespace Converters {
|
||||||
std::cerr << "This file is too old to fix - please reconvert." << std::endl;
|
std::cerr << "This file is too old to fix - please reconvert." << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (oriheader["moreheader"].asInt() > 0 && !conf.getBool("force")){
|
if (DTSC::isFixed(meta) && !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;
|
std::cerr << "This file was already fixed or doesn't need fixing - cancelling." << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
meta.removeMember("isFixed");
|
meta.removeMember("isFixed");
|
||||||
meta.removeMember("keytime");
|
meta.removeMember("keytime");
|
||||||
meta.removeMember("keybpos");
|
meta.removeMember("keybpos");
|
||||||
|
|
|
@ -56,6 +56,11 @@ namespace Converters {
|
||||||
if (tmpFileName == outFileName){
|
if (tmpFileName == outFileName){
|
||||||
fullSort = false;
|
fullSort = false;
|
||||||
}else{
|
}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)));
|
inFiles.insert(std::pair<std::string,DTSC::File>(tmpFileName,DTSC::File(tmpFileName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +69,10 @@ namespace Converters {
|
||||||
outFile = DTSC::File(outFileName, true);
|
outFile = DTSC::File(outFileName, true);
|
||||||
}else{
|
}else{
|
||||||
outFile = DTSC::File(outFileName);
|
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();
|
meta = outFile.getMeta();
|
||||||
newMeta = meta;
|
newMeta = meta;
|
||||||
if (meta.isMember("tracks") && meta["tracks"].size() > 0){
|
if (meta.isMember("tracks") && meta["tracks"].size() > 0){
|
||||||
|
|
Loading…
Add table
Reference in a new issue