Search in sources :

Example 1 with PlaylistEntity

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());
}
Also used : PlaylistEntity(org.schabi.newpipe.database.playlist.model.PlaylistEntity) StreamEntity(org.schabi.newpipe.database.stream.model.StreamEntity) PlaylistStreamEntity(org.schabi.newpipe.database.playlist.model.PlaylistStreamEntity)

Aggregations

PlaylistEntity (org.schabi.newpipe.database.playlist.model.PlaylistEntity)1 PlaylistStreamEntity (org.schabi.newpipe.database.playlist.model.PlaylistStreamEntity)1 StreamEntity (org.schabi.newpipe.database.stream.model.StreamEntity)1