1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 05:40:32 +05:30
yattee/Model/ThumbnailsModel.swift
Arkadiusz Fal 321c265a11 Player controls UI changes
WIP on controls

Chapters

working

Add previews variable

Add lists ids

WIP
2022-10-27 18:03:57 +02:00

31 lines
650 B
Swift

import Foundation
final class ThumbnailsModel: ObservableObject {
@Published var unloadable = Set<URL>()
func insertUnloadable(_ url: URL) {
unloadable.insert(url)
}
func isUnloadable(_ url: URL!) -> Bool {
guard !url.isNil else {
return true
}
return unloadable.contains(url)
}
func best(_ video: Video) -> URL? {
let qualities = [Thumbnail.Quality.default]
for quality in qualities {
let url = video.thumbnailURL(quality: quality)
if !isUnloadable(url) {
return url
}
}
return nil
}
}