your_spotify icon indicating copy to clipboard operation
your_spotify copied to clipboard

[Feature Request] Create Spotify Playlist from "top songs"

Open flighter18 opened this issue 2 years ago • 2 comments

Type: Feature Request

First of all, I really like your_spotify thank u for the work!

Description: I would love if i could create a spotify playlist from my "top songs"

(maybe this implementation would be nice: choose how many songs of the top songs you would like to have in the spotify playlist and choose spotify playlist name)

so i could listen all my fav songs much easier.

flighter18 avatar Aug 24 '22 19:08 flighter18

Hello! Thanks for the feedback!

It is actually a good idea. Having a create a playlist button at the top right of the screen when navigating top songs/albums can be really good! I'll work on this asap.

If you have any idea on how we could implement this in a different way I'd love to hear it :)

Yooooomi avatar Aug 24 '22 20:08 Yooooomi

having such a button at the top right corner would be great :)

a push on this button would open a dialog window where you can enter how many song you would like to have in the play list. like from 100 to 150 "top song" And you also name the playlist as you like.

Thank u very mutch!

flighter18 avatar Aug 24 '22 20:08 flighter18

it would be also nice, if you can add individually song from "top songs" to existing playlist :)

flighter18 avatar Aug 25 '22 09:08 flighter18

@Yooooomi thank u so mutch ;) Will try it tomorrow

flighter18 avatar Oct 08 '22 20:10 flighter18

Wow you got quick, was about to write

Hey! This feature is out, feel free to try it and give your feedback on it. I hope you'll like it :)

Yooooomi avatar Oct 08 '22 20:10 Yooooomi

I've just upgraded - thanks for the update!

However, creating a new playlist with my top songs does not seem to work :/

The API request from my browser to create the playlist fails as error 500 without any message, on the server there's this in the logs:

api_1    | [error]  AxiosError: Request failed with status code 400
api_1    |     at settle (/app/node_modules/axios/dist/node/axios.cjs:1261:12)
api_1    |     at Unzip.handleStreamEnd (/app/node_modules/axios/dist/node/axios.cjs:2444:11)
api_1    |     at Unzip.emit (node:events:525:35)
api_1    |     at endReadableNT (node:internal/streams/readable:1358:12)
api_1    |     at processTicksAndRejections (node:internal/process/task_queues:83:21) {
api_1    |   code: 'ERR_BAD_REQUEST',

.... axios debug info ...

api_1    |     _header: 'POST /v1/users/kolaenten/playlists HTTP/1.1\r\n' +

.... more axios debug info ...

api_1    |   response: {
api_1    |     status: 400,
api_1    |     statusText: 'Bad Request',
api_1    |     headers: AxiosHeaders {
api_1    |       'content-type': 'application/json; charset=utf-8',
api_1    |       'cache-control': 'private, max-age=0',
api_1    |       'x-robots-tag': 'noindex, nofollow',
api_1    |       'access-control-allow-origin': '*',
api_1    |       'access-control-allow-headers': 'Accept, App-Platform, Authorization, Content-Type, Origin, Retry-After, Spotify-App-Version, X-Cloud-Trace-Context, client-token, content-access-token',
api_1    |       'access-control-allow-methods': 'GET, POST, OPTIONS, PUT, DELETE, PATCH',
api_1    |       'access-control-allow-credentials': 'true',
api_1    |       'access-control-max-age': '604800',
api_1    |       'strict-transport-security': 'max-age=31536000',
api_1    |       'x-content-type-options': 'nosniff',
api_1    |       date: 'Sat, 08 Oct 2022 20:28:25 GMT',
api_1    |       server: 'envoy',
api_1    |       via: 'HTTP/2 edgeproxy, 1.1 google',
api_1    |       'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
api_1    |       connection: 'close',
api_1    |       'transfer-encoding': 'chunked',
api_1    |       [Symbol(defaults)]: null
api_1    |     },
api_1    |     config: {
api_1    |       transitional: [Object],
api_1    |       adapter: [Function: httpAdapter],
api_1    |       transformRequest: [Array],
api_1    |       transformResponse: [Array],
api_1    |       timeout: 0,
api_1    |       xsrfCookieName: 'XSRF-TOKEN',
api_1    |       xsrfHeaderName: 'X-XSRF-TOKEN',
api_1    |       maxContentLength: -1,
api_1    | POST /spotify/playlist/create?token= 500 296.490 ms - -
api_1    |       maxBodyLength: -1,
api_1    |       env: [Object],
api_1    |       validateStatus: [Function: validateStatus],
api_1    |       headers: [AxiosHeaders],
api_1    |       baseURL: 'https://api.spotify.com/v1',
api_1    |       method: 'post',
api_1    |       url: '/users/kolaenten/playlists',
api_1    |       data: 'name=Top+Songs+Last+Month&public=true&collaborative=false&description='
api_1    |     },
api_1    |     request: <ref *1> ClientRequest {
api_1    |       _events: [Object: null prototype],
api_1    |       _eventsCount: 7,
api_1    |       _maxListeners: undefined,
api_1    |       outputData: [],
api_1    |       outputSize: 0,
api_1    |       writable: true,
api_1    |       destroyed: true,
api_1    |       _last: true,
api_1    |       chunkedEncoding: false,
api_1    |       shouldKeepAlive: false,
api_1    |       maxRequestsOnConnectionReached: false,
api_1    |       _defaultKeepAlive: true,
api_1    |       useChunkedEncodingByDefault: true,
api_1    |       sendDate: false,
api_1    |       _removedConnection: false,
api_1    |       _removedContLen: false,
api_1    |       _removedTE: false,
api_1    |       _contentLength: null,
api_1    |       _hasBody: true,
api_1    |       _trailer: '',
api_1    |       finished: true,
api_1    |       _headerSent: true,
api_1    |       _closed: true,
api_1    |       socket: [TLSSocket],
api_1    |       _header: 'POST /v1/users/kolaenten/playlists HTTP/1.1\r\n' +
api_1    |         'Accept: application/json, text/plain, */*\r\n' +
api_1    |         'Content-Type: application/x-www-form-urlencoded\r\n' +
api_1    |         'Authorization: Bearer NOTABEARER\r\n' +
api_1    |         'User-Agent: axios/1.1.2\r\n' +
api_1    |         'Content-Length: 70\r\n' +
api_1    |         'Accept-Encoding: gzip, deflate, br\r\n' +
api_1    |         'Host: api.spotify.com\r\n' +
api_1    |         'Connection: close\r\n' +
api_1    |         '\r\n',
api_1    |       _keepAliveTimeout: 0,
api_1    |       _onPendingData: [Function: nop],
api_1    |       agent: [Agent],
api_1    |       socketPath: undefined,
api_1    |       method: 'POST',
api_1    |       maxHeaderSize: undefined,
api_1    |       insecureHTTPParser: undefined,
api_1    |       path: '/v1/users/kolaenten/playlists',
api_1    |       _ended: true,
api_1    |       res: [IncomingMessage],
api_1    |       aborted: false,
api_1    |       timeoutCb: null,
api_1    |       upgradeOrConnect: false,
api_1    |       parser: null,
api_1    |       maxHeadersCount: null,
api_1    |       reusedSocket: false,
api_1    |       host: 'api.spotify.com',
api_1    |       protocol: 'https:',
api_1    |       _redirectable: [Writable],
api_1    |       [Symbol(kCapture)]: false,
api_1    |       [Symbol(kNeedDrain)]: false,
api_1    |       [Symbol(corked)]: 0,
api_1    |       [Symbol(kOutHeaders)]: [Object: null prototype],
api_1    |       [Symbol(kUniqueHeaders)]: null
api_1    |     },
api_1    |     data: { error: [Object] }
api_1    |   }
api_1    | }

I've removed access for my spotify account in Spotify's account settings and re-added it (so that it definitely picks up the new permission to create or modify playlists) but that didn't seem to work.

Should I open a new issue for this?

kolaente avatar Oct 08 '22 20:10 kolaente

And I've noticed two more things:

  1. The list of existing playlists in the "Create Playlist" dialouge does not contain all playlists. I am a bit extreme there in that I have something like 200 playlists but "only" 50 or so show up in the dropdown
  2. I can't seem to select anything other than 50 in the "Number of Items" dropdown in the popup.

kolaente avatar Oct 08 '22 20:10 kolaente

@kolaente thanks for the feedback. I'll have a look at this. I understand the playlist being limited to 50 but don't understand why you wouldn't be able to choose another number than 50.

Yooooomi avatar Oct 08 '22 21:10 Yooooomi

@Yooooomi Not sure either, it would just always select 50, no matter what I click on. Entering a custom number seems to work though.

I'm using Firefox 104 on Linux (NixOS).

kolaente avatar Oct 08 '22 21:10 kolaente

@kolaente I cannot reproduce the error where the app does not show all the playlists. I tried loading playlists by chunks of 10, it is slower but still loads every single one of them. However, it won't load collaborative playlists. I'll check if it can load them but if you could confirm the ones missing are collaborative it would be nice. Thanks

Yooooomi avatar Oct 08 '22 21:10 Yooooomi

Should be fixed now. Dumb mistake on the selector when trying to clean things. Now all your playlists should be visible too, only public ones were visible before. I tested against my account and I only have public playlists so I did not see any difference. Anyways thanks a lot for the very quick feedback. It's always nice to see people testing new features this fast.

Yooooomi avatar Oct 08 '22 22:10 Yooooomi

Awesome, thanks for the fix. I was actually talking with a friend recently about building a feature to automatically create a playlist from your top songs on Spotify - when I saw the release notes I had to check it out right away :)

kolaente avatar Oct 09 '22 11:10 kolaente

I just updated to the latest aka 1.3.1, and I'm getting POST /spotify/playlist/create?token= 500 489.744 ms - - with 49 songs and it still fails so how does one get it to work?

The spotify API seems to respond with 400 to the playlist endpoint.

samip5 avatar Oct 09 '22 15:10 samip5

Hello @samip5. Long time no see! Could you please open a new issue with logs from the server please? Many thanks

Yooooomi avatar Oct 09 '22 17:10 Yooooomi

Hello @samip5. Long time no see! Could you please open a new issue with logs from the server please? Many thanks

Created. #160

samip5 avatar Oct 09 '22 17:10 samip5

Wow you got quick, was about to write

Hey! This feature is out, feel free to try it and give your feedback on it. I hope you'll like it :)

Got a notification :)

Now i have had time to test it. unfortunately i get also an error if i add a song to an existing playlist or if i add a song to a new playlist.

` xhr.js:244 POST https://spotify-app.<URL>/spotify/playlist/create?token= 500 (anonymous) @ xhr.js:244 thunk.ts:33 Ed {message: 'Request failed with status code 500', name: 'AxiosError', code: 'ERR_BAD_RESPONSE', config: {…}, request: XMLHttpRequest, …}code: "ERR_BAD_RESPONSE"config: {transitional: {…}, transformRequest: Array(1), transformResponse: Array(1), timeout: 0, adapter: ƒ, …}message: "Request failed with status code 500"name: "AxiosError"request: XMLHttpRequest {onreadystatechange: null, readyState: 4, timeout: 0, withCredentials: true, upload: XMLHttpRequestUpload, …}response: {data: '', status: 500, statusText: '', headers: lp, config: {…}, …}stack: "AxiosError: Request failed with status code 500\n at https://<URL>/static/js/main.351ceb41.js:2:451498\n at XMLHttpRequest.d (https://<URL>/static/js/main.351ceb41.js:2:451646)"[[Prototype]]: Error

`

i am using a nginx proxy in front of your spotify and have 2 diffrent URLS

  • spotify-app.DOMAIN
  • spotify.DOMAIN

should i open a new issue?

flighter18 avatar Oct 09 '22 19:10 flighter18

@Yooooomi thank u for the fix. It is working now!

a big thank you for adding this feature!

flighter18 avatar Oct 09 '22 20:10 flighter18

Nice to hear! Sorry for this being a bit of a mess. I'm planning to have a beta channel where I can use the platform for 1-2 weeks before publishing officially, this will solve many problems. Have fun with the new feature :)

Yooooomi avatar Oct 09 '22 20:10 Yooooomi