Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show latest from channel #4352

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand All @@ -24,7 +27,8 @@ export default defineComponent({
...mapActions([
'updateHideWatchedSubs',
'updateUseRssFeeds',
'updateFetchSubscriptionsAutomatically'
'updateFetchSubscriptionsAutomatically',
'updateOnlyShowLatestFromChannel'
])
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
:compact="true"
@change="updateHideWatchedSubs"
/>
<ft-toggle-switch
:label="$t('Settings.Subscription Settings.Only Show Latest Video from Channel')"
kommunarr marked this conversation as resolved.
Show resolved Hide resolved
:default-value="onlyShowLatestFromChannel"
:compact="true"
@change="updateOnlyShowLatestFromChannel"
/>
</div>
</div>
</ft-settings-section>
Expand Down
21 changes: 17 additions & 4 deletions src/renderer/helpers/subscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,19 @@ 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.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
})
}

if (store.getters.getHideLiveStreams) {
videoList = videoList.filter(item => {
Expand Down Expand Up @@ -45,6 +54,10 @@ export function updateVideoListAfterProcessing(videos) {
})
}

videoList.sort((a, b) => {
return b.publishedDate - a.publishedDate
})

return videoList
}

Expand Down
1 change: 1 addition & 0 deletions src/renderer/store/modules/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ const state = {
landingPage: 'subscriptions',
listType: 'grid',
maxVideoPlaybackRate: 3,
onlyShowLatestFromChannel: false,
playNextVideo: false,
proxyHostname: '127.0.0.1',
proxyPort: '9050',
Expand Down
1 change: 1 addition & 0 deletions static/locales/en-US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ Settings:
Fetch Feeds from RSS: Fetch Feeds from RSS
Manage Subscriptions: Manage Subscriptions
Fetch Automatically: Fetch Feed Automatically
Only Show Latest Video from Channel: Only Show Latest Video from Channel
kommunarr marked this conversation as resolved.
Show resolved Hide resolved
Distraction Free Settings:
Distraction Free Settings: Distraction Free Settings
Sections:
Expand Down