use of com.github.hakko.musiccabinet.domain.model.library.LastFmUser in project musiccabinet by hakko.
the class StarService method getStarredTracksMask.
public boolean[] getStarredTracksMask(String lastFmUsername, List<Integer> trackIds) {
boolean[] mask = new boolean[trackIds.size()];
if (lastFmUsername == null) {
return mask;
}
LastFmUser lastFmUser = getLastFmUser(lastFmUsername);
for (int i = 0; i < mask.length; i++) {
mask[i] = getStarredTracks(lastFmUser).contains(trackIds.get(i));
}
return mask;
}
use of com.github.hakko.musiccabinet.domain.model.library.LastFmUser in project musiccabinet by hakko.
the class StarService method unstarArtist.
public void unstarArtist(String lastFmUsername, int artistId) {
LastFmUser lastFmUser = getLastFmUser(lastFmUsername);
starDao.unstarArtist(lastFmUser, artistId);
getStarredArtistIds(lastFmUser).remove(artistId);
}
use of com.github.hakko.musiccabinet.domain.model.library.LastFmUser in project musiccabinet by hakko.
the class StarService method getStarredAlbumsMask.
public boolean[] getStarredAlbumsMask(String lastFmUsername, List<Integer> albumIds) {
boolean[] mask = new boolean[albumIds.size()];
if (lastFmUsername == null) {
return mask;
}
LastFmUser lastFmUser = getLastFmUser(lastFmUsername);
for (int i = 0; i < mask.length; i++) {
mask[i] = getStarredAlbumIds(lastFmUser).contains(albumIds.get(i));
}
return mask;
}
use of com.github.hakko.musiccabinet.domain.model.library.LastFmUser in project musiccabinet by hakko.
the class StarService method getLastFmUser.
protected LastFmUser getLastFmUser(String lastFmUsername) {
if (cachedUsers.containsKey(lastFmUsername)) {
return cachedUsers.get(lastFmUsername);
}
LastFmUser lastFmUser = lastFmDao.getLastFmUser(lastFmUsername);
cachedUsers.put(lastFmUsername, lastFmUser);
return lastFmUser;
}
use of com.github.hakko.musiccabinet.domain.model.library.LastFmUser in project musiccabinet by hakko.
the class StarService method starArtist.
public void starArtist(String lastFmUsername, int artistId) {
LastFmUser lastFmUser = getLastFmUser(lastFmUsername);
starDao.starArtist(lastFmUser, artistId);
getStarredArtistIds(lastFmUser).add(artistId);
}
Aggregations