diff options
Diffstat (limited to 'grimtube.go')
| -rw-r--r-- | grimtube.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/grimtube.go b/grimtube.go index 385be92..9f8061b 100644 --- a/grimtube.go +++ b/grimtube.go @@ -15,6 +15,7 @@ import ( var docPath string var dlsrv string +var debug bool func getLangs() []string { return []string{"en", "fr", "de", "ja", "ru"} @@ -102,7 +103,9 @@ func search(w http.ResponseWriter, r *http.Request) { page = p } } - log.Printf("searching: %s, page: %d, lang: %s, order: %s\n", term, page, lang, order) + if debug { + log.Printf("searching: %s, page: %d, lang: %s, order: %s\n", term, page, lang, order) + } items, err := ytparser.Search(term, page, lang, order) if err != nil { log.Println(err) @@ -166,9 +169,11 @@ func main() { port := flag.Int("p", 8080, "The port to bind to.") dir := flag.String("d", "", "Location of the templates and static resources.") dl := flag.String("dlsrv", "", "Link to a download server.") + debugFlag := flag.Bool("debug", false, "Activate debug logs") flag.Parse() docPath = *dir dlsrv = *dl + debug = *debugFlag fs := http.FileServer(http.Dir("static")) http.Handle("/static/", http.StripPrefix(path.Join(docPath, "/static/"), fs)) http.HandleFunc("/favicon.ico", favicon) |
