Python command to retrieve the "Running on" information
#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!
Reply
#2
You mean you want to read this info from the Kodi log file? Look here: https://docs.python.org/2/library/re.html
Reply
#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!
Reply
#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
Reply
#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!
Reply
#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.
Reply
#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, Help and Search the forum before posting.
Reply
#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!
Reply
#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!
Reply
#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, Help and Search the forum before posting.
Reply
#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!
Reply
#12
i have the same problem with xbmc.getInfoLabel('System.OSVersionInfo') always return BUSY
and the workaroud with xbmc.sleep does not work

how can i get the device name??

2019-06-09 10:58:58.142 T:6162  NOTICE: Running on HUAWEI FRD-L09 with Android 8.0.0 API level 26, kernel: Linux ARM 64-bit version 4.4.23+

also tryied os.uname but not return  huawei frd....
this is the content:
('Linux', 'localhost', '4.4.23+', '#1 SMP PREEMPT Tue Jul 10 16:03:40 CST 2018', 'aarch64')
Dev-Maintainer of InputStream Adaptive add-on, Netflix add-on ▫ Skills Python, C#, VB.NET and a bit of C++
Reply
#13
@CastagnaIT did you found any workaround for this?
Reply
#14
(2022-04-12, 18:38)-Dis Wrote: @CastagnaIT did you found any workaround for this?

after two year its difficult to remember why i need it
however only for android case you can use android system prop eg.

python:
model = subprocess.check_output( ['/system/bin/getprop', 'ro.product.model'])

no other solutions
Dev-Maintainer of InputStream Adaptive add-on, Netflix add-on ▫ Skills Python, C#, VB.NET and a bit of C++
Reply
#15
@CastagnaIT @-Dis have you tried what Python itself reports?

There's os.name, platform.version(), sys.platform, os.uname(), maybe others.

Edit: also, if anyone just wants to know what platform you're on, there's the xbmc.getCondVisibility() function with the System.Platform.(...) names:
- https://kodi.wiki/view/List_of_boolean_c...ons#System
- https://github.com/dersphere/script.xbmc...on.py#L143
Reply

Logout Mark Read Team Forum Stats Members Help
Python command to retrieve the "Running on" information0