From cbfcaccd523e3d27dbb6b76f91307fa7825a2b7e Mon Sep 17 00:00:00 2001 From: Nikolaj Frey Date: Fri, 23 Feb 2024 13:56:06 +1100 Subject: [PATCH] Fixed conversion to mp3 command main --- raycast/package.json | 8 +++--- raycast/src/commander.tsx | 25 +++++++++++++++++-- ...nderMp3ToMp4.tsx => commanderMp4ToMp3.tsx} | 0 3 files changed, 27 insertions(+), 6 deletions(-) rename raycast/src/{commanderMp3ToMp4.tsx => commanderMp4ToMp3.tsx} (100%) diff --git a/raycast/package.json b/raycast/package.json index 01052a4..cf42f66 100644 --- a/raycast/package.json +++ b/raycast/package.json @@ -146,10 +146,10 @@ ] }, { - "name": "commanderMp3ToMp4", - "title": "mp3 to mp4", + "name": "commanderMp4ToMp3", + "title": "mp4 to mp3", "description": "Converts an mp4 into an mp3 using ffmpeg at 320Kbps", - "mode": "view", + "mode": "no-view", "fallbackText": "test2", "keywords": [ "commander", @@ -158,7 +158,7 @@ ], "preferences": [ { - "name": "name", + "name": "mp4ToMp3", "required": false, "type": "textfield", "key": "name", diff --git a/raycast/src/commander.tsx b/raycast/src/commander.tsx index 213ced7..47de2cb 100644 --- a/raycast/src/commander.tsx +++ b/raycast/src/commander.tsx @@ -39,8 +39,29 @@ export default async function Command(props: any) { return } - console.log('nik process.argv', process.argv) - console.log('nik process.cwd()', process.cwd()) + // log preferences + console.log(preferences) + + if (Object.hasOwnProperty.call(preferences, 'mp4ToMp3')) { + + console.log('here !') + + const selectedFiles = await getSelectedFiles(); + + await runOperation({ + operation: () => any(selectedFiles, 'MP3'), + selectedImages: selectedFiles, + inProgressMessage: "Conversion in progress...", + successMessage: "Converted", + failureMessage: "Failed to convert", + }); + + await showHUD(`🌈 MP4 to MP3 🦄`) + + return + + } + return (