diff --git a/src/renderer/components/subscription-settings/subscription-settings.js b/src/renderer/components/subscription-settings/subscription-settings.js index 303a5d20c..19404a4d6 100644 --- a/src/renderer/components/subscription-settings/subscription-settings.js +++ b/src/renderer/components/subscription-settings/subscription-settings.js @@ -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' ]) } }) diff --git a/src/renderer/components/subscription-settings/subscription-settings.vue b/src/renderer/components/subscription-settings/subscription-settings.vue index ad6269f8a..090e39c87 100644 --- a/src/renderer/components/subscription-settings/subscription-settings.vue +++ b/src/renderer/components/subscription-settings/subscription-settings.vue @@ -26,6 +26,12 @@ :compact="true" @change="updateHideWatchedSubs" /> + diff --git a/src/renderer/helpers/subscriptions.js b/src/renderer/helpers/subscriptions.js index 8ee8d78d8..c99b0b843 100644 --- a/src/renderer/helpers/subscriptions.js +++ b/src/renderer/helpers/subscriptions.js @@ -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 } diff --git a/src/renderer/store/modules/settings.js b/src/renderer/store/modules/settings.js index 037d446fe..4052e4351 100644 --- a/src/renderer/store/modules/settings.js +++ b/src/renderer/store/modules/settings.js @@ -230,6 +230,7 @@ const state = { landingPage: 'subscriptions', listType: 'grid', maxVideoPlaybackRate: 3, + onlyShowLatestFromChannel: false, playNextVideo: false, proxyHostname: '127.0.0.1', proxyPort: '9050', diff --git a/static/locales/en-US.yaml b/static/locales/en-US.yaml index 301f53b5d..1fbe3e902 100644 --- a/static/locales/en-US.yaml +++ b/static/locales/en-US.yaml @@ -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: