implement create custom playlist, #733

This commit is contained in:
Simon 2025-01-12 19:16:37 +07:00
parent 87cf9fdd53
commit f85772ca14
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,7 @@
"""all playlist API views"""
import uuid
from common.views_base import AdminWriteOnly, ApiBaseView
from download.src.subscriptions import PlaylistSubscription
from playlist.src.index import YoutubePlaylist
@ -45,6 +47,13 @@ class PlaylistApiListView(ApiBaseView):
print(message)
return Response({"message": message}, status=400)
custom_name = data["data"].get("create")
if custom_name:
playlist_id = f"TA_playlist_{uuid.uuid4()}"
custom_playlist = YoutubePlaylist(playlist_id)
custom_playlist.create(custom_name)
return Response(custom_playlist.json_data)
pending = []
for playlist_item in to_add:
playlist_id = playlist_item["playlist_id"]