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

IArtist: Rename media() to tracks()

For consistency
parent c15374da
......@@ -45,7 +45,7 @@ public:
virtual Query<IAlbum> albums( const QueryParameters* params = nullptr ) const = 0;
virtual Query<IAlbum> searchAlbums( const std::string& pattern,
const QueryParameters* params = nullptr ) const = 0;
virtual Query<IMedia> media( const QueryParameters* params = nullptr ) const = 0;
virtual Query<IMedia> tracks( const QueryParameters* params = nullptr ) const = 0;
virtual const std::string& artworkMrl() const = 0;
virtual const std::string& musicBrainzId() const = 0;
/**
......
......@@ -99,7 +99,7 @@ Query<IAlbum> Artist::searchAlbums( const std::string& pattern,
return Album::searchFromArtist( m_ml, pattern, m_id, params );
}
Query<IMedia> Artist::media( const QueryParameters* params ) const
Query<IMedia> Artist::tracks( const QueryParameters* params ) const
{
std::string req = "FROM " + policy::MediaTable::Name + " med ";
......
......@@ -58,8 +58,8 @@ public:
virtual Query<IAlbum> albums( const QueryParameters* params ) const override;
virtual Query<IAlbum> searchAlbums( const std::string& pattern,
const QueryParameters* params = nullptr ) const override;
virtual Query<IMedia> media( const QueryParameters* params ) const override;
bool addMedia( Media& media );
virtual Query<IMedia> tracks( const QueryParameters* params ) const override;
bool addMedia( Media& tracks );
virtual const std::string& artworkMrl() const override;
std::shared_ptr<Thumbnail> thumbnail();
bool setArtworkMrl( const std::string& artworkMrl, Thumbnail::Origin origin );
......
......@@ -466,7 +466,7 @@ void Tests::checkArtists(const rapidjson::Value& expectedArtists, std::vector<Ar
if ( expectedArtist.HasMember( "nbTracks" ) )
{
auto expectedNbTracks = expectedArtist["nbTracks"].GetUint();
auto tracks = artist->media( nullptr )->all();
auto tracks = artist->tracks( nullptr )->all();
if ( expectedNbTracks != tracks.size() )
return false;
if ( expectedNbTracks != artist->nbTracks() )
......
......@@ -181,13 +181,13 @@ TEST_F( Artists, AllSongs )
ASSERT_TRUE( res );
}
auto songs = artist->media( nullptr )->all();
auto songs = artist->tracks( nullptr )->all();
ASSERT_EQ( songs.size(), 3u );
Reload();
auto artist2 = ml->artist( "Cannibal Otters" );
songs = artist2->media( nullptr )->all();
songs = artist2->tracks( nullptr )->all();
ASSERT_EQ( songs.size(), 3u );
}
......@@ -318,14 +318,14 @@ TEST_F( Artists, SortMedia )
}
QueryParameters params { SortingCriteria::Duration, false };
auto tracks = artist->media( &params )->all();
auto tracks = artist->tracks( &params )->all();
ASSERT_EQ( 3u, tracks.size() );
ASSERT_EQ( "song3.mp3", tracks[0]->title() ); // Duration: 8
ASSERT_EQ( "song2.mp3", tracks[1]->title() ); // Duration: 9
ASSERT_EQ( "song1.mp3", tracks[2]->title() ); // Duration: 10
params.desc = true;
tracks = artist->media( &params )->all();
tracks = artist->tracks( &params )->all();
ASSERT_EQ( 3u, tracks.size() );
ASSERT_EQ( "song1.mp3", tracks[0]->title() );
ASSERT_EQ( "song2.mp3", tracks[1]->title() );
......@@ -353,7 +353,7 @@ TEST_F( Artists, SortMediaByAlbum )
}
QueryParameters params { SortingCriteria::Album, false };
auto tracks = artist->media( &params )->all();
auto tracks = artist->tracks( &params )->all();
ASSERT_EQ( 4u, tracks.size() );
ASSERT_EQ( "alb0_song1.mp3", tracks[0]->title() );
ASSERT_EQ( "alb0_song2.mp3", tracks[1]->title() );
......@@ -361,7 +361,7 @@ TEST_F( Artists, SortMediaByAlbum )
ASSERT_EQ( "alb1_song2.mp3", tracks[3]->title() );
params.desc = true;
tracks = artist->media( &params )->all();
tracks = artist->tracks( &params )->all();
ASSERT_EQ( 4u, tracks.size() );
ASSERT_EQ( "alb1_song2.mp3", tracks[0]->title() );
ASSERT_EQ( "alb1_song1.mp3", tracks[1]->title() );
......@@ -511,7 +511,7 @@ TEST_F( Artists, SortTracksMultiDisc )
* [ Disc 2 - Track 3 ]
*/
QueryParameters params { SortingCriteria::Album, false };
auto tracks = artist->media( &params )->all();
auto tracks = artist->tracks( &params )->all();
ASSERT_EQ( 6u, tracks.size() );
ASSERT_EQ( media[0]->id(), tracks[0]->id() );
ASSERT_EQ( media[2]->id(), tracks[1]->id() );
......@@ -521,7 +521,7 @@ TEST_F( Artists, SortTracksMultiDisc )
ASSERT_EQ( media[5]->id(), tracks[5]->id() );
params.desc = true;
tracks = artist->media( &params )->all();
tracks = artist->tracks( &params )->all();
ASSERT_EQ( media[5]->id(), tracks[0]->id() );
ASSERT_EQ( media[3]->id(), tracks[1]->id() );
ASSERT_EQ( media[1]->id(), tracks[2]->id() );
......
......@@ -305,7 +305,7 @@ TEST_F( DeviceFs, PartialAlbumRemoval )
auto artists = ml->artists( true, nullptr )->all();
ASSERT_EQ( 1u, artists.size() );
auto artist = artists[0];
ASSERT_EQ( 2u, artist->media( nullptr )->count() );
ASSERT_EQ( 2u, artist->tracks( nullptr )->count() );
auto device = fsMock->removeDevice( RemovableDeviceUuid );
Reload();
......@@ -315,7 +315,7 @@ TEST_F( DeviceFs, PartialAlbumRemoval )
artists = ml->artists( true, nullptr )->all();
ASSERT_EQ( 1u, artists.size() );
ASSERT_EQ( 1u, albums[0]->tracks( nullptr )->count() );
ASSERT_EQ( 1u, artists[0]->media( nullptr )->count() );
ASSERT_EQ( 1u, artists[0]->tracks( nullptr )->count() );
}
TEST_F( DeviceFs, ChangeDevice )
......
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