Release - XBMC LCDproc Python addon

  Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
jardes69 Offline
Junior Member
Posts: 22
Joined: Jan 2012
Reputation: 0
Post: #31
Thanks, but thos does not have any effect. My LCDd uses SureElec driver and this does not switch the backlight when LCDd stops. Looks like backlight can be switched off only by a client.


Acer Aspire Revo 3600 1Gb RAM + Antec Fusion 350 + Sure Electronics 20*4 LCD + Chinavision IR Receiver + Logitech Harmony 525 + XBMCbuntu Eden
find quote
herrnst Offline
Idle & Lurking
Posts: 228
Joined: Feb 2012
Reputation: 5
Location: Germany
Post: #32
Hm. As a last resort, maybe try this:

Put this script somewhere on your XBMC system (assuming /usr/local/bin/backlightoff.py) and make it executable:
Code:
#!/usr/bin/env python

import telnetlib
import time

tn = telnetlib.Telnet()

tn.open("localhost", "13666")
tn.write("hello\n")
rep = tn.read_until("\n", 2)

tn.write("screen_add backlight\n")
rep = tn.read_until("\n", 2)

tn.write("screen_set backlight -priority alert\n")
rep = tn.read_until("\n", 2)

tn.write("screen_set backlight -backlight off\n")
rep = tn.read_until("\n", 2)

while True:
  time.sleep(10)

Then, execute this in your system suspend handler somewhere, but make sure it is executed to run in the background (e.g. "/usr/local/bin/backlightoff.py &" or so), else your system will appeared hanging during the suspend process.

At last, in your resume handling, simply do a "killall python".

If that also doesn't work, guess we're out of luck for now.

script.xbmc.lcdproc!
Krypton+VDPAU+HD-Audio+LCDproc addon,TVHeadend-master/DVB-C/T2+pvr.tvh addon on Ubuntu 14.04 (amd64)
find quote
jardes69 Offline
Junior Member
Posts: 22
Joined: Jan 2012
Reputation: 0
Post: #33
Many thanks
I tried the script manually it just refreshes the screen, no backlight off.


Acer Aspire Revo 3600 1Gb RAM + Antec Fusion 350 + Sure Electronics 20*4 LCD + Chinavision IR Receiver + Logitech Harmony 525 + XBMCbuntu Eden
find quote
herrnst Offline
Idle & Lurking
Posts: 228
Joined: Feb 2012
Reputation: 5
Location: Germany
Post: #34
Huh?

At least if run manually, lights should go off (that scripts generates a virtual screen with higher priority than that of the addon and turns the backlight off), tested here on my SoundGraph iMON. Please also remember to revert the "Backlight"-setting in your LCDd.conf to "Backlight=open"; if set to "on", it won't work. (Just to mention this - remember to restart LCDd Smile )

script.xbmc.lcdproc!
Krypton+VDPAU+HD-Audio+LCDproc addon,TVHeadend-master/DVB-C/T2+pvr.tvh addon on Ubuntu 14.04 (amd64)
find quote
jardes69 Offline
Junior Member
Posts: 22
Joined: Jan 2012
Reputation: 0
Post: #35
Strange. When I try manually type to a telnet session, the sequence of commands works!!! But when Irun it as script it does no...


Acer Aspire Revo 3600 1Gb RAM + Antec Fusion 350 + Sure Electronics 20*4 LCD + Chinavision IR Receiver + Logitech Harmony 525 + XBMCbuntu Eden
find quote
jardes69 Offline
Junior Member
Posts: 22
Joined: Jan 2012
Reputation: 0
Post: #36
Ohhh, I missed last two lines of the script. Yes, it works when ran manually.


Acer Aspire Revo 3600 1Gb RAM + Antec Fusion 350 + Sure Electronics 20*4 LCD + Chinavision IR Receiver + Logitech Harmony 525 + XBMCbuntu Eden
find quote
herrnst Offline
Idle & Lurking
Posts: 228
Joined: Feb 2012
Reputation: 5
Location: Germany
Post: #37
Wink

Fine, maybe it then also works in the suspend/resume sequence. Just remember (important!) to run it as background process so the suspend procedure can run through.

script.xbmc.lcdproc!
Krypton+VDPAU+HD-Audio+LCDproc addon,TVHeadend-master/DVB-C/T2+pvr.tvh addon on Ubuntu 14.04 (amd64)
find quote
jardes69 Offline
Junior Member
Posts: 22
Joined: Jan 2012
Reputation: 0
Post: #38
No luck with suspend/resume script. I tried this:

/etc/pm/sleep.d/92_display

case "${1}" in
suspend)
/usr/local/bin/backlightoff.py &
/etc/init.d/LCDd stop
killall python
;;
resume|thaw)
/etc/init.d/LCDd start
;;
esac

I am sure the script is being executed.


Acer Aspire Revo 3600 1Gb RAM + Antec Fusion 350 + Sure Electronics 20*4 LCD + Chinavision IR Receiver + Logitech Harmony 525 + XBMCbuntu Eden
find quote
jardes69 Offline
Junior Member
Posts: 22
Joined: Jan 2012
Reputation: 0
Post: #39
Good news.

I found that python script can be fired from inside the XBMC like that:

RunScript(script[,args]*)

So I will map this to a key on my Logitech remote and will add the key to a sequence before calling suspend()

There is also LCD.Suspend build in, that suspends lcdproc.


Acer Aspire Revo 3600 1Gb RAM + Antec Fusion 350 + Sure Electronics 20*4 LCD + Chinavision IR Receiver + Logitech Harmony 525 + XBMCbuntu Eden
find quote
herrnst Offline
Idle & Lurking
Posts: 228
Joined: Feb 2012
Reputation: 5
Location: Germany
Post: #40
That suspend script won't work Wink Try this:

Code:
# cat /etc/pm/sleep.d/92_display

case "${1}" in
  suspend)
    /usr/local/bin/backlightoff.py &
    ;;
  resume|thaw)
    killall python
;;
esac

LCDd stop/start will reset the backlight state, and the python script shall be killed on resume (if directly killed, light will turn on instantly again).

If this works, this one might be something for the wiki page...

script.xbmc.lcdproc!
Krypton+VDPAU+HD-Audio+LCDproc addon,TVHeadend-master/DVB-C/T2+pvr.tvh addon on Ubuntu 14.04 (amd64)
find quote
jardes69 Offline
Junior Member
Posts: 22
Joined: Jan 2012
Reputation: 0
Big Grin  RE: XBMC LCDproc Python addon (testing needed)
Post: #41
I tried this before, without success. Maybe it has something with sleep daemon run levels, I do not have enough time to play with. Anyway, I applied my suggestion with mapping a key to your python script and it works as I need!

Many thanks for your support, I will keep watching this thread, because tiding up LCD during XBMC post-processing is definitely more generic solution.

Jaro


Acer Aspire Revo 3600 1Gb RAM + Antec Fusion 350 + Sure Electronics 20*4 LCD + Chinavision IR Receiver + Logitech Harmony 525 + XBMCbuntu Eden
find quote
herrnst Offline
Idle & Lurking
Posts: 228
Joined: Feb 2012
Reputation: 5
Location: Germany
Post: #42
Greetings,

for all being annoyed by the fact the addon displays all text aligned to the left only, please have a look at the aligntext branch of the script.xbmc.lcd repository at GitHub:

Using that branch, you may put the tags
Code:
$INFO[LCD.AlignCenter]
or
Code:
$INFO[LCD.AlignRight]
(yeah, abusing the GUIInfoLabel replacement stuff here Smile ) inside a <line></line> define to have the addon align that line centered or to the right, e.g. like this:

Code:
<line>$INFO[LCD.AlignCenter]$INFO[VideoPlayer.Title]</line>

If that stuff works without problems, I'll merge this to the master branch. Would love to get some feedback on this! Smile

Best regards,
herrnst

script.xbmc.lcdproc!
Krypton+VDPAU+HD-Audio+LCDproc addon,TVHeadend-master/DVB-C/T2+pvr.tvh addon on Ubuntu 14.04 (amd64)
(This post was last modified: 2012-11-28 22:59 by herrnst.)
find quote
ProGEEK Offline
Junior Member
Posts: 3
Joined: Dec 2012
Reputation: 0
Post: #43
Have just installed this addon in OpenELEC 2.95.2, and have got to say, am very impressed.

Works as expected.

I also have the backlight / LCD on after poweroff, but I think this is because LCDProc doesnt get terminated properly (The OpenELEC team already have a bug report open for this)

Beautiful Addon, and am very happy to test any new changes, as this should be in the main addon repo asap Smile
find quote
herrnst Offline
Idle & Lurking
Posts: 228
Joined: Feb 2012
Reputation: 5
Location: Germany
Post: #44
Thanks Wink The backlight problem might be related to the "Backlight="-setting in LCDd.conf (the light of my iMON also behaves strangely when powering off if the option is not set to "Open"), you may also try to play with the "Dim on shutdown" setting in the addon's GUI settings.

All latest changes (including the alignment feature) are currently merged into master Smile

script.xbmc.lcdproc!
Krypton+VDPAU+HD-Audio+LCDproc addon,TVHeadend-master/DVB-C/T2+pvr.tvh addon on Ubuntu 14.04 (amd64)
find quote
jardes69 Offline
Junior Member
Posts: 22
Joined: Jan 2012
Reputation: 0
Post: #45
Hi, everything works great so far :-) Have you been thinking about a graphic equaliser, is it feasible?


Acer Aspire Revo 3600 1Gb RAM + Antec Fusion 350 + Sure Electronics 20*4 LCD + Chinavision IR Receiver + Logitech Harmony 525 + XBMCbuntu Eden
find quote
Post Reply