diff --git a/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/JSClient.kt b/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/JSClient.kt index 2411ce72cdb3ea8df8f41c0159d3284fc98c524e..9b525fe6a385d28f80f458ac41398f15bcbafe38 100644 --- a/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/JSClient.kt +++ b/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/JSClient.kt @@ -584,7 +584,7 @@ open class JSClient : IPlatformClient { if(it.containsKey(claimType)) { val templates = it[claimType]; if(templates != null) - for(value in values.keys.sortedBy { it }) { + for(value in values.keys.sortedBy { if(it == config.primaryClaimFieldType) Int.MIN_VALUE else it }) { if(templates.containsKey(value)) { return templates[value]!!.replace("{{CLAIMVALUE}}", values[value]!!); } diff --git a/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/SourcePluginConfig.kt b/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/SourcePluginConfig.kt index bb8393d13a075b45d001d46a6e18de3c3b57343d..6320e983849265d400184abdd2cd3734b3a0bef5 100644 --- a/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/SourcePluginConfig.kt +++ b/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/SourcePluginConfig.kt @@ -45,7 +45,8 @@ class SourcePluginConfig( var subscriptionRateLimit: Int? = null, var enableInSearch: Boolean = true, var enableInHome: Boolean = true, - var supportedClaimTypes: List<Int> = listOf() + var supportedClaimTypes: List<Int> = listOf(), + var primaryClaimFieldType: Int? = null ) : IV8PluginConfig { val absoluteIconUrl: String? get() = resolveAbsoluteUrl(iconUrl, sourceUrl); diff --git a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/SubscriptionsFeedFragment.kt b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/SubscriptionsFeedFragment.kt index b391ad241141d2d4471bc415abff8c7a670aee3d..80107679f5691fbcfac9263033ad823863cc6082 100644 --- a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/SubscriptionsFeedFragment.kt +++ b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/SubscriptionsFeedFragment.kt @@ -178,7 +178,7 @@ class SubscriptionsFeedFragment : MainFragment() { val subRequestCounts = StateSubscriptions.instance.getSubscriptionRequestCount(); val reqCountStr = subRequestCounts.map { " ${it.key.config.name}: ${it.value}/${it.key.getSubscriptionRateLimit()}" }.joinToString("\n"); val rateLimitPlugins = subRequestCounts.filter { clientCount -> clientCount.key.getSubscriptionRateLimit()?.let { rateLimit -> clientCount.value > rateLimit } == true } - Logger.w(TAG, "Refreshing subscriptions with requests:\n" + reqCountStr); + Logger.w(TAG, "Trying to refreshing subscriptions with requests:\n" + reqCountStr); if(rateLimitPlugins.any()) throw RateLimitException(rateLimitPlugins.map { it.key.id }); } diff --git a/app/src/main/java/com/futo/platformplayer/states/StatePlatform.kt b/app/src/main/java/com/futo/platformplayer/states/StatePlatform.kt index 855d720f1066812b95761c298e43518c0400f9a8..e884573fa68a4d8d0de54a6d2de6df24948442b8 100644 --- a/app/src/main/java/com/futo/platformplayer/states/StatePlatform.kt +++ b/app/src/main/java/com/futo/platformplayer/states/StatePlatform.kt @@ -407,8 +407,9 @@ class StatePlatform { return@async searchResult; } catch(ex: Throwable) { Logger.e(TAG, "getHomeRefresh", ex); - throw ex; + //throw ex; //return@async null; + return@async PlaceholderPager(10, { PlatformContentPlaceholder(it.id, ex) }); } }); }.toList(); diff --git a/app/src/main/java/com/futo/platformplayer/states/StatePolycentric.kt b/app/src/main/java/com/futo/platformplayer/states/StatePolycentric.kt index 92ca426a46c62efa22503fd88b229a59f7850204..f294a6f93d7cca4b6834ca1776503e1ba1ff2cd3 100644 --- a/app/src/main/java/com/futo/platformplayer/states/StatePolycentric.kt +++ b/app/src/main/java/com/futo/platformplayer/states/StatePolycentric.kt @@ -144,14 +144,15 @@ class StatePolycentric { return DedupContentPager(pager, StatePlatform.instance.getEnabledClients().map { it.id }); } - fun getChannelUrls(url: String, channelId: PlatformID? = null): List<String> { + fun getChannelUrls(url: String, channelId: PlatformID? = null, cacheOnly: Boolean = false): List<String> { var polycentricProfile: PolycentricProfile? = null; try { polycentricProfile = PolycentricCache.instance.getCachedProfile(url)?.profile; if (polycentricProfile == null && channelId != null) { Logger.i("StateSubscriptions", "Get polycentric profile not cached"); - polycentricProfile = runBlocking { PolycentricCache.instance.getProfileAsync(channelId) }?.profile; + if(!cacheOnly) + polycentricProfile = runBlocking { PolycentricCache.instance.getProfileAsync(channelId) }?.profile; } else { Logger.i("StateSubscriptions", "Get polycentric profile cached"); } diff --git a/app/src/main/java/com/futo/platformplayer/states/StateSubscriptions.kt b/app/src/main/java/com/futo/platformplayer/states/StateSubscriptions.kt index c947852118b09407b1fce3c74830802c0554301e..430041b3ec7569afafb15d31a6b91624df11c194 100644 --- a/app/src/main/java/com/futo/platformplayer/states/StateSubscriptions.kt +++ b/app/src/main/java/com/futo/platformplayer/states/StateSubscriptions.kt @@ -241,7 +241,7 @@ class StateSubscriptions { fun getSubscriptionRequestCount(): Map<JSClient, Int> { return SubscriptionFetchAlgorithm.getAlgorithm(_algorithmSubscriptions, StateApp.instance.scope) - .countRequests(getSubscriptions()); + .countRequests(getSubscriptions().associateWith { StatePolycentric.instance.getChannelUrls(it.channel.url, it.channel.id, true) }); } fun getSubscriptionsFeedWithExceptions(allowFailure: Boolean = false, withCacheFallback: Boolean = false, cacheScope: CoroutineScope, onProgress: ((Int, Int)->Unit)? = null, onNewCacheHit: ((Subscription, IPlatformContent)->Unit)? = null): Pair<IPager<IPlatformContent>, List<Throwable>> { diff --git a/app/src/main/java/com/futo/platformplayer/subscription/SmartSubscriptionAlgorithm.kt b/app/src/main/java/com/futo/platformplayer/subscription/SmartSubscriptionAlgorithm.kt index 5df4f381ed27e2896820df4436af94bfb8473c0d..720fb75c9d259e19cdc779def15ea742df1e7d13 100644 --- a/app/src/main/java/com/futo/platformplayer/subscription/SmartSubscriptionAlgorithm.kt +++ b/app/src/main/java/com/futo/platformplayer/subscription/SmartSubscriptionAlgorithm.kt @@ -33,7 +33,7 @@ class SmartSubscriptionAlgorithm( val client = it.value!! as JSClient; val capabilities = client.getChannelCapabilities(); - if(capabilities.hasType(ResultCapabilities.TYPE_MIXED)) + if(capabilities.hasType(ResultCapabilities.TYPE_MIXED) || capabilities.types.isEmpty()) return@flatMap listOf(SubscriptionTask(client, sub, it.key, ResultCapabilities.TYPE_MIXED)); else { val types = listOf( diff --git a/app/src/main/java/com/futo/platformplayer/subscription/SubscriptionsTaskFetchAlgorithm.kt b/app/src/main/java/com/futo/platformplayer/subscription/SubscriptionsTaskFetchAlgorithm.kt index f4623d3c52d35e5dd694003217eef99f86958915..a66c4734c1efb0e5b62d3f3b7aebdcfdf9ef0450 100644 --- a/app/src/main/java/com/futo/platformplayer/subscription/SubscriptionsTaskFetchAlgorithm.kt +++ b/app/src/main/java/com/futo/platformplayer/subscription/SubscriptionsTaskFetchAlgorithm.kt @@ -16,6 +16,7 @@ import com.futo.platformplayer.engine.exceptions.ScriptCaptchaRequiredException import com.futo.platformplayer.engine.exceptions.ScriptCriticalException import com.futo.platformplayer.exceptions.ChannelException import com.futo.platformplayer.findNonRuntimeException +import com.futo.platformplayer.fragment.mainactivity.main.SubscriptionsFeedFragment import com.futo.platformplayer.logging.Logger import com.futo.platformplayer.models.Subscription import com.futo.platformplayer.states.StatePlatform @@ -46,9 +47,10 @@ abstract class SubscriptionsTaskFetchAlgorithm( val tasksGrouped = tasks.groupBy { it.client } val taskCount = tasks.filter { !it.fromCache }.size; val cacheCount = tasks.size - taskCount; + Logger.i(TAG, "Starting Subscriptions Fetch:\n" + - " Tasks: ${taskCount}\n" + - " Cached: ${cacheCount}"); + tasksGrouped.map { " ${it.key.name}: ${it.value.count { !it.fromCache }}, Cached(${it.value.count { it.fromCache } })" }.joinToString("\n")); + try { for(clientTasks in tasksGrouped) { val clientTaskCount = clientTasks.value.filter { !it.fromCache }.size; diff --git a/app/src/unstable/assets/sources/odysee b/app/src/unstable/assets/sources/odysee index 948835fa682b6e536bf05f66b426144ef5b47e69..b6db44bf3ba2825fca9b86c3867204467cfb334f 160000 --- a/app/src/unstable/assets/sources/odysee +++ b/app/src/unstable/assets/sources/odysee @@ -1 +1 @@ -Subproject commit 948835fa682b6e536bf05f66b426144ef5b47e69 +Subproject commit b6db44bf3ba2825fca9b86c3867204467cfb334f diff --git a/app/src/unstable/assets/sources/youtube b/app/src/unstable/assets/sources/youtube index ae803c9295cf3d53aa49ddc2799d0f86aecc06a6..fca0ba3d5ae20baf0586cfea1f716ef4bc00c2f7 160000 --- a/app/src/unstable/assets/sources/youtube +++ b/app/src/unstable/assets/sources/youtube @@ -1 +1 @@ -Subproject commit ae803c9295cf3d53aa49ddc2799d0f86aecc06a6 +Subproject commit fca0ba3d5ae20baf0586cfea1f716ef4bc00c2f7