From e656dd8d8be33c48f4bb4ddd35dc015baaf7ac8a Mon Sep 17 00:00:00 2001 From: Florian Zahn Date: Tue, 1 Apr 2025 22:53:28 +0200 Subject: [PATCH 1/5] feat: Option to auto-skip non-music on youtube music only --- maze-utils | 2 +- public/_locales | 2 +- .../options/CategorySkipOptionsComponent.tsx | 3 ++ src/config.ts | 2 ++ src/content.ts | 33 ++++++++++++++----- 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/maze-utils b/maze-utils index b22477a8..81b41498 160000 --- a/maze-utils +++ b/maze-utils @@ -1 +1 @@ -Subproject commit b22477a8640b407910b24d5bec13d0d6d4d3cf01 +Subproject commit 81b414988814f5735ac6fb621e95537680bdf42d diff --git a/public/_locales b/public/_locales index e9efadcf..e3997068 160000 --- a/public/_locales +++ b/public/_locales @@ -1 +1 @@ -Subproject commit e9efadcf82316b358e3f81cba71b20d7ed1ead86 +Subproject commit e399706837d1415c9875c4fba8044b204923324d diff --git a/src/components/options/CategorySkipOptionsComponent.tsx b/src/components/options/CategorySkipOptionsComponent.tsx index 99c4e973..d865abb2 100644 --- a/src/components/options/CategorySkipOptionsComponent.tsx +++ b/src/components/options/CategorySkipOptionsComponent.tsx @@ -243,6 +243,9 @@ class CategorySkipOptionsComponent extends React.Component void, image } function shouldAutoSkip(segment: SponsorTime): boolean { - return (!Config.config.manualSkipOnFullVideo || !sponsorTimes?.some((s) => s.category === segment.category && s.actionType === ActionType.Full)) - && (utils.getCategorySelection(segment.category)?.option === CategorySkipOption.AutoSkip || - (Config.config.autoSkipOnMusicVideos && sponsorTimes?.some((s) => s.category === "music_offtopic") - && segment.actionType === ActionType.Skip) - || sponsorTimesSubmitting.some((s) => s.segment === segment.segment)); + if (Config.config.manualSkipOnFullVideo && !sponsorTimes?.some((s) => s.category === segment.category && s.actionType === ActionType.Full)) { + return false; + } + + return ( // Normal skip + utils.getCategorySelection(segment.category)?.option === CategorySkipOption.AutoSkip + // Forbid skipping of non-music if we are not on Youtube Music + && !(segment.category === "music_offtopic" && Config.config.skipNonMusicOnlyOnYoutubeMusic && !isOnYouTubeMusic()) + ) + || + ( // Skip every segment, if it's a music video + + // Forbid autoSkipOnMusicVideos if if we are not on Youtube Music + !(Config.config.skipNonMusicOnlyOnYoutubeMusic && !isOnYouTubeMusic()) + && Config.config.autoSkipOnMusicVideos + && sponsorTimes?.some((s) => s.category === "music_offtopic") + && segment.actionType === ActionType.Skip + ) + || + sponsorTimesSubmitting.some((s) => s.segment === segment.segment); } function shouldSkip(segment: SponsorTime): boolean { - return (segment.actionType !== ActionType.Full - && segment.source !== SponsorSourceType.YouTube + if (segment.actionType === ActionType.Full) { + return false; + } + return (segment.source !== SponsorSourceType.YouTube && utils.getCategorySelection(segment.category)?.option !== CategorySkipOption.ShowOverlay) || (Config.config.autoSkipOnMusicVideos && sponsorTimes?.some((s) => s.category === "music_offtopic") && segment.actionType === ActionType.Skip); From 22da289151072fbdf7a8172123653998df05142e Mon Sep 17 00:00:00 2001 From: Ajay Date: Wed, 23 Apr 2025 21:21:07 -0400 Subject: [PATCH 2/5] Improve youtube music check code readability --- src/content.ts | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/content.ts b/src/content.ts index 1e1b42c8..b28075a6 100644 --- a/src/content.ts +++ b/src/content.ts @@ -1895,22 +1895,15 @@ function shouldAutoSkip(segment: SponsorTime): boolean { return false; } - return ( // Normal skip - utils.getCategorySelection(segment.category)?.option === CategorySkipOption.AutoSkip - // Forbid skipping of non-music if we are not on Youtube Music - && !(segment.category === "music_offtopic" && Config.config.skipNonMusicOnlyOnYoutubeMusic && !isOnYouTubeMusic()) - ) - || - ( // Skip every segment, if it's a music video + if (segment.category === "music_offtopic" && Config.config.skipNonMusicOnlyOnYoutubeMusic && !isOnYouTubeMusic()) { + return false; + } - // Forbid autoSkipOnMusicVideos if if we are not on Youtube Music - !(Config.config.skipNonMusicOnlyOnYoutubeMusic && !isOnYouTubeMusic()) - && Config.config.autoSkipOnMusicVideos - && sponsorTimes?.some((s) => s.category === "music_offtopic") - && segment.actionType === ActionType.Skip - ) - || - sponsorTimesSubmitting.some((s) => s.segment === segment.segment); + return (!Config.config.manualSkipOnFullVideo || !sponsorTimes?.some((s) => s.category === segment.category && s.actionType === ActionType.Full)) + && (utils.getCategorySelection(segment.category)?.option === CategorySkipOption.AutoSkip || + (Config.config.autoSkipOnMusicVideos && sponsorTimes?.some((s) => s.category === "music_offtopic") + && segment.actionType === ActionType.Skip) + || sponsorTimesSubmitting.some((s) => s.segment === segment.segment)); } function shouldSkip(segment: SponsorTime): boolean { From be11012096017f819a825a6fd348f10df012bbb8 Mon Sep 17 00:00:00 2001 From: Ajay Date: Wed, 23 Apr 2025 21:23:00 -0400 Subject: [PATCH 3/5] Remove unnecessary change --- src/content.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/content.ts b/src/content.ts index b28075a6..fd49addd 100644 --- a/src/content.ts +++ b/src/content.ts @@ -1907,13 +1907,11 @@ function shouldAutoSkip(segment: SponsorTime): boolean { } function shouldSkip(segment: SponsorTime): boolean { - if (segment.actionType === ActionType.Full) { - return false; - } - return (segment.source !== SponsorSourceType.YouTube - && utils.getCategorySelection(segment.category)?.option !== CategorySkipOption.ShowOverlay) - || (Config.config.autoSkipOnMusicVideos && sponsorTimes?.some((s) => s.category === "music_offtopic") - && segment.actionType === ActionType.Skip); + return (segment.actionType !== ActionType.Full + && segment.source !== SponsorSourceType.YouTube + && utils.getCategorySelection(segment.category)?.option !== CategorySkipOption.ShowOverlay) + || (Config.config.autoSkipOnMusicVideos && sponsorTimes?.some((s) => s.category === "music_offtopic") + && segment.actionType === ActionType.Skip); } /** Creates any missing buttons on the YouTube player if possible. */ From aeb3299c50904cc63596c775f27db186d970088a Mon Sep 17 00:00:00 2001 From: Ajay Date: Wed, 23 Apr 2025 21:23:56 -0400 Subject: [PATCH 4/5] update submodules --- maze-utils | 2 +- public/_locales | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/maze-utils b/maze-utils index 81b41498..9cef8e27 160000 --- a/maze-utils +++ b/maze-utils @@ -1 +1 @@ -Subproject commit 81b414988814f5735ac6fb621e95537680bdf42d +Subproject commit 9cef8e27cdc61acbb7b00db5a782106637ddcdbc diff --git a/public/_locales b/public/_locales index e3997068..314fe2ff 160000 --- a/public/_locales +++ b/public/_locales @@ -1 +1 @@ -Subproject commit e399706837d1415c9875c4fba8044b204923324d +Subproject commit 314fe2ff783797068eb291993662f3e117b07dad From 4826bcf7df4cb5616bc97525deb123f78750e358 Mon Sep 17 00:00:00 2001 From: Ajay Date: Wed, 23 Apr 2025 21:27:56 -0400 Subject: [PATCH 5/5] Remove unnecessary change --- src/content.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/content.ts b/src/content.ts index 3768c1a4..fb1298c6 100644 --- a/src/content.ts +++ b/src/content.ts @@ -1926,10 +1926,6 @@ function createButton(baseID: string, title: string, callback: () => void, image } function shouldAutoSkip(segment: SponsorTime): boolean { - if (Config.config.manualSkipOnFullVideo && !sponsorTimes?.some((s) => s.category === segment.category && s.actionType === ActionType.Full)) { - return false; - } - if (segment.category === "music_offtopic" && Config.config.skipNonMusicOnlyOnYoutubeMusic && !isOnYouTubeMusic()) { return false; }