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

Media: Pass the filename instead of the IFile when creating a media

parent a096d783
......@@ -95,9 +95,9 @@ Media::Media( MediaLibraryPtr ml, const std::string& title, Type type )
{
}
std::shared_ptr<Media> Media::create( MediaLibraryPtr ml, Type type, const fs::IFile& file )
std::shared_ptr<Media> Media::create( MediaLibraryPtr ml, Type type, const std::string& fileName )
{
auto self = std::make_shared<Media>( ml, file.name(), type );
auto self = std::make_shared<Media>( ml, fileName, type );
static const std::string req = "INSERT INTO " + policy::MediaTable::Name +
"(type, insertion_date, title, filename) VALUES(?, ?, ?, ?)";
......
......@@ -82,7 +82,7 @@ class Media : public IMedia, public DatabaseHelpers<Media, policy::MediaTable>
Media( MediaLibraryPtr ml , sqlite::Row& row );
Media( MediaLibraryPtr ml, const std::string &title, Type type);
static std::shared_ptr<Media> create( MediaLibraryPtr ml, Type type, const fs::IFile& file );
static std::shared_ptr<Media> create( MediaLibraryPtr ml, Type type, const std::string& fileName );
static bool createTable( DBConnection connection );
static bool createTriggers( DBConnection connection );
......
......@@ -331,7 +331,7 @@ std::shared_ptr<Media> MediaLibrary::addFile( const fs::IFile& fileFs, Folder& p
}
LOG_INFO( "Adding ", fileFs.fullPath() );
auto mptr = Media::create( this, type, fileFs );
auto mptr = Media::create( this, type, fileFs.name() );
if ( mptr == nullptr )
{
LOG_ERROR( "Failed to add media ", fileFs.fullPath(), " to the media library" );
......
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