Esempio n. 1
0
func main0() {
	cpu := runtime.NumCPU()
	runtime.GOMAXPROCS(cpu)
	db := model.NewDatabase(os.Args[1])
	db.Load(false, false, false)
	ids := collectQ(model.ParseQuery(":albums", db))
	print(len(ids))
}
Esempio n. 2
0
func main3() {
	cpu := runtime.NumCPU()
	runtime.GOMAXPROCS(cpu)

	db_root := os.Args[1]

	db := model.NewDatabase(db_root)
	db.Load(false, false, false)

	q := model.ParseQuery("2015 degustations montoulieu", db)
	for img := range q {
		fmt.Printf("%s: %s\n", img.Name(), img.ItemTime())
	}
}
Esempio n. 3
0
func main() {
	cpu := runtime.NumCPU()
	runtime.GOMAXPROCS(cpu)

	db_root := os.Args[1]
	web_root := os.Args[2]

	var web_port string
	if len(os.Args) == 4 {
		web_port = os.Args[3]
	} else {
		web_port = "8080"
	}

	db := model.NewDatabase(db_root)
	update_disk := true
	minify := true
	force_reload := true
	db.Load(update_disk, minify, force_reload)
	println("Serving...")

	http.HandleFunc("/q",
		func(w http.ResponseWriter, r *http.Request) {
			model.HandleQuery(w, r, db)
		})
	http.HandleFunc("/montage/",
		func(w http.ResponseWriter, r *http.Request) {
			model.HandleMontage(w, r, db)
		})
	http.HandleFunc("/set",
		func(w http.ResponseWriter, r *http.Request) {
			model.HandleSet(w, r, db)
		})
	http.HandleFunc("/viewer",
		func(w http.ResponseWriter, r *http.Request) {
			model.HandleCommands(w, r, db)
		})
	http.HandleFunc("/f",
		func(w http.ResponseWriter, r *http.Request) {
			model.HandleFeed(w, r, db)
		})
	http.Handle("/",
		http.FileServer(http.Dir("/opt/local/apache2/"+web_root+"/")))
	log.Fatal(http.ListenAndServe(":"+web_port, nil))
}