Springen naar inhoud


Foto

Show command line output in first infobar


  • Please log in to reply
Er zijn 5 reacties in dit onderwerp

#1 TheyLive

  • Member
  • 9 berichten

0
Neutral

Geplaatst op 27 juli 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
  • 56288 berichten

+691
Excellent

Geplaatst op 27 juli 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....


Veranderd door littlesat, 27 juli 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 berichten

0
Neutral

Geplaatst op 27 juli 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
  • 4529 berichten

+140
Excellent

Geplaatst op 28 juli 2018 - 10:34

 Try this Infobar, you must install Bijlage  enigma2-plugin-weather_c1.1_all.ipk   307,55K   13 Aantal bijlagen 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>
 
Bijlage  1_0_19_4BCA_832_600_FFFF0000_33.jpg   37,38K   9 Aantal bijlagen


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

  • PLi® Core member
  • 56288 berichten

+691
Excellent

Geplaatst op 28 juli 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...

Veranderd door littlesat, 28 juli 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
  • 14045 berichten

+298
Excellent

Geplaatst op 28 juli 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 gebruiker(s) lezen dit onderwerp

0 leden, 1 bezoekers, 0 anonieme gebruikers