Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
medialibrary
Commits
ecf2457c
Commit
ecf2457c
authored
Jan 21, 2016
by
Hugo Beauzée-Luyssen
Browse files
MediaLibrary: Move createGenre to test code
parent
bf772ac7
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/MediaLibrary.cpp
View file @
ecf2457c
...
...
@@ -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
...
...
src/MediaLibrary.h
View file @
ecf2457c
...
...
@@ -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
);
...
...
src/metadata_services/MetadataParser.cpp
View file @
ecf2457c
...
...
@@ -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"
);
...
...
test/unittest/Tests.cpp
View file @
ecf2457c
...
...
@@ -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
);
...
...
test/unittest/Tests.h
View file @
ecf2457c
...
...
@@ -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:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment