Fix hiding finished streams in groups; new stream state validity condition

Consider stream state valid also if >1/4 of video was watched
This commit is contained in:
Stypox 2021-06-07 09:43:08 +02:00
parent 0113ad5e14
commit 2142f05a88
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23
3 changed files with 40 additions and 10 deletions

View file

@ -211,11 +211,11 @@ public class HistoryRecordManager {
public Maybe<StreamStateEntity> loadStreamState(final PlayQueueItem queueItem) {
return queueItem.getStream()
.map((info) -> streamTable.upsert(new StreamEntity(info)))
.map(info -> streamTable.upsert(new StreamEntity(info)))
.flatMapPublisher(streamStateTable::getState)
.firstElement()
.flatMap(list -> list.isEmpty() ? Maybe.empty() : Maybe.just(list.get(0)))
.filter(StreamStateEntity::isValid)
.filter(state -> state.isValid(queueItem.getDuration()))
.subscribeOn(Schedulers.io());
}
@ -224,7 +224,7 @@ public class HistoryRecordManager {
.flatMapPublisher(streamStateTable::getState)
.firstElement()
.flatMap(list -> list.isEmpty() ? Maybe.empty() : Maybe.just(list.get(0)))
.filter(StreamStateEntity::isValid)
.filter(state -> state.isValid(info.getDuration()))
.subscribeOn(Schedulers.io());
}
@ -232,7 +232,7 @@ public class HistoryRecordManager {
return Completable.fromAction(() -> database.runInTransaction(() -> {
final long streamId = streamTable.upsert(new StreamEntity(info));
final StreamStateEntity state = new StreamStateEntity(streamId, progressMillis);
if (state.isValid()) {
if (state.isValid(info.getDuration())) {
streamStateTable.upsert(state);
}
})).subscribeOn(Schedulers.io());