yattee/Fixtures/Video+Fixtures.swift

122 lines
5.4 KiB
Swift
Raw Permalink Normal View History

import Foundation
2021-07-22 12:43:13 +00:00
extension Video {
2022-04-16 17:44:07 +00:00
static var fixtureID: Video.ID = "video-fixture"
static var fixtureChannelID: Channel.ID = "channel-fixture"
2022-03-27 18:27:26 +00:00
2021-07-22 12:43:13 +00:00
static var fixture: Video {
2022-11-27 10:42:16 +00:00
let bannerURL = "https://yt3.ggpht.com/SQiRareBDrV2Z6A30HSD0iUABOGysanmKLtaJq7lJ_ME-MtoLb3O61QdlJfH2KhSOA0eKPr_=w2560-fcrop64=1,00005a57ffffa5a8-k-c0xffffffff-no-nd-rj"
let thumbnailURL = "https://yt3.ggpht.com/ytc/AKedOLR-pT_JEsz_hcaA4Gjx8DHcqJ8mS42aTRqcVy6P7w=s88-c-k-c0x00ffffff-no-rj-mo"
let chapterImageURL = URL(string: "https://pipedproxy.kavin.rocks/vi/rr2XfL_df3o/hqdefault_29633.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg%3D%3D&rs=AOn4CLDFDm9D5SvsIA7D3v5n5KZahLs_UA&host=i.ytimg.com")!
2021-07-22 12:43:13 +00:00
return Video(
2022-12-09 00:15:19 +00:00
app: .invidious,
2022-03-27 18:27:26 +00:00
videoID: fixtureID,
2022-03-27 10:49:57 +00:00
title: "Relaxing Piano Music to feel good",
2021-07-22 12:43:13 +00:00
author: "Fancy Videotuber",
length: 582,
published: "7 years ago",
2021-08-22 19:13:33 +00:00
views: 21534,
2021-07-22 12:43:13 +00:00
description: "Some relaxing live piano music",
genre: "Music",
channel: Channel(
2022-12-13 23:07:32 +00:00
app: .invidious,
2022-04-16 17:44:07 +00:00
id: fixtureChannelID,
name: "The Channel",
2022-11-27 10:42:16 +00:00
bannerURL: URL(string: bannerURL)!,
thumbnailURL: URL(string: thumbnailURL)!,
2022-12-17 13:24:09 +00:00
description: "The best channel that ever existed.\nThe best channel that ever existed. The best channel that ever existed. The best channel that ever existed. The best channel that ever existed. ",
subscriptionsCount: 2300,
2022-11-27 10:42:16 +00:00
totalViews: 3_260_378_817,
videos: []
),
2022-03-27 18:27:26 +00:00
thumbnails: [],
2021-07-22 12:43:13 +00:00
live: false,
2021-08-22 19:13:33 +00:00
upcoming: false,
2021-11-28 14:37:55 +00:00
publishedAt: Date(),
2021-08-22 19:13:33 +00:00
likes: 37333,
dislikes: 30,
keywords: ["very", "cool", "video", "msfs 2020", "757", "747", "A380", "737-900", "MOD", "Zibo", "MD80", "MD11", "Rotate", "Laminar", "787", "A350", "MSFS", "MS2020", "Microsoft Flight Simulator", "Microsoft", "Flight", "Simulator", "SIM", "World", "Ortho", "Flying", "Boeing MAX"],
2022-12-17 23:08:30 +00:00
related: [.otherFixture],
chapters: [
.init(title: "A good chapter name", image: chapterImageURL, start: 20),
.init(title: "Other fine but incredibly too long chapter name, I don't know what else to say", image: chapterImageURL, start: 30),
.init(title: "Short", image: chapterImageURL, start: 60)
]
)
}
static var otherFixture: Video {
let bannerURL = "https://yt3.ggpht.com/SQiRareBDrV2Z6A30HSD0iUABOGysanmKLtaJq7lJ_ME-MtoLb3O61QdlJfH2KhSOA0eKPr_=w2560-fcrop64=1,00005a57ffffa5a8-k-c0xffffffff-no-nd-rj"
let thumbnailURL = "https://yt3.ggpht.com/ytc/AKedOLR-pT_JEsz_hcaA4Gjx8DHcqJ8mS42aTRqcVy6P7w=s88-c-k-c0x00ffffff-no-rj-mo"
let chapterImageURL = URL(string: "https://pipedproxy.kavin.rocks/vi/rr2XfL_df3o/hqdefault_29633.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg%3D%3D&rs=AOn4CLDFDm9D5SvsIA7D3v5n5KZahLs_UA&host=i.ytimg.com")!
return Video(
app: .invidious,
videoID: fixtureID + fixtureID,
title: "Relaxing Piano Music to feel good",
author: "Fancy Videotuber",
length: 582,
published: "7 years ago",
views: 21534,
description: "Some relaxing live piano music",
genre: "Music",
channel: Channel(
app: .invidious,
id: fixtureChannelID + fixtureChannelID,
name: "The Channel",
bannerURL: URL(string: bannerURL)!,
thumbnailURL: URL(string: thumbnailURL)!,
subscriptionsCount: 2300,
totalViews: 3_260_378_817,
videos: []
),
thumbnails: [],
live: false,
upcoming: false,
publishedAt: Date(),
likes: 37333,
dislikes: 30,
keywords: ["very", "cool", "video", "msfs 2020", "757", "747", "A380", "737-900", "MOD", "Zibo", "MD80", "MD11", "Rotate", "Laminar", "787", "A350", "MSFS", "MS2020", "Microsoft Flight Simulator", "Microsoft", "Flight", "Simulator", "SIM", "World", "Ortho", "Flying", "Boeing MAX"],
chapters: [
.init(title: "A good chapter name", image: chapterImageURL, start: 20),
.init(title: "Other fine but incredibly too long chapter name, I don't know what else to say", image: chapterImageURL, start: 30),
.init(title: "Short", image: chapterImageURL, start: 60)
]
2021-07-22 12:43:13 +00:00
)
}
static var fixtureLiveWithoutPublishedOrViews: Video {
var video = fixture
video.title = "\(video.title) \(video.title) \(video.title) \(video.title) \(video.title)"
video.published = "0 seconds ago"
video.views = 0
video.live = true
return video
}
static var fixtureUpcomingWithoutPublishedOrViews: Video {
var video = fixtureLiveWithoutPublishedOrViews
video.live = false
video.upcoming = true
return video
}
2021-07-27 22:40:04 +00:00
static var allFixtures: [Video] {
[fixture, fixtureLiveWithoutPublishedOrViews, fixtureUpcomingWithoutPublishedOrViews]
}
2021-09-29 11:45:00 +00:00
static func fixtures(_ count: Int) -> [Video] {
var result = [Video]()
while result.count < count {
result.append(allFixtures.shuffled().first!)
}
return result
}
2021-07-22 12:43:13 +00:00
}