mirror of
https://github.com/FreeTubeApp/FreeTube
synced 2024-11-22 09:56:23 +01:00
Show latest from channel (#4352)
* Implement 'show latest video from channel' feature * Apply suggestions from code review Co-authored-by: PikachuEXE <pikachuexe@gmail.com> * Adjust ordering to maximize chance of content being presented --------- Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
This commit is contained in:
parent
e05827b482
commit
6af85b3726
@ -13,6 +13,9 @@ export default defineComponent({
|
||||
hideWatchedSubs: function () {
|
||||
return this.$store.getters.getHideWatchedSubs
|
||||
},
|
||||
onlyShowLatestFromChannel: function () {
|
||||
return this.$store.getters.getOnlyShowLatestFromChannel
|
||||
},
|
||||
useRssFeeds: function () {
|
||||
return this.$store.getters.getUseRssFeeds
|
||||
},
|
||||
@ -24,7 +27,8 @@ export default defineComponent({
|
||||
...mapActions([
|
||||
'updateHideWatchedSubs',
|
||||
'updateUseRssFeeds',
|
||||
'updateFetchSubscriptionsAutomatically'
|
||||
'updateFetchSubscriptionsAutomatically',
|
||||
'updateOnlyShowLatestFromChannel'
|
||||
])
|
||||
}
|
||||
})
|
||||
|
@ -26,6 +26,12 @@
|
||||
:compact="true"
|
||||
@change="updateHideWatchedSubs"
|
||||
/>
|
||||
<ft-toggle-switch
|
||||
:label="$t('Settings.Subscription Settings.Only Show Latest Video for Each Channel')"
|
||||
:default-value="onlyShowLatestFromChannel"
|
||||
:compact="true"
|
||||
@change="updateOnlyShowLatestFromChannel"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</ft-settings-section>
|
||||
|
@ -8,11 +8,6 @@ import { calculatePublishedDate } from './utils'
|
||||
export function updateVideoListAfterProcessing(videos) {
|
||||
let videoList = videos
|
||||
|
||||
// Filtering and sorting based in preference
|
||||
videoList.sort((a, b) => {
|
||||
return b.publishedDate - a.publishedDate
|
||||
})
|
||||
|
||||
if (store.getters.getHideLiveStreams) {
|
||||
videoList = videoList.filter(item => {
|
||||
return (!item.liveNow && !item.isUpcoming)
|
||||
@ -45,6 +40,26 @@ export function updateVideoListAfterProcessing(videos) {
|
||||
})
|
||||
}
|
||||
|
||||
// ordered last to show first eligible video from channel
|
||||
// if the first one incidentally failed one of the above checks
|
||||
if (store.getters.getOnlyShowLatestFromChannel) {
|
||||
const authors = new Set()
|
||||
videoList = videoList.filter((video) => {
|
||||
if (!video.authorId) {
|
||||
return true
|
||||
} else if (!authors.has(video.authorId)) {
|
||||
authors.add(video.authorId)
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
})
|
||||
}
|
||||
|
||||
videoList.sort((a, b) => {
|
||||
return b.publishedDate - a.publishedDate
|
||||
})
|
||||
|
||||
return videoList
|
||||
}
|
||||
|
||||
|
@ -230,6 +230,7 @@ const state = {
|
||||
landingPage: 'subscriptions',
|
||||
listType: 'grid',
|
||||
maxVideoPlaybackRate: 3,
|
||||
onlyShowLatestFromChannel: false,
|
||||
playNextVideo: false,
|
||||
proxyHostname: '127.0.0.1',
|
||||
proxyPort: '9050',
|
||||
|
@ -339,6 +339,7 @@ Settings:
|
||||
Fetch Feeds from RSS: Fetch Feeds from RSS
|
||||
Manage Subscriptions: Manage Subscriptions
|
||||
Fetch Automatically: Fetch Feed Automatically
|
||||
Only Show Latest Video for Each Channel: Only Show Latest Video for Each Channel
|
||||
Distraction Free Settings:
|
||||
Distraction Free Settings: Distraction Free Settings
|
||||
Sections:
|
||||
|
Loading…
Reference in New Issue
Block a user