Code Monkey home page Code Monkey logo

Comments (6)

felix-hilden avatar felix-hilden commented on July 30, 2024

Also related: spotipy-dev/spotipy#1063

from tekore.

Ch00k avatar Ch00k commented on July 30, 2024

I found this issue trying to track down whether tekore has ever supported removing playlist items by index. Apparently it has, according to add1f2a and #315. As far as I can see, even though the functionality is not documented here, it still works: you can delete tracks with indexes providing a body like this:

{
  "tracks": [
    {
      "uri": "spotify:track:6YowAxI2HIbhAwumOqpldE",
      "positions": [7]
    }
  ]
}

I verified this at https://spotify-dedup.com/ (it sends Spotify API requests right from the browser, so it's easy to verify).

I am currently working on an app that, among other things, allow removing duplicate tracks from playlists, and without being able to remove playlist items by their index the workflow is much more involved than I'd like it to be: I have to remove the track by ID, which removes all its occurrences, then re-add the same track to the position of its first occurrence. And that's not to mention a full backup of the entire playlist in question, in case something goes wrong along the way.

Is there a story behind why #315 came to be? My guess is that it probably was spotipy-dev/spotipy#1063. Is there a reason tekore would not want to bring back the playlist_remove_occurrences method, removed in add1f2a, even though the official API docs don't mention the functionality?

from tekore.

felix-hilden avatar felix-hilden commented on July 30, 2024

We actually got errors in our tests from Spotify. The logs will expire soon, but here it is (400: Could not remove tracks, please check parameters.). The previous body only included the positions parameter, but that's interesting if it works! Thank you 👌 Would you be willing to contribute a fix?

from tekore.

Ch00k avatar Ch00k commented on July 30, 2024

Hm, interesting. The failed test was calling playlist_remove_indices. playlist_remove_occurrences call however, which in the test is made before playlist_remove_indices, succeeded.

I'll create a PR to add the playlist_remove_occurrences back. I'll also verify if playlist_remove_indices works, and add it back too if it does.

Since this functionality is undocumented, I think it would be convenient for the user to know about this. I was thinking about something along the lines of a RuntimeWarning if the user calls a function that utilizes undocumented features. What do you think?

from tekore.

felix-hilden avatar felix-hilden commented on July 30, 2024

Oh, fair! I may have jumped the gun with that when I saw it wasn't documented anymore. And that sounds good. RuntimeWarnings are a bit much. I've resorted to just documenting the fact that it's not mentioned officially. So a note in the docstring would be enough for me! Thank you!

from tekore.

felix-hilden avatar felix-hilden commented on July 30, 2024

remove_indices still not working, but the old remove_occurrences does! I couldn't find any other things we've missed though.

from tekore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.