Skip to content
This repository has been archived by the owner on Jul 14, 2024. It is now read-only.

Commit

Permalink
Merge pull request #44 from gazes-media/main
Browse files Browse the repository at this point in the history
Update minor
  • Loading branch information
garder500 authored Dec 5, 2023
2 parents aceba7d + 7119abb commit 337c4d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions routes/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ func DownloadHandler(w http.ResponseWriter, r *http.Request, id, ep string, cach
}

w.Header().Set("Content-Type", "video/mp4")
go downloadEpisode(episode, cache)
episodeName := episode.Vostfr.Title + "- Episode " + strconv.Itoa(episode.Vostfr.Num)
videoIsReady, found := cache.Get(episodeName)
if found {
Expand All @@ -46,6 +45,7 @@ func DownloadHandler(w http.ResponseWriter, r *http.Request, id, ep string, cach
} else {
fmt.Println("Video not found in cache")
w.Write([]byte("Video not found in cache"))
downloadEpisode(episode, cache)
return
}
}
Expand Down Expand Up @@ -83,8 +83,8 @@ func downloadEpisode(episode EpisodeJson, cache *functions.Cache) (string, error
for scanner.Scan() {
m := scanner.Text()
if strings.Contains(m, "time=") {
log.Println(m)
cache.Set(episodeName, episodeName+".mp4")
fmt.Println("Downloaded " + episodeName)
}
}
if err := cmd.Wait(); err != nil {
Expand Down

0 comments on commit 337c4d1

Please sign in to comment.