Skip to content

Commit

Permalink
Darwin build
Browse files Browse the repository at this point in the history
  • Loading branch information
chulo authored and chulo committed Feb 24, 2020
1 parent 21be7f8 commit 3a76f26
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions internal/lyricfier/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/labstack/echo"
"html/template"
"io"
"mime"
"net/http"
"os"
)
Expand All @@ -30,6 +31,7 @@ func (t *TemplateRegistry) Render(w io.Writer, name string, data interface{}, c
}

func (h *Server) Init(appData *AppData) {
mime.AddExtensionType(".mjs", "application/javascript")
h.hub = newHub()
go h.hub.run()
h.e = echo.New()
Expand Down
12 changes: 7 additions & 5 deletions internal/lyricfier/spotify_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
package lyricfier

import (
"fmt"
"golang.org/x/text/encoding/charmap"
"log"
"os/exec"
"os"
. "os/exec"
"path/filepath"
"strings"
"time"
)
Expand All @@ -15,7 +17,7 @@ type Spotify struct {
func (h *Spotify) Init() {
}
func getDataFromAppleScript() (bool, string, string) {
cmd := exec.Command("osascript", "-e", `
cmd := Command("osascript", "-e", `
tell application "System Events"
set processList to (name of every process)
end tell
Expand All @@ -30,7 +32,7 @@ end if

out, err := cmd.Output()
if err != nil {
log.Fatal(err)
fmt.Println(err, out)
return false, "", ""
}
d := charmap.CodePage850.NewDecoder()
Expand Down Expand Up @@ -69,7 +71,7 @@ func (h *Spotify) Ticker(changes chan string) {
}

func GetDbPath() string {
return filepath.join(os.Getenv("HOME"), "/Library/Application Support/lyricfier")
return filepath.Join(os.Getenv("HOME"), "/Library/Application Support/lyricfier")
}

func GetPlatformName() string {
Expand Down

0 comments on commit 3a76f26

Please sign in to comment.