Skip to content

Commit

Permalink
fixed request parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
LumePart committed Apr 22, 2024
1 parent 0bfabf5 commit c3c8688
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions subsonic.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,25 @@ func createPlaylist(cfg Subsonic, tracks []string) error {
return err
}
if ID == "" { // If no ID is found, ignore track
log.Printf("can't find ID for %s", track)
continue
}
trackIDs.WriteString("&songId=" + ID)
}
year, week := time.Now().ISOWeek()
reqParam := fmt.Sprintf("createPlaylist?name=Discover-Weekly-%v-Week%v&%s", year, week, trackIDs.String())
reqParam := fmt.Sprintf("createPlaylist?name=Discover-Weekly-%v-Week%v%s", year, week, trackIDs.String())
_, err := subsonicRequest(reqParam, cfg)

return err
}

func scan(cfg Subsonic) {

reqParam := "startScan?f=json"
subsonicRequest(reqParam, cfg)
_, err := subsonicRequest(reqParam, cfg)
if err != nil {
log.Println("failed to initialize music folder scan")
}
}

func subsonicRequest(reqParams string, cfg Subsonic) ([]byte, error) {
Expand Down

0 comments on commit c3c8688

Please sign in to comment.