Questions générales sur Manjaro Linux.
S'il vous plaît, avant de poster, essayez la fonction de recherche du forum.
#1Messageil y a 3 ansJe post ça ici car je suis pas au top avec cette commande.
Voici la ligne de référence que j'utilise dans mon conky pour afficher le prix d'une crypto avec l'API Kraken.
${font Monospace:normal:size=8}${color1} LTC ${texeci 300 curl https://api.kraken.com/0/public/Ticker?pair=XLTCZUSD | jq ".result.XLTCZUSD.c[0]" | grep -oE "[0-9]*\....."}
J'essais d'adapter cette ligne avec l'API de min-api.cryptocompare car il y a plus de crypto listé.
Par exemple pour afficher l'ERD j'utilise cette ligne:
https://min-api.cryptocompare.com/data/ ... &tsyms=USD
J'ai essayé de plusieurs manière mais j'ai une erreur à l'affichage de mon conky.
Exemple:
${font Monospace:normal:size=8}${color1} ERD ${texeci 300 curl https://min-api.cryptocompare.com/data/price?fsym=ERD&tsyms=USD | jq ".USD.[0]" | grep -oE "[0-9]*\....."}
Si quelqu'un pouvait me donner un coup de pouce ce serait bien venu OS:Manjaro
Release: Release: 23.0.2-86_64
Codename: Uranos
Kernel: 6.5.3-1
Bureau: Xfce 4.18
Motherboard: Gigabyte B450M DS3H (rev. 1.0)
CPU: AMD Ryzen 2600 (6) @ 3.400GHz
GPU: NVIDIA GeForce GTX 950 Driver 440.64
Memoire: 32Go Corsair 3000MHz
HDD system: SSD 970 EVO plus 250Go
HDD Backup: Seagate 450 Go
HDD VM: SSD Sandisk 240Go
#2Messageil y a 3 ansbonjour
ta commande jq ne fonctionne pas dans ta requete, le noeud USD n'est pas une liste mais une valeur (donc le grep ...?)
Que tu sois avec conky ne change rien: il faut tester les commandes une à une dans le terminal
curl -s https://min-api.cryptocompare.com/data/price\?fsym\=ERD\&tsyms\=USD
curl -s https://min-api.cryptocompare.com/data/price\?fsym\=ERD\&tsyms\=USD | jq ".USD"
curl -s https://min-api.cryptocompare.com/data/price\?fsym\=ERD\&tsyms\=USD | jq ".USD" | xxx
Ensuite, si bon, on insert le tout dans conky Manjaro STABLE - Linux lts - fish - Kde5 - icore N100 - 16Go RAM - ssd - efi
#mount /dev/archlinux /mnt/manjaro
#3Messageil y a 3 anspapajoke a écrit : ↑il y a 3 ans
bonjour
ta commande jq ne fonctionne pas
dans ta requete, le noeud USD n'est pas une liste mais une valeur (donc le grep ...?)
Que tu sois avec conky ne change rien: il faut tester les commandes une à une dans le terminal
curl -s https://min-api.cryptocompare.com/data/price\?fsym\=ERD\&tsyms\=USD
curl -s https://min-api.cryptocompare.com/data/price\?fsym\=ERD\&tsyms\=USD | jq ".USD"
curl -s https://min-api.cryptocompare.com/data/price\?fsym\=ERD\&tsyms\=USD | jq ".USD" | xxx
Ensuite, si bon, on insert le tout dans conky
Un grand merci papajoke car du coup je vais pouvoir ajouter plus de crypto et la ligne est plus simple OS:Manjaro
Release: Release: 23.0.2-86_64
Codename: Uranos
Kernel: 6.5.3-1
Bureau: Xfce 4.18
Motherboard: Gigabyte B450M DS3H (rev. 1.0)
CPU: AMD Ryzen 2600 (6) @ 3.400GHz
GPU: NVIDIA GeForce GTX 950 Driver 440.64
Memoire: 32Go Corsair 3000MHz
HDD system: SSD 970 EVO plus 250Go
HDD Backup: Seagate 450 Go
HDD VM: SSD Sandisk 240Go
#4Messageil y a 3 ansJe partage le script si cela intéresse quelqu'un
conky.config = {
-- — SETTINGS — #
background = false,
update_interval = 1,
cpu_avg_samples = 2,
net_avg_samples = 2,
double_buffer = true,
no_buffers = true,
text_buffer_size = 1024,
imlib_cache_size = 0,
-- — WINDOW — #
own_window = true,
own_window_type = 'normal',
own_window_transparent = false,
own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
-- — BORDER — #
border_inner_margin = 1,
border_outer_margin = 1,
border_width = 1,
-- — ALIGNMENT — #
alignment = 'top_right',
gap_x = 1520,
gap_y = 10,
-- — GRAPHIC — #
draw_shades = false,
draw_outline = false,
draw_borders = false,
draw_graph_borders = true,
-- — TEXT — #
use_xft = true,
font = 'Dejavu Sans:size=8',
xftalpha = 1.0,
uppercase = false,
override_utf8_locale = true,
default_color = '#3E5C6E',
-- — Colors — #
color1 = '#C8E3F6',
own_window_argb_visual = false,
own_window_colour = '#000000',
minimum_width = 100, minimum_height = 50,
own_window_argb_value = 0,
};
conky.text = [[
${font Monospace:normal:size=8}${color1} BTC ${texeci 300 curl curl -s https://min-api.cryptocompare.com/data/price\?fsym\=BTC\&tsyms\=USD | jq ".USD"} ${goto 90}USD
${font Monospace:normal:size=8}${color1} BAT ${texeci 300 curl curl -s https://min-api.cryptocompare.com/data/price\?fsym\=BAT\&tsyms\=USD | jq ".USD"} ${goto 90}USD
${font Monospace:normal:size=8}${color1} LTC ${texeci 300 curl curl -s https://min-api.cryptocompare.com/data/price\?fsym\=LTC\&tsyms\=USD | jq ".USD"} ${goto 90}USD
${font Monospace:normal:size=8}${color1} ERD ${texeci 300 curl curl -s https://min-api.cryptocompare.com/data/price\?fsym\=ERD\&tsyms\=USD | jq ".USD"} ${goto 90}USD
${font Monospace:normal:size=8}${color1} CKB ${texeci 300 curl curl -s https://min-api.cryptocompare.com/data/price\?fsym\=CKB\&tsyms\=USD | jq ".USD"} ${goto 90}USD
]];
Pour afficher en EURO mettre comme ceci:
${font Monospace:normal:size=8}${color1} BTC ${texeci 300 curl curl -s https://min-api.cryptocompare.com/data/price\?fsym\=BTC\&tsyms\=EUR | jq ".EUR"} ${goto 90}EUR
PS: Ce script n'affiche que le prix des cryptos
OS:Manjaro
Release: Release: 23.0.2-86_64
Codename: Uranos
Kernel: 6.5.3-1
Bureau: Xfce 4.18
Motherboard: Gigabyte B450M DS3H (rev. 1.0)
CPU: AMD Ryzen 2600 (6) @ 3.400GHz
GPU: NVIDIA GeForce GTX 950 Driver 440.64
Memoire: 32Go Corsair 3000MHz
HDD system: SSD 970 EVO plus 250Go
HDD Backup: Seagate 450 Go
HDD VM: SSD Sandisk 240Go
#5Messageil y a 3 ansOS:Manjaro
Release: Release: 23.0.2-86_64
Codename: Uranos
Kernel: 6.5.3-1
Bureau: Xfce 4.18
Motherboard: Gigabyte B450M DS3H (rev. 1.0)
CPU: AMD Ryzen 2600 (6) @ 3.400GHz
GPU: NVIDIA GeForce GTX 950 Driver 440.64
Memoire: 32Go Corsair 3000MHz
HDD system: SSD 970 EVO plus 250Go
HDD Backup: Seagate 450 Go
HDD VM: SSD Sandisk 240Go
#6Messageil y a 3 ans
curl -s "https://api.binance.com/api/v1/ticker/24hr?symbol=BTCUSDT" | jq ".priceChangePercent"
Me donne des valeurs négative en sortie avec le " - "Pc 1 : Manjaro XFCE4 - I3 WM - proco Pentium© Dual-Core CPU E6700 @ 3.20GHz × 2 - Ram 3 Go - HDD 333.6 Go - Carte graph Intel Corporation 82G33/G31 Express Integrated Graphics Controller
Pc 2 : Manjaro KDE : i7 - 16 Go Ram 10 To Hdd Geforge GTX 670 ( Bientôt réinstallation suite déménagement )
#7Messageil y a 3 ansl'api donne bien ce genre de résultat
Moi je voudrai supprimer les guillemets pour afficher comme ceci
Mais quand je fais ça le signe moins disparait alors qu'il faudrait le garder.
Je ne trouve pas comment faire OS:Manjaro
Release: Release: 23.0.2-86_64
Codename: Uranos
Kernel: 6.5.3-1
Bureau: Xfce 4.18
Motherboard: Gigabyte B450M DS3H (rev. 1.0)
CPU: AMD Ryzen 2600 (6) @ 3.400GHz
GPU: NVIDIA GeForce GTX 950 Driver 440.64
Memoire: 32Go Corsair 3000MHz
HDD system: SSD 970 EVO plus 250Go
HDD Backup: Seagate 450 Go
HDD VM: SSD Sandisk 240Go
#8Messageil y a 3 ansgrep n'est pas le top pour cela (et tu dois donner de mauvais paramètres à grep ?)
mais le plus simple est d'indiquer à jq que l'on désire ce résultat en ajoutant l'option -r
: jq -r ".priceChangePercent"
----
sinon on peut utiliser sed
, par exemple
... | jq ".priceChangePercent"| sed 's/"//g'
en clair: remplacer tous les "
par rien du tout
----
Ou avec grep
| jq ".priceChangePercent" | grep -o '[-.0-9]*'
on ne retourne que les caractères -
, .
et de 0 à 9
Manjaro STABLE - Linux lts - fish - Kde5 - icore N100 - 16Go RAM - ssd - efi
#mount /dev/archlinux /mnt/manjaro
#9Messageil y a 3 ansUn grand merci à toi papajoke pour ces précisions et ce bout de code
OS:Manjaro
Release: Release: 23.0.2-86_64
Codename: Uranos
Kernel: 6.5.3-1
Bureau: Xfce 4.18
Motherboard: Gigabyte B450M DS3H (rev. 1.0)
CPU: AMD Ryzen 2600 (6) @ 3.400GHz
GPU: NVIDIA GeForce GTX 950 Driver 440.64
Memoire: 32Go Corsair 3000MHz
HDD system: SSD 970 EVO plus 250Go
HDD Backup: Seagate 450 Go
HDD VM: SSD Sandisk 240Go