Ejemplo n.º 1
0
// GET /libraries/:id/process
// Processes a library of files to fetch metadata
func LibraryProcess(w http.ResponseWriter, r *http.Request) (interface{}, error) {
	idstr := getPathParam(r, "id")
	id, err := strconv.ParseInt(idstr, 10, 64)
	if err != nil {
		return nil, err
	}

	library, err := database.GetLibrary(id)
	if err != nil {
		return nil, err
	}

	processor.ProcessLibrary(library)

	return nil, nil
}
Ejemplo n.º 2
0
func LibraryProcess(w http.ResponseWriter, r *http.Request) error {
	idstr := r.URL.Query().Get(":id")

	log.Printf("Handling request to precess library: %s", idstr)

	id, err := strconv.ParseInt(idstr, 10, 64)
	if err != nil {
		return err
	}

	library, err := database.GetLibrary(id)
	if err != nil {
		return err
	}

	processor.ProcessLibrary(library)

	return RenderText(w, "Processing", 200)
}