2021-07-07 22:39:18 +00:00
|
|
|
import Foundation
|
|
|
|
import SwiftyJSON
|
|
|
|
|
|
|
|
struct Thumbnail {
|
2021-07-22 12:43:13 +00:00
|
|
|
enum Quality: String, CaseIterable {
|
|
|
|
case maxres, maxresdefault, sddefault, high, medium, `default`, start, middle, end
|
2021-10-20 22:21:50 +00:00
|
|
|
|
|
|
|
var filename: String {
|
|
|
|
switch self {
|
|
|
|
case .maxres:
|
|
|
|
return "maxres"
|
|
|
|
case .maxresdefault:
|
|
|
|
return "maxresdefault"
|
|
|
|
case .sddefault:
|
|
|
|
return "sddefault"
|
|
|
|
case .high:
|
|
|
|
return "hqdefault"
|
|
|
|
case .medium:
|
|
|
|
return "mqdefault"
|
|
|
|
case .default:
|
|
|
|
return "default"
|
|
|
|
case .start:
|
|
|
|
return "1"
|
|
|
|
case .middle:
|
|
|
|
return "2"
|
|
|
|
case .end:
|
|
|
|
return "3"
|
|
|
|
}
|
|
|
|
}
|
2021-07-22 12:43:13 +00:00
|
|
|
}
|
|
|
|
|
2021-07-07 22:39:18 +00:00
|
|
|
var url: URL
|
2021-07-22 12:43:13 +00:00
|
|
|
var quality: Quality
|
2021-07-07 22:39:18 +00:00
|
|
|
|
2021-07-22 12:43:13 +00:00
|
|
|
init(url: URL, quality: Quality) {
|
|
|
|
self.url = url
|
|
|
|
self.quality = quality
|
2021-07-07 22:39:18 +00:00
|
|
|
}
|
|
|
|
}
|