Because the comment in the top of this file is so complete, I’m just going to include the file and let you read it – Download link is at the bottom as usual :)
#!/usr/bin/perl############################################################## MDPD (Myth DPMS Preview Disabler) By Shannon Wynter# http://fremnet.net/article/254/mythtv-dpms-preview-disabler############################################################## One of the going concerns I have with MythTV is that when# I walk away from my TV after watching a show (leaving DPMS# to take care of the power saving) it's frequently left in# the watch recordings screen.## Because of the Preview available in this screen the hard# disk never spins down and ticks over quite happily until# you come back and wake the machine back up.## This simple script checks to see if DPMS has changed from# the on state to any other state, then asks MythTV what it# is doing. If MythTV says that it's in Watch Recordings it# tells MythTV to jump back to Main Menu.## Installation:# 1) Install required CPAN modules# Net::Telnet (Gentoo: emerge dev-perl/Net-Telnet)# X11::Protocol (Gentoo: emerge dev-perl/X11-Protocol)## 2) Make sure you've enabled telnet remote control in your# MythFrontend## 3) Run this script# I normally pop it into .xinitrc before launching# mythfrontend as /path/to/mpdp.pl &#use strict;use X11::Protocol;use X11::Protocol::Ext::DPMS;use Net::Telnet;# I assume you want to be connecting to a local socketmy $host = "localhost";my $port = 6546;# Configure default Net::Telnet objectmy $telnet = new Net::Telnet (Timeout => 10,Port => $port,Errmode => 'die',Prompt => '/#/');# Connect to X and initialize the extension to usemy $x = X11::Protocol->new();$x->init_extension('DPMS');# Storagemy $power_level = '';# Loop foreverwhile(1) {# Archive the power level and get the current onemy $old_pl = $power_level;($power_level, undef) = $x->DPMSInfo();# See if we've recently switched from DPMSModeOnif(($old_pl eq 'DPMSModeOn') && ($power_level ne 'DPMSModeOn')) { # Connect to mythfrontend $telnet->open( $host ); $telnet->waitfor('/#/i'); # Ask it where we are my $line = join('',$telnet->cmd("query location")); chomp($line); # In the PlaybackBox? if ($line =~ /PlaybackBox/i) { # Leave the PlaybackBox $telnet->cmd("jump mainmenu"); } $telnet->close();}sleep 60;}Commenting is closed for this article.