refactor: use /test to test + some lines < 80c now
Somes lines under 80 columns now
This commit is contained in:
parent
09ec28a1e5
commit
e3ea068163
1 changed files with 14 additions and 7 deletions
21
server.go
21
server.go
|
@ -40,8 +40,14 @@ func testBandcamp(album string, artist string) BandcampAlbum{
|
||||||
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, _ := 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("Accept", "application/json")
|
||||||
req.Header.Add("Content-Type", "application/json")
|
req.Header.Add("Content-Type", "application/json")
|
||||||
req.Header.Add("Authorization", SpotifyAPI)
|
req.Header.Add("Authorization", SpotifyAPI)
|
||||||
|
@ -68,13 +74,12 @@ func getListPlaylist(id string) {
|
||||||
tmp := BandcampAlbum{}
|
tmp := BandcampAlbum{}
|
||||||
|
|
||||||
for i := 0; i < len(ree.Items); i++ {
|
for i := 0; i < len(ree.Items); i++ {
|
||||||
tmp = testBandcamp(ree.Items[i].Track.Album.Name, ree.Items[i].Track.Album.Artists[0].Name)
|
tmp = testBandcamp(ree.Items[i].Track.Album.Name,
|
||||||
|
ree.Items[i].Track.Album.Artists[0].Name)
|
||||||
if tmp.find {
|
if tmp.find {
|
||||||
fmt.Printf("Find !! url: %s\n", tmp.url)
|
fmt.Printf("Find !! url: %s\n", tmp.url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf(ree.Href)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func formHandler(w http.ResponseWriter, r *http.Request) {
|
func formHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -105,14 +110,16 @@ func index(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Fprintf(w, "Helo!")
|
fmt.Fprintf(w, "Helo!")
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func test(w http.ResponseWriter, r *http.Request) {
|
||||||
getListPlaylist("6OGZZ8tI45MB1d3EUEqNKI")
|
getListPlaylist("6OGZZ8tI45MB1d3EUEqNKI")
|
||||||
return
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
fileServer := http.FileServer(http.Dir("./static"))
|
fileServer := http.FileServer(http.Dir("./static"))
|
||||||
http.Handle("/", fileServer)
|
http.Handle("/", fileServer)
|
||||||
http.HandleFunc("/hello", index)
|
http.HandleFunc("/hello", index)
|
||||||
http.HandleFunc("/back", formHandler)
|
http.HandleFunc("/back", formHandler)
|
||||||
|
http.HandleFunc("/test", test)
|
||||||
|
|
||||||
fmt.Printf("Starting the server…\n")
|
fmt.Printf("Starting the server…\n")
|
||||||
if err := http.ListenAndServe(":8080", nil); err != nil {
|
if err := http.ListenAndServe(":8080", nil); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue