Python command to retrieve the "Running on" information

  Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
axlt2002 Offline
Fan
Posts: 446
Joined: Jun 2014
Reputation: 6
Location: Turin (Italy)
Post: #1
Hi all,

In the Kodi logs I can find the following information (I report just some examples):
  • 13:01:22.568 T:1958416384 NOTICE: Running on Open Source Media Center 2017.07-1, kernel: Linux ARM 32-bit version 4.9.29-9-osmc
  • 16:49:59.316 T:1693747968 NOTICE: Running on Sony D5103 with Android 4.4.4 API level 19, kernel: Linux ARM 32-bit version 3.4.0
  • 21:21:51.228 T:140684478301440 NOTICE: Running on LibreELEC (community) - Version: devel-20170528113803-r25683-g24c82c134 8.0, kernel: Linux x86 64-bit version 4.9.29
  • 15:59:49.744 T:139682791762304 NOTICE: Running on Ubuntu 17.04, kernel: Linux x86 64-bit version 4.10.0-26-generic
  • 23:14:15.226 T:5472 NOTICE: Running on Windows 10, kernel: Windows NT x86 64-bit version 10.0
Which is the command in python for which I can retrieve the "Running on" information?

Thanks in advance for any help! Nod

Light IMDb Ratings Update - Keep updated the IMDb ratings for your Movies and TV Shows.
In case you found useful my work, feel free to offer me a cappuccino!
find quote
Roman_V_M Offline
Team-Kodi Member
Posts: 1,141
Joined: Jun 2011
Reputation: 56
Location: Kyiv, Ukraine
Post: #2
You mean you want to read this info from the Kodi log file? Look here: https://docs.python.org/2/library/re.html

Raspberry PI 2 + LibreELEC 8 (Kodi 17)
Samsung Galaxy Tab A 10.1 + Kodi 17 for Android
find quote
axlt2002 Offline
Fan
Posts: 446
Joined: Jun 2014
Reputation: 6
Location: Turin (Italy)
Post: #3
Hi Roman,

Thanks for your answer.

Sorry, I was not clear enough. I mean to obtain that information (in particular the bolded text) from an add-on; I was wondering which python or xbmc command I need to use. I have tried platform(), but is not the right way to go.

Light IMDb Ratings Update - Keep updated the IMDb ratings for your Movies and TV Shows.
In case you found useful my work, feel free to offer me a cappuccino!
find quote
sshah93 Offline
Junior Member
Posts: 19
Joined: Jun 2015
Reputation: 0
Post: #4
Hello,

If you are just looking to find out what the operating system regardless of the os version, than You could use os.system() from the python os module, you can look up more here:

https://stackoverflow.com/questions/1325...-in-python
find quote
axlt2002 Offline
Fan
Posts: 446
Joined: Jun 2014
Reputation: 6
Location: Turin (Italy)
Post: #5
Thanks but I'm looking for something more....the command you pointed out is the one that I'm actually using.

To be more clear, I'm not able to understand when LibreELEC, OSMC or similars are running, despite from the logs it looks that is possible (first and third bullets in my initial post)...so I was wondering about the command used to retrieve that information.

Any additional help is really appreciated

Light IMDb Ratings Update - Keep updated the IMDb ratings for your Movies and TV Shows.
In case you found useful my work, feel free to offer me a cappuccino!
find quote
Roman_V_M Offline
Team-Kodi Member
Posts: 1,141
Joined: Jun 2011
Reputation: 56
Location: Kyiv, Ukraine
Post: #6
Boolean visibility conditions can tell you if you are running on special platforms like Raspberry or Android. https://codedocs.xyz/xbmc/xbmc/group__py...cb79caef6f
Other than that and Python's platform module there's no other way to detect a platform from addon perspective. Or parse a the log file.

Raspberry PI 2 + LibreELEC 8 (Kodi 17)
Samsung Galaxy Tab A 10.1 + Kodi 17 for Android
(This post was last modified: 2017-08-10 23:06 by Roman_V_M.)
find quote
ronie Offline
Team-Kodi Member
Posts: 13,179
Joined: Jan 2009
Reputation: 392
Post: #7
this should return (more or less) what you're after:
Code:
xbmc.getInfoLabel('system.osversioninfo')

Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ and Search the forum before posting.
For troubleshooting and bug reporting please make sure you read this first.
find quote
axlt2002 Offline
Fan
Posts: 446
Joined: Jun 2014
Reputation: 6
Location: Turin (Italy)
Post: #8
(2017-08-10 23:02)ronie Wrote:  this should return (more or less) what you're after:
Code:
xbmc.getInfoLabel('system.osversioninfo')

Thanks ronie, I will give it a try!

Light IMDb Ratings Update - Keep updated the IMDb ratings for your Movies and TV Shows.
In case you found useful my work, feel free to offer me a cappuccino!
find quote
axlt2002 Offline
Fan
Posts: 446
Joined: Jun 2014
Reputation: 6
Location: Turin (Italy)
Post: #9
(2017-08-10 23:02)ronie Wrote:  this should return (more or less) what you're after:
Code:
xbmc.getInfoLabel('system.osversioninfo')

Maybe there is something wrong, but calling that command, the result is "Busy"...

The code I used is:

Code:
label = xbmc.getInfoLabel('System.OSVersionInfo')
xbmc.log( "[%s] - %s" % ( addonName, label ) )

Any idea?

Light IMDb Ratings Update - Keep updated the IMDb ratings for your Movies and TV Shows.
In case you found useful my work, feel free to offer me a cappuccino!
find quote
ronie Offline
Team-Kodi Member
Posts: 13,179
Joined: Jan 2009
Reputation: 392
Post: #10
don't know why, but apparently it takes a bit of time for kodi to retrieve this info.
adding a bit of sleep should give a proper result.

Code:
xbmc.getInfoLabel('System.OSVersionInfo')
xbmc.sleep(100)
label = xbmc.getInfoLabel('System.OSVersionInfo')
xbmc.log( "[%s] - %s" % ( addonName, label ) )

Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ and Search the forum before posting.
For troubleshooting and bug reporting please make sure you read this first.
find quote
axlt2002 Offline
Fan
Posts: 446
Joined: Jun 2014
Reputation: 6
Location: Turin (Italy)
Post: #11
(2017-08-11 23:31)ronie Wrote:  don't know why, but apparently it takes a bit of time for kodi to retrieve this info.
adding a bit of sleep should give a proper result.

Code:
xbmc.getInfoLabel('System.OSVersionInfo')
xbmc.sleep(100)
label = xbmc.getInfoLabel('System.OSVersionInfo')
xbmc.log( "[%s] - %s" % ( addonName, label ) )

That solved the issue! Thanks a lot!

Light IMDb Ratings Update - Keep updated the IMDb ratings for your Movies and TV Shows.
In case you found useful my work, feel free to offer me a cappuccino!
find quote