Search in sources :

Example 61 with Artist

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

the class LibraryBrowserServiceTest method findsCoverArtFileForTrack.

@Test
public void findsCoverArtFileForTrack() throws Exception {
    Artist artist = new Artist("Artist Name");
    int artistId = musicDao.getArtistId(artist);
    scannerService.add(set(media3));
    List<Album> albums = browserService.getAlbums(artistId, false, true);
    int trackId = albums.get(1).getTrackIds().get(0);
    String coverArtPath = browserService.getCoverArtFileForTrack(trackId);
    Assert.assertNotNull(coverArtPath);
    Assert.assertTrue(coverArtPath.endsWith("Folder artwork" + separatorChar + "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)

Example 62 with Artist

use of com.github.hakko.musiccabinet.domain.model.music.Artist 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 63 with Artist

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

the class LibraryBrowserServiceTest method findsAlbum.

@Test
public void findsAlbum() throws Exception {
    Artist theBeatles = new Artist("The Beatles");
    int beatlesId = musicDao.getArtistId(theBeatles);
    scannerService.add(set(media2));
    List<Album> albums = browserService.getAlbums(beatlesId, true);
    assertAlbums(albums, theBeatles, "1967-1970");
    int albumId = albums.get(0).getId();
    Album album = browserService.getAlbum(albumId);
    assertAlbums(Arrays.asList(album), theBeatles, "1967-1970");
}
Also used : Artist(com.github.hakko.musiccabinet.domain.model.music.Artist) Album(com.github.hakko.musiccabinet.domain.model.music.Album) Test(org.junit.Test)

Example 64 with Artist

use of com.github.hakko.musiccabinet.domain.model.music.Artist 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)

Example 65 with Artist

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

the class ArtistRelationServiceTest method artistRelationUpdateUpdatesAllArtists.

@Test
public void artistRelationUpdateUpdatesAllArtists() throws ApplicationException, IOException {
    clearLibraryAndAddCherTrack();
    WebserviceInvocation wi = new WebserviceInvocation(ARTIST_GET_SIMILAR, new Artist(artistName));
    Assert.assertTrue(webserviceHistoryService.isWebserviceInvocationAllowed(wi));
    Set<String> artistNames = webserviceHistoryService.getArtistNamesScheduledForUpdate(ARTIST_GET_SIMILAR);
    Assert.assertNotNull(artistNames);
    Assert.assertEquals(1, artistNames.size());
    Assert.assertTrue(artistNames.contains(artistName));
    ArtistRelationService artistRelationService = new ArtistRelationService();
    artistRelationService.setArtistSimilarityClient(getArtistSimilarityClient(webserviceHistoryService));
    artistRelationService.setArtistRelationDao(artistRelationDao);
    artistRelationService.setWebserviceHistoryService(webserviceHistoryService);
    artistRelationService.updateSearchIndex();
    Assert.assertFalse(webserviceHistoryService.isWebserviceInvocationAllowed(wi));
}
Also used : Artist(com.github.hakko.musiccabinet.domain.model.music.Artist) WebserviceInvocation(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation) Test(org.junit.Test)

Aggregations

Artist (com.github.hakko.musiccabinet.domain.model.music.Artist)66 Test (org.junit.Test)33 WebserviceInvocation (com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation)19 ArrayList (java.util.ArrayList)13 Album (com.github.hakko.musiccabinet.domain.model.music.Album)11 ArtistInfo (com.github.hakko.musiccabinet.domain.model.music.ArtistInfo)11 ApplicationException (com.github.hakko.musiccabinet.exception.ApplicationException)10 Track (com.github.hakko.musiccabinet.domain.model.music.Track)9 File (com.github.hakko.musiccabinet.domain.model.library.File)8 NameValuePair (org.apache.http.NameValuePair)8 Calltype (com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation.Calltype)7 Before (org.junit.Before)6 WebserviceHistoryService (com.github.hakko.musiccabinet.service.lastfm.WebserviceHistoryService)5 StringUtil (com.github.hakko.musiccabinet.util.StringUtil)5 UnittestLibraryUtil.getFile (com.github.hakko.musiccabinet.util.UnittestLibraryUtil.getFile)5 WSResponse (com.github.hakko.musiccabinet.ws.lastfm.WSResponse)5 LastFmUser (com.github.hakko.musiccabinet.domain.model.library.LastFmUser)4 Tag (com.github.hakko.musiccabinet.domain.model.music.Tag)4 ResourceUtil (com.github.hakko.musiccabinet.util.ResourceUtil)4 ResultSet (java.sql.ResultSet)4