Skip to content

Commit f60d4f9

Browse files
fix: feed doesn't fetch live tab
1 parent e4ec120 commit f60d4f9

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

android/src/main/kotlin/project/pipepipe/app/service/FeedWorker.kt

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,39 @@ class FeedWorker(
119119

120120
DatabaseOperations.insertOrUpdateSubscription(result.info!! as ChannelInfo, true)
121121

122+
var streamInfoList = mutableListOf<StreamInfo>()
123+
122124
if (result.pagedData != null) {
125+
streamInfoList.addAll(result.pagedData!!.itemList as List<StreamInfo>)
126+
}
127+
128+
val channelInfo = result.info as ChannelInfo
129+
val fetchChannelTabs = SharedContext.settingsManager.getStringSet("feed_fetch_channel_tabs_key", setOf("fetch_channel_tabs_videos"))
130+
if (!fetchChannelTabs.contains("fetch_channel_tabs_videos")) {
131+
streamInfoList.clear()
132+
}
133+
val fetchLiveTabs = fetchChannelTabs.contains("fetch_channel_tabs_live")
134+
135+
if (fetchLiveTabs) {
136+
val liveTab = channelInfo.tabs.find { it.type.name == "LIVE" }
137+
if (liveTab != null) {
138+
val liveResult = withContext(Dispatchers.IO) {
139+
executeJobFlow(
140+
SupportedJobType.FETCH_FIRST_PAGE,
141+
liveTab.url,
142+
subscription.service_id
143+
)
144+
}
145+
if (liveResult.pagedData != null) {
146+
streamInfoList.addAll(liveResult.pagedData!!.itemList as List<StreamInfo>)
147+
}
148+
}
149+
}
150+
151+
if (streamInfoList.isNotEmpty()) {
123152
DatabaseOperations.updateSubscriptionFeed(
124153
subscription.url!!,
125-
result.pagedData!!.itemList as List<StreamInfo>
154+
streamInfoList
126155
)
127156
} else {
128157
failedCount.incrementAndGet()

library/src/commonMain/kotlin/project/pipepipe/app/ui/screens/settings/FeedSettingsScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ fun FeedSettingsScreen(
177177
summary = stringResource(MR.strings.feed_fetch_channel_tabs_summary),
178178
entries = feedFetchChannelTabsEntries,
179179
entryValues = feedFetchChannelTabsValues,
180-
defaultValues = feedFetchChannelTabsValues.toSet(),
180+
defaultValues = setOf("fetch_channel_tabs_videos"),
181181
onValuesChange = { values ->
182182
feedFetchChannelTabsValue = values
183183
}

0 commit comments

Comments
 (0)