remove redundant video player api endpoint

This commit is contained in:
simon 2022-02-05 18:35:02 +07:00
parent 5b37bd059c
commit 91452b5114
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
3 changed files with 0 additions and 42 deletions

View File

@ -23,10 +23,6 @@ response = requests.get(url, headers=headers)
## Video Item View
/api/video/\<video_id>/
## Video Player View
returns all relevant information to create video player
/api/video/\<video_id>/player
## Channel List View
/api/channel/

View File

@ -6,7 +6,6 @@ from api.views import (
DownloadApiListView,
DownloadApiView,
PlaylistApiView,
VideoApiPlayerView,
VideoApiView,
)
from django.urls import path
@ -17,11 +16,6 @@ urlpatterns = [
VideoApiView.as_view(),
name="api-video",
),
path(
"video/<slug:video_id>/player/",
VideoApiPlayerView.as_view(),
name="api-video-player",
),
path(
"channel/",
ChannelApiListView.as_view(),

View File

@ -92,38 +92,6 @@ class VideoApiView(ApiBaseView):
return Response(self.response, status=self.status_code)
class VideoApiPlayerView(ApiBaseView):
"""resolves to /api/video/<video_id>/player
GET: returns dict of video to build player
"""
search_base = "/ta_video/_doc/"
def get(self, request, video_id):
# pylint: disable=unused-argument
"""get request"""
self.config_builder()
self.get_document(video_id)
player = self.process_response()
return Response(player, status=self.status_code)
def process_response(self):
"""build all needed vars for player"""
vid_data = self.response["data"]
youtube_id = vid_data["youtube_id"]
vid_thumb_url = ThumbManager().vid_thumb_path(youtube_id)
player = {
"youtube_id": youtube_id,
"media_url": "/media/" + vid_data["media_url"],
"vid_thumb_url": "/cache/" + vid_thumb_url,
"title": vid_data["title"],
"channel_name": vid_data["channel"]["channel_name"],
"channel_id": vid_data["channel"]["channel_id"],
"is_watched": vid_data["player"]["watched"],
}
return player
class ChannelApiView(ApiBaseView):
"""resolves to /api/channel/<channel_id>/
GET: returns metadata dict of channel