2022-08-08 20:29:07 +00:00
|
|
|
//
|
2022-08-16 02:37:47 +00:00
|
|
|
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
|
2022-08-08 20:29:07 +00:00
|
|
|
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
|
|
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
//
|
2024-02-19 03:34:53 +00:00
|
|
|
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
|
2022-08-08 20:29:07 +00:00
|
|
|
//
|
2022-08-08 20:21:06 +00:00
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import Get
|
|
|
|
import URLQueryEncoder
|
|
|
|
|
2022-08-17 21:08:41 +00:00
|
|
|
public extension Paths {
|
2022-08-08 20:21:06 +00:00
|
|
|
/// Gets subtitles in a specified format.
|
2022-08-17 21:08:41 +00:00
|
|
|
static func getSubtitleWithTicks(
|
|
|
|
routeItemID: String,
|
|
|
|
routeMediaSourceID: String,
|
|
|
|
routeIndex: Int,
|
|
|
|
routeStartPositionTicks: Int,
|
|
|
|
routeFormat: String,
|
|
|
|
parameters: GetSubtitleWithTicksParameters? = nil
|
|
|
|
) -> Request<String> {
|
|
|
|
Request(
|
2023-08-30 22:09:52 +00:00
|
|
|
path: "/Videos/\(routeItemID)/\(routeMediaSourceID)/Subtitles/\(routeIndex)/\(routeStartPositionTicks)/Stream.\(routeFormat)",
|
2022-08-17 21:08:41 +00:00
|
|
|
method: "GET",
|
|
|
|
query: parameters?.asQuery,
|
|
|
|
id: "GetSubtitleWithTicks"
|
|
|
|
)
|
2022-08-08 20:21:06 +00:00
|
|
|
}
|
|
|
|
|
2022-08-17 21:08:41 +00:00
|
|
|
struct GetSubtitleWithTicksParameters {
|
2022-08-17 16:43:04 +00:00
|
|
|
public var itemID: String?
|
2022-08-08 20:21:06 +00:00
|
|
|
public var mediaSourceID: String?
|
2023-04-12 19:10:22 +00:00
|
|
|
public var index: Int?
|
|
|
|
public var startPositionTicks: Int?
|
2022-08-08 20:21:06 +00:00
|
|
|
public var format: String?
|
2023-04-12 19:10:22 +00:00
|
|
|
public var endPositionTicks: Int?
|
2022-08-08 20:21:06 +00:00
|
|
|
public var isCopyTimestamps: Bool?
|
|
|
|
public var isAddVttTimeMap: Bool?
|
|
|
|
|
2022-08-17 21:08:41 +00:00
|
|
|
public init(
|
|
|
|
itemID: String? = nil,
|
|
|
|
mediaSourceID: String? = nil,
|
2023-04-12 19:10:22 +00:00
|
|
|
index: Int? = nil,
|
|
|
|
startPositionTicks: Int? = nil,
|
2022-08-17 21:08:41 +00:00
|
|
|
format: String? = nil,
|
2023-04-12 19:10:22 +00:00
|
|
|
endPositionTicks: Int? = nil,
|
2022-08-17 21:08:41 +00:00
|
|
|
isCopyTimestamps: Bool? = nil,
|
|
|
|
isAddVttTimeMap: Bool? = nil
|
|
|
|
) {
|
2022-08-08 20:21:06 +00:00
|
|
|
self.itemID = itemID
|
|
|
|
self.mediaSourceID = mediaSourceID
|
|
|
|
self.index = index
|
|
|
|
self.startPositionTicks = startPositionTicks
|
|
|
|
self.format = format
|
|
|
|
self.endPositionTicks = endPositionTicks
|
|
|
|
self.isCopyTimestamps = isCopyTimestamps
|
|
|
|
self.isAddVttTimeMap = isAddVttTimeMap
|
|
|
|
}
|
|
|
|
|
|
|
|
public var asQuery: [(String, String?)] {
|
|
|
|
let encoder = URLQueryEncoder()
|
|
|
|
encoder.encode(itemID, forKey: "itemId")
|
|
|
|
encoder.encode(mediaSourceID, forKey: "mediaSourceId")
|
|
|
|
encoder.encode(index, forKey: "index")
|
|
|
|
encoder.encode(startPositionTicks, forKey: "startPositionTicks")
|
|
|
|
encoder.encode(format, forKey: "format")
|
|
|
|
encoder.encode(endPositionTicks, forKey: "endPositionTicks")
|
|
|
|
encoder.encode(isCopyTimestamps, forKey: "copyTimestamps")
|
|
|
|
encoder.encode(isAddVttTimeMap, forKey: "addVttTimeMap")
|
|
|
|
return encoder.items
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|