From 37a7962adf148e3943be094b78c89192f6ec0653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramon=20R=C3=BCttimann?= Date: Tue, 14 Jan 2020 11:07:51 +0100 Subject: [PATCH] better defaults MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ramon Rüttimann --- faker/main.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/faker/main.go b/faker/main.go index 8ad4819..dc2762e 100644 --- a/faker/main.go +++ b/faker/main.go @@ -6,6 +6,8 @@ import ( "fmt" "io/ioutil" "net/http" + "path" + "strings" "git.ramonr.ch/ramon/mediaconverter/converter" "k8s.io/klog" @@ -17,14 +19,20 @@ var ( commit = "" ) +const baseDir = "/mnt/data/media/downloads/music/" + func main() { klog.InitFlags(nil) - postAddr := flag.String("post-addr", "mediaconverter", "the address where to post the request") - directory := flag.String("dir", "", "the directory that contains the flac files") + 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. If relative path, baseDir will be appendend automatically") artistName := flag.String("artist", "", "name of the artist") flag.Parse() 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) if err != nil { klog.Fatalf("could not create message: %v", err)