Jump to content


Photo

Show command line output in first infobar


  • Please log in to reply
5 replies to this topic

#1 TheyLive

  • Member
  • 9 posts

0
Neutral

Posted 27 July 2018 - 10:53

Hi!

 

[OpenPLI 6.2]

 

Please, help me show command line output in infobars.

For example, CPU tempearature in milli Celsius degrees from command

cat /sys/class/thermal/thermal_zone0/temp

Or, for example, active memory in kB

cat /proc/meminfo | grep -m1 Active | awk '{ print int($2) }'

And so on

 

 



Re: Show command line output in first infobar #2 littlesat

  • PLi® Core member
  • 57,062 posts

+698
Excellent

Posted 27 July 2018 - 11:05

You can create a renderer for it... See the other renderers in /etc/enigma2/python/Components/Renderers

 

Some skins who show this data may gave example renderers

 

But why do you really need this info in milli degrees Celcius as this does not have any real added value....


Edited by littlesat, 27 July 2018 - 11:07.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Show command line output in first infobar #3 TheyLive

  • Member
  • 9 posts

0
Neutral

Posted 27 July 2018 - 11:14

Ok, I need simple Celsius without any prescision.

 

Thanks, I hoped that may be universal renderer exists.



Re: Show command line output in first infobar #4 Loui (PD1LOI)

  • Senior Member
  • 4,589 posts

+146
Excellent

Posted 28 July 2018 - 10:34

 Try this Infobar, you must install Attached File  enigma2-plugin-weather_c1.1_all.ipk   307.55KB   13 downloads and there you City.
 
 <widget backgroundColor="background" font="Regular; 32" foregroundColor="green" halign="right" position="990,855" render="Label" size="370,35" source="session.MSNWeather" transparent="1" zPosition="1">
    <convert type="MSNWeather">city</convert>
  </widget>
  <widget foregroundColor="white" backgroundColor="background" font="Regular2; 22" render="Label" position="1379,844" size="70,45" source="session.MSNWeather" zPosition="1" halign="center" transparent="1">
    <convert type="MSNWeather">temperature_heigh_low,current</convert>
  </widget>
  <widget backgroundColor="background" font="Regular2; 30" foregroundColor="unffff00" halign="center" position="1463,855" render="Label" size="80,35" source="session.MSNWeather" transparent="1" zPosition="1">
    <convert type="MSNWeather">temperature_current</convert>
  </widget>
  <widget backgroundColor="background" font="Regular2; 30" foregroundColor="red" halign="center" position="1530,855" render="Label" size="310,35" source="session.MSNWeather" transparent="1" zPosition="1">
    <convert type="MSNWeather">winddisplay</convert>
  </widget>
  <widget alphatest="blend" position="1800,847" render="MSNWeatherPixmap" size="90,90" source="session.MSNWeather" zPosition="5" transparent="0">
    <convert type="MSNWeather">weathericon,current,/usr/share/enigma2/weather_icons/,png</convert>
  </widget>
 
Attached File  1_0_19_4BCA_832_600_FFFF0000_33.jpg   37.38KB   9 downloads


Re: Show command line output in first infobar #5 littlesat

  • PLi® Core member
  • 57,062 posts

+698
Excellent

Posted 28 July 2018 - 13:14

It is time someone add infobar add plugin functionality so you can simply add a weather ‘screen window’ to your skin that only appears when the plugin is installed. So you don’t need the special renderers anymore...

Edited by littlesat, 28 July 2018 - 13:15.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Show command line output in first infobar #6 MiLo

  • PLi® Core member
  • 14,055 posts

+298
Excellent

Posted 28 July 2018 - 14:20

cat /sys/class/thermal/thermal_zone0/temp
cat /proc/meminfo | grep -m1 Active | awk '{ print int($2) }'


I want to express my hope that people do realize that these are not "commands" to retrieve information. The "cat" command just reads a file and writes it to output. Anything that calls "cat" or "echo" or "grep" or "awk" from code (like a plugin) is stupidly broken.

In a plugin, you'd write:

temperature = int(open('/sys/class/thermal/thermal_zone0/temp','r').read().strip())

for line in open('/proc/meminfo', 'r'):
    if line.startswith('Active'):
        amem = int(line.strip().split()[1])
        break
Please please please don't do things like forking of a shell process to read the contents of a file. Please.
Real musicians never die - they just decompose


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users