ytmusicapi icon indicating copy to clipboard operation
ytmusicapi copied to clipboard

Inconsistency between YTMusic.remove_playlist_items() and YTMusic.add_playlist_items()

Open xplorr opened this issue 6 years ago • 2 comments

YTMusic.add_playlist_items(): needs a list of songids. YTMusic.remove_playlist_items(): needs a list of dictionaries of songids

Why not also use a list of songids for YTMusic.remove_playlist_items(), which is consistent and simpler.

xplorr avatar Aug 25 '20 18:08 xplorr

This is not an inconsistency, it's how the API works. You can have duplicate videos in a playlist, so a different ID (setVideoId) is used for removing/moving playlist items. Check this code snippet from remove_playlist_items:

https://github.com/sigma67/ytmusicapi/blob/7c18d8df4be21989ee95a17005dcfb728a067bb2/ytmusicapi/mixins/playlists.py#L259-L264

The same goes for moving playlist items. The moveItem is a tuple here, but the same two IDs (videoId and setVideoId) are used:

https://github.com/sigma67/ytmusicapi/blob/7c18d8df4be21989ee95a17005dcfb728a067bb2/ytmusicapi/mixins/playlists.py#L182-L187

Whereas for adding playlist items, they're always added to the end of the playlist, so there's no need to specify a position.

sigma67 avatar Aug 26 '20 09:08 sigma67

Ok, seems logical, thx

xplorr avatar Aug 26 '20 10:08 xplorr