+ # Create new playlist if one does not exist\r
+ # DEVELOPMENT TEMP ALWAYS CREATE NEW PLAYLIST\r
+ #if (!$playlistID) {\r
+ if (true) {\r
+\r
+ $playlist_data = [\r
+ 'name' => $playlistName,\r
+ ];\r
+ \r
+ $playlist_opts = [\r
+ 'http' => [\r
+ 'method' => 'POST',\r
+ 'header' => 'Authorization: Bearer ' . $spot_token . "\r\n"\r
+ . 'Content-Type application/json \r\n',\r
+ 'content' => json_encode($playlist_data)\r
+ ]\r
+ ];\r
+\r
+ $playlist_context = stream_context_create($playlist_opts);\r
+ $playlist_req = file_get_contents(BASE_URL . 'users/' . $me_id . '/playlists', false, $playlist_context);\r
+ $playlist_json = json_decode($playlist_req, true);\r
+ $playlistID = $playlist_json['id'];\r
+ \r
+ #echo '<br />' . $playlistID;\r
+ \r
+ }\r