-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55f89fe
commit 0dd1447
Showing
6 changed files
with
41 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import type { Playlist, PlaylistItem } from '../../types/playlist'; | ||
|
||
import { formatDuration, formatVideoSchedule } from './formatting'; | ||
|
||
export const createVideoMetadata = (media: PlaylistItem, episodesLabel?: string) => { | ||
const metaData = []; | ||
const duration = formatDuration(media.duration); | ||
|
||
if (media.pubdate) metaData.push(String(new Date(media.pubdate * 1000).getFullYear())); | ||
if (!episodesLabel && duration) metaData.push(duration); | ||
if (episodesLabel) metaData.push(episodesLabel); | ||
if (media.genre) metaData.push(media.genre); | ||
if (media.rating) metaData.push(media.rating); | ||
|
||
return metaData; | ||
}; | ||
export const createPlaylistMetadata = (playlist: Playlist, episodesLabel?: string) => { | ||
const metaData = []; | ||
|
||
if (episodesLabel) metaData.push(episodesLabel); | ||
if (playlist.genre) metaData.push(playlist.genre as string); | ||
if (playlist.rating) metaData.push(playlist.rating as string); | ||
|
||
return metaData; | ||
}; | ||
export const createLiveEventMetadata = (media: PlaylistItem, locale: string) => { | ||
const metaData = []; | ||
const scheduled = formatVideoSchedule(locale, media.scheduledStart, media.scheduledEnd); | ||
const duration = formatDuration(media.duration); | ||
|
||
if (scheduled) metaData.push(scheduled); | ||
if (duration) metaData.push(duration); | ||
if (media.genre) metaData.push(media.genre); | ||
if (media.rating) metaData.push(media.rating); | ||
|
||
return metaData; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters