From 932827d44f1292b8f2cd249493ae04caadf0f53b Mon Sep 17 00:00:00 2001 From: sigma67 Date: Mon, 18 May 2020 18:04:53 +0200 Subject: [PATCH] Allow adding a playlist to another playlist (closes #22) --- ytmusicapi/ytmusic.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ytmusicapi/ytmusic.py b/ytmusicapi/ytmusic.py index edab348..0025aed 100644 --- a/ytmusicapi/ytmusic.py +++ b/ytmusicapi/ytmusic.py @@ -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)