mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-04 18:09:33 +00:00
fix custom playlist sortorder handling
This commit is contained in:
@@ -160,6 +160,7 @@ class SearchProcess:
|
||||
"playlist_last_refresh": playlist_last_refresh,
|
||||
}
|
||||
)
|
||||
print(playlist_dict)
|
||||
|
||||
return dict(sorted(playlist_dict.items()))
|
||||
|
||||
|
||||
@@ -325,6 +325,7 @@ class YoutubePlaylist(YouTubeItem):
|
||||
self.delete_metadata()
|
||||
|
||||
def create(self, name):
|
||||
"""create custom playlist"""
|
||||
self.json_data = {
|
||||
"playlist_id": self.youtube_id,
|
||||
"playlist_active": False,
|
||||
@@ -337,6 +338,7 @@ class YoutubePlaylist(YouTubeItem):
|
||||
"playlist_description": False,
|
||||
"playlist_thumbnail": False,
|
||||
"playlist_subscribed": False,
|
||||
"playlist_sort_order": "top",
|
||||
}
|
||||
self.upload_to_es()
|
||||
self.get_playlist_art()
|
||||
|
||||
@@ -45,7 +45,7 @@ class QueryBuilder:
|
||||
|
||||
type_parsed = getattr(PlaylistTypesEnum, playlist_type.upper()).value
|
||||
|
||||
return {"match": {"playlist_type.keyword": type_parsed}}
|
||||
return {"match": {"playlist_types": type_parsed}}
|
||||
|
||||
def parse_sort(self) -> dict:
|
||||
"""return sort"""
|
||||
|
||||
@@ -239,6 +239,12 @@ class PlaylistApiView(ApiBaseView):
|
||||
error = ErrorResponseSerializer({"error": "playlist not found"})
|
||||
return Response(error.data, status=404)
|
||||
|
||||
if self.response["playlist_type"] == "custom":
|
||||
error = ErrorResponseSerializer(
|
||||
{"error": f"playlist with ID {playlist_id} is custom"}
|
||||
)
|
||||
return Response(error.data, status=400)
|
||||
|
||||
subscribed = validated_data.get("playlist_subscribed")
|
||||
sort_order = validated_data.get("playlist_sort_order")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user