-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SpotifyPlayList-dev-017-fix-deployment-bugs (#180)
* FE fix auth use BASE_URL, BE fix config format * FE recommendation view fix button style * FE fix createPlayList view layout * FE recommendation make market as dropdown * make genre as dropdown, readme add ML ref * update readme * fix readme * fix readme * fix readme * make env var overwrite FE baseURL, BE secret, redirectURL * fix readme type * fix * fix docker-compose.yml * add GetSongFeatureTest.java * fix test name, add get song feature from playlist * BE align cofig var name with docker, update BE code, docker file read from env var, update npm pkg file * docker clean npm cache, setup publicPath at vue conf * fix run vue app in prod mode * roll back cli-service version
- Loading branch information
Showing
13 changed files
with
4,227 additions
and
7,236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
springSpotifyPlayList/backend/SpotifyPlayList/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
server.port=8888 | ||
|
||
spring.application.name=SpotifyPlayList | ||
spotify.clientId=833e496a818d4dac926a00970ba4d725 | ||
spotify.clientSecret= | ||
spotify.redirectURL=http://localhost:8080/playlist #http://<ec2_url>:8080/playlist | ||
spotify.client.id=833e496a818d4dac926a00970ba4d725 | ||
spotify.client.secret= | ||
spotify.redirect.url=http://localhost:8080/playlist | ||
#spotify.redirectURL=http://<ec2_url>:8080/playlist | ||
spotify.authorize.scope=playlist-modify-public,playlist-modify-private,user-read-private,user-read-email | ||
|
||
spotify.userId=62kytpy7jswykfjtnjn9zv3ou |
105 changes: 105 additions & 0 deletions
105
...ayList/backend/SpotifyPlayList/src/test/java/com/yen/SpotifyPlayList/SongFeatureTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
package com.yen.SpotifyPlayList; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import se.michaelthelin.spotify.SpotifyApi; | ||
import se.michaelthelin.spotify.exceptions.SpotifyWebApiException; | ||
import se.michaelthelin.spotify.model_objects.specification.*; | ||
import se.michaelthelin.spotify.requests.data.playlists.GetPlaylistsItemsRequest; | ||
import se.michaelthelin.spotify.requests.data.tracks.GetAudioFeaturesForTrackRequest; | ||
|
||
import java.io.IOException; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
public class SongFeatureTest { | ||
|
||
final String accessToken = "BQCVX_9iFkOgTNsyrl2l3Xw7BczyFbmugxUUC5Lm0nhTyw02D9RNKzNixqbiEv7o8YK8N7VYH3MyUutbT_uHY6aFb5cAnsolKzOtjP2hgGbjEaMGGPE"; | ||
String trackId = "6oHUMXEKpnXOrs13VoGsuF"; | ||
|
||
String playListId = "6fbBvdE95blBGc3ekFMzh1"; | ||
|
||
// // https://github.com/spotify-web-api-java/spotify-web-api-java/blob/master/examples/data/tracks/GetAudioFeaturesForTrackExample.java | ||
@Test | ||
public void test_getSong_feature() { | ||
|
||
try { | ||
final SpotifyApi spotifyApi = new SpotifyApi.Builder() | ||
.setAccessToken(accessToken) | ||
.build(); | ||
final GetAudioFeaturesForTrackRequest getAudioFeaturesForTrackRequest = spotifyApi | ||
.getAudioFeaturesForTrack(trackId) | ||
.build(); | ||
|
||
final AudioFeatures audioFeatures = getAudioFeaturesForTrackRequest.execute(); | ||
|
||
System.out.println(">>> ID: " + audioFeatures.getId()); | ||
|
||
/** | ||
* example output: | ||
* | ||
* >>> audioFeatures: AudioFeatures(acousticness=0.443, analysisUrl=https://api.spotify.com/v1/audio-analysis/6oHUMXEKpnXOrs13VoGsuF, danceability=0.658, durationMs=225387, energy=0.86, id=6oHUMXEKpnXOrs13VoGsuF, instrumentalness=0.0, key=5, liveness=0.304, loudness=-2.898, mode=MINOR, speechiness=0.0272, tempo=88.032, timeSignature=4, trackHref=https://api.spotify.com/v1/tracks/6oHUMXEKpnXOrs13VoGsuF, type=AUDIO_FEATURES, uri=spotify:track:6oHUMXEKpnXOrs13VoGsuF, valence=0.644) | ||
*/ | ||
System.out.println(">>> audioFeatures: " + audioFeatures); | ||
|
||
} catch (IOException | SpotifyWebApiException e) { | ||
System.out.println("Error: " + e.getMessage()); | ||
} catch (org.apache.hc.core5.http.ParseException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
} | ||
|
||
// https://github.com/spotify-web-api-java/spotify-web-api-java/blob/master/examples/data/playlists/GetPlaylistsItemsExample.java | ||
|
||
@Test | ||
public void test_getSongFeatureList_from_playList(){ | ||
|
||
try { | ||
final SpotifyApi spotifyApi = new SpotifyApi.Builder() | ||
.setAccessToken(accessToken) | ||
.build(); | ||
|
||
final GetPlaylistsItemsRequest getPlaylistsItemsRequest = spotifyApi | ||
.getPlaylistsItems(playListId) | ||
// .fields("description") | ||
// .limit(10) | ||
// .offset(0) | ||
// .market(CountryCode.SE) | ||
// .additionalTypes("track,episode") | ||
.build(); | ||
|
||
|
||
final CompletableFuture<Paging<PlaylistTrack>> pagingFuture = getPlaylistsItemsRequest.executeAsync(); | ||
|
||
// Thread free to do other tasks... | ||
|
||
// Example Only. Never block in production code. | ||
final Paging<PlaylistTrack> playlistTrackPaging = pagingFuture.join(); | ||
|
||
System.out.println("Total: " + playlistTrackPaging.getTotal()); | ||
//System.out.println("Track's first artist: " + ((Track) playlistTrackPaging.getItems()[0].getTrack()).getArtists()[0]); | ||
//System.out.println("Episode's show: " + ((Episode) playlistTrackPaging.getItems()[0].getTrack()).getShow()); | ||
|
||
|
||
PlaylistTrack[] playlistTracks = playlistTrackPaging.getItems(); | ||
for (PlaylistTrack track: playlistTracks){ | ||
|
||
String songId = track.getTrack().getId(); | ||
//System.out.println(">>> name = " + track.getTrack().getName() + ", id = " + songId); | ||
// get song feature | ||
final GetAudioFeaturesForTrackRequest getAudioFeaturesForTrackRequest = spotifyApi | ||
.getAudioFeaturesForTrack(songId) | ||
.build(); | ||
|
||
final AudioFeatures audioFeatures = getAudioFeaturesForTrackRequest.execute(); | ||
|
||
System.out.println(">>> name = " + track.getTrack().getName() + ", id = " + songId + ", audioFeatures = " + audioFeatures); | ||
|
||
} | ||
|
||
} catch (Exception e) { | ||
System.out.println("Error: " + e.getMessage()); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VUE_APP_BASE_URL=http://localhost:8888/ |
Oops, something went wrong.