fix(audio): misc

This commit is contained in:
Ibrahima G. Coulibaly
2025-07-08 17:43:44 +01:00
parent 7962bba04f
commit f3ed70258e
10 changed files with 55 additions and 52 deletions

57
.idea/workspace.xml generated
View File

@@ -4,11 +4,15 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="chore: add array key">
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="feat: groupBy tools autocomplete">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/components/Hero.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/Hero.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools-by-category/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools-by-category/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/utils/string.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/string.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/components/input/ToolMultipleAudioInput.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/input/ToolMultipleAudioInput.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/audio/extract-audio/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/audio/extract-audio/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/audio/extract-audio/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/audio/extract-audio/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/audio/merge-audio/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/audio/merge-audio/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/audio/merge-audio/meta.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/audio/merge-audio/meta.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools/audio/merge-audio/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/audio/merge-audio/service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tools/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/tools/index.ts" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -22,7 +26,7 @@
<option name="PUSH_AUTO_UPDATE" value="true" />
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="fork/y1hao/dark" />
<entry key="$PROJECT_DIR$" value="fork/y1hao/grouping" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@@ -209,7 +213,21 @@
"id": "PR_kwDOMJIfts6dwQJi",
"number": 163
},
"lastSeen": 1751893861615
"lastSeen": 1751894349626
},
{
"id": {
"id": "PR_kwDOMJIfts6drHMN",
"number": 160
},
"lastSeen": 1751991164761
},
{
"id": {
"id": "PR_kwDOMJIfts6d1nEd",
"number": 165
},
"lastSeen": 1751992541880
}
]
}]]></component>
@@ -268,7 +286,7 @@
"Vitest.replaceText function (regexp mode).should return the original text when passed an invalid regexp.executor": "Run",
"Vitest.replaceText function.executor": "Run",
"Vitest.timeBetweenDates.executor": "Run",
"git-widget-placeholder": "#163 on fork/y1hao/grouping",
"git-widget-placeholder": "#165 on fork/AshAnand34/audio-feature-addition",
"ignore.virus.scanning.warn.message": "true",
"kotlin-language-version-configured": "true",
"last_opened_file_path": "C:/Users/Ibrahima/IdeaProjects/omni-tools/src/pages/tools/json",
@@ -509,15 +527,8 @@
<workItem from="1749047510481" duration="879000" />
<workItem from="1751846528195" duration="4358000" />
<workItem from="1751852868038" duration="680000" />
<workItem from="1751893034799" duration="1192000" />
</task>
<task id="LOCAL-00159" summary="refactor: sum">
<option name="closed" value="true" />
<created>1741544086061</created>
<option name="number" value="00159" />
<option name="presentableId" value="LOCAL-00159" />
<option name="project" value="LOCAL" />
<updated>1741544086061</updated>
<workItem from="1751893034799" duration="1868000" />
<workItem from="1751991143661" duration="1750000" />
</task>
<task id="LOCAL-00160" summary="fix: tools by category scroll">
<option name="closed" value="true" />
@@ -903,7 +914,15 @@
<option name="project" value="LOCAL" />
<updated>1751893722720</updated>
</task>
<option name="localTasksCounter" value="208" />
<task id="LOCAL-00208" summary="feat: groupBy tools autocomplete">
<option name="closed" value="true" />
<created>1751894332017</created>
<option name="number" value="00208" />
<option name="presentableId" value="LOCAL-00208" />
<option name="project" value="LOCAL" />
<updated>1751894332017</updated>
</task>
<option name="localTasksCounter" value="209" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -950,7 +969,6 @@
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_NEW_TODO" value="false" />
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="refactor: compress pdf" />
<MESSAGE value="refactor: lib" />
<MESSAGE value="fix: path" />
<MESSAGE value="fix: vite worker format" />
@@ -975,7 +993,8 @@
<MESSAGE value="fix: tsc" />
<MESSAGE value="chore: remove .codebuddy" />
<MESSAGE value="chore: add array key" />
<option name="LAST_COMMIT_MESSAGE" value="chore: add array key" />
<MESSAGE value="feat: groupBy tools autocomplete" />
<option name="LAST_COMMIT_MESSAGE" value="feat: groupBy tools autocomplete" />
</component>
<component name="VgoProject">
<integration-enabled>false</integration-enabled>

View File

@@ -27,9 +27,7 @@ export default function ToolMultipleAudioInput({
title,
type
}: MultiAudioInputComponentProps) {
const theme = useTheme();
const fileInputRef = useRef<HTMLInputElement>(null);
const { showSnackBar } = useContext(CustomSnackBarContext);
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const files = event.target.files;

View File

@@ -181,7 +181,7 @@ export default function ChangeSpeed({
getGroups={getGroups}
setInput={setInput}
compute={compute}
toolInfo={{ title: `What is a ${title}?`, description: longDescription }}
toolInfo={{ title: `What is ${title}?`, description: longDescription }}
/>
);
}

View File

@@ -1,12 +1,5 @@
import {
Box,
FormControl,
InputLabel,
MenuItem,
Select,
SelectChangeEvent
} from '@mui/material';
import React, { useState, useEffect, useRef } from 'react';
import { Box } from '@mui/material';
import React, { useState } from 'react';
import ToolContent from '@components/ToolContent';
import { ToolComponentProps } from '@tools/defineTool';
import { extractAudioFromVideo } from './service';
@@ -28,7 +21,6 @@ export default function ExtractAudio({
const [audioFile, setAudioFile] = useState<File | null>(null);
const [loading, setLoading] = useState(false);
// Tool Options section for output format
const getGroups: GetGroupsType<InitialValuesType> = ({
values,
updateField
@@ -58,13 +50,12 @@ export default function ExtractAudio({
];
};
// Compute function for ToolContent (no-op, extraction is handled by effect)
const compute = async (values: InitialValuesType, input: File | null) => {
if (!input) return;
try {
setLoading(true);
const audioFileObj = await extractAudioFromVideo(input, values);
await setAudioFile(audioFileObj);
setAudioFile(audioFileObj);
} catch (err) {
console.error(err);
} finally {
@@ -84,15 +75,10 @@ export default function ExtractAudio({
<ToolFileResult
title={'Extracting Audio'}
value={null}
extension={''}
loading={true}
/>
) : (
<ToolFileResult
title={'Extracted Audio'}
value={audioFile}
extension={initialValues.outputFormat}
/>
<ToolFileResult title={'Extracted Audio'} value={audioFile} />
)
}
initialValues={initialValues}

View File

@@ -20,7 +20,7 @@ export async function extractAudioFromVideo(
const configuredOutputAudioFormat = options.outputFormat;
const outputName = `output.${configuredOutputAudioFormat}`;
let args: string[] = ['-i', inputName, '-vn'];
const args: string[] = ['-i', inputName, '-vn'];
if (configuredOutputAudioFormat === 'mp3') {
args.push(

View File

@@ -106,7 +106,7 @@ export default function MergeAudio({
getGroups={getGroups}
setInput={setInput}
compute={compute}
toolInfo={{ title: `What is a ${title}?`, description: longDescription }}
toolInfo={{ title: `What is ${title}?`, description: longDescription }}
/>
);
}

View File

@@ -4,7 +4,7 @@ import { lazy } from 'react';
export const tool = defineTool('audio', {
name: 'Merge Audio',
path: 'merge-audio',
icon: 'mdi:music-note-multiple',
icon: 'fluent:merge-20-regular',
description:
'Combine multiple audio files into a single audio file by concatenating them in sequence.',
shortDescription: 'Merge multiple audio files into one (MP3, AAC, WAV).',

View File

@@ -36,7 +36,7 @@ export async function mergeAudioFiles(
await ffmpeg.writeFile(fileListName, fileListContent);
// Build FFmpeg arguments for merging
let args: string[] = ['-f', 'concat', '-safe', '0', '-i', fileListName];
const args: string[] = ['-f', 'concat', '-safe', '0', '-i', fileListName];
// Add format-specific arguments
if (outputFormat === 'mp3') {

View File

@@ -122,7 +122,7 @@ export default function Trim({ title, longDescription }: ToolComponentProps) {
getGroups={getGroups}
setInput={setInput}
compute={compute}
toolInfo={{ title: `What is a ${title}?`, description: longDescription }}
toolInfo={{ title: `What is ${title}?`, description: longDescription }}
/>
);
}

View File

@@ -1,7 +1,7 @@
import { stringTools } from '../pages/tools/string';
import { imageTools } from '../pages/tools/image';
import { DefinedTool, ToolCategory } from './defineTool';
import { capitalizeFirstLetter } from '../utils/string';
import { capitalizeFirstLetter } from '@utils/string';
import { numberTools } from '../pages/tools/number';
import { videoTools } from '../pages/tools/video';
import { audioTools } from 'pages/tools/audio';
@@ -15,17 +15,17 @@ import { pdfTools } from '../pages/tools/pdf';
const toolCategoriesOrder: ToolCategory[] = [
'image-generic',
'string',
'json',
'pdf',
'string',
'video',
'time',
'audio',
'json',
'list',
'csv',
'number',
'png',
'time',
'gif',
'audio'
'gif'
];
export const tools: DefinedTool[] = [
...imageTools,
@@ -121,7 +121,7 @@ const categoriesConfig: {
},
{
type: 'audio',
icon: 'rivet-icons:audio',
icon: 'ic:twotone-audiotrack',
value:
'Tools for working with audio extract audio from video, adjusting audio speed, merging multiple audio files and much more.'
}