Release Turn Off screensaver
#45
I had a more specific need for such a screen saver due to my dumb Philips monitor that always auto-switches between video signal inputs. Therefore I started to hack a little bit the source code of this add-on, considering to share my experience here.

I have a setup where I'm using Kodi (Matrix) mainly for playing audio streams (internet radio) in the background during the day and sharing a single monitor for both Kodi, running itself on a Linux thin client connected on DP and my workstation connected on HDMI.
Now, if my workstation puts the screen in standby, the dumb Philips monitor auto-switches (cannot disable the function - stupid OSD - made in China) to the next available video input - an that'll be Kodi on DP.

First, the only reliable way to suspend the monitor on Linux (x86) looks to be using xrandr and the code from this add-on is broken (simple Python syntax and xrandr arguments, both are wrong).
I used this package and unzipped it:
https://github.com/add-ons/screensaver.t...trix.1.zip
Edited the file screensaver.py - see here the source online:
https://github.com/add-ons/screensaver.t...ensaver.py
Not a Python coder myself, quite the contrary - a total noob, but learned from here the proper syntax for executing command line programs with arguments (need to split all arguments):
https://docs.python.org/2/library/subpro...onstructor
So, in screensaver.py I commented the nonfunctional CRT-0 related lines and substituted with mine:
 
Code:
    dict(name='dpms-xrandr', title='DPMS (using xrandr)',
         function='run_command',
#         args_off=['xrandr', '--output CRT-0', 'off'],
#         args_on=['xrandr', '--output CRT-0', 'on']),
         args_off=['xrandr', '--display', ':0.0', '--output', 'DP-1', '--off'],
         args_on=['xrandr', '--display', ':0.0', '--output', 'DP-1', '--auto']),
Note that to enable the display with xrandr you have to use auto and not on. Then, to learn which video output (in my case Display Port 1)  you're using - run on the console:
 
Code:
xrandr -display :0.0 -q

Packed back the Addon zip file and side loaded it (Add-ons - install from ZIP file) into Kodi. Tested it and all worked fine (had to disable mute audio in the Addon config).
All worked fine except that it didn't execute while I was playing audio streams because for a reason I don't fully understand, the developer considered to add a conditional checking at the end of screensaver.py.
It checks the state of the player and if it's in use (playing) with some media, then it doesn't start the screensaver Smile
But all this logic and conditional checking is already available inside Kodi. And, Kodi itself doesn't start the whatever screensaver is installed if video media is played, it does only for audio playback if no visualization is active (which makes perfect sense).
Now, before further butchering screensaver.py, I tried to just substitute the checking for Player.HasMedia with Player.HasVideo and failed - see the reference:
https://xbmc.github.io/docs.kodi.tv/mast...tions.html

Finally I did the "right thing" and commented the whole useless conditional checking at the end of screensaver.py
See:
https://github.com/add-ons/screensaver.t...ensaver.py
 
Code:
def run():
    ''' Runs the screensaver '''
#    from xbmc import getCondVisibility

    # If player has media, avoid running
#    if getCondVisibility("Player.HasMedia"):
#        log(1, 'Screensaver not started because player has media.')
#        return

    TurnOffDialog('gui.xml', addon_path(), 'default').doModal()

Now I have a functional ScreenSaver that activates on idle and when playing audio without visualizations. Smile
Reply


Messages In This Thread
Turn Off screensaver - by dag- - 2018-04-18, 23:14
RE: Turn Off screensaver - by fracti0n - 2018-04-30, 14:17
RE: Turn Off screensaver - by dag- - 2018-04-30, 15:07
RE: Turn Off screensaver - by c_g_f - 2018-05-28, 15:06
RE: Turn Off screensaver - by c_g_f - 2018-05-28, 15:35
RE: Turn Off screensaver - by Atreyu - 2018-12-02, 14:02
RE: Turn Off screensaver - by STEPHANVS - 2019-02-07, 00:49
RE: Turn Off screensaver - by STEPHANVS - 2019-02-07, 01:14
RE: Turn Off screensaver - by Arokhaerr - 2019-06-16, 22:28
RE: Turn Off screensaver - by Aerotinge - 2019-09-07, 17:50
RE: Turn Off screensaver - by dag- - 2019-09-18, 21:23
RE: Turn Off screensaver - by tuna8311 - 2020-05-09, 04:57
RE: Turn Off screensaver - by dag- - 2020-05-09, 15:11
RE: Turn Off screensaver - by mariofenech - 2020-05-09, 21:16
RE: Turn Off screensaver - by dag- - 2020-05-11, 20:40
RE: Turn Off screensaver - by ppeterson - 2020-06-02, 02:31
RE: Turn Off screensaver - by LeVvE - 2020-07-11, 01:00
RE: Turn Off screensaver - by tt4079 - 2020-12-31, 19:23
RE: Turn Off screensaver - by tt4079 - 2021-02-20, 00:11
RE: Turn Off screensaver - by ExTechOp - 2021-08-09, 09:43
RE: Turn Off screensaver - by ExTechOp - 2021-08-11, 19:00
RE: Turn Off screensaver - by hib1000 - 2021-08-09, 10:02
RE: Turn Off screensaver - by toml272 - 2021-08-24, 09:38
RE: Turn Off screensaver - by grimm_lokason - 2022-02-10, 20:00
RE: Turn Off screensaver - by Nickg102 - 2023-03-05, 15:09
RE: Turn Off screensaver - by mariofenech - 2023-03-05, 15:47
Turn Off on KODI/LibreELEC/RPi - by tinca - 2023-05-29, 19:11
RE: Turn Off on KODI/LibreELEC/RPi - by tinca - 2023-05-30, 13:57
RE: Turn Off screensaver - by mariofenech - 2023-05-30, 14:06
RE: Turn Off screensaver - by mariofenech - 2023-05-30, 14:10
RE: Turn Off screensaver - by tinca - 2023-05-30, 17:49
RE: Turn Off screensaver - by mariofenech - 2023-05-30, 19:27
RE: Turn Off screensaver - by tinca - 2023-05-30, 19:39
RE: Turn Off screensaver - by tinca - 2023-05-30, 19:41
RE: Turn Off screensaver - by mariofenech - 2023-05-31, 02:12
RE: Turn Off screensaver - by tinca - 2023-05-31, 08:51
RE: Turn Off screensaver - by mariofenech - 2023-05-31, 18:58
RE: Turn Off screensaver - by tinca - 2023-05-31, 22:00
RE: Turn Off screensaver - by abga - 2023-07-11, 03:51
RE: Turn Off screensaver - by Patkino - 2023-08-21, 23:18
RE: Turn Off screensaver - by izprtxqkft - 2023-08-22, 04:23
RE: Turn Off screensaver - by Patkino - 2023-08-22, 08:31
RE: Turn Off screensaver - by CodyLane - 2024-03-27, 01:31
Logout Mark Read Team Forum Stats Members Help
Turn Off screensaver0