Merge pull request #614 from Stremio/feat/settings-transcoding-profile

feat: implement transcoding profile
This commit is contained in:
Tim 2024-03-28 13:48:01 +01:00 committed by GitHub
commit 937baa1785
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 53 additions and 7 deletions

8
package-lock.json generated
View file

@ -36,7 +36,7 @@
"react-i18next": "^12.1.1",
"react-is": "18.2.0",
"spatial-navigation-polyfill": "github:Stremio/spatial-navigation#64871b1422466f5f45d24ebc8bbd315b2ebab6a6",
"stremio-translations": "github:Stremio/stremio-translations#aa51ad5bba2db9275236eba2736f0e6b9d91e08f",
"stremio-translations": "github:Stremio/stremio-translations#b13b3e2653bd0dcf644d2a20ffa32074fe6532dd",
"url": "0.11.0",
"use-long-press": "^3.1.5"
},
@ -12470,9 +12470,9 @@
}
},
"node_modules/stremio-translations": {
"version": "1.44.5",
"resolved": "git+ssh://git@github.com/Stremio/stremio-translations.git#aa51ad5bba2db9275236eba2736f0e6b9d91e08f",
"integrity": "sha512-mgdeEUol79mzrSiNHppbmJfk/nGtHfBWvAj3S/T03jJHA0aCjPx4bs0v2KX4xuBUbQQSSlDq56j/F4tpUlJpUg==",
"version": "1.44.7",
"resolved": "git+ssh://git@github.com/Stremio/stremio-translations.git#b13b3e2653bd0dcf644d2a20ffa32074fe6532dd",
"integrity": "sha512-OtRAM3j9ie89llgI379p4utCbgnNMswE+LtL/lyLRVLfm5B+jpBLp4ozpU25iQg0O4tvN+OHBjXZ870CCHtZMA==",
"license": "MIT"
},
"node_modules/string_decoder": {

View file

@ -39,7 +39,7 @@
"react-i18next": "^12.1.1",
"react-is": "18.2.0",
"spatial-navigation-polyfill": "github:Stremio/spatial-navigation#64871b1422466f5f45d24ebc8bbd315b2ebab6a6",
"stremio-translations": "github:Stremio/stremio-translations#aa51ad5bba2db9275236eba2736f0e6b9d91e08f",
"stremio-translations": "github:Stremio/stremio-translations#b13b3e2653bd0dcf644d2a20ffa32074fe6532dd",
"url": "0.11.0",
"use-long-press": "^3.1.5"
},

View file

@ -49,7 +49,8 @@ const Settings = () => {
streamingServerRemoteUrlInput,
remoteEndpointSelect,
cacheSizeSelect,
torrentProfileSelect
torrentProfileSelect,
transcodingProfileSelect,
} = useStreamingServerSettingsInputs(streamingServer);
const [configureServerUrlModalOpen, openConfigureServerUrlModal, closeConfigureServerUrlModal] = useBinaryState(false);
const configureServerUrlInputRef = React.useRef(null);
@ -612,6 +613,20 @@ const Settings = () => {
:
null
}
{
transcodingProfileSelect !== null ?
<div className={styles['option-container']}>
<div className={styles['option-name-container']}>
<div className={styles['label']}>{ t('SETTINGS_TRANSCODE_PROFILE') }</div>
</div>
<Multiselect
className={classnames(styles['option-input-container'], styles['multiselect-container'])}
{...transcodingProfileSelect}
/>
</div>
:
null
}
</div>
<div ref={shortcutsSectionRef} className={styles['section-container']}>
<div className={styles['section-title']}>{ t('SETTINGS_NAV_SHORTCUTS') }</div>

View file

@ -167,7 +167,38 @@ const useStreamingServerSettingsInputs = (streamingServer) => {
}
};
}, [streamingServer.settings]);
return { streamingServerRemoteUrlInput, remoteEndpointSelect, cacheSizeSelect, torrentProfileSelect };
const transcodingProfileSelect = React.useMemo(() => {
if (streamingServer.settings?.type !== 'Ready' || streamingServer.deviceInfo?.type !== 'Ready') {
return null;
}
return {
options: [
{
label: t('SETTINGS_DISABLED'),
value: null,
},
...streamingServer.deviceInfo.content.availableHardwareAccelerations.map((name) => ({
label: name,
value: name,
}))
],
selected: [streamingServer.settings.content.transcodeProfile],
onSelect: (event) => {
core.transport.dispatch({
action: 'StreamingServer',
args: {
action: 'UpdateSettings',
args: {
...streamingServer.settings.content,
transcodeProfile: event.value,
}
}
});
}
};
}, [streamingServer.settings, streamingServer.deviceInfo]);
return { streamingServerRemoteUrlInput, remoteEndpointSelect, cacheSizeSelect, torrentProfileSelect, transcodingProfileSelect };
};
module.exports = useStreamingServerSettingsInputs;