Skip to content
Permalink
Browse files

Add binary readme and directory creation

  • Loading branch information...
HenrySlawniak committed Sep 6, 2018
1 parent 9282759 commit a222d7d82a7507abd95d9e001f1ed246dc19e815
Showing with 34 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +33 −0 main.go
@@ -2,3 +2,4 @@
config.json
.bin/*
.logs/*
bin/*
33 main.go
@@ -30,28 +30,61 @@ import (
"io/ioutil"
"os"
"path/filepath"
"runtime"
)

var (
numFrames = flag.Int("frames", 12, "The number of frames to generate")
writeInfo = flag.Bool("write-info", true, "Write info JSON to file")
frameWidth = flag.Int("frame-width", 854, "The width to generate thumbnails at")

buildTime string
commit string
)

const binHelp = `This directory is used to store binaries for ffmpeg.
Place ffmpeg.exe, ffprobe.exe or the appropriate linux binaries here.
If no binaries are found, thumbnailer will use your PATH.
`

func init() {
flag.Parse()
cLog := console.New(false)
log.AddHandler(cLog, log.AllLevels...)
}

func main() {
if buildTime != "" {
log.Info("Built: " + buildTime)
}
if commit != "" {
log.Info("Revision: " + commit)
}
log.Info("Go: " + runtime.Version())

err := os.MkdirAll("tmp", 0755)
if err != nil {
log.Error("Cannot create tmp directory")
log.Error(err)
return
}

err = os.MkdirAll("bin", 0755)
if err != nil {
log.Error("Cannot create tmp directory")
log.Error(err)
return
}

err = ioutil.WriteFile("bin/readme.txt", []byte(binHelp), 0644)
if err != nil {
log.Error("Error writing readme")
log.Error(err)
return
}

for _, a := range os.Args[1:] {
if FileExists(a) {
f, err := os.Open(a)

0 comments on commit a222d7d

Please sign in to comment.
You can’t perform that action at this time.