use of com.kabouzeid.gramophone.model.Song in project Phonograph by kabouzeid.
the class ArtistGlideRequest method createBaseRequest.
public static DrawableTypeRequest createBaseRequest(RequestManager requestManager, Artist artist, boolean noCustomImage) {
boolean hasCustomImage = CustomArtistImageUtil.getInstance(App.getInstance()).hasCustomArtistImage(artist);
if (noCustomImage || !hasCustomImage) {
final List<AlbumCover> songs = new ArrayList<>();
for (final Album album : artist.albums) {
final Song song = album.safeGetFirstSong();
songs.add(new AlbumCover(album.getYear(), song.data));
}
return requestManager.load(new ArtistImage(artist.getName(), songs));
} else {
return requestManager.load(CustomArtistImageUtil.getFile(artist));
}
}
use of com.kabouzeid.gramophone.model.Song in project Phonograph by kabouzeid.
the class M3UWriter method write.
public static File write(Context context, File dir, Playlist playlist) throws IOException {
if (// noinspection ResultOfMethodCallIgnored
!dir.exists())
dir.mkdirs();
File file = new File(dir, playlist.name.concat("." + EXTENSION));
List<? extends Song> songs;
if (playlist instanceof AbsCustomPlaylist) {
songs = ((AbsCustomPlaylist) playlist).getSongs(context);
} else {
songs = PlaylistSongLoader.getPlaylistSongList(context, playlist.id);
}
if (songs.size() > 0) {
BufferedWriter bw = new BufferedWriter(new FileWriter(file));
bw.write(HEADER);
for (Song song : songs) {
bw.newLine();
bw.write(ENTRY + song.duration + DURATION_SEPARATOR + song.artistName + " - " + song.title);
bw.newLine();
bw.write(song.data);
}
bw.close();
}
return file;
}
Aggregations