fix image urls starting with http or https sometimes;

fix show view, scroll trough seasons now instead of double navigation
This commit is contained in:
Jens Timmerman 2020-09-28 02:36:36 +02:00
parent 6ceee7a50d
commit 4c5f0864bb
2 changed files with 26 additions and 3 deletions

View File

@ -29,8 +29,31 @@ struct ContentView: View {
}
}
struct ShowView: View {
var show: Show
var body: some View {
NavigationView(){
List{
ForEach(show.getSeasons(), id: \.self){ season in
Section(header: Text(season.seasonName).font(.largeTitle)) {
ForEach(season.getEpisodes(), id:\.self){ episode in
NavigationLink(destination: VideoView(episode: episode)){
HStack{
AsyncImage(url: episode.imageURL,placeholder: {
//Image(name: "loading")
Text("Loading...")
},image:{Image(uiImage:$0).resizable()}).frame(width: 300, height: 300)
Text(episode.name)
}
}
}
}}
}
}
}
}
struct VisibleShowView: View {
var show: Show
var body: some View {
NavigationView(){

View File

@ -168,7 +168,7 @@ struct Season: Hashable, Comparable{
episode = output[i].replacingOccurrences(of: "vrtnu/a-z/" + show.showName + "/" + seasonName + "/", with: "").replacingOccurrences(of: "/", with: "")
print(episode)
print(seasonName)
let image = URL(string: imageoutput[i].replacingOccurrences(of: "data-responsive-image=\"", with: "https:"))!
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))
}
@ -275,7 +275,7 @@ struct VRTNu {
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: "data-responsive-image=\"", with: "https:")
image = imageoutput[i].replacingOccurrences(of: "https:", with: "").replacingOccurrences(of: "http:", with: "").replacingOccurrences(of: "data-responsive-image=\"", with: "https:")
myshows.append(Show(showName: show, title: show, imageURL: URL(string: image)!))
}
myshows.sort()