Skip to content

Commit

Permalink
Merge branch 'master' of code.mythtv.org:mythtv into devel/resync-ffmpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
jyavenard committed Mar 25, 2013
2 parents 4d75ba2 + 2377fbf commit f622b85
Show file tree
Hide file tree
Showing 58 changed files with 1,317 additions and 669 deletions.
13 changes: 4 additions & 9 deletions mythplugins/mytharchive/mytharchive/exportnative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,21 +476,16 @@ void ExportNative::runScript()
QString configDir = tempDir + "config";
QString commandline;

// remove existing progress.log if present
if (QFile::exists(logDir + "/progress.log"))
QFile::remove(logDir + "/progress.log");
// remove any existing logs
myth_system("rm -f " + logDir + "/*.log");

// remove cancel flag file if present
if (QFile::exists(logDir + "/mythburncancel.lck"))
QFile::remove(logDir + "/mythburncancel.lck");

createConfigFile(configDir + "/mydata.xml");
commandline = "mytharchivehelper --nativearchive --outfile " + configDir +
"/mydata.xml"; // job file
commandline += logPropagateArgs;
if (!logPropagateQuiet())
commandline += " --quiet";
commandline += " > " + logDir + "/progress.log 2>&1 &"; // Logs
commandline = "mytharchivehelper --logpath " + logDir + " --nativearchive "
"--outfile " + configDir + "/mydata.xml"; // job file

uint flags = kMSRunBackground | kMSDontBlockInputDevs |
kMSDontDisableDrawing;
Expand Down
12 changes: 4 additions & 8 deletions mythplugins/mytharchive/mytharchive/importnative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,16 +449,12 @@ void ImportNative::finishedPressed()

QString logDir = tempDir + "logs";

// remove existing progress.log if prescent
if (QFile::exists(logDir + "/progress.log"))
QFile::remove(logDir + "/progress.log");
// remove any existing logs
myth_system("rm -f " + logDir + "/*.log");

commandline = "mytharchivehelper --importarchive --infile \"" + m_xmlFile +
commandline = "mytharchivehelper --logpath " + logDir + " --importarchive "
"--infile \"" + m_xmlFile +
"\" --chanid " + chanID;
commandline += logPropagateArgs;
if (!logPropagateQuiet())
commandline += " --quiet";
commandline += " > " + logDir + "/progress.log 2>&1 &";

uint flags = kMSRunBackground | kMSDontBlockInputDevs |
kMSDontDisableDrawing;
Expand Down
53 changes: 51 additions & 2 deletions mythplugins/mytharchive/mytharchive/logviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,49 @@ void showLogViewer(void)
{
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
QString logDir = getTempDirectory() + "logs";
QString progressLog;
QString fullLog;

// wait for a log file to be available
int tries = 10;
while (tries--)
{
if (QFile::exists(logDir + "/progress.log"))
progressLog = logDir + "/progress.log";

if (QFile::exists(logDir + "/mythburn.log"))
fullLog = logDir + "/mythburn.log";

// we wait for both the progress.log and mythburn.log
if ((!progressLog.isEmpty()) && (!fullLog.isEmpty()))
break;

// or we wait for a log from mytharchivehelper
if (progressLog.isEmpty() && fullLog.isEmpty())
{
QStringList logFiles;
QStringList filters;
filters << "*.log";

QDir d(logDir);
logFiles = d.entryList(filters, QDir::Files | QDir::Readable, QDir::Time);

if (logFiles.count())
{
// the first log file should be the newest one available
progressLog = logDir + '/' + logFiles[0];
break;
}
}

sleep(1);
}

// do any logs exist?
if (QFile::exists(logDir + "/progress.log") || QFile::exists(logDir + "/mythburn.log"))
if ((!progressLog.isEmpty()) || (!fullLog.isEmpty()))
{
LogViewer *viewer = new LogViewer(mainStack);
viewer->setFilenames(logDir + "/progress.log", logDir + "/mythburn.log");
viewer->setFilenames(progressLog, fullLog);
if (viewer->Create())
mainStack->AddScreen(viewer);
}
Expand Down Expand Up @@ -244,6 +281,8 @@ QString LogViewer::getSetting(const QString &key)

bool LogViewer::loadFile(QString filename, QStringList &list, int startline)
{
bool strip = !(filename.endsWith("progress.log") || filename.endsWith("mythburn.log"));

list.clear();

QFile file(filename);
Expand All @@ -267,6 +306,16 @@ bool LogViewer::loadFile(QString filename, QStringList &list, int startline)
while ( !stream.atEnd() )
{
s = stream.readLine();

if (strip)
{
// the logging from mytharchivehelper contains a lot of junk
// we are not interested in so just strip it out
int pos = s.indexOf(" - ");
if (pos != -1)
s = s.mid(pos + 3);
}

list.append(s);
}
file.close();
Expand Down
5 changes: 2 additions & 3 deletions mythplugins/mytharchive/mytharchive/mythburn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,9 +942,8 @@ void MythBurn::runScript()
QString configDir = tempDir + "config";
QString commandline;

// remove existing progress.log if present
if (QFile::exists(logDir + "/progress.log"))
QFile::remove(logDir + "/progress.log");
// remove any existing logs
myth_system("rm -f " + logDir + "/*.log");

// remove cancel flag file if present
if (QFile::exists(logDir + "/mythburncancel.lck"))
Expand Down

0 comments on commit f622b85

Please sign in to comment.