Skip to content

Commit

Permalink
Fix settings not read from config file (thx @cizara)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilioastarita committed Sep 16, 2020
1 parent 0032e9e commit 6d9c0a7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions internal/lyricfier/general.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,14 @@ func (h *Main) ReadSettings() {
h.AppData.Settings = defaultSettings()
return
}
err = json.Unmarshal(val, h.AppData.Settings)
var p *Settings
err = json.Unmarshal(val, &p)

This comment has been minimized.

Copy link
@martinsanchezmeli

martinsanchezmeli Sep 16, 2020

Ojo aca que settings es un puntero y en el unmarshal ademas lo pasas como puntero

if err != nil {
fmt.Printf("error umarshalling saved settings %v\n", err)
fmt.Printf("error umarshalling saved settings: %v\n", err)
h.AppData.Settings = defaultSettings()
return
}
h.AppData.Settings = p;
}

func (h *Main) Search(done chan *SearchResult, artist string, title string) {
Expand Down
2 changes: 1 addition & 1 deletion internal/lyricfier/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (h *Server) routes(hub *Hub) {
}
settings, err := json.Marshal(s)
if err != nil {
fmt.Printf("could not marshal config json: %v\n", err)
fmt.Printf("Could not marshal config json: %v\n", err)
return c.JSON(http.StatusInternalServerError, h.appData)
}

Expand Down
4 changes: 2 additions & 2 deletions internal/lyricfier/spotify_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ package lyricfier
import (
"encoding/csv"
"fmt"
"path/filepath"
"os"
"golang.org/x/text/encoding/charmap"
"log"
"os"
"os/exec"
"path/filepath"
"strings"
"syscall"
"time"
Expand Down

0 comments on commit 6d9c0a7

Please sign in to comment.