mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Fix channel save new video handling.
This commit is contained in:
parent
5efa4d22e5
commit
1d2ef196be
1 changed files with 9 additions and 7 deletions
|
@ -214,9 +214,11 @@ public class DatabaseHelper {
|
||||||
CollectionUtils.collectPreloadedTabs(info.getTabs())
|
CollectionUtils.collectPreloadedTabs(info.getTabs())
|
||||||
.stream()
|
.stream()
|
||||||
.parallel()
|
.parallel()
|
||||||
.map(tab -> {
|
.mapMulti((tab, consumer) -> {
|
||||||
try {
|
try {
|
||||||
return ChannelTabInfo.getInfo(YOUTUBE_SERVICE, tab).getRelatedItems();
|
ChannelTabInfo.getInfo(YOUTUBE_SERVICE, tab)
|
||||||
|
.getRelatedItems()
|
||||||
|
.forEach(consumer);
|
||||||
} catch (ExtractionException | IOException e) {
|
} catch (ExtractionException | IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -224,11 +226,11 @@ public class DatabaseHelper {
|
||||||
.filter(StreamInfoItem.class::isInstance)
|
.filter(StreamInfoItem.class::isInstance)
|
||||||
.map(StreamInfoItem.class::cast)
|
.map(StreamInfoItem.class::cast)
|
||||||
.forEach(item -> {
|
.forEach(item -> {
|
||||||
long time = item.getUploadDate() != null
|
long time = item.getUploadDate() != null
|
||||||
? item.getUploadDate().offsetDateTime().toInstant().toEpochMilli()
|
? item.getUploadDate().offsetDateTime().toInstant().toEpochMilli()
|
||||||
: System.currentTimeMillis();
|
: System.currentTimeMillis();
|
||||||
if ((System.currentTimeMillis() - time) < TimeUnit.DAYS.toMillis(Constants.FEED_RETENTION))
|
if ((System.currentTimeMillis() - time) < TimeUnit.DAYS.toMillis(Constants.FEED_RETENTION))
|
||||||
VideoHelpers.handleNewVideo(item.getUrl(), time, channel);
|
VideoHelpers.handleNewVideo(item.getUrl(), time, channel);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue