Skip to content

Commit

Permalink
Add binary readme and directory creation
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrySlawniak committed Sep 6, 2018
1 parent 9282759 commit a222d7d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,3 +2,4 @@
config.json
.bin/*
.logs/*
bin/*
33 changes: 33 additions & 0 deletions main.go
Expand Up @@ -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)
Expand Down

0 comments on commit a222d7d

Please sign in to comment.