deefrawley / Flow.Launcher.Plugin.Currency

Currency conversion plugin for Flow Launcher that uses the euro and rates at https://www.ecb.europa.eu/ to convert between currencies.
MIT License
16 stars 2 forks source link

[Bug/Feature request] Currency convertor returns values after a small delay #10

Closed rp1231 closed 2 years ago

rp1231 commented 2 years ago

Bug/Feature request hybrid for the currency convertor plugin.

Currently the currency convertor has a small delay before it returns the converted value.

I used to use a plugin on Wox which used to give instant results.

Wanted to ask if the same would be possible in the currency convertor plugin included with flow.

Thanks.

rp1231 commented 2 years ago

Hi, Also regarding the explanation you provided on the Flow github page regarding this plugin. "The delay is the plugin going and downloading the XML file of currency rates. It won't do this if the file was downloaded within the last two hours (subsequent calls should be quicker). I can look at adding a windows notification through Flow of the download, extend the shelf life of the XML file or both"

Would it be possible to have the xml updated at regular intervals in the background so that it doesn't download it when called.

Also just a thought, but maybe an option could be added in the settings field to select the update rate for the currencies. I don't need the currencies to be updated every two hours and would be ok with them being updated even every 12 hours.

Thanks.

deefrawley commented 2 years ago

Sure, I'll look in to regular background jobs. If not the setting is a great idea - python plugins having access to a settings page is relatively new so I haven't implemented that yet. Was thinking of having a setting where you can set your currency and if only one currency code is entered it defaults to that.

rp1231 commented 2 years ago

Just wanted to add that there is a minute delay even when the xml is updated. I don't know if this is because the plugin starts calculating the difference between the two currencies when the second currency is entered.

Here is the link for the plugin that I used on Wox and it has instantaneous results: https://github.com/encyclist/CurrencyConversion This one gives a list of results the moment the first currency is entered.

Not sure if you would be concerned with such a minute delay. But have linked to the plugin for reference, Just in case it would be something you would be interested in looking at.

Thanks

deefrawley commented 2 years ago

Hmmm, it would seem there may be something wrong with your install. The plugin takes 4 seconds to update the file on my PC and subsequent calls are near instantaneous. The plugin you listed also goes and downloads a rates file from the internet to convert. Are other Flow python plugins slow for you? Are you using your own Python install or letting Flow download it?

rp1231 commented 2 years ago

I'm using my own Python install.

The difference I'm talking about is a very minute difference. It's the difference between instantaneous and near instantaneous. Even when the xml is updated, It takes a second for the converted value to show up.

I'm not really sure which of the other plugins are python ones. but the general convertor works fine for me (Which I just realized is by you as well) It's instantaneous.

deefrawley commented 2 years ago

The general converter uses a hardcoded conversion table so doesn't download anything. For the currency one I think the best thing is to set the XML file timeout to longer with a setting so it uses the local file instead of downloading. I'll work on it over the christmas break and also see if I can optimise the code further as well..

deefrawley commented 2 years ago

The time it waits before refreshing the rates file is now configurable so you can have less downloading but with the current framework there is no way to update the rates file in the background so there is still the delay when it does. The new flox library I am using is being updated constantly so if this becomes possible, I'll add it in.