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

MediaLibrary: Allow a folder to be fetched using its path

parent 389314ee
......@@ -34,12 +34,16 @@ class IMediaLibrary
virtual bool initialize( const std::string& dbPath ) = 0;
/// Adds a stand alone file
virtual FilePtr addFile( const std::string& path ) = 0;
/// Adds a folder and all the files it contains
virtual FolderPtr addFolder( const std::string& path ) = 0;
virtual FilePtr file( const std::string& path ) = 0;
virtual bool deleteFile( const std::string& mrl ) = 0;
virtual bool deleteFile( FilePtr file ) = 0;
/// Adds a folder and all the files it contains
virtual FolderPtr addFolder( const std::string& path ) = 0;
virtual FolderPtr folder( const std::string& path ) = 0;
virtual bool deleteFolder( FolderPtr folder ) = 0;
virtual LabelPtr createLabel( const std::string& label ) = 0;
virtual bool deleteLabel( const std::string& label ) = 0;
virtual bool deleteLabel( LabelPtr label ) = 0;
......
......@@ -101,6 +101,11 @@ FolderPtr MediaLibrary::addFolder( const std::string& path )
return folder;
}
FolderPtr MediaLibrary::folder( const std::string& path )
{
return Folder::fetch( m_dbConnection, path );
}
bool MediaLibrary::deleteFile( const std::string& mrl )
{
return File::destroy( m_dbConnection, mrl );
......
......@@ -17,9 +17,11 @@ class MediaLibrary : public IMediaLibrary
virtual std::vector<FilePtr> files();
virtual FilePtr file( const std::string& path );
virtual FilePtr addFile( const std::string& path );
virtual FolderPtr addFolder( const std::string& path ) override;
virtual bool deleteFile( const std::string& mrl );
virtual bool deleteFile( FilePtr file );
virtual FolderPtr addFolder( const std::string& path ) override;
virtual FolderPtr folder( const std::string& path ) override;
virtual bool deleteFolder( FolderPtr folder ) override;
virtual LabelPtr createLabel( const std::string& label );
......
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