Commit 1b5ddf5d authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

parser: Handle task management from the worker

parent 028df7b1
......@@ -217,9 +217,6 @@ parser::Task::Status MetadataParser::run( parser::Task& task )
if ( task.item().file()->isDeleted() == true || task.item().media()->isDeleted() == true )
return parser::Task::Status::Fatal;
task.markStepCompleted( parser::Task::ParserStep::MetadataAnalysis );
if ( task.saveParserStep() == false )
return parser::Task::Status::Fatal;
m_notifier->notifyMediaCreation( task.item().media() );
return parser::Task::Status::Success;
}
......
......@@ -91,9 +91,6 @@ parser::Task::Status VLCMetadataService::run( parser::Task& task )
return parser::Task::Status::Fatal;
}
mediaToItem( vlcMedia, task.item() );
// Don't save the file parsing step yet, since all data are just in memory. Just mark
// the extraction as done.
task.markStepCompleted( parser::Task::ParserStep::MetadataExtraction );
return parser::Task::Status::Success;
}
......
......@@ -209,7 +209,17 @@ void ParserWorker::setIdle(bool isIdle)
bool ParserWorker::handleServiceResult( parser::Task& task, parser::Task::Status status )
{
if ( status == parser::Task::Status::Completed )
if ( status == parser::Task::Status::Success )
{
task.markStepCompleted( m_service->targetedStep() );
// We don't want to save the extraction step in database, as restarting a
// task with extraction completed but analysis uncompleted wouldn't run
// the extraction again, causing the analysis to run with no info.
if ( m_service->targetedStep() != parser::Task::ParserStep::MetadataExtraction )
return task.saveParserStep();
return true;
}
else if ( status == parser::Task::Status::Completed )
{
task.markStepCompleted( parser::Task::ParserStep::Completed );
return task.saveParserStep();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment