|
@@ -247,7 +247,7 @@ func findPlaylist(wikiText string) (spotify.ID, []spotify.ID) {
|
247
|
247
|
j += i
|
248
|
248
|
}
|
249
|
249
|
trackId := line[i+len(SPOTIFY_MARK) : j]
|
250
|
|
- tracks = append(tracks, spotify.ID(trackId))
|
|
250
|
+ tracks = append(tracks, spotify.ID(chopArgs(trackId)))
|
251
|
251
|
}
|
252
|
252
|
} else if strings.Index(line, SPOTIFY_PLAYLIST_MARK) != -1 && strings.Index(line, PLAYLIST_MARK) != -1 {
|
253
|
253
|
i := strings.Index(line, SPOTIFY_PLAYLIST_MARK)
|
|
@@ -258,7 +258,7 @@ func findPlaylist(wikiText string) (spotify.ID, []spotify.ID) {
|
258
|
258
|
if q != -1 {
|
259
|
259
|
playlist = playlist[:q]
|
260
|
260
|
}
|
261
|
|
- playlistId = spotify.ID(playlist)
|
|
261
|
+ playlistId = spotify.ID(chopArgs(playlist))
|
262
|
262
|
}
|
263
|
263
|
}
|
264
|
264
|
log.Printf("Found playlist %s and tracks %s\n", playlistId, tracks)
|
|
@@ -266,6 +266,14 @@ func findPlaylist(wikiText string) (spotify.ID, []spotify.ID) {
|
266
|
266
|
return spotify.ID(playlistId), tracks
|
267
|
267
|
}
|
268
|
268
|
|
|
269
|
+func chopArgs(value string) string {
|
|
270
|
+ q := strings.Index(value, "?")
|
|
271
|
+ if q != -1 {
|
|
272
|
+ value = value[:q]
|
|
273
|
+ }
|
|
274
|
+ return value
|
|
275
|
+}
|
|
276
|
+
|
269
|
277
|
func appendPlaylist(wikiText string, playlist *spotify.FullPlaylist) string {
|
270
|
278
|
changedText := wikiText + `
|
271
|
279
|
[` + playlist.ExternalURLs["spotify"] + ` Spotify-soittolista]
|