feat: add opening/ending autoskip and correct sponsor hover anchors
Sponsor hover labels used the overlapping chapter midpoint; retain chapter-title lookup but anchor the label to the sponsored range midpoint.
This commit is contained in:
@@ -10,6 +10,7 @@ public struct PlayerConfiguration: Equatable, Sendable {
|
||||
public var automaticQuality: Bool
|
||||
public var sponsorBlock: Bool
|
||||
public var sponsorBlockAutoSkip: Bool
|
||||
public var openingEndingAutoSkip: Bool
|
||||
public var snapToEdges: Bool
|
||||
public var compactTitleProgress: CompactTitleProgress
|
||||
public var miruroVideoProvider: String
|
||||
@@ -17,13 +18,14 @@ public struct PlayerConfiguration: Equatable, Sendable {
|
||||
public var keys: KeyBindings
|
||||
|
||||
public init(showBufferInfo: Bool = false, automaticQuality: Bool = false, sponsorBlock: Bool = false,
|
||||
sponsorBlockAutoSkip: Bool = false, snapToEdges: Bool = true,
|
||||
sponsorBlockAutoSkip: Bool = false, openingEndingAutoSkip: Bool = false, snapToEdges: Bool = true,
|
||||
compactTitleProgress: CompactTitleProgress = .time, miruroVideoProvider: String = "",
|
||||
miruroCaptionProvider: String = "", keys: KeyBindings = KeyBindings()) {
|
||||
self.showBufferInfo = showBufferInfo
|
||||
self.automaticQuality = automaticQuality
|
||||
self.sponsorBlock = sponsorBlock
|
||||
self.sponsorBlockAutoSkip = sponsorBlockAutoSkip
|
||||
self.openingEndingAutoSkip = openingEndingAutoSkip
|
||||
self.snapToEdges = snapToEdges
|
||||
self.compactTitleProgress = compactTitleProgress
|
||||
self.miruroVideoProvider = miruroVideoProvider
|
||||
@@ -40,6 +42,7 @@ public struct PlayerConfiguration: Equatable, Sendable {
|
||||
"automatic_quality = \(defaults.automaticQuality)",
|
||||
"sponsorblock = \(defaults.sponsorBlock)",
|
||||
"sponsorblock_autoskip = \(defaults.sponsorBlockAutoSkip)",
|
||||
"opening_ending_autoskip = \(defaults.openingEndingAutoSkip)",
|
||||
"", "[miruro]",
|
||||
"video_provider = \"\(defaults.miruroVideoProvider)\"",
|
||||
"caption_provider = \"\(defaults.miruroCaptionProvider)\"",
|
||||
@@ -100,6 +103,7 @@ public struct PlayerConfiguration: Equatable, Sendable {
|
||||
automaticQuality: values.playback?.automaticQuality ?? false,
|
||||
sponsorBlock: values.playback?.sponsorBlock ?? false,
|
||||
sponsorBlockAutoSkip: values.playback?.sponsorBlockAutoSkip ?? false,
|
||||
openingEndingAutoSkip: values.playback?.openingEndingAutoSkip ?? false,
|
||||
snapToEdges: values.ui?.compactSnapToEdges ?? true,
|
||||
compactTitleProgress: values.ui?.compactTitleProgress ?? .time,
|
||||
miruroVideoProvider: values.miruro?.videoProvider ?? "",
|
||||
@@ -186,12 +190,15 @@ public struct PlayerConfiguration: Equatable, Sendable {
|
||||
let automaticQuality: Bool?
|
||||
let sponsorBlock: Bool?
|
||||
let sponsorBlockAutoSkip: Bool?
|
||||
let openingEndingAutoSkip: Bool?
|
||||
|
||||
init(container: KeyedDecodingContainer<SettingKey>) throws {
|
||||
try validate(container, allowed: ["automatic_quality", "sponsorblock", "sponsorblock_autoskip"])
|
||||
try validate(container, allowed: ["automatic_quality", "sponsorblock", "sponsorblock_autoskip",
|
||||
"opening_ending_autoskip"])
|
||||
automaticQuality = try container.decodeIfPresent(Bool.self, forKey: SettingKey("automatic_quality"))
|
||||
sponsorBlock = try container.decodeIfPresent(Bool.self, forKey: SettingKey("sponsorblock"))
|
||||
sponsorBlockAutoSkip = try container.decodeIfPresent(Bool.self, forKey: SettingKey("sponsorblock_autoskip"))
|
||||
openingEndingAutoSkip = try container.decodeIfPresent(Bool.self, forKey: SettingKey("opening_ending_autoskip"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user