deanishe / alfred-convert Goto Github PK
View Code? Open in Web Editor NEWConvert between different units in Alfred
License: Other
Convert between different units in Alfred
License: Other
This is by far the best converter workflow I have come across and I have been looking for ages. Would be good if you could support more currencies including 'United Arab Emirates Dirham'.
Thanks!
Oil barrel to cubic meter
1 bbl = 0.1589873 m^3
Ton to oil barrel (for average density oil)
1 ton = 7.1475121 bbl
Barrel of oil equivalent (BOE) to cubic meter
1 boe = 169.902 m^3
Barrel of oil equivalent (BOE) to Million Standard Cubic Feet
1 boe = 0.006 MMscf
Thanks!
Hello.
Great workflow. I noticed that I can't currently convert between km/h or mi/h and another unit of speed.
In my country kph
is not common, we use km/h
all the time.
I noticed the workflow is confusing this notation with a division involving the plank_constant
.
It works if I use conv 32km/hour mi/hour
.
Also can't do, for example, conv 5760h min
.
In some cases, should h
just be mapped to 1 hour?
Should we change this behavior or keep it? What do you think?
Great workflow thanks!
In most cases I only need the resulting number, not the unit, after doing a conversion. So would it be possible to add an option to specify that only the number is copied to the clipboard, without the unit?
Awesome workflow!
It's neat, that you can set different delimiters for the results, but I expected the configurations also to affect the input.
Line 277 in 76be62d
Formatter
on that value, but I don't know much about python. Guess it would need some conversion.
A nice solution would parse the number no matter what:
23.34 => 23.34
23,34 => 23.34
12.123,345 => 12123.345
12,123.345 => 12123.345
The only problem would be three decimal places:
23,345 => 23.345 / 23345.00 ???
And this does not considers all cases.
So using the configuration would be most convenient, I guess.
Hi,
I was attempting a unit conversion and this works:
conv 10 m**2 sq_in
which displays 15,500.03
but if you reverse it
conv 10 sq_in m**2
you get an error saying 'ascii' codec can't encode character 'u\xb2' in position 5: ordinal not in range(128)
Should I be using another unit name instead of m**2? The same thing happens if I use m^2.
Thanks!
Hi,
Would it be possible to convert between number bases? I'm thinking of decimal, hexadecimal, binary, etc, for "coding" purposes.
I looked at the default units and Pint docs, but I couldn't find anything about that. Is it possible to add a unit that call a python function maybe?
Thanks
The help-guide wasn't very useful for me in trying to add the APP_KEY from Open Exchange Rates – I ended up opening the workflow and editing the .plist.
Clarification would be super helpful! :-)
Thanks!
It would be extremely useful to be able to convert between different temperature units.
[2017-12-17 09:17:42][ERROR: input.scriptfilter] Code 1: Traceback (most recent call last):
File "convert.py", line 20, in <module>
from workflow import Workflow3, ICON_WARNING, ICON_INFO
File "/Users/Canor/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.5E09B0F2-1E7D-4131-8F98-A36B01C3707E/workflow/__init__.py", line 16, in <module>
from .workflow import Workflow, manager
File "/Users/Canor/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.5E09B0F2-1E7D-4131-8F98-A36B01C3707E/workflow/workflow.py", line 27, in <module>
import cPickle
ModuleNotFoundError: No module named 'cPickle'
this recently has come to my attention, since it suddenly stopped working obviously. Does alfred-convert require cPickle
to be installed on System?
Thanks.
Appears as though fiats that were working in a prior release are no longer recognised.
Have verified they appear in active_currencies.
Running latest 3.2 from git. Removed workflow + leftover files, restarted Alfred, reinstalled, same result.
FIAT symbols tried from USD: AUD, NZD, ZAR.
Screenshots attached.
The problem is that pint
uses distinct mapping while in reality there is some kind of ambiguity without a proper context.
For example: Does kn
means kilo newton
or knots
? Does h
mean hour
or the Planck constant?
It would be great to evaluate the possible meaning of the source expression and the target expression. If there is a match in types it's very likely that's the context the user meant. Or even show the result of both if possible.
No way in hell I will remember I have to use kpm
for km/h
or knots
instead of kn
. It's hard to build up muscle memory for this.
I guess replacing the dictionary with units that I use could be an option. But so far I only found how to add new units. No problem to drop the Planck constant. But it would be sad to drop newton.
Great tool! It would be really nice to also take advantage of the more advanced conversions already available in pint, such as converting between energy and length in the context of spectroscopy (e.g., 1 Å = 12398 eV for light).
I can't convert -11 degC to degF, for instance.
Hi Dean,
Thanks for this plugin, I've been using it for years, and I was recently delighted to discover that you've added crypto conversions. Thanks!
Took me quite a while to figure out that I needed to rename the extension for it to install, is that deliberate?
This may sound quite stupid, but I'm staring at the documentation without understanding how do I add the openexchangerates API key I just created to the extension.
Do I need to edit manually the extension files? How so? thanks!
After running a conversion, the CPU of the Python process spikes to 100% and stays there indefinitely on my Mac. This occurs after any conversion, like currency, or length.
I think this only started happening a few days ago. I already re-installed the workflow.
Hi,
is there a chance to make the workflow use the mac's local settings for the decimal point? While the US uses a "dot" many other countries use a "comma". Alfred's built in calculations adapt to the mac's regional settings, so it would be great if the workflow would that to, because it is confusing to use one here and the other one there. I always do it wrong the first time.
Again: Awesome extension. Thank you.
Julian
EDIT: Fixed my mistake
These days i've noticed the following bug:
When i type conv 1 usd kzt
it keeps telling my "Updating exchange rates" and i won't get actual data...
As a user of the convert alfred workflow I want to be able to convert from frequency (Hz) to a period back and forth.
// Period (T) to Frequency (Hz)
Input: conv 5 s Hz
Output: 0.2 Hz
Input: conv 0.25 s Hz
Output: 4 Hz
Input: conv 1 ms Hz
Output: 1000 Hz
// Frequency (Hz) to Period (T)
Input: conv 1000 Hz ms
Output: 1 ms
After the last update v3.5.1, I can convert anymore the following error appear.
Debug log
`Starting debug for 'Convert'
[2018-03-11 21:42:23][ERROR: input.scriptfilter] Code 1: 21:42:23 workflow.py:2247 DEBUG ---------- Convert (3.5.1) ----------
21:42:23 workflow.py:1657 DEBUG reading settings from /Users/Ray420/Library/Application Support/Alfred 3/Workflow Data/net.deanishe.alfred-convert/settings.json
21:42:23 workflow.py:2526 INFO checking for update ...
21:42:23 background.py:188 DEBUG [__workflow_update_check] command cached: /Users/Ray420/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-convert/__workflow_update_check.argcache
21:42:23 background.py:192 DEBUG [__workflow_update_check] passing job to background runner: [u'/usr/bin/python', '/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/workflow/background.pyc', u'__workflow_update_check']
21:42:23 workflow.py:2247 DEBUG ---------- Convert (3.5.1) ----------
21:42:23 background.py:197 DEBUG [__workflow_update_check] background job started
21:42:23 convert.py:625 DEBUG query : 12 usd jpy
21:42:23 workflow.py:2411 DEBUG last run version: 3.5.1
21:42:23 convert.py:103 DEBUG version=3.5.1, last_version=3.5.1
21:42:23 workflow.py:1884 DEBUG loading cached data: /Users/Ray420/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-convert/__workflow_update_status.cpickle
21:42:23 workflow.py:2461 DEBUG update_data: {u'available': False}
21:42:23 workflow.py:1884 DEBUG loading cached data: /Users/Ray420/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-convert/exchange_rates.cpickle
21:42:23 convert.py:530 DEBUG registering currency : 'DZD = usd / 114.04071 = dzd'
21:42:23 convert.py:530 DEBUG registering currency : 'NAD = usd / 11.915 = nad'
21:42:23 convert.py:530 DEBUG registering currency : 'GHS = usd / 4.46 = ghs'
21:42:23 convert.py:530 DEBUG registering currency : 'EGP = usd / 17.641 = egp'
21:42:23 convert.py:530 DEBUG registering currency : 'BGN = usd / 1.58816 = bgn'
21:42:23 convert.py:530 DEBUG registering currency : 'LSK = usd / 0.05168 = lsk'
21:42:23 convert.py:530 DEBUG registering currency : 'PAB = usd / 1 = pab'
21:42:23 convert.py:530 DEBUG registering currency : 'BOB = usd / 6.910011 = bob'
21:42:23 convert.py:530 DEBUG registering currency : 'DKK = usd / 6.04549 = dkk'
21:42:23 convert.py:530 DEBUG registering currency : 'BWP = usd / 9.578914 = bwp'
21:42:23 convert.py:530 DEBUG registering currency : 'LBP = usd / 1512.5 = lbp'
21:42:23 convert.py:530 DEBUG registering currency : 'TZS = usd / 2254.1 = tzs'
21:42:23 convert.py:530 DEBUG registering currency : 'VND = usd / 22752.44336 = vnd'
21:42:23 convert.py:530 DEBUG registering currency : 'AOA = usd / 215.1155 = aoa'
21:42:23 convert.py:530 DEBUG registering currency : 'KHR = usd / 4002'
21:42:23 convert.py:530 DEBUG registering currency : 'QAR = usd / 3.641996 = qar'
21:42:23 convert.py:530 DEBUG registering currency : 'KYD = usd / 0.832789'
21:42:23 convert.py:530 DEBUG registering currency : 'LYD = usd / 1.33 = lyd'
21:42:23 convert.py:530 DEBUG registering currency : 'UAH = usd / 26.5275 = uah'
21:42:23 convert.py:530 DEBUG registering currency : 'JOD = usd / 0.709001 = jod'
21:42:23 convert.py:530 DEBUG registering currency : 'AWG = usd / 1.786505 = awg'
21:42:23 convert.py:530 DEBUG registering currency : 'SAR = usd / 3.75015 = sar'
21:42:23 convert.py:530 DEBUG registering currency : 'BND = usd / 1.321966 = bnd'
21:42:23 convert.py:530 DEBUG registering currency : 'HKD = usd / 7.830598 = hkd'
21:42:23 convert.py:530 DEBUG registering currency : 'CHF = usd / 0.93757 = chf'
21:42:23 convert.py:530 DEBUG registering currency : 'GIP = usd / 0.724428 = gip'
21:42:23 convert.py:530 DEBUG registering currency : 'XPF = usd / 96.875298 = xpf'
21:42:23 convert.py:530 DEBUG registering currency : 'XPD = usd / 38.77 = xpd'
21:42:23 convert.py:530 DEBUG registering currency : 'DASH = usd / 0.001649 = dash'
21:42:23 convert.py:530 DEBUG registering currency : 'MRO = usd / 356 = mro'
21:42:23 convert.py:530 DEBUG registering currency : 'HRK = usd / 6.038184 = hrk'
21:42:23 convert.py:530 DEBUG registering currency : 'DJF = usd / 177.075 = djf'
21:42:23 convert.py:530 DEBUG registering currency : 'THB = usd / 31.4465 = thb'
21:42:23 convert.py:530 DEBUG registering currency : 'XAF = usd / 532.515732 = xaf'
21:42:23 convert.py:530 DEBUG registering currency : 'XAG = usd / 0.06061195 = xag'
21:42:23 convert.py:530 DEBUG registering currency : 'ETB = usd / 27.56 = etb'
21:42:23 convert.py:530 DEBUG registering currency : 'UYU = usd / 28.40176 = uyu'
21:42:23 convert.py:530 DEBUG registering currency : 'NIO = usd / 31.085 = nio'
21:42:23 convert.py:530 DEBUG registering currency : 'LAK = usd / 8305 = lak'
21:42:23 convert.py:530 DEBUG registering currency : 'MAID = usd / 2.43 = maid'
21:42:23 convert.py:530 DEBUG registering currency : 'SYP = usd / 514.98999 = syp'
21:42:23 convert.py:530 DEBUG registering currency : 'MAD = usd / 9.2 = mad'
21:42:23 convert.py:530 DEBUG registering currency : 'MZN = usd / 61.855 = mzn'
21:42:23 convert.py:530 DEBUG registering currency : 'YER = usd / 250.325 = yer'
21:42:23 convert.py:530 DEBUG registering currency : 'ZAR = usd / 11.9234 = zar'
21:42:23 convert.py:530 DEBUG registering currency : 'NPR = usd / 104.297226 = npr'
21:42:23 convert.py:530 DEBUG registering currency : 'ZWL = usd / 322.355011 = zwl'
21:42:23 convert.py:530 DEBUG registering currency : 'NGN = usd / 360.5 = ngn'
21:42:23 convert.py:530 DEBUG registering currency : 'ANG = usd / 1.784194 = ang'
21:42:23 convert.py:530 DEBUG registering currency : 'CRC = usd / 569.71 = crc'
21:42:23 convert.py:530 DEBUG registering currency : 'AED = usd / 3.673014 = aed'
21:42:23 convert.py:530 DEBUG registering currency : 'GBP = usd / 0.724428 = gbp'
21:42:23 convert.py:530 DEBUG registering currency : 'MWK = usd / 725.725 = mwk'
21:42:23 convert.py:530 DEBUG registering currency : 'LKR = usd / 155.13 = lkr'
21:42:23 convert.py:530 DEBUG registering currency : 'DOP = usd / 49.13 = dop'
21:42:23 convert.py:530 DEBUG registering currency : 'PKR = usd / 110.65 = pkr'
21:42:23 convert.py:530 DEBUG registering currency : 'HUF = usd / 254.6475 = huf'
21:42:23 convert.py:530 DEBUG registering currency : 'BMD = usd / 1 = bmd'
21:42:23 convert.py:530 DEBUG registering currency : 'LSL = usd / 11.91 = lsl'
21:42:23 convert.py:530 DEBUG registering currency : 'MNT = usd / 2390.948643 = mnt'
21:42:23 convert.py:530 DEBUG registering currency : 'AMD = usd / 480.77 = amd'
21:42:23 convert.py:530 DEBUG registering currency : 'UGX = usd / 3648.3 = ugx'
21:42:23 convert.py:530 DEBUG registering currency : 'XDR = usd / 0.689644 = xdr'
21:42:23 convert.py:530 DEBUG registering currency : 'JMD = usd / 127.1499 = jmd'
21:42:23 convert.py:530 DEBUG registering currency : 'TTD = usd / 6.73915 = ttd'
21:42:23 convert.py:530 DEBUG registering currency : 'SHP = usd / 0.724428 = shp'
21:42:23 convert.py:530 DEBUG registering currency : 'AFN = usd / 69.475 = afn'
21:42:23 convert.py:530 DEBUG registering currency : 'MMK = usd / 1339.7 = mmk'
21:42:23 convert.py:530 DEBUG registering currency : 'KPW = usd / 900 = kpw'
21:42:23 convert.py:530 DEBUG registering currency : 'MKD = usd / 49.983876 = mkd'
21:42:23 convert.py:530 DEBUG registering currency : 'TRY = usd / 3.806784 = try'
21:42:23 convert.py:530 DEBUG registering currency : 'BDT = usd / 82.977763 = bdt'
21:42:23 convert.py:530 DEBUG registering currency : 'SJCX = usd / 0 = sjcx'
21:42:23 workflow.py:2266 ERROR division by zero
Traceback (most recent call last):
File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/workflow/workflow.py", line 2259, in run
func(self)
File "convert.py", line 645, in main
register_exchange_rates(exchange_rates)
File "convert.py", line 531, in register_exchange_rates
ureg.define(definition)
File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/pint/registry.py", line 233, in define
self._define(Definition.from_string(line))
File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/pint/definitions.py", line 57, in from_string
return UnitDefinition(name, symbol, aliases, value)
File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/pint/definitions.py", line 117, in init
converter = ParserHelper.from_string(converter)
File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/pint/util.py", line 417, in from_string
return cls._from_string(input_string)
File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/pint/compat/lrucache.py", line 129, in wrapper
result = user_function(*args, **kwds)
File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/pint/util.py", line 452, in _from_string
ret = build_eval_tree(gen).evaluate(cls.eval_token)
File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/pint/pint_eval.py", line 83, in evaluate
return bin_op[op_text](left, self.right.evaluate(define_op, bin_op, un_op))
File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/pint/util.py", line 535, in truediv
new.scale /= other
ZeroDivisionError: division by zero
21:42:23 workflow.py:2268 INFO for assistance, see: https://github.com/deanishe/alfred-convert/issues
21:42:23 workflow.py:2289 DEBUG ---------- finished in 0.382s ----------`
Hi,
could you integrate bitcoins as a currency as they are becoming more and more popular. There is no official ISO code yet, but most widely XBT or BTC are used:
http://www.xe.com/currency/xbt-bitcoin#
That would be awesome :)
Have tried the Fixum workflow, it did not pickup anything.
macOS 10.12.5
Starting debug for 'Convert'
[2017-07-14 08:55:25][STDERR: input.scriptfilter] 08:55:25 workflow.py:2225 DEBUG Workflow version : 2.6.0
08:55:25 workflow.py:1628 DEBUG Reading settings from `/Users/chbuschmann/Library/Application Support/Alfred 3/Workflow Data/net.deanishe.alfred-convert/settings.json` ...
08:55:25 workflow.py:2509 INFO Checking for update ...
08:55:25 background.py:170 INFO Task `__workflow_update_check` is already running
08:55:25 convert.py:183 DEBUG query : 10 eur nok
08:55:25 workflow.py:2444 DEBUG update_data : None
08:55:25 background.py:170 INFO Task `update` is already running
08:55:25 convert.py:126 DEBUG quantity : 10.0 tail : eur nok
08:55:25 convert.py:140 DEBUG atoms : [u'eur', u'nok'] i : 0 q1 : eur q2 : nok
08:55:25 convert.py:140 DEBUG atoms : [u'eur', u'nok'] i : 1 q1 : eur nok q2 :
08:55:25 convert.py:232 CRITICAL Invalid query : Unknown unit : eur nok
08:55:25 convert.py:255 DEBUG finished
08:55:25 workflow.py:2423 DEBUG Set last run version : 2.6.0
08:55:25 workflow.py:2267 DEBUG Workflow finished in 0.008 seconds.
The documentation mentions a configuration sheet in which APP_KEY (for currency conversion) should be added. Where is that configuration sheet? An enigmatic [x] is all that can be found in the documentation...
Ensure existing definitions are not overwritten when adding currencies.
Hi @deanishe ,
Do you know if this will work with newest Alfred version (3.1.1)? Will it break anything if I go ahead and try?
Thanks.
For example, for me I would like to have all currency converted by default, if no other target specified, to USD. For weight, I would like to see everything in grams, etc, etc.
conv 1hr s
shows 3,600 second
in the UI and copies 3,600
to the clipboard.
I like that the UI shows the thousand groupings, however, often I'm converting units for programming, spreadsheets, etc. and in those situations I usually want the "raw" value.
An option to show the thousand separators in the UI but not copy them to the clipboard would be great. Final result would be:
conv 1hr s
shows 3,600 second
in the UI and copies 3600
to the clipboard.
Hi, is it possible to choose between yahoo and google finance? Also is it possible to set how often currencies will sync?
Any chance to add a comma to separate thousands?
Hi,
May I suggest you to use https://exchangeratesapi.io API? It's free, has no limit and is based on the European Central Bank's service. Users wouldn't have to create an account on openexchangerates.org to get an App ID and they could convert currencies with no limit.
Might be worth having unit definitions for bits/bytes/kilobytes/megabytes/gigabytes etc built in.
Here's a gist of my unit_definitions.txt for reference.
What do you think?
P.S. Thanks for the workflow; I use it all the time ⚡
I can convert some cryptocurrencies e.g. conv 1 btc usd
& conv 1 zec usd
work but not ZCL (zclassic) e.g. conv 1 zcl usd
returns Unknown unit zcl
ZCL is listed in https://github.com/deanishe/alfred-convert/blob/master/docs/currencies.md#cryptocurrencies and present on https://www.cryptocompare.com/coins/zcl/overview
Any plans for timezones conversion?
Hi, the Pint docs say in http://pint.readthedocs.org/en/latest/nonmult.html
The default definition file includes fahrenheits, celsius, kelvin and rankine
abbreviated as degF, degC, degK, and degR.
However, when I do (in 1.1 from http://www.packal.org/workflow/convert)
convert 11 degC degF
it gives me an error message:
Unknown unit : degc
The workaround is to type the long names:
convert 11 celsius fahrenheit
That does work, but is pretty long to type.
Otherwise, this is an awesome workflow. Thank you for the work you put into this.
Best,
Julian
When I hit conv 170 mm pixel
, it says Can't convert from millimeter [length] to pixel [printing_unit]
Then I found a formula to convert between millimeter and pixel at the bottom of this page, and it works perfectly for me.
So, why not add this functionality into alfred-convert?
This script should be extended to handle cases where the resulting conversion is lower than 1. Most common example would cryptocurrencies such as Bitcoin. Because the ration is so huge, and a single dollar is worth less than 0.0001 BTC, more decimal spaces are needed to properly display the resulting conversion.
In the current implementation, conv 1 USD BTC
would result in 0.00 BTC
, which is obviously incorrect. What the script should do instead is check whether the resulting conversion is lower than 1, and format the result using an alternate decimal places property. Say, MICRO_DECIMAL_PLACES
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.