|
|
|
@@ -37,7 +37,6 @@ type Config struct { |
|
|
|
func loadConfig(path string) (Config, error) { |
|
|
|
cfg := Config{ |
|
|
|
Port: 8080, |
|
|
|
WinampPath: `C:\Program Files\Winamp\Winamp.exe`, |
|
|
|
KillListFile: "killist.dat", |
|
|
|
ResumeFile: "resume.dat", |
|
|
|
} |
|
|
|
@@ -228,7 +227,9 @@ func (s *Server) handleCommand(raw []byte) { |
|
|
|
_ = s.kl.Remove(cmd.Title) |
|
|
|
case "winamp_start": |
|
|
|
if !s.wa.IsRunning() { |
|
|
|
_ = exec.Command(s.cfg.WinampPath).Start() |
|
|
|
if s.cfg.WinampPath != "" { |
|
|
|
_ = exec.Command(s.cfg.WinampPath).Start() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// Push a fresh status after any command. |
|
|
|
@@ -417,6 +418,10 @@ func (s *Server) handleWinampStart(w http.ResponseWriter, r *http.Request) { |
|
|
|
jsonOK(w, map[string]string{"status": "already_running"}) |
|
|
|
return |
|
|
|
} |
|
|
|
if s.cfg.WinampPath == "" { |
|
|
|
http.Error(w, "winamp_path not configured", http.StatusServiceUnavailable) |
|
|
|
return |
|
|
|
} |
|
|
|
if err := exec.Command(s.cfg.WinampPath).Start(); err != nil { |
|
|
|
http.Error(w, err.Error(), 500) |
|
|
|
return |
|
|
|
|