Skip to content

Add yafw extension#11894

Merged
raycastbot merged 7 commits intoraycast:mainfrom
pablopunk:ext/yafw
Apr 29, 2024
Merged

Add yafw extension#11894
raycastbot merged 7 commits intoraycast:mainfrom
pablopunk:ext/yafw

Conversation

@pablopunk
Copy link
Contributor

@pablopunk pablopunk commented Apr 19, 2024

Description

Are you tired of apps that claim to compress videos but they're just ffmpeg wrappers? Me neither, so I decided to create a Raycast extension that does exactly that

Screencast

(no need to say I compressed this screencast with YAFW)

CleanShot.2024-04-19.at.18.45.26.yafw.balanced.mp4

Checklist

- welcome
- screenshots
- Finder
- link
- quote
- ▶︎
- typo
- again, better compression settings
- better compression values and text, fix removed files when adding them back manually, better output name
- readme
- unused fn
- better compression settings and storage history management
- fix history, new command, automatic stuff, unique arrays
- it works
- first commit
@raycastbot raycastbot added the new extension Label for PRs with new extensions label Apr 19, 2024
@raycastbot
Copy link
Collaborator

Congratulations on your new Raycast extension! 🚀

We will aim to make the initial review within five working days. Once the PR is approved and merged, the extension will be available on our Store.

Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi 👋

Thanks for your contribution 💪

I have now tested your extension, and I have some feedback ready for you:

  • You could maybe check if ffmpeg is installed by checking the default paths instead (and keep the field optional if people installed it elsewhere)

  • You can maybe do something like how Brew or Display Placer installs packages.

I'm looking forward to testing this extension again 🔥

Request a new review when you are ready. Feel free to contact me here or at Slack if you have any questions.

onAction={() => removeFromHistory(file)}
icon={{ source: Icon.Trash }}
/>
<Action title="Clear All History" onAction={clearAllHistory} icon={{ source: Icon.Trash }} />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Action title="Clear All History" onAction={clearAllHistory} icon={{ source: Icon.Trash }} />
<Action
title="Clear All History"
style={Action.Style.Destructive}
onAction={clearAllHistory}
icon={{ source: Icon.Trash }}
/>

}
/>
))}
{history == null && <Grid.Item key="loading" title="Loading history..." content="" />}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{history == null && <Grid.Item key="loading" title="Loading history..." content="" />}

};

return (
<Grid selectedItemId={"0"}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Grid selectedItemId={"0"}>
<Grid>

Add isLoading={} instead, set it with useState

@pernielsentikaer pernielsentikaer self-assigned this Apr 23, 2024
- check for ffmpeg in the path
- address pr comments
@pablopunk
Copy link
Contributor Author

Thanks for the review @pernielsentikaer! I addressed all the comments 👌🏻

Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the corrections 🔥

  • Do you have a clue why the video I have selected seems to come back on every load (and on compleation)

Request a new review when you are ready. Feel free to contact me here or at Slack if you have any questions.

compressVideoFiles(files, compression).then((successfulFiles) => {
if (successfulFiles.length === 0) return;
successfulFiles.forEach((file) => Clipboard.copy({ file }));
navigation.push(<Videos files={successfulFiles} />);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
navigation.push(<Videos files={successfulFiles} />);
try {
popToRoot();
launchCommand({ name: "history", type: LaunchType.UserInitiated });
} catch {
/* */
}

Maybe something like this instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the advantage here? I'd rather keep the current behavior because of 2 reasons:

  • Passing the successfulFiles prop allows me to create a decorator for the new files (see screenshot below)
  • If you want to go back to compress more videos, you can just press Esc or the back arrow in the UI

WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes senes, you can maybe add a preference to let the user decide if it should popToRoot, Show compressed files(default) or just history upon completion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to keep it as it is for the first version, but I'll keep it in mind for the future 🙏🏻

* > Looks like the command is rendering a lot without any changes. This might indicate an rendering loop caused by a `setState` not being wrapped in a `useEffect`.
* > This will degrade the performances of Raycast and Raycast might arbitrarily decide to terminate the extension if it happens too many times.
*/
setInterval(lookForVideoSources, 3000);
Copy link
Contributor Author

@pablopunk pablopunk Apr 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a clue why the video I have selected seems to come back on every load (and on compleation)

@pernielsentikaer this is probably caused by this interval, which I'm still not sure about. I made it so if you open the extension and only then you go to select/copy some videos, it regularly checks if there are more videos in the clipboard or the finder.

I could disable this behavior if you think is not a good idea

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's the tradeoff that you'll need to keep it open, much better than using a lot of renders to keep it, maybe we can do something like this "warning"

yafw 2024-04-25 at 08 45 25

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm it's not really during compression, it's right on that selection screen

user opens command -> no videos selected -> user goes to Finder to select or copy some videos -> comes back to the command -> the command auto-refreshes the list with the new files

to be honest I think I'm overthinking a bit here, I think I'll remove the setInterval and add a warning saying

To add videos automatically, copy them or select them in the Finder and launch this command again

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝🏻 this should also solve going back from the history and seeing the compressed video auto-selected

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image image

Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the corrections, I gave it another spin:

  • Clear All History action does not work when you are in the compressed history view (and in the normal history view, you might want to add a confirmation alert with remember user choice).
Raycast25042024-KGtzXnU8.png.mp4
  • It seems it automatically copies the file to the clipboard even though there is an action to copy it; it is better to let the user choose

@pablopunk
Copy link
Contributor Author

pablopunk commented Apr 26, 2024

@pernielsentikaer there's an action to copy because you might convert more than one file at the same time, so I want to give the option to copy any of those single files afterwards.

IMO the usual flow will be compressing just one file, and I'd like to keep the automatic copy-to-clipboard behavior in this case, I find it handy (they'll have clipboard history in raycast anyway).

Regarding the Clear All History, yeah I'm only removing the "old" files (i.e. the ones you are not converting right now). I'll change it to remove all 👍🏻

The only problem now is that the CLI is not letting me update the PR for some reason 🤔

image

@pernielsentikaer
Copy link
Collaborator

Just do as it says, go to your fork (the link) and sync it 🙂

Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi 👋

Looks good to me, approved 🔥

@raycastbot raycastbot merged commit e53e194 into raycast:main Apr 29, 2024
@j3lte
Copy link
Contributor

j3lte commented Apr 30, 2024

@pernielsentikaer is it me or is it not published in the Store? Can't seem to find it...

@pablopunk
Copy link
Contributor Author

@j3lte looks like the job failed https://github.com/raycast/extensions/actions/runs/8884540958/job/24393845273

not sure if i can help with that

@pernielsentikaer
Copy link
Collaborator

Let me have a look, thanks for flagging @j3lte

@pernielsentikaer
Copy link
Collaborator

I should be there in two minutes. I accidentally added a style property twice 🙂

@pablopunk pablopunk deleted the ext/yafw branch April 30, 2024 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new extension Label for PRs with new extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants