diff --git a/vrtnu/vrtnu.xcodeproj/project.pbxproj b/vrtnu/vrtnu.xcodeproj/project.pbxproj index 927d8bb..6bde47a 100644 --- a/vrtnu/vrtnu.xcodeproj/project.pbxproj +++ b/vrtnu/vrtnu.xcodeproj/project.pbxproj @@ -9,7 +9,6 @@ /* Begin PBXBuildFile section */ B408F0DD251F6D180043E3A4 /* AsyncImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B408F0DC251F6D180043E3A4 /* AsyncImage.swift */; }; B408F0E5251F7AC50043E3A4 /* Just.swift in Sources */ = {isa = PBXBuildFile; fileRef = B408F0E4251F7AC50043E3A4 /* Just.swift */; }; - B408F0ED251F9D2C0043E3A4 /* loading.jpg in Resources */ = {isa = PBXBuildFile; fileRef = B408F0EC251F9D2C0043E3A4 /* loading.jpg */; }; B4F0CC7B251BE62B00E9EA74 /* vrtnuApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4F0CC7A251BE62B00E9EA74 /* vrtnuApp.swift */; }; B4F0CC7D251BE62B00E9EA74 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4F0CC7C251BE62B00E9EA74 /* ContentView.swift */; }; B4F0CC7F251BE62F00E9EA74 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B4F0CC7E251BE62F00E9EA74 /* Assets.xcassets */; }; @@ -40,7 +39,6 @@ /* Begin PBXFileReference section */ B408F0DC251F6D180043E3A4 /* AsyncImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AsyncImage.swift; sourceTree = ""; }; B408F0E4251F7AC50043E3A4 /* Just.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Just.swift; sourceTree = ""; }; - B408F0EC251F9D2C0043E3A4 /* loading.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = loading.jpg; sourceTree = ""; }; B4F0CC77251BE62B00E9EA74 /* vrtnu.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = vrtnu.app; sourceTree = BUILT_PRODUCTS_DIR; }; B4F0CC7A251BE62B00E9EA74 /* vrtnuApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = vrtnuApp.swift; sourceTree = ""; }; B4F0CC7C251BE62B00E9EA74 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; @@ -94,7 +92,6 @@ B4F0CC6E251BE62B00E9EA74 = { isa = PBXGroup; children = ( - B408F0EC251F9D2C0043E3A4 /* loading.jpg */, B4F0CC79251BE62B00E9EA74 /* vrtnu */, B4F0CC8B251BE62F00E9EA74 /* vrtnuTests */, B4F0CC96251BE62F00E9EA74 /* vrtnuUITests */, @@ -256,7 +253,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - B408F0ED251F9D2C0043E3A4 /* loading.jpg in Resources */, B4F0CC82251BE62F00E9EA74 /* Preview Assets.xcassets in Resources */, B4F0CC7F251BE62F00E9EA74 /* Assets.xcassets in Resources */, ); diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/.DS_Store b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/.DS_Store new file mode 100644 index 0000000..1a1ff71 Binary files /dev/null and b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/.DS_Store differ diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json index 2e00335..a62cc11 100644 --- a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +++ b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -1,6 +1,7 @@ { "images" : [ { + "filename" : "shopiconback.png", "idiom" : "tv" } ], diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/shopiconback.png b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/shopiconback.png new file mode 100644 index 0000000..f0ca2d8 Binary files /dev/null and b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/shopiconback.png differ diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json index 2e00335..377c30e 100644 --- a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +++ b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -1,6 +1,7 @@ { "images" : [ { + "filename" : "shopiconfront.png", "idiom" : "tv" } ], diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/shopiconfront.png b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/shopiconfront.png new file mode 100644 index 0000000..9eb22f1 Binary files /dev/null and b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/shopiconfront.png differ diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json index 2e00335..207da6e 100644 --- a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +++ b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -1,6 +1,7 @@ { "images" : [ { + "filename" : "shopiconmiddle.png", "idiom" : "tv" } ], diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/shopiconmiddle.png b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/shopiconmiddle.png new file mode 100644 index 0000000..cd0f5ee Binary files /dev/null and b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/shopiconmiddle.png differ diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json index 795cce1..3739ac7 100644 --- a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +++ b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -5,6 +5,7 @@ "scale" : "1x" }, { + "filename" : "iconback@2x.png", "idiom" : "tv", "scale" : "2x" } diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/iconback@2x.png b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/iconback@2x.png new file mode 100644 index 0000000..fc14855 Binary files /dev/null and b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/iconback@2x.png differ diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json index 795cce1..0c2bad1 100644 --- a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +++ b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -5,6 +5,7 @@ "scale" : "1x" }, { + "filename" : "icontop@2x.png", "idiom" : "tv", "scale" : "2x" } diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/icontop@2x.png b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/icontop@2x.png new file mode 100644 index 0000000..995eb1b Binary files /dev/null and b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/icontop@2x.png differ diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json index 795cce1..0d1dfa2 100644 --- a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +++ b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -5,6 +5,7 @@ "scale" : "1x" }, { + "filename" : "iconmiddle@2x.png", "idiom" : "tv", "scale" : "2x" } diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/iconmiddle@2x.png b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/iconmiddle@2x.png new file mode 100644 index 0000000..7887280 Binary files /dev/null and b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/iconmiddle@2x.png differ diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json index b65f0cd..dcce160 100644 --- a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json +++ b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json @@ -1,18 +1,22 @@ { "images" : [ { + "filename" : "topshelft@1x.png", "idiom" : "tv", "scale" : "1x" }, { + "filename" : "topshelft@2x.png", "idiom" : "tv", "scale" : "2x" }, { + "filename" : "topshelft@1x-1.png", "idiom" : "tv-marketing", "scale" : "1x" }, { + "filename" : "topshelft@2x-1.png", "idiom" : "tv-marketing", "scale" : "2x" } diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/topshelft@1x-1.png b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/topshelft@1x-1.png new file mode 100644 index 0000000..6b1df78 Binary files /dev/null and b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/topshelft@1x-1.png differ diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/topshelft@1x.png b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/topshelft@1x.png new file mode 100644 index 0000000..6b1df78 Binary files /dev/null and b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/topshelft@1x.png differ diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/topshelft@2x-1.png b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/topshelft@2x-1.png new file mode 100644 index 0000000..2108634 Binary files /dev/null and b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/topshelft@2x-1.png differ diff --git a/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/topshelft@2x.png b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/topshelft@2x.png new file mode 100644 index 0000000..2108634 Binary files /dev/null and b/vrtnu/vrtnu/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/topshelft@2x.png differ diff --git a/vrtnu/vrtnu/ContentView.swift b/vrtnu/vrtnu/ContentView.swift index 8e1d9bd..5551289 100644 --- a/vrtnu/vrtnu/ContentView.swift +++ b/vrtnu/vrtnu/ContentView.swift @@ -53,20 +53,27 @@ struct LoginView: View{ } struct VRTNuView: View{ var vrtNu: VRTNu - var body: some View { +w var body: some View { NavigationView(){ - List(vrtNu.getShows(), id: \.self){ show in + List(vrtNu.getShows(), id: \.title){ show in NavigationLink(destination: ShowView(show: show)){ HStack{ AsyncImage(url: show.imageURL,placeholder: { //Image(name: "loading") Text("Loading...") - }, image:{Image(uiImage:$0).resizable()}).frame(width: 300, height:300) - Text(show.title) + }, image:{ + Image(uiImage:$0) + .resizable() + }).aspectRatio(contentMode: .fit).frame(width: 480, height:300) + VStack(alignment: .leading){ + Text(show.title) + .padding() + Text(show.showURL.absoluteString) + } } } } - } + }.navigationTitle("Browse VRT Nu")//.listStyle(DefaultListStyle()) } } struct ShowView: View { @@ -82,8 +89,12 @@ struct ShowView: View { AsyncImage(url: episode.imageURL,placeholder: { //Image(name: "loading") Text("Loading...") - },image:{Image(uiImage:$0).resizable()}).frame(width: 300, height: 300) - Text(episode.name) + },image:{Image(uiImage:$0).resizable() + }).aspectRatio(contentMode: .fit).frame(width: 480, height:300) + VStack(alignment: .leading){ + Text(episode.title).padding() + Text(episode.episodeurl) + } } } } @@ -106,6 +117,7 @@ struct VisibleShowView: View { } } +//not used at the moment, we have an integrated view of seasons in the episode list struct SeasonView: View { var season: Season var body: some View { @@ -116,7 +128,8 @@ struct SeasonView: View { AsyncImage(url: episode.imageURL,placeholder: { //Image(name: "loading") Text("Loading...") - },image:{Image(uiImage:$0).resizable()}).frame(width: 300, height: 300) + },image:{Image(uiImage:$0).resizable() + }).aspectRatio(contentMode: .fit).frame(width: 480, height:300) Text(episode.name) } @@ -145,52 +158,8 @@ struct VideoView: View { struct ContentView_Previews: PreviewProvider { static var previews: some View { - SeasonView(season: VRTNu().getShows()[0].getSeasons()[0]) - //ContentView() + //ShowView(show: VRTNu().getShows()[0]) + ContentView() } } - - - -/*struct OldContentView: View { -var body: some View { -NavigationView(){ - VStack(alignment: .leading) { - ForEach(VRTNu().shows, id: \.self){ show in - VStack{ - Text(show.title) - HStack{ - - ForEach(show.seasons, id:\.self){ season in - - List(season.episodes, id:\.self){ episode in - NavigationLink(destination: VideoView(url: episode.video.hlsUrl)){ - VStack{ - Text(season.seasonName) - Text(episode.name) - AsyncImage(url: episode.imageurl,placeholder: { - //Image(name: "loading") - Text("Loading...") - Text("Loading...") - Text("Loading...") - Text("Loading...") - Text("Loading...") - Text("Loading...") - Text("Loading...") - Text("Loading...") - Text("Loading...") - Text("Loading...") - Text("Loading...") - },image:{Image(uiImage:$0).resizable()}) - }} - } - } - } - } - } - } -} -} -}*/ - diff --git a/vrtnu/vrtnu/VrtNuLayout.swift b/vrtnu/vrtnu/VrtNuLayout.swift index 19a2a65..72bd0b1 100644 --- a/vrtnu/vrtnu/VrtNuLayout.swift +++ b/vrtnu/vrtnu/VrtNuLayout.swift @@ -17,13 +17,16 @@ let just = JustOf() struct Episode: Hashable, Comparable{ static func < (lhs: Episode, rhs: Episode) -> Bool { - return lhs.name < rhs.name + return lhs.name.localizedStandardCompare(rhs.name) == .orderedAscending } let name: String + let title: String let season: Season let imageURL: URL let metadataurl: URL + let episodeurl: String + func authenticated() -> Bool{ //check if current token is valid @@ -58,11 +61,13 @@ struct Episode: Hashable, Comparable{ return video }() - init(season: Season, episodeName: String, imageURL: URL){ + init(season: Season, episodeName: String, title: String, imageURL: URL){ self.name = episodeName self.season = season self.imageURL = imageURL - self.metadataurl = URL(string: "https://www.vrt.be/vrtnu/a-z/" + season.show.showName + "/" + season.seasonName + "/" + episodeName + ".mssecurevideo.json")! + self.episodeurl = "https://www.vrt.be/vrtnu/a-z/" + season.show.showName + "/" + season.seasonName + "/" + episodeName + self.metadataurl = URL(string: episodeurl + ".mssecurevideo.json")! + self.title = title } func getVideo() -> Video{ @@ -104,7 +109,8 @@ func parseData(data: String, regexPattern: String) -> [String]{ struct Season: Hashable, Comparable{ static func < (lhs: Season, rhs: Season) -> Bool { - return lhs.seasonName < rhs.seasonName + //return lhs.seasonName < rhs.seasonName + return lhs.seasonName.localizedStandardCompare(rhs.seasonName) == .orderedAscending } static func == (lhs: Season, rhs: Season) -> Bool { @@ -121,19 +127,25 @@ struct Season: Hashable, Comparable{ let regexPattern = "vrtnu/a-z/" + show.showName + "/" + seasonName + "/([^\"]*)/" let imageregexPattern = "data-responsive-image=\".*(jpg|png)" + let titleregexPattern = "\">(.*)(|
)" + let data = Just.get("https://www.vrt.be/vrtnu/a-z/" + show.showName + "/" + seasonName + ".lists.all-episodes/").text! - let output = Array(Set(parseData(data: data, regexPattern: regexPattern))) + let output = parseData(data: data, regexPattern: regexPattern) let imageoutput = parseData(data: data, regexPattern: imageregexPattern) + let titleoutput = parseData(data: data, regexPattern: titleregexPattern) + print(data) var episode: String var myepisodes: [Episode] myepisodes = [] - for i in 0 ..< output.count{ - episode = output[i].replacingOccurrences(of: "vrtnu/a-z/" + show.showName + "/" + seasonName + "/", with: "").replacingOccurrences(of: "/", with: "") + for i in 0 ..< titleoutput.count{ + // output always contains same url twice + episode = output[i * 2].replacingOccurrences(of: "vrtnu/a-z/" + show.showName + "/" + seasonName + "/", with: "").replacingOccurrences(of: "/", with: "") print(episode) print(seasonName) let image = URL(string: imageoutput[i].replacingOccurrences(of: "https:", with: "").replacingOccurrences(of: "http:", with: "").replacingOccurrences(of: "data-responsive-image=\"", with: "https:"))! - myepisodes.append(Episode(season: self, episodeName: episode, imageURL: image)) + let title = titleoutput[i].replacingOccurrences(of: "\">", with: "").replacingOccurrences(of: "
", with: "").replacingOccurrences(of: "", with: "") + myepisodes.append(Episode(season: self, episodeName: episode, title: title, imageURL: image)) } myepisodes.sort() @@ -159,8 +171,10 @@ struct Season: Hashable, Comparable{ } struct Show: Hashable, Comparable{ + static func < (lhs: Show, rhs: Show) -> Bool { - return lhs.showName < rhs.showName + //return lhs.showName < rhs.showName + return lhs.showName.localizedStandardCompare(rhs.showName) == .orderedAscending } static func == (lhs: Show, rhs: Show) -> Bool { @@ -227,20 +241,25 @@ struct VRTNu: Hashable { lazy var shows: [Show] = { let regexPattern = "a href=\"/vrtnu/a-z/(.*).relevant" let imageregexPattern = "data-responsive-image=\".*(jpg|png)" + let titleregexPattern = ".relevant/\">(.*)" + let data = Just.get("https://www.vrt.be/vrtnu/a-z/").text! print(data) let output = parseData(data: data, regexPattern: regexPattern) let imageoutput = parseData(data: data, regexPattern: imageregexPattern) + let titleoutput = parseData(data: data, regexPattern: titleregexPattern) var show: String + var title: String var image: String var myshows: [Show] myshows = [] for i in 0 ..< output.count{ show = output[i].replacingOccurrences(of: ".relevant", with: "").replacingOccurrences(of: "a href=\"/vrtnu/a-z/", with: "") image = imageoutput[i].replacingOccurrences(of: "https:", with: "").replacingOccurrences(of: "http:", with: "").replacingOccurrences(of: "data-responsive-image=\"", with: "https:") - myshows.append(Show(vrtNu: self, showName: show, title: show, imageURL: URL(string: image)!)) + title = titleoutput[i].replacingOccurrences(of: ".relevant/\">", with: "").replacingOccurrences(of: "", with: "") + myshows.append(Show(vrtNu: self, showName: show, title: title, imageURL: URL(string: image)!)) } myshows.sort() return myshows