use of org.schabi.newpipe.database.playlist.model.PlaylistStreamEntity in project NewPipe by TeamNewPipe.
the class LocalPlaylistManager method updateJoin.
public Completable updateJoin(final long playlistId, final List<Long> streamIds) {
List<PlaylistStreamEntity> joinEntities = new ArrayList<>(streamIds.size());
for (int i = 0; i < streamIds.size(); i++) {
joinEntities.add(new PlaylistStreamEntity(playlistId, streamIds.get(i), i));
}
return Completable.fromRunnable(() -> database.runInTransaction(() -> {
playlistStreamTable.deleteBatch(playlistId);
playlistStreamTable.insertAll(joinEntities);
})).subscribeOn(Schedulers.io());
}
use of org.schabi.newpipe.database.playlist.model.PlaylistStreamEntity in project NewPipe by TeamNewPipe.
the class LocalPlaylistManager method upsertStreams.
private List<Long> upsertStreams(final long playlistId, final List<StreamEntity> streams, final int indexOffset) {
List<PlaylistStreamEntity> joinEntities = new ArrayList<>(streams.size());
final List<Long> streamIds = streamTable.upsertAll(streams);
for (int index = 0; index < streamIds.size(); index++) {
joinEntities.add(new PlaylistStreamEntity(playlistId, streamIds.get(index), index + indexOffset));
}
return playlistStreamTable.insertAll(joinEntities);
}
Aggregations