extensions icon indicating copy to clipboard operation
extensions copied to clipboard

[Spotify Player] Please add a check for duplicate tracks before adding to a playlist

Open 3raxton opened this issue 1 year ago β€’ 12 comments

Extension

https://www.raycast.com/mattisssa/spotify-player

Description

Currently, users can add duplicate tracks to playlists by running the extension and adding a track to a playlist that already has that track in it. This could be resolved by checking the title, track name and artist or URI. This way, no duplicates would be added to a playlist. Ideally, the flow would look something like this:

User runs extension to add track to playlist > Extension checks if track is already in playlist >

  • If yes, the user is asked if they want to add a duplicate track
  • If no, the track is added to the playlist

Alternatively, users could use a different shortcut key combination to add tracks without checking for duplicates.

Further, Spotify already has a feature that does this. Could you utilize what already exists to build this out?

Who will benefit from this feature?

Music listeners everywhere!

Anything else?

Thank you for building such an excellent extension. I've added this to my daily workflow, and I appreciate how much easier it has made my use of Spotify. Keep up the great work!

3raxton avatar Jul 23 '25 05:07 3raxton

Thank you for opening this issue!

πŸ”” @mattisssa @peduarte @sxn @dillionverma @andreaselia @stuart @tonka3000 @dancannon @pernielsentikaer @stevensd2m @erics118 @hjoelh @hobhouse @jatindotdev @the-devbear @rfaccio @badta5te @andyburris @thomaslombart @rhesamu @mpatel283 @LitoMore @EnneEmme @lineville @tsibog @viethung0823 @eyalevy23 @jonasengelmann @vmrjnvc @Karthikxp @kartheesan05 @joshkat you might want to have a look.

πŸ’‘ Author and Contributors commands

The author and contributors of mattisssa/spotify-player can trigger bot actions by commenting:

  • @raycastbot close this issue Closes the issue.
  • @raycastbot close as not planned Closes the issue as not planned.
  • @raycastbot rename this issue to "Awesome new title" Renames the issue.
  • @raycastbot reopen this issue Reopens the issue.
  • @raycastbot assign me Assigns yourself to the issue.
  • @raycastbot good first issue Adds the "Good first issue" label to the issue.
  • @raycastbot keep this issue open Make sure the issue won't go stale and will be kept open by the bot.

raycastbot avatar Jul 23 '25 05:07 raycastbot

@raycastbot assign me

joshkat avatar Jul 24 '25 04:07 joshkat

@3raxton just sent in a PR with this feature linked here.

Spotifys API for adding a song to playlist doesn't have a way to filter if it's already been added or not so solution I came up with involved caching your playlists to local storage, and it's based on a refresh rate of your choosing.

joshkat avatar Jul 24 '25 05:07 joshkat

Sweet @joshkat, that's awesome! Quick thought regarding an edge case: I have a playlist that is 10,000 songs long; this is the max that Spotify allows. Would a playlist this large cause a massive cache in local storage?

I anticipate the refresh rate for this would prevent that from happening, but what would happen if a large playlist needs to be cached again or the refresh rate is set to its longest interval?

3raxton avatar Jul 24 '25 05:07 3raxton

Great thinking, going to blame late night brain for missing out on this lol.

So as it stands right now the cache only gets updated if a given playlist tries to get updated after the time-frame of a refresh, but will implement a cleanup anytime the function is run wholesale.

In terms of lowering sizing until that time-frame is hit though I can make it so that the cache just stores an array of ID's as thats all I need for actually checking if the playing song is in a given playlist, which should drastically lower cache size.

Will look through it again some other time this week πŸ‘

joshkat avatar Jul 24 '25 05:07 joshkat

No sweat, the only reason this comes up is because I have a playlist that I've maxed out. The ray of IDs would work well but I wonder if such a massive playlist would cause the return to take an extensive amount of time.

Sounds good, appreciate you working on this!

3raxton avatar Jul 25 '25 23:07 3raxton

Totally valid concern. From my testing (there will likely be some variance due to internet speed as well as API polling variance), I was able to fully check through a playlist of size ~9,500 in 1 minute and 15 seconds, which isn't greatttt, but given the playlist length, there really isn't much else that can be done, unfortunately (unless, of course, Spotify adds a faster method to their API).

joshkat avatar Jul 27 '25 01:07 joshkat

I agree and don’t anticipate Spotify providing a faster method to their API. Maybe an alternative option for this could be allowing for checks for duplicates to be enabled or disabled on specific playlists if there is a playlist where it will take minutes to check? I appreciate your work on this! On Jul 26, 2025 at 20:46 -0500, Josh Katayev @.***>, wrote:

joshkat left a comment (raycast/extensions#20597) Totally valid concern. From my testing (there will likely be some variance due to internet speed as well as API polling variance), I was able to fully check through a playlist of size ~9,500 in 1 minute and 15 seconds, which isn't greatttt, but given the playlist length, there really isn't much else that can be done, unfortunately (unless, of course, Spotify adds a faster method to their API). β€” Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

3raxton avatar Jul 27 '25 19:07 3raxton

To be honest I think that's just up to the users discretion at that point, I did leave a note on the description of the toggle saying it'll be slow for playlists of a large size. Though once the PR actually gets an init review (summer time has response times of checks between 1-2 weeks) I'll be sure to mention it.

joshkat avatar Jul 31 '25 01:07 joshkat

@3raxton the PR has been merged you should be able to use this feature now.

joshkat avatar Aug 25 '25 13:08 joshkat

@raycastbot close this issue

joshkat avatar Aug 25 '25 13:08 joshkat

Hey @joshkat, I am using this extension currently and this feature is not working. What details can I provide you with for further diagnosis?

3raxton avatar May 06 '26 04:05 3raxton