Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

Commit

Permalink
Fix a quirky issue with videos missing type
Browse files Browse the repository at this point in the history
  • Loading branch information
morphar committed Aug 7, 2016
1 parent 36e5695 commit 3049e30
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ func main() {
}
}

mediaJson, _ := json.Marshal(allMedia)
err = ioutil.WriteFile(indexPath, mediaJson, filePerm)

progress := pb.New(progressCount)
progress.ShowCounters = true
progress.ShowTimeLeft = true
Expand Down Expand Up @@ -319,7 +322,7 @@ func main() {
}
}

mediaJson, _ := json.Marshal(allMedia)
mediaJson, _ = json.Marshal(allMedia)
err = ioutil.WriteFile(indexPath, mediaJson, filePerm)

if err != nil {
Expand Down Expand Up @@ -389,6 +392,12 @@ func fetchMedia(client *Crawler, media *Media) {
func getMediaFilename(media *Media) (filename string) {
extension := strings.ToLower(media.Format)
extension = strings.Replace(extension, "jpeg", "jpg", 1)
if strings.Trim(extension, " ") == "" {
if media.MediaType == "Video" {
// Assume mov
extension = "mov"
}
}
filename = media.Id + "." + extension
return
}
Expand Down

0 comments on commit 3049e30

Please sign in to comment.