btc: also usuable with cjson
This commit is contained in:
parent
52e9b72217
commit
dcdfe3345c
|
@ -64,7 +64,10 @@ Supported platforms: Linux (required tools: `sysfs`)
|
||||||
|
|
||||||
Provides current Bitcoin price in any currency by code (
|
Provides current Bitcoin price in any currency by code (
|
||||||
https://en.wikipedia.org/wiki/ISO_4217).
|
https://en.wikipedia.org/wiki/ISO_4217).
|
||||||
Supported platforms: Linux, FreeBSD (required tools: `curl`)
|
Requires `curl` and one of the following json libraries:
|
||||||
|
- [lua-cjson](https://github.com/mpx/lua-cjson/))
|
||||||
|
- [luajson](https://github.com/harningt/luajson/)
|
||||||
|
Supported platforms: Linux, FreeBSD
|
||||||
|
|
||||||
- Arguments:
|
- Arguments:
|
||||||
* takes currency code, i.e. `"usd"`, `"rub"` and other. `"usd"` by
|
* takes currency code, i.e. `"usd"`, `"rub"` and other. `"usd"` by
|
||||||
|
|
|
@ -8,7 +8,12 @@ local setmetatable = setmetatable
|
||||||
local pcall = pcall
|
local pcall = pcall
|
||||||
local helpers = require("vicious.helpers")
|
local helpers = require("vicious.helpers")
|
||||||
local spawn = require("awful.spawn")
|
local spawn = require("awful.spawn")
|
||||||
local json = require("json")
|
|
||||||
|
local success, json = pcall(require, "cjson")
|
||||||
|
if not success then
|
||||||
|
json = require("json")
|
||||||
|
end
|
||||||
|
|
||||||
local string = {
|
local string = {
|
||||||
sub = string.sub,
|
sub = string.sub,
|
||||||
upper = string.upper,
|
upper = string.upper,
|
||||||
|
|
Loading…
Reference in New Issue