Search in sources :

Example 21 with Album

use of com.github.hakko.musiccabinet.domain.model.music.Album in project musiccabinet by hakko.

the class LibraryBrowserServiceTest method findsTrack.

@Test
public void findsTrack() throws Exception {
    scannerService.add(set(aretha));
    Artist artist = new Artist("Aretha Franklin");
    int artistId = musicDao.getArtistId(artist);
    List<Album> albums = browserService.getAlbums(artistId, true);
    assertAlbums(albums, artist, UNKNOWN_ALBUM);
    List<Track> tracks = browserService.getTracks(albums.get(0).getTrackIds());
    assertTracks(tracks, Arrays.asList(new Track("Aretha Franklin", "Bridge Over Troubled Water")));
}
Also used : Artist(com.github.hakko.musiccabinet.domain.model.music.Artist) Album(com.github.hakko.musiccabinet.domain.model.music.Album) Track(com.github.hakko.musiccabinet.domain.model.music.Track) Test(org.junit.Test)

Example 22 with Album

use of com.github.hakko.musiccabinet.domain.model.music.Album in project musiccabinet by hakko.

the class LibraryBrowserServiceTest method findsArtwork.

@Test
public void findsArtwork() throws Exception {
    Artist artist = new Artist("Artist Name");
    int artistId = musicDao.getArtistId(artist);
    scannerService.add(set(media3));
    List<Album> albums = browserService.getAlbums(artistId, true);
    assertAlbums(albums, artist, "Embedded artwork", "Folder artwork");
    Album folderArtAlbum = getAlbum(albums, "Folder artwork");
    Album embeddedArtAlbum = getAlbum(albums, "Embedded artwork");
    Assert.assertTrue(embeddedArtAlbum.getCoverArtPath() != null);
    Assert.assertTrue(embeddedArtAlbum.isCoverArtEmbedded());
    Assert.assertTrue(embeddedArtAlbum.getCoverArtURL() == null);
    Assert.assertTrue(folderArtAlbum.getCoverArtPath() != null);
    Assert.assertFalse(folderArtAlbum.isCoverArtEmbedded());
    Assert.assertTrue(folderArtAlbum.getCoverArtURL() == null);
    Assert.assertTrue(embeddedArtAlbum.getCoverArtPath().endsWith("Embedded artwork.mp3"));
    Assert.assertTrue(folderArtAlbum.getCoverArtPath().endsWith("folder.png"));
}
Also used : Artist(com.github.hakko.musiccabinet.domain.model.music.Artist) Album(com.github.hakko.musiccabinet.domain.model.music.Album) Test(org.junit.Test)

Aggregations

Album (com.github.hakko.musiccabinet.domain.model.music.Album)22 Artist (com.github.hakko.musiccabinet.domain.model.music.Artist)11 Test (org.junit.Test)10 Track (com.github.hakko.musiccabinet.domain.model.music.Track)5 AlbumInfo (com.github.hakko.musiccabinet.domain.model.music.AlbumInfo)4 ResultSet (java.sql.ResultSet)3 SQLException (java.sql.SQLException)3 LastFmUser (com.github.hakko.musiccabinet.domain.model.library.LastFmUser)2 ApplicationException (com.github.hakko.musiccabinet.exception.ApplicationException)2 ArrayList (java.util.ArrayList)2 Before (org.junit.Before)2 AlbumRowMapper (com.github.hakko.musiccabinet.dao.jdbc.rowmapper.AlbumRowMapper)1 NameSearchResult (com.github.hakko.musiccabinet.domain.model.aggr.NameSearchResult)1 File (com.github.hakko.musiccabinet.domain.model.library.File)1 WebserviceInvocation (com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation)1 ArtistInfo (com.github.hakko.musiccabinet.domain.model.music.ArtistInfo)1 AlbumInfoParser (com.github.hakko.musiccabinet.parser.lastfm.AlbumInfoParser)1 AlbumInfoParserImpl (com.github.hakko.musiccabinet.parser.lastfm.AlbumInfoParserImpl)1 WebserviceHistoryService (com.github.hakko.musiccabinet.service.lastfm.WebserviceHistoryService)1 StringUtil (com.github.hakko.musiccabinet.util.StringUtil)1