Commit 994c490d authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

Remove MediaLibrary::folder

parent 24c4b431
......@@ -228,11 +228,6 @@ std::shared_ptr<Media> MediaLibrary::addFile( const std::string& path, Folder* p
return fptr;
}
std::shared_ptr<Folder> MediaLibrary::folder( const std::string& path )
{
return Folder::fromPath( m_dbConnection.get(), path );
}
bool MediaLibrary::deleteFile( const Media* file )
{
return Media::destroy( m_dbConnection.get(), file->id() );
......
......@@ -56,7 +56,6 @@ class MediaLibrary : public IMediaLibrary
std::shared_ptr<Media> addFile(const std::string& path, Folder* parentFolder, fs::IDirectory* parentFolderFs);
virtual bool deleteFile(const Media* file );
std::shared_ptr<Folder> folder( const std::string& path );
bool deleteFolder( const Folder* folder );
std::shared_ptr<Device> device( const std::string& uuid );
std::shared_ptr<Device> addDevice( const std::string& uuid, bool isRemovable );
......
......@@ -30,6 +30,7 @@
#include "discoverer/FsDiscoverer.h"
#include "mocks/FileSystem.h"
#include "Media.h"
#include "Folder.h"
class TestEnv : public ::testing::Environment
{
......@@ -88,3 +89,16 @@ MediaPtr MediaLibraryTester::media( const std::string& path )
}
return nullptr;
}
std::shared_ptr<Folder> MediaLibraryTester::folder( const std::string& path )
{
static const std::string req = "SELECT * FROM " + policy::FolderTable::Name +
" WHERE is_blacklisted IS NULL AND is_present = 1";
auto folders = Folder::DatabaseHelpers::fetchAll<Folder>( m_dbConnection.get(), req );
for ( auto &f : folders )
{
if ( f->path() == path )
return f;
}
return nullptr;
}
......@@ -30,6 +30,7 @@ class MediaLibraryTester : public MediaLibrary
public:
std::shared_ptr<Media> media( unsigned int id );
MediaPtr media( const std::string& path );
std::shared_ptr<Folder> folder( const std::string& path );
};
class MediaLibraryWithoutParser : public MediaLibraryTester
......
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