mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 05:23:41 +00:00
SponsorBlock align categories with upstream
This commit is contained in:
parent
d1cf45c6a1
commit
321eaecd21
@ -5,7 +5,7 @@ import Logging
|
|||||||
import SwiftyJSON
|
import SwiftyJSON
|
||||||
|
|
||||||
final class SponsorBlockAPI: ObservableObject {
|
final class SponsorBlockAPI: ObservableObject {
|
||||||
static let categories = ["sponsor", "selfpromo", "intro", "outro", "interaction", "music_offtopic"]
|
static let categories = ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "filler", "music_offtopic"]
|
||||||
|
|
||||||
let logger = Logger(label: "stream.yattee.app.sb")
|
let logger = Logger(label: "stream.yattee.app.sb")
|
||||||
|
|
||||||
@ -21,15 +21,19 @@ final class SponsorBlockAPI: ObservableObject {
|
|||||||
case "sponsor":
|
case "sponsor":
|
||||||
return "Sponsor".localized()
|
return "Sponsor".localized()
|
||||||
case "selfpromo":
|
case "selfpromo":
|
||||||
return "Self-promotion".localized()
|
return "Unpaid/Self Promotion".localized()
|
||||||
case "intro":
|
|
||||||
return "Intro".localized()
|
|
||||||
case "outro":
|
|
||||||
return "Outro".localized()
|
|
||||||
case "interaction":
|
case "interaction":
|
||||||
return "Interaction".localized()
|
return "Interaction Reminder (Subscribe)".localized()
|
||||||
|
case "intro":
|
||||||
|
return "Intermission/Intro Animation".localized()
|
||||||
|
case "outro":
|
||||||
|
return "Endcards/Credits".localized()
|
||||||
|
case "preview":
|
||||||
|
return "Preview/Recap/Hook".localized()
|
||||||
|
case "filler":
|
||||||
|
return "Filler Tangent/Jokes".localized()
|
||||||
case "music_offtopic":
|
case "music_offtopic":
|
||||||
return "Offtopic in Music Videos".localized()
|
return "Music: Non-Music Section".localized()
|
||||||
default:
|
default:
|
||||||
return name.capitalized
|
return name.capitalized
|
||||||
}
|
}
|
||||||
@ -46,9 +50,14 @@ final class SponsorBlockAPI: ObservableObject {
|
|||||||
"The creator will receive payment or compensation in the form of money or free products.").localized()
|
"The creator will receive payment or compensation in the form of money or free products.").localized()
|
||||||
|
|
||||||
case "selfpromo":
|
case "selfpromo":
|
||||||
return ("Promoting a product or service that is directly related to the creator themselves. " +
|
return ("The creator will not receive any payment in exchange for this promotion. " +
|
||||||
|
"This includes charity drives or free shout outs for products or other people they like.\n\n" +
|
||||||
|
"Promoting a product or service that is directly related to the creator themselves. " +
|
||||||
"This usually includes merchandise or promotion of monetized platforms.").localized()
|
"This usually includes merchandise or promotion of monetized platforms.").localized()
|
||||||
|
|
||||||
|
case "interaction":
|
||||||
|
return "Explicit reminders to like, subscribe or interact with them on any paid or free platform(s) (e.g. click on a video).".localized()
|
||||||
|
|
||||||
case "intro":
|
case "intro":
|
||||||
return ("Segments typically found at the start of a video that include an animation, " +
|
return ("Segments typically found at the start of a video that include an animation, " +
|
||||||
"still frame or clip which are also seen in other videos by the same creator.").localized()
|
"still frame or clip which are also seen in other videos by the same creator.").localized()
|
||||||
@ -56,8 +65,11 @@ final class SponsorBlockAPI: ObservableObject {
|
|||||||
case "outro":
|
case "outro":
|
||||||
return "Typically near or at the end of the video when the credits pop up and/or endcards are shown.".localized()
|
return "Typically near or at the end of the video when the credits pop up and/or endcards are shown.".localized()
|
||||||
|
|
||||||
case "interaction":
|
case "preview":
|
||||||
return "Explicit reminders to like, subscribe or interact with them on any paid or free platform(s) (e.g. click on a video).".localized()
|
return "Collection of clips that show what is coming up in in this video or other videos in a series where all information is repeated later in the video".localized()
|
||||||
|
|
||||||
|
case "filler":
|
||||||
|
return "Filler Tangent/ Jokes is only for tangential scenes added only for filler or humor that are not required to understand the main content of the video.".localized()
|
||||||
|
|
||||||
case "music_offtopic":
|
case "music_offtopic":
|
||||||
return "For videos which feature music as the primary content.".localized()
|
return "For videos which feature music as the primary content.".localized()
|
||||||
@ -100,8 +112,8 @@ final class SponsorBlockAPI: ObservableObject {
|
|||||||
self.segments = JSON(value).arrayValue.map(SponsorBlockSegment.init).sorted { $0.end < $1.end }
|
self.segments = JSON(value).arrayValue.map(SponsorBlockSegment.init).sorted { $0.end < $1.end }
|
||||||
|
|
||||||
self.logger.info("loaded \(self.segments.count) SponsorBlock segments")
|
self.logger.info("loaded \(self.segments.count) SponsorBlock segments")
|
||||||
self.segments.forEach {
|
for segment in self.segments {
|
||||||
self.logger.info("\($0.start) -> \($0.end)")
|
self.logger.info("\(segment.start) -> \(segment.end)")
|
||||||
}
|
}
|
||||||
case let .failure(error):
|
case let .failure(error):
|
||||||
self.segments = []
|
self.segments = []
|
||||||
|
@ -79,17 +79,18 @@ struct SponsorBlockSettings: View {
|
|||||||
ForEach(SponsorBlockAPI.categories, id: \.self) { category in
|
ForEach(SponsorBlockAPI.categories, id: \.self) { category in
|
||||||
Text(SponsorBlockAPI.categoryDescription(category) ?? "Category")
|
Text(SponsorBlockAPI.categoryDescription(category) ?? "Category")
|
||||||
.fontWeight(.bold)
|
.fontWeight(.bold)
|
||||||
|
.padding(.bottom, 0.5)
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.focusable()
|
.focusable()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Text(SponsorBlockAPI.categoryDetails(category) ?? "Details")
|
Text(SponsorBlockAPI.categoryDetails(category) ?? "Details")
|
||||||
.padding(.bottom, 3)
|
.padding(.bottom, 10)
|
||||||
.fixedSize(horizontal: false, vertical: true)
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
.padding(.top, 3)
|
.padding(.top, 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
func toggleCategory(_ category: String, value: Bool) {
|
func toggleCategory(_ category: String, value: Bool) {
|
||||||
|
@ -108,7 +108,7 @@
|
|||||||
"Enter fullscreen in landscape" = "Enter fullscreen in landscape";
|
"Enter fullscreen in landscape" = "Enter fullscreen in landscape";
|
||||||
"Error" = "Error";
|
"Error" = "Error";
|
||||||
"Error when accessing playlist" = "Error when accessing playlist";
|
"Error when accessing playlist" = "Error when accessing playlist";
|
||||||
"Explicit reminders to like, subscribe or interact with them on any paid or free platform(s) (e.g. click on a video)." = "Explicit reminders to like, subscribe or interact with them on any paid or free platform(s) (e.g. click on a video).\n";
|
"Explicit reminders to like, subscribe or interact with them on any paid or free platform(s) (e.g. click on a video)." = "Explicit reminders to like, subscribe or interact with them on any paid or free platform(s) (e.g. click on a video).";
|
||||||
"Favorites" = "Favorites";
|
"Favorites" = "Favorites";
|
||||||
"Filter" = "Filter";
|
"Filter" = "Filter";
|
||||||
"Filter: active" = "Filter: active";
|
"Filter: active" = "Filter: active";
|
||||||
|
Loading…
Reference in New Issue
Block a user