better defaults

Signed-off-by: Ramon Rüttimann <ramon@nine.ch>
master
Ramon Rüttimann 5 years ago
parent 68620c1e51
commit 37a7962adf

@ -6,6 +6,8 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"path"
"strings"
"git.ramonr.ch/ramon/mediaconverter/converter" "git.ramonr.ch/ramon/mediaconverter/converter"
"k8s.io/klog" "k8s.io/klog"
@ -17,14 +19,20 @@ var (
commit = "" commit = ""
) )
const baseDir = "/mnt/data/media/downloads/music/"
func main() { func main() {
klog.InitFlags(nil) klog.InitFlags(nil)
postAddr := flag.String("post-addr", "mediaconverter", "the address where to post the request") postAddr := flag.String("post-addr", "http://localhost:8088", "the address where to post the request")
directory := flag.String("dir", "", "the directory that contains the flac files") directory := flag.String("dir", "", "the directory that contains the flac files. If relative path, baseDir will be appendend automatically")
artistName := flag.String("artist", "", "name of the artist") artistName := flag.String("artist", "", "name of the artist")
flag.Parse() flag.Parse()
fmt.Printf("Mediaconverter version %v, commit %v\n", version, commit) fmt.Printf("Mediaconverter version %v, commit %v\n", version, commit)
if !strings.HasPrefix("/", *directory) {
*directory = path.Join(baseDir, *directory)
}
msg, err := converter.CreateMessage(*artistName, *directory) msg, err := converter.CreateMessage(*artistName, *directory)
if err != nil { if err != nil {
klog.Fatalf("could not create message: %v", err) klog.Fatalf("could not create message: %v", err)

Loading…
Cancel
Save