[mythtv-users] Having fun with OSD

Brad DerManouelian myth at dermanouelian.com
Wed Dec 21 07:00:00 EST 2005


On Dec 21, 2005, at 4:07 AM, Phill Edwards wrote:

>> You inspired me. I just wrote this quick script to display my
>> MythNews headlines. Anyone know if it's possible to trigger an
>> external script while watching TV? I set it to run every hour, but
>> I'd much prefer it to run when I hit a button on my remote and feel
>> like being depressed.
>>
>> Use/modify it if you like.
>>
>> #!/usr/bin/perl -w
>> use strict;
>> use LWP::Simple;
>> use XML::RSS;
>> use DBI;

use HTML::Entities ();

>>
>> my $dbh = DBI->connect('dbi:mysql:mythconverg','mythtv','mythtv');
>> my $sql = "SELECT url FROM newssites ORDER BY updated DESC";
>> my $sth = $dbh->prepare( $sql );
>>
>> $sth->execute || die ('Could not execute SQL statement: $sql');
>>
>> my $sNews;
>> while ( my $row = $sth->fetchrow )
>> {
>>     my $rss = new XML::RSS;
>>     $rss->parse( get( $row ) );
>>     foreach my $item (@{$rss->{'items'}})
>>     {
>>         $sNews .= "$item->{'title'} - $item->
>> {'description'}          ";
>>     }
>> }
>>

$sNews = HTML::Entities::encode($sNews);

>> `mythtvosd --template=scroller scroll_text="$sNews"`;
>
> Thanks Brad. I tried it but when I do a test run from the command line
> I get these errors:

Yeah, sorry about that. I wasn't handling some HTML entities that the  
shell doesn't like. Apply the mod that Graeme Hilton  suggested  
earlier in the thread and you should be all set. Look at my quoted  
text above for where the lines go.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20051221/2b50ac92/attachment.htm


More information about the mythtv-users mailing list