コード例 #1
0
 /**
  * Pre-load other album (done outside the EDT).
  *
  * @throws Exception the exception
  */
 void preFetchOthersAlbum() throws Exception {
   albums = LastFmService.getInstance().getAlbumList(artist, true, 0);
   // Perform images downloads and caching
   if (albums != null && albums.getAlbums().size() > 0) {
     for (AlbumInfo album : albums.getAlbums()) {
       // stop this list of albums if there was another file launched in the meantime
       String albumUrl = album.getBigCoverURL();
       if (StringUtils.isBlank(albumUrl)) {
         continue;
       }
       // Download thumb
       URL remote = new URL(albumUrl);
       // Download image and store file reference (to generate the
       // popup thumb for ie)
       DownloadManager.downloadToCache(remote);
     }
   }
 }
コード例 #2
0
 /**
  * Pre-load other album (done outside the EDT).
  *
  * @throws Exception the exception
  */
 void preFetchSimilarArtists() throws Exception {
   // Perform last.fm calls
   similar = LastFmService.getInstance().getSimilarArtists(artist);
   // artists is null for void (unknown) similar artists
   if (similar != null && similar.getArtists() != null) {
     List<ArtistInfo> artists = similar.getArtists();
     for (ArtistInfo similarArtist : artists) {
       // stop this list of albums if there was another file launched in the meantime, another
       // refresh will take place anyway
       String artistUrl = similarArtist.getImageUrl();
       if (StringUtils.isBlank(artistUrl)) {
         continue;
       }
       // Download thumb
       URL remote = new URL(artistUrl);
       // Download the picture and store file reference (to
       // generate the popup thumb for ie)
       DownloadManager.downloadToCache(remote);
     }
   }
 }