Jump to content

Coinc - Currency converter


tomy0000000

Recommended Posts

Coinc is an Alfred workflow which do currency conversion by using live currency rates from Open Exchange Rates API.

 

image.png.bfe236621be0abd261fd624a64860f5b.png

I'm the author of the workflow, and the project is hosted on [GitHub](https://github.com/tomy0000000/Coinc) under my username. I have been working on some renovation facilitating various features provided by Alfred 5 and expect to release version 3.0 after everything is settled on Alfred Gallery. The only thing left for now is that I'm not quite sure where I can setup the dependency for homebrew.

 

Thoughts and instructions are welcome.

Link to comment
Share on other sites

On 12/18/2022 at 9:56 AM, tomy0000000 said:

I have been working on some renovation facilitating various features provided by Alfred 5 and expect to release version 3.0 after everything is settled on Alfred Gallery.


The Gallery is already in early access. What makes sense is to release the improvements now so the review process can begin.

 

On 12/18/2022 at 9:56 AM, tomy0000000 said:

The only thing left for now is that I'm not quite sure where I can setup the dependency for homebrew.


You say what the dependency is in this post. That’s handled on the Gallery side right now.

Link to comment
Share on other sites

4 hours ago, vitor said:

You say what the dependency is in this post. That’s handled on the Gallery side right now.

 

Actually, the dependency config is the only thing left. If that's not something required to embed in the workflow file, than my workflow is ready to release and to be reviewed.

 

You can find a copy of version 3.0.0 in the root directory of the GitHub file directory, and use that for initial review. I'll publish the release with that workflow file once the documentation is updated.

Link to comment
Share on other sites

3 hours ago, tomy0000000 said:

Actually, the dependency config is the only thing left. If that's not something required to embed in the workflow file

 

It’s not something to embed in the workflow but it is something you need tell me so it can be properly added in the Gallery.

 

3 hours ago, tomy0000000 said:

I'll publish the release with that workflow file once the documentation is updated.

 

The documentation has to be updated first. It helps with the review.

Link to comment
Share on other sites

  • 1 month later...
On 12/21/2022 at 3:03 AM, vitor said:

 

It’s not something to embed in the workflow but it is something you need tell me so it can be properly added in the Gallery.

 

 

The documentation has to be updated first. It helps with the review.

 

The document is updated in the repository, and v3 has been released. Please have a look.

Link to comment
Share on other sites

@tomy0000000 Almost ready to go in. I did find a couple of issues:

  • cur-alias creates its file in the workflow’s own directory, meaning it will be overwritten on updates making users lose their customisation.
  • cur-unalias always errors with a list index out of range:
workflow.py:2114 ERROR    list index out of range
Traceback (most recent call last):
  File "/Users/username/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.E7A758F8-9A59-4E62-8BC6-554497AE0885/workflow/workflow.py", line 2107, in run
    func(self)
  File "/Users/username/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.E7A758F8-9A59-4E62-8BC6-554497AE0885/coinc/__init__.py", line 254, in unalias
    alias = workflow.args[1].upper()
IndexError: list index out of range

 

Once those are fixed the workflow can be added.

 

I also bumped into a few things which could be improved, but which are not dealbreakers:

  • In the Configuration, the Open Exchange Rates App ID entry has a typo in the description: “an free”.
  • In the Configuration, it would make sense for the Base currency to be a Popup Selection.
  • In cur-alias, it’s not immediately obvious that you’re supposed to type alias<space>currency. The preview of currencies is quite good, but by that point one had to have already figured out the syntax. A simple subtitle would be enough to clarify.

Note that in the wiki you say:

 

Quote

Press the Hotkey (Default is ⌥-C, but you can change it)

 

Hotkeys are stripped on first import so they do not clash with other Hotkeys the users might have. You can suggest a Hotkey, but can’t set a default for other users.

 

Unrelated, would you share how you’ve added the progress bar to your GIFs? I have made a script exactly for that years ago because I didn’t find anything else suitable. It works well but can be somewhat slow due to the method used. Its output is quite similar to what you have, so I’m curious if there’s a solution out there which would be more efficient.

 

Edited by vitor
Link to comment
Share on other sites

On 2/17/2023 at 3:14 AM, vitor said:

cur-unalias always errors with a list index out of range

This bug was pre-dated before the release of v3, but I failed to merge the patch before the release, which should be fixed in the next minor update.

 

On 2/17/2023 at 3:14 AM, vitor said:

In the Configuration, the Open Exchange Rates App ID entry has a typo in the description: “an free”.

Ah, my bad. This should be fixed in the next minor release, too.

 

On 2/17/2023 at 3:14 AM, vitor said:

In the Configuration, it would make sense for the Base currency to be a Popup Selection.

The reason why I did not make it a popup is that the currency list is dynamic. If Alfred supports that, please let me know how I can configure it.

 

On 2/17/2023 at 3:14 AM, vitor said:

In cur-alias, it’s not immediately obvious that you’re supposed to type alias<space>currency. The preview of currencies is quite good, but by that point one had to have already figured out the syntax. A simple subtitle would be enough to clarify.

I've opened an issue regarding this on the repository, and I'll look into how I can improve it in the next few days.

 

On 2/17/2023 at 3:14 AM, vitor said:

cur-alias creates its file in the workflow’s own directory, meaning it will be overwritten on updates making users lose their customisation.

I just ran some checks and can confirm that this bug did exist. Additionally, I'm still looking into some possible fixes for this.

 

Anyway, thank you so much for all the feedback. I'll manage to get them fixed soon.

Link to comment
Share on other sites

On 2/17/2023 at 3:14 AM, vitor said:

Unrelated, would you share how you’ve added the progress bar to your GIFs? I have made a script exactly for that years ago because I didn’t find anything else suitable. It works well but can be somewhat slow due to the method used. Its output is quite similar to what you have, so I’m curious if there’s a solution out there which would be more efficient.

 

I'm using this one from GitHub. It has pre-compiled binary, so I don't have to mess around with how golang works, which is nice. However, I do find out that it will error out in some edge case, which is why not all the gif in the documentation has a progress bar at the moment.

 

I think GitHub is gradually supporting inline video in markdown, but it seems it only works in README and Issue/PR pages (wiki not included) at the moment. I plan to replace those gifs with videos when they're fully supported.

Edited by tomy0000000
fix link
Link to comment
Share on other sites

On 2/17/2023 at 3:14 AM, vitor said:

Once those are fixed the workflow can be added.

 

The fix is completed. I've uploaded a release candidate to GitHub.

Please have a look and see if that works, and I'll publish the version if all goes well.

 

Thanks for the feedback.

;-)

Link to comment
Share on other sites

Now cur-alias doesn’t work either.

 

Code 1: Traceback (most recent call last):
  File "/Users/username/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.E7A758F8-9A59-4E62-8BC6-554497AE0885/main.py", line 7, in <module>
    import coinc
  File "/Users/username/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.E7A758F8-9A59-4E62-8BC6-554497AE0885/coinc/__init__.py", line 7, in <module>
    from .alfred import persisted_data
  File "/Users/username/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.E7A758F8-9A59-4E62-8BC6-554497AE0885/coinc/alfred.py", line 12, in <module>
    def persisted_data(key: str, content: dict | None = None) -> dict:
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

 

Link to comment
Share on other sites

9 hours ago, vitor said:

Now cur-alias doesn’t work either.

 

I believe this is caused by a wrong python version (I'm guessing 3.9). Coinc requires python 3.10 or above. Could you please update to 3.10 and try it again?

Link to comment
Share on other sites

8 hours ago, tomy0000000 said:

Coinc requires python 3.10 or above. Could you please update to 3.10 and try it again?


Ventura ships with 3.9.6 and everything else in the workflow works with it. Raising the requirement to 3.10 for a minor feature makes it so everyone has to install a new Python version. That is possible with Homebrew but also brings a lot of considerations regarding bundled dependencies. For now we’re avoiding requiring a new installation of Python in the Gallery dependencies.

Link to comment
Share on other sites

4 hours ago, vitor said:

Raising the requirement to 3.10 for a minor feature makes it so everyone has to install a new Python version.

 

Seems legit.

 

I just updated a version that should work with 3.9 at the same location.

 

I set the target Python version to the latest one provided by homebrew when Apple stopped shipping 2.7 since I was unaware that Xcode CLI tools provided Python 3. Anyway, now that Ventura comes with a Python executable, that will make installation a lot easier, but do you know where I can find info regarding which python version is being shipped with the latest CLI tools? Cause I don't see Apple have release notes for these.

Link to comment
Share on other sites

On 2/21/2023 at 4:58 PM, tomy0000000 said:

I just updated a version that should work with 3.9 at the same location.

 

Working! Please let me know when you’ve made the release and I’ll finish up adding to the Gallery. It will be live at http://alfred.app/workflows/tomy0000000/coinc/.

 

On 2/21/2023 at 4:58 PM, tomy0000000 said:

do you know where I can find info regarding which python version is being shipped with the latest CLI tools? Cause I don't see Apple have release notes for these.

 

I haven’t seen those documented, but I’ve also never seemed them change within a major release. I check manually. The version on Monterey was 3.8.9, so they are updating it but keeping a margin.

 

Edited by vitor
Link to comment
Share on other sites

2 hours ago, vitor said:

Working! Please let me know when you’ve made the release and I’ll finish up adding to the Gallery. It will be live at http://alfredapp.com/workflows/tomy0000000/coinc/.

 

It's ready. I just published the 3.1.0 at GitHub. You may go ahead and add it.

Thanks for all the feedbacks and helps.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...