Commit 21aa2793 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

(cherry picked from commit 72f3a690

)
Signed-off-by: Hugo Beauzée-Luyssen's avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent 9383d042
......@@ -52,6 +52,7 @@ class IMedia
Unknown,
Video,
Audio,
External,
};
enum class SubType : uint8_t
{
......
......@@ -380,7 +380,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();
......
Supports Markdown
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