Skip to content

Commit

Permalink
Fix Hide Channels and Hide Premier settings (#3673)
Browse files Browse the repository at this point in the history
* fix for invidious (+6 squashed commits)
Squashed commits:
[65932b4] update playlist and channel filtering
[952a721] update subscriptions js to use premiereDate over durationText
[530dea9] Add back isRSS and viewcount check to fix when in subscriptions page
[93ebb76] Fix hide premiere
[de7a8b4] ft-list-lazy-wrapper put whitespace back to what it was
[8dadb59] move showResult from a method to a computed to work with v-if

* Fix Hide Premier for Invidous API

* Refactor code to be more redable with better doc

---------

Co-authored-by: petaded <[email protected]>
Co-authored-by: PikachuEXE <[email protected]>
  • Loading branch information
3 people authored Jul 9, 2023
1 parent f7b7fe5 commit 3eb657c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ export default defineComponent({
if (this.hideUpcomingPremieres &&
// Observed for premieres in Local API Channels.
(data.premiereDate != null ||
// Invidious API
// `premiereTimestamp` only available on premiered videos
// https://docs.invidious.io/api/common_types/#videoobject
data.premiereTimestamp != null ||
// viewCount is our only method of detecting premieres in RSS
// data without sending an additional request.
// If we ever get a better flag, use it here instead.
Expand All @@ -79,12 +83,30 @@ export default defineComponent({
return false
}
} else if (data.type === 'channel') {
if (this.channelsHidden.includes(data.channelID) || this.channelsHidden.includes(data.name)) {
const attrsToCheck = [
// Local API
data.id,
data.name,
// Invidious API
// https://docs.invidious.io/api/common_types/#channelobject
data.author,
data.authorId,
]
if (attrsToCheck.some(a => a != null && this.channelsHidden.includes(a))) {
// hide channels by author
return false
}
} else if (data.type === 'playlist') {
if (this.channelsHidden.includes(data.authorId) || this.channelsHidden.includes(data.author)) {
const attrsToCheck = [
// Local API
data.channelId,
data.channelName,
// Invidious API
// https://docs.invidious.io/api/common_types/#playlistobject
data.author,
data.authorId,
]
if (attrsToCheck.some(a => a != null && this.channelsHidden.includes(a))) {
// hide playlists by author
return false
}
Expand Down
7 changes: 6 additions & 1 deletion src/renderer/views/Subscriptions/Subscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,12 @@ export default defineComponent({
return item.viewCount !== '0'
}
// Observed for premieres in Local API Subscriptions.
return item.premiereDate == null
return (item.premiereDate == null ||
// Invidious API
// `premiereTimestamp` only available on premiered videos
// https://docs.invidious.io/api/common_types/#videoobject
item.premiereTimestamp == null
)
})
}

Expand Down

0 comments on commit 3eb657c

Please sign in to comment.