40 lines
1.1 KiB
Swift
40 lines
1.1 KiB
Swift
import Foundation
|
|
|
|
extension Components.Schemas.BaseItemPerson: Identifiable { }
|
|
|
|
extension Components.Schemas.BaseItemDto: Identifiable { }
|
|
|
|
public extension Components.Schemas.SearchHint {
|
|
var runtimeString: String {
|
|
guard let ticks = runTimeTicks else { return "" }
|
|
let totalSeconds = Int(ticks / 10_000_000)
|
|
let hours = totalSeconds / 3600
|
|
let minutes = (totalSeconds % 3600) / 60
|
|
if hours > 0 { return "\(hours)h \(minutes)m" }
|
|
return "\(minutes)m"
|
|
}
|
|
}
|
|
|
|
public extension Components.Schemas.BaseItemDto {
|
|
var runtimeString: String {
|
|
guard let ticks = runTimeTicks else { return "" }
|
|
let totalSeconds = Int(ticks / 10_000_000)
|
|
let hours = totalSeconds / 3600
|
|
let minutes = (totalSeconds % 3600) / 60
|
|
if hours > 0 { return "\(hours)h \(minutes)m" }
|
|
return "\(minutes)m"
|
|
}
|
|
|
|
var yearString: String {
|
|
guard let year = productionYear else { return "" }
|
|
return "\(year)"
|
|
}
|
|
|
|
var primaryImageTag: String? {
|
|
imageTags?.additionalProperties["Primary"]
|
|
}
|
|
|
|
var backdropImageTag: String? {
|
|
backdropImageTags?.first
|
|
}
|
|
}
|