vrtnu-app/vrtnu/vrtnu/VrtNuLayout.swift

82 lines
2.3 KiB
Swift

//
// VrtNuLayout.swift
// vrtnu
//
// Created by Jens Timmerman on 25/09/2020.
//
import Foundation
struct Episode: Hashable{
let name: String
let video: Video
let imageurl: URL
init(episodeurl: URL){
self.name = "test"
self.video = Video(hlsUrl: URL(string: "https://remix-cf.lwc.vrtcdn.be/remix/ecd69313-4a39-4297-95b1-aede167725b7/remix.ism/.m3u8")!,
title: "best of dinges",
duration: 2946)
self.imageurl = URL(string: "https://images.vrt.be/w320hx/2019/05/02/dbc03914-6cbc-11e9-abcc-02b7b76bf47f.jpg")!
}
}
struct Season: Hashable{
static func == (lhs: Season, rhs: Season) -> Bool {
return lhs.seasonUrl == rhs.seasonUrl
}
let seasonName: String
let seasonUrl: URL
let episodes: [Episode]
init(seasonUrl: URL){
self.seasonUrl = seasonUrl
self.episodes = [
Episode(episodeurl: URL(string: "https://www.vrt.be/vrtnu/a-z/het-peulengaleis/2005-hm/het-peulengaleis-s2005-hma1/")!)
]
self.seasonName = "Best of"
}
}
struct Show: Hashable{
static func == (lhs: Show, rhs: Show) -> Bool {
return lhs.showUrl == rhs.showUrl
}
let showUrl: URL
let title: String
let seasons: [Season]
let imageUrl: URL
init(showUrl: URL, title: String) {
self.showUrl = showUrl
self.title = title
self.imageUrl = URL(string: "https://images.vrt.be/w320hx/2019/05/02/dbc03914-6cbc-11e9-abcc-02b7b76bf47f.jpg")!
//TODO: fetch seasons
self.seasons = [
Season(seasonUrl: URL(string: "https://www.vrt.be/vrtnu/a-z/het-peulengaleis/2005-hm/")!),
Season(seasonUrl: URL(string: "https://www.vrt.be/vrtnu/a-z/het-peulengaleis/3/")!),
Season(seasonUrl: URL(string: "https://www.vrt.be/vrtnu/a-z/het-peulengaleis/4/")!),
Season(seasonUrl: URL(string: "https://www.vrt.be/vrtnu/a-z/het-peulengaleis/5/")!)
]
}
func getimageurl() -> URL{
//TODO: stub
return self.imageUrl
}
}
struct VRTNu {
let shows: [Show]
init() {
//TODO: fetch shows
self.shows = [Show(showUrl: URL(string: "https://www.vrt.be/vrtnu/a-z/het-peulengaleis/")!, title: "Het Peulengaleis")]
}
}