Commit 72f3a690 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

MediaLibrary: Use a specific type for external media

In order not to confuse them with media we failed to parse
parent 12a45daa
......@@ -52,6 +52,7 @@ class IMedia
Unknown,
Video,
Audio,
External,
};
enum class SubType : uint8_t
{
......
......@@ -377,7 +377,7 @@ MediaPtr MediaLibrary::addMedia( const std::string& mrl )
{
return sqlite::Tools::withRetries( 3, [this, &mrl]() -> MediaPtr {
auto t = m_dbConnection->newTransaction();
auto media = Media::create( this, IMedia::Type::Unknown, utils::file::fileName( mrl ) );
auto media = Media::create( this, IMedia::Type::External, utils::file::fileName( mrl ) );
if ( media == nullptr )
return nullptr;
if ( media->addExternalMrl( mrl, IFile::Type::Main ) == nullptr )
......
......@@ -429,7 +429,7 @@ TEST_F( Medias, SortByFileSize )
TEST_F( Medias, SetType )
{
auto m1 = std::static_pointer_cast<Media>( ml->addMedia( "media1.mp3" ) );
ASSERT_EQ( IMedia::Type::Unknown, m1->type() );
ASSERT_EQ( IMedia::Type::External, m1->type() );
m1->setType( IMedia::Type::Video );
m1->save();
......
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