Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I turn off the screen blackout in Linux when playing a film in BBC iPlayer? I usually use it in Chrome, but if there is a way to do it in Firefox (Iceweasel) than it is good enough as well.

I think by default iPlayer uses Flash, but if there is a way to switch to HTML 5 that does the job than I am fine to do it as well.

I know how to turn it off completely, but obviously I want it to save energy in all other circumstances.

share|improve this question
    
You could manually inhibit power management via D-Bus. –  sr_ Jan 19 '13 at 11:51
    
@sr_, unfortunately I haven't heard about this stuff before. How would I use it? –  Grzenio Jan 20 '13 at 14:25
    
There's a utility called caffeine that purports to turn off screensavers while video is playing. I installed it on kubuntu precise and it crashes. YMMV. –  Joe Jan 25 '13 at 20:07
add comment

1 Answer 1

I cannot add a comment but to completely turn off the screen blanking I usually use this

xset -dpms &
xset s noblank &
xset s off &

I'm not an expert on sqlite files but you can maybe use a command like

  sqlite3 ./.mozilla/firefox/*default/places.sqlite "select a.url from moz_places a;" | grep bbc.co.uk/iplayer

and try to get a timestamp to check against to trigger the turning off of the screen blanking. Hope this could be of some use!

EDIT

I digged a little bit into it and came out with this python script

import subprocess


def get_last_visit():

    shell_cmd = ('sqlite3 ~/.mozilla/firefox/*default/places.sqlite '
                 '"select b.visit_date, a.url from moz_places a, '
                 'moz_historyvisits b where a.url like '
                 '\'%www.bbc.co.uk/iplay%\';"')

    proc = subprocess.check_output(shell_cmd, shell=True)

    dates = [x[:10] for x in proc.split()]

    return int(max(dates))


def get_curren_date():

    current_date = subprocess.Popen(['date', '+%s'],
                                    stdout=subprocess.PIPE)[0][:10]

    return int(current_date)


def main():

    last_visit = get_last_visit()
    current_date = get_curren_date()

    if current_date - last_visit < 300:
        subprocess.call(['xset', '-dpms'])
        subprocess.call(['xset', 's', 'noblank'])
        subprocess.call(['xset', 's', 'off'])

if __name__ == '__main__':

    main()

I haven't tested it but you can try to add it to your crond to execute every 5 minutes, should check to see if you were on the bbc/iplay website in the last five minutes and if yes turn off screen blanking. Its far from perfect but I hope that someone can improve it and give suggestions!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.