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

IMediaLibrary: Rename addMedia -> addExternalMedia

parent 8dd59acc
......@@ -251,7 +251,19 @@ class IMediaLibrary
virtual bool deleteLabel( LabelPtr label ) = 0;
virtual MediaPtr media( int64_t mediaId ) const = 0;
virtual MediaPtr media( const std::string& mrl ) const = 0;
virtual MediaPtr addMedia( const std::string& mrl ) = 0;
/**
* @brief addExternalMedia Adds an external media to the list of known media
* @param mrl This media MRL
*
* Once created, this media can be used just like any other media, except
* it won't have a subType, and won't be analyzed to extract tracks and
* won't be inserted to any collection (ie. album/show/...)
* If the mrl is already known to the medialibrary, this function will
* return nullptr.
*
* The media can be fetched using media( std::string ) afterward.
*/
virtual MediaPtr addExternalMedia( const std::string& mrl ) = 0;
virtual Query<IMedia> audioFiles( const QueryParameters* params = nullptr ) const = 0;
virtual Query<IMedia> videoFiles( const QueryParameters* params = nullptr ) const = 0;
virtual AlbumPtr album( int64_t id ) const = 0;
......
......@@ -435,7 +435,7 @@ MediaPtr MediaLibrary::media( const std::string& mrl ) const
return file->media();
}
MediaPtr MediaLibrary::addMedia( const std::string& mrl )
MediaPtr MediaLibrary::addExternalMedia( const std::string& mrl )
{
try
{
......
......@@ -72,7 +72,7 @@ class MediaLibrary : public IMediaLibrary, public IDeviceListerCb
virtual MediaPtr media( int64_t mediaId ) const override;
virtual MediaPtr media( const std::string& mrl ) const override;
virtual MediaPtr addMedia( const std::string& mrl ) override;
virtual MediaPtr addExternalMedia( const std::string& mrl ) override;
virtual Query<IMedia> audioFiles( const QueryParameters* params ) const override;
virtual Query<IMedia> videoFiles( const QueryParameters* params ) const override;
......
......@@ -204,3 +204,8 @@ void MediaLibraryTester::startThumbnailer()
void MediaLibraryTester::populateFsFactories()
{
}
MediaPtr MediaLibraryTester::addMedia( const std::string& mrl )
{
return addExternalMedia( mrl );
}
......@@ -75,6 +75,7 @@ public:
sqlite::Connection* getDbConn();
virtual void startThumbnailer();
virtual void populateFsFactories();
MediaPtr addMedia( const std::string& mrl );
private:
std::shared_ptr<fs::IDirectory> dummyDirectory;
......
......@@ -584,7 +584,7 @@ TEST_F( Medias, MetadataUnset )
TEST_F( Medias, ExternalMrl )
{
auto m = ml->addMedia( "https://foo.bar/sea-otters.mkv" );
auto m = ml->addExternalMedia( "https://foo.bar/sea-otters.mkv" );
ASSERT_NE( nullptr, m );
ASSERT_EQ( m->title(), "sea-otters.mkv" );
......@@ -611,8 +611,8 @@ TEST_F( Medias, ExternalMrl )
TEST_F( Medias, DuplicatedExternalMrl )
{
auto m = ml->addMedia( "http://foo.bar" );
auto m2 = ml->addMedia( "http://foo.bar" );
auto m = ml->addExternalMedia( "http://foo.bar" );
auto m2 = ml->addExternalMedia( "http://foo.bar" );
ASSERT_NE( nullptr, m );
ASSERT_EQ( nullptr, m2 );
}
......
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