mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-25 21:20:15 +00:00
remove redundant video player api endpoint
This commit is contained in:
parent
5b37bd059c
commit
91452b5114
@ -23,10 +23,6 @@ response = requests.get(url, headers=headers)
|
|||||||
## Video Item View
|
## Video Item View
|
||||||
/api/video/\<video_id>/
|
/api/video/\<video_id>/
|
||||||
|
|
||||||
## Video Player View
|
|
||||||
returns all relevant information to create video player
|
|
||||||
/api/video/\<video_id>/player
|
|
||||||
|
|
||||||
## Channel List View
|
## Channel List View
|
||||||
/api/channel/
|
/api/channel/
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ from api.views import (
|
|||||||
DownloadApiListView,
|
DownloadApiListView,
|
||||||
DownloadApiView,
|
DownloadApiView,
|
||||||
PlaylistApiView,
|
PlaylistApiView,
|
||||||
VideoApiPlayerView,
|
|
||||||
VideoApiView,
|
VideoApiView,
|
||||||
)
|
)
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
@ -17,11 +16,6 @@ urlpatterns = [
|
|||||||
VideoApiView.as_view(),
|
VideoApiView.as_view(),
|
||||||
name="api-video",
|
name="api-video",
|
||||||
),
|
),
|
||||||
path(
|
|
||||||
"video/<slug:video_id>/player/",
|
|
||||||
VideoApiPlayerView.as_view(),
|
|
||||||
name="api-video-player",
|
|
||||||
),
|
|
||||||
path(
|
path(
|
||||||
"channel/",
|
"channel/",
|
||||||
ChannelApiListView.as_view(),
|
ChannelApiListView.as_view(),
|
||||||
|
@ -92,38 +92,6 @@ class VideoApiView(ApiBaseView):
|
|||||||
return Response(self.response, status=self.status_code)
|
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):
|
class ChannelApiView(ApiBaseView):
|
||||||
"""resolves to /api/channel/<channel_id>/
|
"""resolves to /api/channel/<channel_id>/
|
||||||
GET: returns metadata dict of channel
|
GET: returns metadata dict of channel
|
||||||
|
Loading…
Reference in New Issue
Block a user