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

MediaLibrary: Move createGenre to test code

parent bf772ac7
......@@ -314,11 +314,6 @@ std::vector<GenrePtr> MediaLibrary::genres() const
return Genre::fetchAll<IGenre>( m_dbConnection.get() );
}
std::shared_ptr<Genre> MediaLibrary::createGenre( const std::string& name )
{
return Genre::create( m_dbConnection.get(), name );
}
ShowPtr MediaLibrary::show(const std::string& name)
{
static const std::string req = "SELECT * FROM " + policy::ShowTable::Name
......
......@@ -69,7 +69,6 @@ class MediaLibrary : public IMediaLibrary
virtual std::vector<AlbumPtr> albums() override;
virtual std::vector<GenrePtr> genres() const override;
std::shared_ptr<Genre> createGenre( const std::string& name );
virtual ShowPtr show( const std::string& name ) override;
std::shared_ptr<Show> createShow( const std::string& name );
......
......@@ -341,7 +341,7 @@ std::shared_ptr<AlbumTrack> MetadataParser::handleTrack( std::shared_ptr<Album>
auto genre = Genre::fromName( m_dbConn, task.genre );
if ( genre == nullptr )
{
genre = m_ml->createGenre( task.genre );
genre = Genre::create( m_dbConn, task.genre );
if ( genre == nullptr )
{
LOG_ERROR( "Failed to create a genre in database" );
......
......@@ -132,6 +132,11 @@ void MediaLibraryTester::deleteAlbum( unsigned int albumId )
Album::destroy( m_dbConnection.get(), albumId );
}
std::shared_ptr<Genre> MediaLibraryTester::createGenre( const std::string& name )
{
return Genre::create( m_dbConnection.get(), name );
}
void MediaLibraryTester::deleteGenre( unsigned int genreId )
{
Genre::destroy( m_dbConnection.get(), genreId );
......
......@@ -38,6 +38,7 @@ public:
std::shared_ptr<Media> addFile( const std::string& path );
std::shared_ptr<Playlist> playlist( unsigned int playlistId );
void deleteAlbum( unsigned int albumId );
std::shared_ptr<Genre> createGenre( const std::string& name );
void deleteGenre( unsigned int genreId );
private:
......
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