mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-08-08 09:09:48 +00:00
Fix channels updating while they shouldnt
This commit is contained in:
parent
4655d8369d
commit
25527997fa
1 changed files with 13 additions and 3 deletions
|
@ -6,6 +6,7 @@ import com.futo.platformplayer.api.media.models.channels.SerializedChannel
|
||||||
import com.futo.platformplayer.api.media.models.contents.IPlatformContent
|
import com.futo.platformplayer.api.media.models.contents.IPlatformContent
|
||||||
import com.futo.platformplayer.api.media.models.contents.IPlatformContentDetails
|
import com.futo.platformplayer.api.media.models.contents.IPlatformContentDetails
|
||||||
import com.futo.platformplayer.getNowDiffDays
|
import com.futo.platformplayer.getNowDiffDays
|
||||||
|
import com.futo.platformplayer.logging.Logger
|
||||||
import com.futo.platformplayer.serializers.OffsetDateTimeSerializer
|
import com.futo.platformplayer.serializers.OffsetDateTimeSerializer
|
||||||
import com.futo.platformplayer.states.StatePlatform
|
import com.futo.platformplayer.states.StatePlatform
|
||||||
import com.futo.platformplayer.states.StateSubscriptions
|
import com.futo.platformplayer.states.StateSubscriptions
|
||||||
|
@ -56,9 +57,9 @@ class Subscription {
|
||||||
fun shouldFetchVideos() = doFetchVideos &&
|
fun shouldFetchVideos() = doFetchVideos &&
|
||||||
(lastVideo.getNowDiffDays() < 30 || lastVideoUpdate.getNowDiffDays() >= 1) &&
|
(lastVideo.getNowDiffDays() < 30 || lastVideoUpdate.getNowDiffDays() >= 1) &&
|
||||||
(lastVideo.getNowDiffDays() < 180 || lastVideoUpdate.getNowDiffDays() >= 3);
|
(lastVideo.getNowDiffDays() < 180 || lastVideoUpdate.getNowDiffDays() >= 3);
|
||||||
fun shouldFetchStreams() = doFetchStreams && lastLiveStream.getNowDiffDays() < 7;
|
fun shouldFetchStreams() = doFetchStreams && (lastLiveStream.getNowDiffDays() < 7);
|
||||||
fun shouldFetchLiveStreams() = doFetchLive && lastLiveStream.getNowDiffDays() < 14;
|
fun shouldFetchLiveStreams() = doFetchLive && (lastLiveStream.getNowDiffDays() < 14);
|
||||||
fun shouldFetchPosts() = doFetchPosts && lastPost.getNowDiffDays() < 5;
|
fun shouldFetchPosts() = doFetchPosts && (lastPost.getNowDiffDays() < 5);
|
||||||
|
|
||||||
fun getClient() = StatePlatform.instance.getChannelClientOrNull(channel.url);
|
fun getClient() = StatePlatform.instance.getChannelClientOrNull(channel.url);
|
||||||
|
|
||||||
|
@ -105,30 +106,39 @@ class Subscription {
|
||||||
else {
|
else {
|
||||||
interval = 5;
|
interval = 5;
|
||||||
mostRecent = null;
|
mostRecent = null;
|
||||||
|
Logger.i("Subscription", "Subscription [${channel.name}]:${type} no results found");
|
||||||
}
|
}
|
||||||
when(type) {
|
when(type) {
|
||||||
ResultCapabilities.TYPE_VIDEOS -> {
|
ResultCapabilities.TYPE_VIDEOS -> {
|
||||||
uploadInterval = interval;
|
uploadInterval = interval;
|
||||||
if(mostRecent != null)
|
if(mostRecent != null)
|
||||||
lastVideo = mostRecent;
|
lastVideo = mostRecent;
|
||||||
|
else if(lastVideo.year > 3000)
|
||||||
|
lastVideo = OffsetDateTime.MIN;
|
||||||
lastVideoUpdate = OffsetDateTime.now();
|
lastVideoUpdate = OffsetDateTime.now();
|
||||||
}
|
}
|
||||||
ResultCapabilities.TYPE_MIXED -> {
|
ResultCapabilities.TYPE_MIXED -> {
|
||||||
uploadInterval = interval;
|
uploadInterval = interval;
|
||||||
if(mostRecent != null)
|
if(mostRecent != null)
|
||||||
lastVideo = mostRecent;
|
lastVideo = mostRecent;
|
||||||
|
else if(lastVideo.year > 3000)
|
||||||
|
lastVideo = OffsetDateTime.MIN;
|
||||||
lastVideoUpdate = OffsetDateTime.now();
|
lastVideoUpdate = OffsetDateTime.now();
|
||||||
}
|
}
|
||||||
ResultCapabilities.TYPE_STREAMS -> {
|
ResultCapabilities.TYPE_STREAMS -> {
|
||||||
uploadStreamInterval = interval;
|
uploadStreamInterval = interval;
|
||||||
if(mostRecent != null)
|
if(mostRecent != null)
|
||||||
lastLiveStream = mostRecent;
|
lastLiveStream = mostRecent;
|
||||||
|
else if(lastLiveStream.year > 3000)
|
||||||
|
lastLiveStream = OffsetDateTime.MIN;
|
||||||
lastStreamUpdate = OffsetDateTime.now();
|
lastStreamUpdate = OffsetDateTime.now();
|
||||||
}
|
}
|
||||||
ResultCapabilities.TYPE_POSTS -> {
|
ResultCapabilities.TYPE_POSTS -> {
|
||||||
uploadPostInterval = interval;
|
uploadPostInterval = interval;
|
||||||
if(mostRecent != null)
|
if(mostRecent != null)
|
||||||
lastPost = mostRecent;
|
lastPost = mostRecent;
|
||||||
|
else if(lastPost.year > 3000)
|
||||||
|
lastPost = OffsetDateTime.MIN;
|
||||||
lastPostUpdate = OffsetDateTime.now();
|
lastPostUpdate = OffsetDateTime.now();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue