[mythtv-users] tv_grab_au script from this list. Anyone elsehadproblems today?

F'Nog fnog at thegirlwithtwobreasts.com
Tue Aug 2 12:21:21 UTC 2005


Nick Tan wrote:

>>Berry, David wrote:
>>    
>>
>>>Same here (Canberra)
>>>
>>>How do we fix it? - change the script?
>>>      
>>>
>>I had a poke around and the changes seem to be they changed the url from
>>/closeup/ to /cu/ and changed a couple of the attributes that are
>>searched for the find the programs id to find its close up details. The
>>url changes are pretty simple and only exist in a couple of places
>>however I don't know anywhere enough, well no, perl to change the
>>regular expressions to filter out the right program info.
>>
>>It seems it's either fixing this all the time or going back to d1 (I
>>only ever got program data for SBS News here in Canberra, never played
>>with it much) or paying $150 a year with IceTV.
>>    
>>
>
>I think I've fixed it (it works with my setup anyways)
>
>As you've said they've changed /closeup/ to /cu/ but they've also changed
>how the pids are displayed.
>
>Changes at around line 350 of the script:
>
>if ($link =~ /cu\/default.asp/)
>        {
>        my $rowspan = $link;
>        $rowspan =~ s/.+rowspan=//g;
>        $rowspan =~ s/ .+//g;
>
>        my $name = $link;
>        #$name =~ s/.+target=new>(<P>|)//g;
>        $name =~ s/.+target=_new class=tv>//g;
>        $name =~ s/<\/a>.+//g;
>        if ($name =~ /\]/) {
>                my @nameline=split/\]/,$name;
>                $name = $nameline[1];
>                $name =~ s/^ //g;
>        }
>        my $linktemp = $link;
>        $link =~ s/.+pid=//g;
>        $link =~ s/".+//g; #"
>        my @linksplit=split/&/,$link;
>        #$link = $linksplit[0];
>        my @linksplit2=split/ /,$linksplit[0];
>        $link = $linksplit2[0];
>        chomp($link);
>        chomp($rowspan);
>        chomp($name);
>
>
>also change the fetch_details subroutine to be:
>
>sub fetch_details
>{
>        my $datepid=$datepids->dequeue;
>        my @datepidl=split /-/, $datepid;
>        my $date = $datepidl[0];
>        my $pidtemp = $datepidl[1];
>        my @pidsplit=split /&/, $pidtemp;
>        my $pid = $pidsplit[0];
>
>        while (($date!=0) and ($pid!=0))
>        {
>                my $guide_dir = $cache_dir . "/" . $date;
>                mkpath ($guide_dir);
>
>                my $url = $details_url . $pid;
>                my $details_file = $guide_dir . "/" . $pid . ".html";
>
>                for (my $retry=0; is_error(getstore($url, $details_file))
>&& ($retry<$retrys); $retry++)
>                {
>                        sleep($seconds_before_retry);
>                }
>
>                $datepid=$datepids->dequeue;
>                @datepidl=split /-/, $datepid;
>                $date = $datepidl[0];
>        #       $pid = $datepidl[1];
>                my $pidtemp = $datepidl[1];
>                my @pidsplit=split /&/, $pidtemp;
>                my $pid = $pidsplit[0];
>        }
>}
>
>
>
>
>Like I said, this works for me, YMMV.  But it should be a good starting
>point for anyone who wants to clean it up a bit :)
>  
>
Change

        my @linksplit=split/&/,$link;
        #$link = $linksplit[0];
        my @linksplit2=split/ /,$linksplit[0];
	$link = $linksplit2[0];

to

        my @linksplit=split/&/,$link;
        if ($#linksplit <= 0) {
		@linksplit=split/ /,$link;
	}
	if ($#linksplit > 0) {
		my @linksplit2=split/ / ,$linksplit[0];
		$link=$linksplit2[0];
	}

Otherwise changed_guide will fail when running the script and it's 
checking currently entered program info. It ends up with <pid> onclick= 
instead of <pid>&x=<x> for some reason I'm sure will be clear in the 
morning. Have fun :D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20050802/386a0e7f/attachment.htm


More information about the mythtv-users mailing list