Allow adding a playlist to another playlist (closes #22)

This commit is contained in:
sigma67 2020-05-18 18:04:53 +02:00
commit 932827d44f
No known key found for this signature in database
GPG key ID: 1545A01D4474BAF0

View file

@ -789,15 +789,18 @@ class YTMusic:
title: str = None,
description: str = None,
privacyStatus: str = None,
moveItem: Tuple[str, str] = None) -> Union[str, Dict]:
moveItem: Tuple[str, str] = None,
addPlaylistId: str = None) -> Union[str, Dict]:
"""
Edit title, description or privacyStatus of a playlist, or move an item within a playlist.
Edit title, description or privacyStatus of a playlist.
You may also move an item within a playlist or append another playlist to this playlist.
:param playlistId: Playlist id
:param title: Optional. New title for the playlist
:param description: Optional. New description for the playlist
:param privacyStatus: Optional. New privacy status for the playlist
:param moveItem: Optional. Move one item before another. Items are specified by setVideoId, see :py:func:`get_playlist`
:param addPlaylistId: Optional. Id of another playlist to add to this playlist
:return: Status String or full response
"""
self.__check_auth()
@ -825,6 +828,12 @@ class YTMusic:
'movedSetVideoIdSuccessor': moveItem[1]
})
if addPlaylistId:
actions.append({
'action': 'ACTION_ADD_PLAYLIST',
'addedFullListId': addPlaylistId
})
body['actions'] = actions
endpoint = 'browse/edit_playlist'
response = self.__send_request(endpoint, body)