Skip to content

Commit

Permalink
feat(series): add total episodes in video metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristiaanScheermeijer committed Jun 23, 2021
1 parent 3a89e3d commit 7ba0599
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/Video/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type Props = {
onTrailerClick: () => void;
onTrailerClose: () => void;
isSeries?: boolean;
episodeCount?: number;
children?: JSX.Element;
};

Expand All @@ -65,6 +66,7 @@ const Video: React.FC<Props> = ({
onTrailerClick,
onTrailerClose,
isSeries = false,
episodeCount,
}: Props) => {
const [isPlaying, setIsPlaying] = useState<boolean>(false);
const [userActive, setUserActive] = useState(true);
Expand All @@ -84,7 +86,8 @@ const Video: React.FC<Props> = ({

const metaData = [];
if (item.pubdate) metaData.push(new Date(item.pubdate * 1000).getFullYear());
if (item.duration) metaData.push(formatDuration(item.duration));
if (!isSeries && item.duration) metaData.push(formatDuration(item.duration));
if (isSeries && episodeCount) metaData.push(t('video:total_episodes', { count: episodeCount }));
if (item.genre) metaData.push(item.genre);
if (item.rating) metaData.push(item.rating);
const metaString = metaData.join(' • ');
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/en_US/video.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"season_prefix": "Season ",
"share": "Share",
"start_watching": "Start watching",
"total_episodes": "{{ count }} episode",
"total_episodes_plural": "{{ count }} episodes",
"trailer": "Trailer",
"watch_trailer": "Watch the trailer",
"share_video": "Share this video"
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/nl_NL/video.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"season_prefix": "",
"share": "",
"start_watching": "",
"total_episodes": "",
"total_episodes_plural": "",
"trailer": "",
"watch_trailer": "",
"share_video": ""
Expand Down
1 change: 1 addition & 0 deletions src/screens/Series/Series.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ const Series = ({
</Helmet>
<VideoComponent
title={seriesPlaylist.title}
episodeCount={seriesPlaylist.playlist.length}
item={item}
feedId={feedId ?? undefined}
trailerItem={trailerItem}
Expand Down

0 comments on commit 7ba0599

Please sign in to comment.