diff --git a/docs/expressions.md b/docs/expressions.md index 00621da0..765d4e47 100644 --- a/docs/expressions.md +++ b/docs/expressions.md @@ -21,3 +21,7 @@ See more examples in-app. You can also use JavaScript expressions when referring to variables inside `${}` in output file name templates, e.g. `${FILENAME.toLowerCase()}`. See also [Export file name template](file-name-template.md). + +## Select tracks by expression + +For available variables, open the *Tracks* dialog, then for the respective track, open *Track info* and you will see all available variables which you can use in your filter. diff --git a/src/common/constants.ts b/src/common/constants.ts index 6964eb20..3fa2d2db 100644 --- a/src/common/constants.ts +++ b/src/common/constants.ts @@ -14,4 +14,5 @@ export const troubleshootingUrl = 'https://mifi.no/losslesscut/troubleshooting'; export const exportedFileNameTemplateHelpUrl = 'https://mifi.no/losslesscut/file-name-template'; export const selectSegmentByExpressionHelpUrl = 'https://mifi.no/losslesscut/select-segments-by-expression'; export const editSegmentByExpressionHelpUrl = 'https://mifi.no/losslesscut/edit-segments-by-expression'; +export const changeEnabledStreamsExpressionHelpUrl = 'https://mifi.no/losslesscut/select-tracks-by-expression'; export const supportEmail = 'losslesscut@mifi.no'; diff --git a/src/renderer/src/hooks/useStreamsMeta.tsx b/src/renderer/src/hooks/useStreamsMeta.tsx index 2b3ea40f..dbb50f19 100644 --- a/src/renderer/src/hooks/useStreamsMeta.tsx +++ b/src/renderer/src/hooks/useStreamsMeta.tsx @@ -12,6 +12,10 @@ import i18n from '../i18n'; import Action from '../components/Action'; import ExpressionDialog from '../components/ExpressionDialog'; import type { ShowGenericDialog } from '../components/GenericDialog'; +import { changeEnabledStreamsExpressionHelpUrl } from '../../../common/constants'; + +const remote = window.require('@electron/remote'); +const { shell } = remote; export default function useStreamsMeta({ mainStreams, externalFilesMeta, filePath, autoExportExtraStreams, showGenericDialog }: { @@ -128,7 +132,7 @@ export default function useStreamsMeta({ mainStreams, externalFilesMeta, filePat { name: i18n.t('1st, 2nd and 3rd track'), code: 'track.index >= 0 && track.index <= 2' }, ]} title={i18n.t('Toggle tracks by expression')} - description={Enter a JavaScript filter expression which will be evaluated for each track of the current file. Tracks for which the expression evaluates to "true" will be selected or deselected. You may also the keyboard action to run this filter.} + description={<>Enter a JavaScript filter expression which will be evaluated for each track of the current file. Tracks for which the expression evaluates to "true" will be selected or deselected. You may also the keyboard action to run this filter. } inputValue={enabledStreamsFilter ?? ''} /> ),