Skip to content

The swiss army knife of lossless video/audio editing

fix bug with unbinding setCutStart/setCutEnd

Mikael Finstad25103103cc71
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx
index d5ee19b5..ab8487c5 100644
--- a/src/renderer/src/App.tsx
+++ b/src/renderer/src/App.tsx
@@ -90,7 +90,7 @@ import BigWaveform from './components/BigWaveform';
import isDev from './isDev';
import { BatchFile, Chapter, CustomTagsByFile, EdlExportType, EdlFileType, EdlImportType, FfmpegCommandLog, FilesMeta, goToTimecodeDirectArgsSchema, openFilesActionArgsSchema, ParamsByStreamId, PlaybackMode, SegmentBase, SegmentColorIndex, SegmentTags, StateSegment, TunerType } from './types';
-import { CaptureFormat, KeyboardAction, Html5ifyMode, ApiActionRequest, KeyBinding } from '../../../types';
+import { CaptureFormat, KeyboardAction, Html5ifyMode, ApiActionRequest } from '../../../types';
import { FFprobeChapter, FFprobeFormat, FFprobeStream } from '../../../ffprobe';
import useLoading from './hooks/useLoading';
import useVideo from './hooks/useVideo';
@@ -179,7 +179,7 @@ function App() {
} = allUserSettings;
// Note that each action may be multiple key bindings and this will only be the first binding for each action
- const keyBindingByAction = useMemo(() => Object.fromEntries(keyBindings.map((binding) => [binding.action, binding])) as Record<KeyboardAction, KeyBinding>, [keyBindings]);
+ const keyBindingByAction = useMemo(() => Object.fromEntries(keyBindings.map((binding) => [binding.action, binding])), [keyBindings]);
const { working, setWorking, workingRef, abortWorking } = useLoading();
const { videoRef, videoContainerRef, playbackRate, setPlaybackRate, outputPlaybackRate, setOutputPlaybackRate, commandedTime, seekAbs, playingRef, getRelevantTime, setPlaying, onSeeked, relevantTime, onStartPlaying, setCommandedTime, setOutputPlaybackRateState, commandedTimeRef, onStopPlaying, onVideoAbort, playerTime, setPlayerTime, playbackModeRef, playing, play, pause, seekRel } = useVideo({ filePath });
diff --git a/src/renderer/src/NoFileLoaded.tsx b/src/renderer/src/NoFileLoaded.tsx
index 5d19f58f..603b4b65 100644
--- a/src/renderer/src/NoFileLoaded.tsx
+++ b/src/renderer/src/NoFileLoaded.tsx
@@ -7,12 +7,15 @@ import SetCutpointButton from './components/SetCutpointButton';
import SimpleModeButton from './components/SimpleModeButton';
import useUserSettings from './hooks/useUserSettings';
import { StateSegment } from './types';
-import { KeyBinding, KeyboardAction } from '../../../types';
+import { KeyBinding } from '../../../types';
import { splitKeyboardKeys } from './util';
const electron = window.require('electron');
-function Keys({ keys }: { keys: string }) {
+function Keys({ keys }: { keys: string | undefined }) {
+ if (keys == null || keys === '') {
+ return <kbd>UNBOUND</kbd>;
+ }
const split = splitKeyboardKeys(keys);
return split.map((key, i) => (
<Fragment key={key}><kbd>{key.toUpperCase()}</kbd>{i < split.length - 1 && <span style={{ fontSize: '.7em', marginLeft: '-.2em', marginRight: '-.2em' }}>{' + '}</span>}</Fragment>
@@ -42,7 +45,7 @@ function NoFileLoaded({ mifiLink, currentCutSeg, onClick, darkMode, keyBindingBy
currentCutSeg: StateSegment | undefined,
onClick: () => void,
darkMode?: boolean,
- keyBindingByAction: Record<KeyboardAction, KeyBinding>,
+ keyBindingByAction: Record<string, KeyBinding>,
}) {
const { t } = useTranslation();
const { simpleMode } = useUserSettings();
@@ -67,7 +70,7 @@ function NoFileLoaded({ mifiLink, currentCutSeg, onClick, darkMode, keyBindingBy
</div>
<div style={{ fontSize: '1.3em', color: 'var(--gray-11)' }}>
- <Trans><SetCutpointButton currentCutSeg={currentCutSegOrDefault} side="start" style={{ verticalAlign: 'middle' }} /> <SetCutpointButton currentCutSeg={currentCutSegOrDefault} side="end" style={{ verticalAlign: 'middle' }} /> or <Keys keys={keyBindingByAction.setCutStart.keys} /> <Keys keys={keyBindingByAction.setCutEnd.keys} /> to set cutpoints</Trans>
+ <Trans><SetCutpointButton currentCutSeg={currentCutSegOrDefault} side="start" style={{ verticalAlign: 'middle' }} /> <SetCutpointButton currentCutSeg={currentCutSegOrDefault} side="end" style={{ verticalAlign: 'middle' }} /> or <Keys keys={keyBindingByAction['setCutStart']?.keys} /> <Keys keys={keyBindingByAction['setCutEnd']?.keys} /> to set cutpoints</Trans>
</div>
<div style={{ fontSize: '1.3em', color: 'var(--gray-11)' }} role="button" onClick={(e) => e.stopPropagation()}>