From 2bfdf02c7942762bd9f5201459b1a9ad6003b9a6 Mon Sep 17 00:00:00 2001 From: Mohamed jinas Date: Sun, 22 May 2022 22:12:05 +0500 Subject: [PATCH 01/10] feat: conditional media server name --- next.config.js | 1 + src/components/TvDetails/index.tsx | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/next.config.js b/next.config.js index f0a623d4e..83a0c63cb 100644 --- a/next.config.js +++ b/next.config.js @@ -1,6 +1,7 @@ module.exports = { env: { commitTag: process.env.COMMIT_TAG || 'local', + JELLYFIN_TYPE: 'emby', }, images: { domains: ['image.tmdb.org'], diff --git a/src/components/TvDetails/index.tsx b/src/components/TvDetails/index.tsx index 7de7fff17..98bf45e34 100644 --- a/src/components/TvDetails/index.tsx +++ b/src/components/TvDetails/index.tsx @@ -124,10 +124,7 @@ const TvDetails: React.FC = ({ tv }) => { }) ) { 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: , }); @@ -228,6 +225,18 @@ const TvDetails: React.FC = ({ tv }) => { 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' }); + } + return (
Date: Thu, 26 May 2022 05:49:33 +0500 Subject: [PATCH 02/10] feat: conditional media server name to add emby to tvdetails --- next.config.js | 1 - 1 file changed, 1 deletion(-) diff --git a/next.config.js b/next.config.js index 83a0c63cb..f0a623d4e 100644 --- a/next.config.js +++ b/next.config.js @@ -1,7 +1,6 @@ module.exports = { env: { commitTag: process.env.COMMIT_TAG || 'local', - JELLYFIN_TYPE: 'emby', }, images: { domains: ['image.tmdb.org'], From e75b71b8168b4a661971b809c88f9910c4206545 Mon Sep 17 00:00:00 2001 From: Fallenbagel <98979876+Fallenbagel@users.noreply.github.com> Date: Thu, 26 May 2022 05:54:57 +0500 Subject: [PATCH 03/10] feat: conditional media server name to add emby to tvdetails --- src/components/TvDetails/index.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/TvDetails/index.tsx b/src/components/TvDetails/index.tsx index 98bf45e34..fe9a039a4 100644 --- a/src/components/TvDetails/index.tsx +++ b/src/components/TvDetails/index.tsx @@ -138,10 +138,7 @@ const TvDetails: React.FC = ({ tv }) => { }) ) { mediaLinks.push({ - text: - settings.currentSettings.mediaServerType === MediaServerType.JELLYFIN - ? intl.formatMessage(messages.play4k, { mediaServerName: 'Jellyfin' }) - : intl.formatMessage(messages.play4k, { mediaServerName: 'Plex' }), + text: getAvalaibleMediaServerName(), url: data.mediaInfo?.mediaUrl4k, svg: , }); From ddd773c03ff61654490644dec21f406d03374b3d Mon Sep 17 00:00:00 2001 From: Fallenbagel <98979876+Fallenbagel@users.noreply.github.com> Date: Thu, 26 May 2022 08:30:21 +0500 Subject: [PATCH 04/10] fix: conditional media server name for 4k url to add emby to tvdetails --- src/components/TvDetails/index.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/TvDetails/index.tsx b/src/components/TvDetails/index.tsx index fe9a039a4..0548e2485 100644 --- a/src/components/TvDetails/index.tsx +++ b/src/components/TvDetails/index.tsx @@ -138,7 +138,7 @@ const TvDetails: React.FC = ({ tv }) => { }) ) { mediaLinks.push({ - text: getAvalaibleMediaServerName(), + text: getAvalaible4kMediaServerName(), url: data.mediaInfo?.mediaUrl4k, svg: , }); @@ -234,6 +234,18 @@ const TvDetails: React.FC = ({ tv }) => { 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 (
Date: Thu, 26 May 2022 08:37:51 +0500 Subject: [PATCH 05/10] feat(ui): conditional media server name to add emby to moviedetails --- src/components/MovieDetails/index.tsx | 34 ++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/components/MovieDetails/index.tsx b/src/components/MovieDetails/index.tsx index fbbad4bd3..0ba0b9279 100644 --- a/src/components/MovieDetails/index.tsx +++ b/src/components/MovieDetails/index.tsx @@ -130,10 +130,7 @@ const MovieDetails: React.FC = ({ 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: , }); @@ -146,10 +143,7 @@ const MovieDetails: React.FC = ({ 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: , }); @@ -228,6 +222,30 @@ const MovieDetails: React.FC = ({ 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 (
Date: Thu, 26 May 2022 08:39:39 +0500 Subject: [PATCH 06/10] feat(ui): conditional media server name to add emby to issuedetails play on button --- src/components/IssueDetails/index.tsx | 68 +++++++++++++++++---------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/src/components/IssueDetails/index.tsx b/src/components/IssueDetails/index.tsx index 90cfb494c..346133896 100644 --- a/src/components/IssueDetails/index.tsx +++ b/src/components/IssueDetails/index.tsx @@ -366,13 +366,18 @@ const IssueDetails: React.FC = () => { > - {intl.formatMessage(messages.playonplex, { - mediaServerName: - settings.currentSettings.mediaServerType === + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.playonplex, { + mediaServerName: 'Emby', + }) + : settings.currentSettings.mediaServerType === MediaServerType.PLEX - ? 'Plex' - : 'Jellyfin', - })} + ? intl.formatMessage(messages.playonplex, { + mediaServerName: 'Plex', + }) + : intl.formatMessage(messages.playonplex, { + mediaServerName: 'Jellyfin', + })} )} @@ -407,13 +412,18 @@ const IssueDetails: React.FC = () => { > - {intl.formatMessage(messages.play4konplex, { - mediaServerName: - settings.currentSettings.mediaServerType === + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.play4konplex, { + mediaServerName: 'Emby', + }) + : settings.currentSettings.mediaServerType === MediaServerType.PLEX - ? 'Plex' - : 'Jellyfin', - })} + ? intl.formatMessage(messages.play4konplex, { + mediaServerName: 'Plex', + }) + : intl.formatMessage(messages.play4konplex, { + mediaServerName: 'Jellyfin', + })} )} @@ -618,13 +628,18 @@ const IssueDetails: React.FC = () => { > - {intl.formatMessage(messages.playonplex, { - mediaServerName: - settings.currentSettings.mediaServerType === + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.playonplex, { + mediaServerName: 'Emby', + }) + : settings.currentSettings.mediaServerType === MediaServerType.PLEX - ? 'Plex' - : 'Jellyfin', - })} + ? intl.formatMessage(messages.playonplex, { + mediaServerName: 'Plex', + }) + : intl.formatMessage(messages.playonplex, { + mediaServerName: 'Jellyfin', + })} )} @@ -659,13 +674,18 @@ const IssueDetails: React.FC = () => { > - {intl.formatMessage(messages.play4konplex, { - mediaServerName: - settings.currentSettings.mediaServerType === + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.play4konplex, { + mediaServerName: 'Emby', + }) + : settings.currentSettings.mediaServerType === MediaServerType.PLEX - ? 'Plex' - : 'Jellyfin', - })} + ? intl.formatMessage(messages.play4konplex, { + mediaServerName: 'Plex', + }) + : intl.formatMessage(messages.play4konplex, { + mediaServerName: 'Jellyfin', + })} )} From f8a239b1b82feb8f2705bfd8b1b76dd448b14e7c Mon Sep 17 00:00:00 2001 From: Fallenbagel <98979876+Fallenbagel@users.noreply.github.com> Date: Thu, 26 May 2022 08:52:16 +0500 Subject: [PATCH 07/10] style(ui): conditional media server name to add emby to settings Conditionaly media server name to replace every reference of jellyfin with emby in settings tab when environmental variable set --- src/components/Settings/SettingsJellyfin.tsx | 86 ++++++++++++++----- src/components/Settings/SettingsLayout.tsx | 16 +++- .../Settings/SettingsUsers/index.tsx | 12 ++- 3 files changed, 85 insertions(+), 29 deletions(-) diff --git a/src/components/Settings/SettingsJellyfin.tsx b/src/components/Settings/SettingsJellyfin.tsx index 9740762ce..5a5d4ffa2 100644 --- a/src/components/Settings/SettingsJellyfin.tsx +++ b/src/components/Settings/SettingsJellyfin.tsx @@ -14,28 +14,28 @@ import LoadingSpinner from '../Common/LoadingSpinner'; import LibraryItem from './LibraryItem'; const messages = defineMessages({ - jellyfinsettings: 'Jellyfin Settings', + jellyfinsettings: '{mediaServerName} Settings', jellyfinsettingsDescription: - 'Configure the settings for your Jellyfin server. Jellyfin scans your Jellyfin libraries to see what content is available.', + 'Configure the settings for your {mediaServerName} server. {mediaServerName} scans your {mediaServerName} libraries to see what content is available.', timeout: 'Timeout', save: 'Save Changes', saving: 'Saving…', - jellyfinlibraries: 'Jellyfin Libraries', + jellyfinlibraries: '{mediaServerName} Libraries', jellyfinlibrariesDescription: - 'The libraries Jellyfin scans for titles. Click the button below if no libraries are listed.', + 'The libraries {mediaServerName} scans for titles. Click the button below if no libraries are listed.', jellyfinSettingsFailure: - 'Something went wrong while saving Jellyfin settings.', - jellyfinSettingsSuccess: 'Jellyfin settings saved successfully!', - jellyfinSettings: 'Jellyfin Settings', + 'Something went wrong while saving {mediaServerName} settings.', + jellyfinSettingsSuccess: '{mediaServerName} settings saved successfully!', + jellyfinSettings: '{mediaServerName} Settings', jellyfinSettingsDescription: - 'Optionally configure an external player endpoint for your jellyfin server that is different to the internal URL used during setup', + 'Optionally configure an external player endpoint for your {mediaServerName} server that is different to the internal URL used during setup', externalUrl: 'External URL', validationUrl: 'You must provide a valid URL', syncing: 'Syncing', syncJellyfin: 'Sync Libraries', manualscanJellyfin: 'Manual Library Scan', manualscanDescriptionJellyfin: - "Normally, this will only be run once every 24 hours. Jellyfin will check your Jellyfin server's recently added more aggressively. If this is your first time configuring Jellyfin, a one-time full manual library scan is recommended!", + "Normally, this will only be run once every 24 hours. {mediaServerName} will check your {mediaServerName} server's recently added more aggressively. If this is your first time configuring {mediaServerName}, a one-time full manual library scan is recommended!", notrunning: 'Not Running', currentlibrary: 'Current Library: {name}', librariesRemaining: 'Libraries Remaining: {count}', @@ -161,10 +161,22 @@ const SettingsJellyfin: React.FC = ({ <>

- + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.jellyfinlibraries, { + mediaServerName: 'Emby', + }) + : intl.formatMessage(messages.jellyfinlibraries, { + mediaServerName: 'Jellyfin', + })}

- + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.jellyfinlibrariesDescription, { + mediaServerName: 'Emby', + }) + : intl.formatMessage(messages.jellyfinlibrariesDescription, { + mediaServerName: 'Jellyfin', + })}

@@ -201,7 +213,13 @@ const SettingsJellyfin: React.FC = ({

- + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.manualscanDescriptionJellyfin, { + mediaServerName: 'Emby', + }) + : intl.formatMessage(messages.manualscanDescriptionJellyfin, { + mediaServerName: 'Jellyfin', + })}

@@ -305,10 +323,22 @@ const SettingsJellyfin: React.FC = ({ <>

- {intl.formatMessage(messages.jellyfinSettings)} + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.jellyfinSettings, { + mediaServerName: 'Emby', + }) + : intl.formatMessage(messages.jellyfinSettings, { + mediaServerName: 'Jellyfin', + })}

- {intl.formatMessage(messages.jellyfinSettingsDescription)} + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.jellyfinSettingsDescription, { + mediaServerName: 'Emby', + }) + : intl.formatMessage(messages.jellyfinSettingsDescription, { + mediaServerName: 'Jellyfin', + })}

= ({ externalHostname: values.jellyfinExternalUrl, } as JellyfinSettings); - addToast(intl.formatMessage(messages.jellyfinSettingsSuccess), { - autoDismiss: true, - appearance: 'success', - }); + addToast( + intl.formatMessage(messages.jellyfinSettingsSuccess, { + mediaServerName: + process.env.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin', + }), + { + autoDismiss: true, + appearance: 'success', + } + ); } catch (e) { - addToast(intl.formatMessage(messages.jellyfinSettingsFailure), { - autoDismiss: true, - appearance: 'error', - }); + addToast( + intl.formatMessage(messages.jellyfinSettingsFailure, { + mediaServerName: + process.env.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin', + }), + { + autoDismiss: true, + appearance: 'error', + } + ); } finally { revalidate(); } diff --git a/src/components/Settings/SettingsLayout.tsx b/src/components/Settings/SettingsLayout.tsx index f2fa90784..23af1c632 100644 --- a/src/components/Settings/SettingsLayout.tsx +++ b/src/components/Settings/SettingsLayout.tsx @@ -8,7 +8,7 @@ const messages = defineMessages({ menuGeneralSettings: 'General', menuUsers: 'Users', menuPlexSettings: 'Plex', - menuJellyfinSettings: 'Jellyfin', + menuJellyfinSettings: '{mediaServerName}', menuServices: 'Services', menuNotifications: 'Notifications', menuLogs: 'Logs', @@ -18,7 +18,6 @@ const messages = defineMessages({ const SettingsLayout: React.FC = ({ children }) => { const intl = useIntl(); - const settingsRoutes: SettingsRoute[] = [ { text: intl.formatMessage(messages.menuGeneralSettings), @@ -36,7 +35,7 @@ const SettingsLayout: React.FC = ({ children }) => { regex: /^\/settings\/plex/, }, { - text: intl.formatMessage(messages.menuJellyfinSettings), + text: getAvalaibleMediaServerName(), route: '/settings/jellyfin', regex: /^\/settings\/jellyfin/, }, @@ -76,6 +75,17 @@ const SettingsLayout: React.FC = ({ children }) => {
{children}
); + function getAvalaibleMediaServerName() { + if (process.env.JELLYFIN_TYPE === 'emby') { + return intl.formatMessage(messages.menuJellyfinSettings, { + mediaServerName: 'Emby', + }); + } + + return intl.formatMessage(messages.menuJellyfinSettings, { + mediaServerName: 'Jellyfin', + }); + } }; export default SettingsLayout; diff --git a/src/components/Settings/SettingsUsers/index.tsx b/src/components/Settings/SettingsUsers/index.tsx index d53a619bf..03232f884 100644 --- a/src/components/Settings/SettingsUsers/index.tsx +++ b/src/components/Settings/SettingsUsers/index.tsx @@ -131,16 +131,20 @@ const SettingsUsers: React.FC = () => {