Skip to content

Commit

Permalink
feat(ui): conditional media server name to add emby to moviedetails
Browse files Browse the repository at this point in the history
  • Loading branch information
Fallenbagel committed May 26, 2022
1 parent ddd773c commit 14d2937
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions src/components/MovieDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {

if (data.mediaInfo?.mediaUrl) {
mediaLinks.push({
text:
settings.currentSettings.mediaServerType === MediaServerType.JELLYFIN
? intl.formatMessage(messages.play, { mediaServerName: 'Jellyfin' })
: intl.formatMessage(messages.play, { mediaServerName: 'Plex' }),
text: getAvalaibleMediaServerName(),
url: data.mediaInfo?.mediaUrl,
svg: <PlayIcon />,
});
Expand All @@ -146,10 +143,7 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
})
) {
mediaLinks.push({
text:
settings.currentSettings.mediaServerType === MediaServerType.JELLYFIN
? intl.formatMessage(messages.play4k, { mediaServerName: 'Jellyfin' })
: intl.formatMessage(messages.play4k, { mediaServerName: 'Plex' }),
text: getAvalaible4kMediaServerName(),
url: data.mediaInfo?.mediaUrl4k,
svg: <PlayIcon />,
});
Expand Down Expand Up @@ -228,6 +222,30 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
data?.watchProviders?.find((provider) => provider.iso_3166_1 === region)
?.flatrate ?? [];

function getAvalaibleMediaServerName() {
if (process.env.JELLYFIN_TYPE === 'emby') {
return intl.formatMessage(messages.play, { mediaServerName: 'Emby' });
}

if (settings.currentSettings.mediaServerType === MediaServerType.PLEX) {
return intl.formatMessage(messages.play, { mediaServerName: 'Plex' });
}

return intl.formatMessage(messages.play, { mediaServerName: 'Jellyfin' });
}

function getAvalaible4kMediaServerName() {
if (process.env.JELLYFIN_TYPE === 'emby') {
return intl.formatMessage(messages.play4k, { mediaServerName: 'Emby' });
}

if (settings.currentSettings.mediaServerType === MediaServerType.PLEX) {
return intl.formatMessage(messages.play4k, { mediaServerName: 'Plex' });
}

return intl.formatMessage(messages.play4k, { mediaServerName: 'Jellyfin' });
}

return (
<div
className="media-page"
Expand Down

0 comments on commit 14d2937

Please sign in to comment.