mbz discover + auto import

This commit is contained in:
Gabe Farrell 2026-04-08 23:42:35 -04:00
parent 986b0273be
commit c7d6a088ed
11 changed files with 2036 additions and 266 deletions

10
main.go
View file

@ -18,6 +18,9 @@ var importerRunning bool
//go:embed index.html.tmpl
var tmplFS embed.FS
//go:embed static
var staticFS embed.FS
var tmpl = template.Must(
template.New("index.html.tmpl").
Funcs(template.FuncMap{
@ -120,8 +123,15 @@ func handleRun(w http.ResponseWriter, r *http.Request) {
func main() {
log.Printf("Music Importer %s starting on http://localhost:8080", version)
startMonitor()
http.Handle("/static/", http.FileServer(http.FS(staticFS)))
http.HandleFunc("/", handleHome)
http.HandleFunc("/run", handleRun)
http.HandleFunc("/discover/search", handleDiscoverSearch)
http.HandleFunc("/discover/fetch", handleDiscoverFetch)
http.HandleFunc("/discover/fetch/artist", handleDiscoverFetchArtist)
http.HandleFunc("/discover/fetch/status", handleDiscoverFetchStatus)
http.HandleFunc("/discover/fetch/list", handleDiscoverFetchList)
log.Fatal(http.ListenAndServe(":8080", nil))
}