2021-08-28 21:05:38 +02:00
|
|
|
package main
|
|
|
|
|
2021-08-28 21:53:12 +02:00
|
|
|
import "time"
|
|
|
|
|
2021-09-04 19:05:09 +02:00
|
|
|
type TokenUser struct {
|
|
|
|
Token string `json:"access_token"`
|
|
|
|
TokenType string `json:"token_type"`
|
|
|
|
ExpiresIn string `json:"expires_in"`
|
|
|
|
}
|
|
|
|
|
2021-09-01 12:13:40 +02:00
|
|
|
type BandcampAlbum struct {
|
|
|
|
find bool
|
|
|
|
url string
|
|
|
|
}
|
|
|
|
|
|
|
|
type UrlBandcamp struct {
|
|
|
|
Artiste string `json:"artist"`
|
|
|
|
Album string `json:"album"`
|
|
|
|
SpotifyUrl string `json:"spotifyurl"`
|
|
|
|
BandcampUrl string `json:"bandcampurl"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func newUrlBandcamp(auteur, album, spo, band string) UrlBandcamp {
|
|
|
|
return UrlBandcamp{Artiste: auteur, Album: album, SpotifyUrl: spo, BandcampUrl: band}
|
|
|
|
}
|
|
|
|
|
2021-09-01 16:00:07 +02:00
|
|
|
func newUrlWoBandcamp(auteur, album, spo string) UrlBandcamp {
|
|
|
|
return UrlBandcamp{Artiste: auteur, Album: album, SpotifyUrl: spo, BandcampUrl: ""}
|
|
|
|
}
|
|
|
|
|
2021-09-01 12:13:40 +02:00
|
|
|
type RespBandcamp struct {
|
|
|
|
Done int `json:"done"`
|
|
|
|
Todo int `json:"todo"`
|
2021-09-01 16:00:07 +02:00
|
|
|
Albums []UrlBandcamp `json:"albums"`
|
|
|
|
Artists []UrlBandcamp `json:"artists"`
|
|
|
|
Notfound []UrlBandcamp `json:"notfound"`
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rp *RespBandcamp) AddAlbum(tmp UrlBandcamp) []UrlBandcamp {
|
|
|
|
rp.Albums = append(rp.Albums, tmp)
|
|
|
|
return rp.Albums
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rp *RespBandcamp) AddArtist(tmp UrlBandcamp) []UrlBandcamp {
|
|
|
|
rp.Artists = append(rp.Artists, tmp)
|
|
|
|
return rp.Artists
|
2021-09-01 12:13:40 +02:00
|
|
|
}
|
|
|
|
|
2021-09-01 16:00:07 +02:00
|
|
|
func (rp *RespBandcamp) AddNotfound(tmp UrlBandcamp) []UrlBandcamp {
|
|
|
|
rp.Notfound = append(rp.Notfound, tmp)
|
|
|
|
return rp.Notfound
|
2021-09-01 12:13:40 +02:00
|
|
|
}
|
|
|
|
|
2021-09-01 12:24:04 +02:00
|
|
|
type SpotifyItem struct {
|
|
|
|
AddedAt time.Time `json:"added_at"`
|
|
|
|
AddedBy struct {
|
|
|
|
ExternalUrls struct {
|
|
|
|
Spotify string `json:"spotify"`
|
|
|
|
} `json:"external_urls"`
|
|
|
|
Href string `json:"href"`
|
|
|
|
ID string `json:"id"`
|
|
|
|
Type string `json:"type"`
|
|
|
|
URI string `json:"uri"`
|
|
|
|
} `json:"added_by"`
|
|
|
|
IsLocal bool `json:"is_local"`
|
|
|
|
PrimaryColor interface{} `json:"primary_color"`
|
|
|
|
Track struct {
|
|
|
|
Album struct {
|
|
|
|
AlbumType string `json:"album_type"`
|
|
|
|
Artists []struct {
|
2021-08-28 21:05:38 +02:00
|
|
|
ExternalUrls struct {
|
|
|
|
Spotify string `json:"spotify"`
|
|
|
|
} `json:"external_urls"`
|
|
|
|
Href string `json:"href"`
|
|
|
|
ID string `json:"id"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Type string `json:"type"`
|
|
|
|
URI string `json:"uri"`
|
|
|
|
} `json:"artists"`
|
|
|
|
AvailableMarkets []string `json:"available_markets"`
|
2021-09-01 12:24:04 +02:00
|
|
|
ExternalUrls struct {
|
|
|
|
Spotify string `json:"spotify"`
|
|
|
|
} `json:"external_urls"`
|
|
|
|
Href string `json:"href"`
|
|
|
|
ID string `json:"id"`
|
|
|
|
Images []struct {
|
|
|
|
Height int `json:"height"`
|
|
|
|
URL string `json:"url"`
|
|
|
|
Width int `json:"width"`
|
|
|
|
} `json:"images"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
ReleaseDate string `json:"release_date"`
|
|
|
|
ReleaseDatePrecision string `json:"release_date_precision"`
|
|
|
|
TotalTracks int `json:"total_tracks"`
|
|
|
|
Type string `json:"type"`
|
|
|
|
URI string `json:"uri"`
|
|
|
|
} `json:"album"`
|
|
|
|
Artists []struct {
|
2021-08-28 21:05:38 +02:00
|
|
|
ExternalUrls struct {
|
|
|
|
Spotify string `json:"spotify"`
|
|
|
|
} `json:"external_urls"`
|
2021-09-01 12:24:04 +02:00
|
|
|
Href string `json:"href"`
|
|
|
|
ID string `json:"id"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Type string `json:"type"`
|
|
|
|
URI string `json:"uri"`
|
|
|
|
} `json:"artists"`
|
|
|
|
AvailableMarkets []string `json:"available_markets"`
|
|
|
|
DiscNumber int `json:"disc_number"`
|
|
|
|
DurationMs int `json:"duration_ms"`
|
|
|
|
Episode bool `json:"episode"`
|
|
|
|
Explicit bool `json:"explicit"`
|
|
|
|
ExternalIds struct {
|
|
|
|
Isrc string `json:"isrc"`
|
|
|
|
} `json:"external_ids"`
|
|
|
|
ExternalUrls struct {
|
|
|
|
Spotify string `json:"spotify"`
|
|
|
|
} `json:"external_urls"`
|
|
|
|
Href string `json:"href"`
|
|
|
|
ID string `json:"id"`
|
|
|
|
IsLocal bool `json:"is_local"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Popularity int `json:"popularity"`
|
|
|
|
PreviewURL string `json:"preview_url"`
|
|
|
|
Track bool `json:"track"`
|
|
|
|
TrackNumber int `json:"track_number"`
|
|
|
|
Type string `json:"type"`
|
|
|
|
URI string `json:"uri"`
|
|
|
|
} `json:"track"`
|
|
|
|
VideoThumbnail struct {
|
|
|
|
URL interface{} `json:"url"`
|
|
|
|
} `json:"video_thumbnail"`
|
|
|
|
}
|
2021-08-28 21:05:38 +02:00
|
|
|
|
2021-09-01 12:24:04 +02:00
|
|
|
type SpotifyPlaylist struct {
|
|
|
|
Href string `json:"href"`
|
2021-09-01 12:32:29 +02:00
|
|
|
Items []SpotifyItem `json:"items"`
|
2021-08-28 21:05:38 +02:00
|
|
|
Limit int `json:"limit"`
|
|
|
|
Next string `json:"next"`
|
|
|
|
Offset int `json:"offset"`
|
|
|
|
Previous interface{} `json:"previous"`
|
|
|
|
Total int `json:"total"`
|
|
|
|
}
|