feat: show optional SponsorBlock ranges on playback timeline
This commit is contained in:
@@ -8,17 +8,20 @@ public enum CompactTitleProgress: String, Decodable, Sendable {
|
||||
public struct PlayerConfiguration: Equatable, Sendable {
|
||||
public var showBufferInfo: Bool
|
||||
public var automaticQuality: Bool
|
||||
public var sponsorBlock: Bool
|
||||
public var snapToEdges: Bool
|
||||
public var compactTitleProgress: CompactTitleProgress
|
||||
public var miruroVideoProvider: String
|
||||
public var miruroCaptionProvider: String
|
||||
public var keys: KeyBindings
|
||||
|
||||
public init(showBufferInfo: Bool = false, automaticQuality: Bool = false, snapToEdges: Bool = true,
|
||||
public init(showBufferInfo: Bool = false, automaticQuality: Bool = false, sponsorBlock: 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.snapToEdges = snapToEdges
|
||||
self.compactTitleProgress = compactTitleProgress
|
||||
self.miruroVideoProvider = miruroVideoProvider
|
||||
@@ -33,6 +36,7 @@ public struct PlayerConfiguration: Equatable, Sendable {
|
||||
var lines = [
|
||||
"[playback]",
|
||||
"automatic_quality = \(defaults.automaticQuality)",
|
||||
"sponsorblock = \(defaults.sponsorBlock)",
|
||||
"", "[miruro]",
|
||||
"video_provider = \"\(defaults.miruroVideoProvider)\"",
|
||||
"caption_provider = \"\(defaults.miruroCaptionProvider)\"",
|
||||
@@ -91,6 +95,7 @@ public struct PlayerConfiguration: Equatable, Sendable {
|
||||
let values = try TOMLDecoder(isLenient: false).decode(FileConfiguration.self, from: data)
|
||||
return Self(showBufferInfo: values.ui?.bufferInfo ?? false,
|
||||
automaticQuality: values.playback?.automaticQuality ?? false,
|
||||
sponsorBlock: values.playback?.sponsorBlock ?? false,
|
||||
snapToEdges: values.ui?.compactSnapToEdges ?? true,
|
||||
compactTitleProgress: values.ui?.compactTitleProgress ?? .time,
|
||||
miruroVideoProvider: values.miruro?.videoProvider ?? "",
|
||||
@@ -175,10 +180,12 @@ public struct PlayerConfiguration: Equatable, Sendable {
|
||||
|
||||
private struct PlaybackConfiguration {
|
||||
let automaticQuality: Bool?
|
||||
let sponsorBlock: Bool?
|
||||
|
||||
init(container: KeyedDecodingContainer<SettingKey>) throws {
|
||||
try validate(container, allowed: ["automatic_quality"])
|
||||
try validate(container, allowed: ["automatic_quality", "sponsorblock"])
|
||||
automaticQuality = try container.decodeIfPresent(Bool.self, forKey: SettingKey("automatic_quality"))
|
||||
sponsorBlock = try container.decodeIfPresent(Bool.self, forKey: SettingKey("sponsorblock"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user