47 lines
1.3 KiB
Swift
47 lines
1.3 KiB
Swift
//
|
|
// BaseItemDto+Display.swift
|
|
// LuminateCore
|
|
//
|
|
// Created by Brendan Szymanski on 6/5/26.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension Components.Schemas.BaseItemPerson: Identifiable {}
|
|
|
|
extension Components.Schemas.BaseItemDto: Identifiable {}
|
|
|
|
extension Components.Schemas.SearchHint {
|
|
public 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"
|
|
}
|
|
}
|
|
|
|
extension Components.Schemas.BaseItemDto {
|
|
public 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 var yearString: String {
|
|
guard let year = productionYear else { return "" }
|
|
return "\(year)"
|
|
}
|
|
|
|
public var primaryImageTag: String? {
|
|
imageTags?.additionalProperties["Primary"]
|
|
}
|
|
|
|
public var backdropImageTag: String? {
|
|
backdropImageTags?.first
|
|
}
|
|
}
|