use of org.schabi.newpipe.database.playlist.model.PlaylistEntity in project NewPipe by TeamNewPipe.
the class LocalPlaylistManager method createPlaylist.
public Maybe<List<Long>> createPlaylist(final String name, final List<StreamEntity> streams) {
// Disallow creation of empty playlists
if (streams.isEmpty())
return Maybe.empty();
final StreamEntity defaultStream = streams.get(0);
final PlaylistEntity newPlaylist = new PlaylistEntity(name, defaultStream.getThumbnailUrl());
return Maybe.fromCallable(() -> database.runInTransaction(() -> upsertStreams(playlistTable.insert(newPlaylist), streams, 0))).subscribeOn(Schedulers.io());
}
Aggregations