LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices



Reply
 
Search this Thread
Old 05-24-2013, 08:05 AM   #1
SeRi@lDiE
Member
 
Registered: Jun 2006
Location: /dev/null
Distribution: Slackware 13.1, Slackware 13.37, aptosid, rhel
Posts: 538
Blog Entries: 7

Rep: Reputation: 54
conky help


I have a web enable irrigation system.

The system has an api that allows you to curl the data.

I am trying to use conky to curl the data and display it on my conky window.

The problem is that I dont know how to make the data readable.

Here is what I got on conkyrc.


#${voffset 4}${font PizzaDude Bullets:size=14}a${font} Status: ${alignr}${execi 3600 curl »irrigation:23456/status.json}

Here is the output that comes out the curl:


{"zoneNumber":0,"progNumber":0,"allowRun":true,"running":false,"useSensor1":true,"isRaining":false," zoneSecLeft":0,"progSecLeft":0,"maxZones":10}

How can I make the output be aligned and readable?

Thanks in advance for the help!
 
Old 05-24-2013, 08:31 AM   #2
273
Senior Member
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 3,565

Rep: Reputation: 804Reputation: 804Reputation: 804Reputation: 804Reputation: 804Reputation: 804Reputation: 804
You could run the output through sed, for example, to change the formatting. I'm very new to sed so my solution would be using sed multiple times something like this:
Code:
|sed 's/\,/\n/g'| sed 's/\"//g'| sed 's/{//g'| sed 's/}//g'
Of course somebody who knows sed better could likely do this in one.
Or you could be more clever and if the isRaining part is true display a picture. I'm guessing you could use cut to obtain the relevant field then use the ${if_match} conky directive to decide what to display.
 
Old 05-24-2013, 09:11 AM   #3
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-{14.1,current} on a Lenovo Thinkpad T61 6457-4XG
Posts: 4,661

Rep: Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236
There is more than one way to skin a cat
Code:
<curl_command>  | tr -d  '{' | tr -d '}' | tr -d '"' | tr ',' '\n' | tr -d ' '
 
Old 05-24-2013, 09:25 AM   #4
273
Senior Member
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 3,565

Rep: Reputation: 804Reputation: 804Reputation: 804Reputation: 804Reputation: 804Reputation: 804Reputation: 804
Indeed, Didier, that is a bit neater .
 
Old 05-24-2013, 11:36 AM   #5
SeRi@lDiE
Member
 
Registered: Jun 2006
Location: /dev/null
Distribution: Slackware 13.1, Slackware 13.37, aptosid, rhel
Posts: 538
Blog Entries: 7

Original Poster
Rep: Reputation: 54
Thanks guys. This was perfect.
Does any body know how to tell conky to re size automatically instead of cutting?
 
Old 05-24-2013, 11:39 AM   #6
273
Senior Member
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 3,565

Rep: Reputation: 804Reputation: 804Reputation: 804Reputation: 804Reputation: 804Reputation: 804Reputation: 804
I'm not sure what you mean? I tend to set the sizes in my conky manually just adjusting things until they fit.
 
Old 05-24-2013, 11:45 AM   #7
SeRi@lDiE
Member
 
Registered: Jun 2006
Location: /dev/null
Distribution: Slackware 13.1, Slackware 13.37, aptosid, rhel
Posts: 538
Blog Entries: 7

Original Poster
Rep: Reputation: 54
Quote:
Originally Posted by 273 View Post
I'm not sure what you mean? I tend to set the sizes in my conky manually just adjusting things until they fit.
Yup I got it a few seconds after the post.

Thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Conky question: How can you pass Conky variables to scripts? evan1026 Linux - Software 1 12-29-2012 07:52 PM
conky question: passing conky-variable to shell-script zlin50 Linux - Software 2 12-29-2012 07:47 PM
LXer: Configure conky-Lua in Ubuntu (11.10 & 12.04), Fedora, debian and LinuxMint | Howto Conky LXer Syndicated Linux News 0 03-06-2012 01:40 PM
LXer: Conky Colors Makes Your Conky Beautiful In Seconds (Version 3.20 Released) LXer Syndicated Linux News 0 08-01-2010 12:21 PM
Conky on Suse 10.0 - *** buffer overflow detected *** conky terminated Slidex Linux - Software 1 03-17-2006 12:50 PM


All times are GMT -5. The time now is 10:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration