refactor: remove useless code
This commit is contained in:
parent
a2ef5d3b79
commit
070770f281
2 changed files with 0 additions and 40 deletions
|
@ -1,5 +1,4 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
var SpotifyAPI = ""
|
|
||||||
var ClientID = ""
|
var ClientID = ""
|
||||||
var RedirectURI = ""
|
var RedirectURI = ""
|
||||||
|
|
39
server.go
39
server.go
|
@ -110,39 +110,6 @@ func getAllTracksPlaylist(id string, offset int) (SpotifyPlaylist, error) {
|
||||||
id de la playlist
|
id de la playlist
|
||||||
*/
|
*/
|
||||||
func getListPlaylist(id string) {
|
func getListPlaylist(id string) {
|
||||||
/*
|
|
||||||
req, _ := http.NewRequest("GET",
|
|
||||||
"https://api.spotify.com/v1/playlists/"+id+"/tracks",
|
|
||||||
nil)
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
req, _ := http.NewRequest("GET",
|
|
||||||
"http://localhost:8001",
|
|
||||||
nil)
|
|
||||||
req.Header.Add("Accept", "application/json")
|
|
||||||
req.Header.Add("Content-Type", "application/json")
|
|
||||||
req.Header.Add("Authorization", SpotifyAPI)
|
|
||||||
|
|
||||||
res, err := MyClient.Do(req)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("error:", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if res.StatusCode > 300 {
|
|
||||||
fmt.Printf("Erreur !!\n")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
playlist := &SpotifyPlaylist{}
|
|
||||||
defer res.Body.Close()
|
|
||||||
err = json.NewDecoder(res.Body).Decode(&playlist)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("error:", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
playlist, err := getAllTracksPlaylist(id, 0)
|
playlist, err := getAllTracksPlaylist(id, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Erreru!!\n")
|
fmt.Printf("Erreru!!\n")
|
||||||
|
@ -157,17 +124,11 @@ func getListPlaylist(id string) {
|
||||||
tmp = searchAlbumBandcamp(playlist.Items[i].Track.Album.Name,
|
tmp = searchAlbumBandcamp(playlist.Items[i].Track.Album.Name,
|
||||||
playlist.Items[i].Track.Album.Artists[0].Name)
|
playlist.Items[i].Track.Album.Artists[0].Name)
|
||||||
if tmp.find {
|
if tmp.find {
|
||||||
//fmt.Printf("Find !! url: %s\n", tmp.url)
|
|
||||||
//MyResp.url = append(MyResp.url, tmp.url)
|
|
||||||
//MyResp.url = append (MyResp.url, tmp.url)
|
|
||||||
//MyResp.Add(tmp.url)
|
|
||||||
MyResp.AddAlbum(newUrlBandcamp(
|
MyResp.AddAlbum(newUrlBandcamp(
|
||||||
playlist.Items[i].Track.Album.Artists[0].Name,
|
playlist.Items[i].Track.Album.Artists[0].Name,
|
||||||
playlist.Items[i].Track.Album.Name,
|
playlist.Items[i].Track.Album.Name,
|
||||||
playlist.Items[i].Track.Album.ExternalUrls.Spotify,
|
playlist.Items[i].Track.Album.ExternalUrls.Spotify,
|
||||||
tmp.url))
|
tmp.url))
|
||||||
//fmt.Printf("tmp %s \n", MyResp.url[0])
|
|
||||||
//fmt.Printf("len=%d cap=%d %v\n", len(MyResp.url), cap(MyResp.url), MyResp.url)
|
|
||||||
} else {
|
} else {
|
||||||
tmp = searchArtistBandcamp(playlist.Items[i].Track.Album.Artists[0].Name)
|
tmp = searchArtistBandcamp(playlist.Items[i].Track.Album.Artists[0].Name)
|
||||||
if tmp.find {
|
if tmp.find {
|
||||||
|
|
Loading…
Reference in a new issue