Commit 92be3f0c authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

parser: Store duration in the task item

parent b38d6e79
......@@ -200,7 +200,7 @@ parser::Task::Status MetadataParser::run( parser::Task& task )
track.language(), track.description() );
}
}
task.media->setDuration( task.vlcMedia.duration() );
task.media->setDuration( task.item().duration() );
t->commit();
}, std::move( tracks ) );
}
......
......@@ -148,6 +148,7 @@ void VLCMetadataService::mediaToItem( VLC::Media& media, parser::Task::Item& ite
media.meta( libvlc_meta_DiscNumber ) );
item.setMeta( parser::Task::Item::Metadata::DiscTotal,
media.meta( libvlc_meta_DiscTotal ) );
item.setDuration( media.duration() );
auto subItems = media.subitems();
if ( subItems != nullptr )
......
......@@ -170,6 +170,16 @@ void Task::Item::addSubItem( Task::Item item )
m_subItems.emplace_back( std::move( item ) );
}
int64_t Task::Item::duration() const
{
return m_duration;
}
void Task::Item::setDuration( int64_t duration )
{
m_duration = duration;
}
bool Task::restoreLinkedEntities()
{
LOG_INFO("Restoring linked entities of task ", m_id);
......
......@@ -117,10 +117,14 @@ public:
const std::vector<Item>& subItems() const;
void addSubItem( Item mrl );
int64_t duration() const;
void setDuration( int64_t duration );
private:
std::string m_mrl;
std::unordered_map<Metadata, std::string> m_metadata;
std::vector<Item> m_subItems;
int64_t m_duration;
};
static_assert( std::is_move_assignable<Item>::value, "Item must be move assignable" );
......
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