From 75169462e322da263769693726076200c87dc85f Mon Sep 17 00:00:00 2001 From: Roland Date: Thu, 11 Nov 2021 17:05:04 -0700 Subject: [PATCH] Including video.view_count in minimum video. Displaying video.view_count before info_json view count in UI. --- app/src/components/VideoPlayer.js | 7 +++---- modules/videos/common.py | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/components/VideoPlayer.js b/app/src/components/VideoPlayer.js index 9b2f18b0..152aebba 100644 --- a/app/src/components/VideoPlayer.js +++ b/app/src/components/VideoPlayer.js @@ -11,8 +11,7 @@ const MEDIA_PATH = '/media'; function VideoPage(props) { - let video = props.video; - let channel = video.channel; + let {video, channel} = props; let [deleteOpen, setDeleteOpen] = useState(false); async function handleDeleteVideo(video_id) { @@ -37,10 +36,10 @@ function VideoPage(props) { } let description = 'No description available.'; - let viewCount = null; + let viewCount = video.view_count; if (video.info_json) { description = video.info_json['description']; - viewCount = video.info_json['view_count']; + viewCount = viewCount || video.info_json['view_count']; } let [favorite, setFavorite] = React.useState(video.favorite); diff --git a/modules/videos/common.py b/modules/videos/common.py index 9bbf9f84..284fca4f 100644 --- a/modules/videos/common.py +++ b/modules/videos/common.py @@ -26,7 +26,8 @@ REQUIRED_OPTIONS = ['name', 'directory'] MINIMUM_CHANNEL_KEYS = {'id', 'name', 'directory', 'url', 'video_count', 'link'} MINIMUM_INFO_JSON_KEYS = {'description', 'view_count'} MINIMUM_VIDEO_KEYS = {'id', 'title', 'upload_date', 'duration', 'channel', 'channel_id', 'favorite', 'size', - 'poster_path', 'caption_path', 'video_path', 'info_json', 'channel', 'viewed', 'source_id'} + 'poster_path', 'caption_path', 'video_path', 'info_json', 'channel', 'viewed', 'source_id', + 'view_count'} VIDEO_QUERY_LIMIT = 20 VIDEO_QUERY_MAX_LIMIT = 100 # These are the supported video formats. These are in order of their preference.