23a24,25 > use LWP::UserAgent; > use HTTP::Request; 35a38,40 > our $debug; > our $showdebug = 0; > 44c49 < my @itemtags = qw(itemtitle itemlink itemdesc itempubdate itemguid itemguidispermalink itemdeschtml); # item field names --- > my @itemtags = qw(itemtitle itemlink itemdesc itempubdate itemguid itemguidispermalink itemdeschtml itemenclosure itemenclosuremedia itemenclosurelength); # item field names 59c64 < 'templateguid' => 'itemguid', 'templateguidispermalink' => 'itemguidispermalink'); # template to item mapping --- > 'templateguid' => 'itemguid', 'templateguidispermalink' => 'itemguidispermalink', 'templateenclosure' => 'itemenclosure', 'templateenclosuremedia' => 'itemenclosuremedia', 'templateenclosurelength' => 'itemenclosurelength', ); # template to item mapping 538a544 > $debug .= '$datavalues{'.$valname.'} = '.$val.'
'; 571a578,604 > # get length and content-type of enclosure from feed > if($datavalues{"itemenclosure$params{edititemnum}"} && > !($datavalues{"itemenclosuremedia$params{edititemnum}"} && > $datavalues{"itemenclosurelength$params{edititemnum}"})) { > $debug .= "Doing the inference for $params{edititemnum}.
"; > > my $request = > HTTP::Request-> > new(HEAD => > $datavalues{"itemenclosure$params{edititemnum}"}); > > my $ua = LWP::UserAgent->new; > my $response = $ua->request($request); > if ($response->is_success) { > $debug .= "Success!
"; > $datavalues{"itemenclosuremedia$params{edititemnum}"} = > $response->content_type; > $datavalues{"itemenclosurelength$params{edititemnum}"} = > $response->content_length; > } else { > $debug .= $response->status_line, "\n"; > } > > > > } > 659a693,719 > > > # get length and content-type of enclosure from feed > if($datavalues{"itemenclosure1"} && > !($datavalues{"itemenclosuremedia1"} && > $datavalues{"itemenclosurelength1"})) { > $debug .= "Doing the inference for 1.
"; > > my $request = > HTTP::Request-> > new(HEAD => > $datavalues{"itemenclosure1"}); > > my $ua = LWP::UserAgent->new; > my $response = $ua->request($request); > if ($response->is_success) { > $debug .= "Success!
"; > $datavalues{"itemenclosuremedia1"} = > $response->content_type; > $datavalues{"itemenclosurelength1"} = > $response->content_length; > } else { > $debug .= $response->status_line, "\n"; > } > > } > 1061a1122,1123 > my $enclosureradiomp3 = $datavalues{templateenclosureradio} eq 'mp3' ? " CHECKED" : ""; > my $enclosureradioacc = $datavalues{templateenclosureradio} eq 'acc' ? " CHECKED" : ""; 1063c1125 < html_escape(\%params, \%htmlvalue, qw(edititemtitle edititemlink edititemdesc edititempubdate edititemguid edititemguidispermalink edititemdeschtml)); --- > html_escape(\%params, \%htmlvalue, qw(edititemtitle edititemlink edititemdesc edititempubdate edititemguid edititemguidispermalink edititemdeschtml edititemenclosure edititemenclosuremedia edititemenclosurelength)); 1120a1183,1189 >
Enclosure
>
> Media type:     Length: >
> The URL (http only) of a media file to be included in the feed as an enclosure. If the media type and length are not specified, they will be requested from the server (using a HEAD request). If you fill them in by hand, your input will not be overridden, but you must fill in both. To reset the values, simply delete them and save the item, a new request will fill them in again. >
(Optional) >
1147a1217,1218 > my $enclosureradiomp3 = $datavalues{templateenclosureradio} eq 'mp3' ? " CHECKED" : ""; > my $enclosureradioacc = $datavalues{templateenclosureradio} eq 'acc' ? " CHECKED" : ""; 1202a1274,1282 >
Enclosure
>
> Media type:     Length: >
> The URL (http only) of a media file to be included in the feed as an enclosure. If the media type and length are not specified, they will be requested from the server (using a HEAD request). If you fill them in by hand, your input will not be overridden, but you must fill in both. To reset the values, simply delete them and save the item, a new request will fill them in again. >
(Optional) > >
>
1321c1401 < html_escape(\%datavalues, \%htmlv, ("itemtitle$i", "itemlink$i", "itemdesc$i", "itempubdate$i", "itemguid$i")); --- > html_escape(\%datavalues, \%htmlv, ("itemtitle$i", "itemlink$i", "itemdesc$i", "itempubdate$i", "itemguid$i", "itemenclosure$1")); 1381a1462,1465 > > $response .= <<"EOF" if ($datavalues{"itemenclosure$i"} && ($datavalues{displayenclosure} || !defined $datavalues{displayenclosure})); >
Enclosure: $datavalues{"itemenclosure$i"} ($datavalues{"itemenclosuremedia$i"}, $datavalues{"itemenclosurelength$i"})
> EOF 1496c1580 < html_escape(\%datavalues, \%htmlv, ("itemtitle$i", "itemlink$i", "itemdesc$i", "itempubdate$i", "itemguid$i")); --- > html_escape(\%datavalues, \%htmlv, ("itemtitle$i", "itemlink$i", "itemdesc$i", "itempubdate$i", "itemguid$i", "itemenclosure$i")); 1498c1582 < my ($titletext, $linktext, $desctext, $pubdatetext, $guidtext, $guidispermalink); --- > my ($titletext, $linktext, $desctext, $pubdatetext, $guidtext, $guidispermalink, $encurl, $enclength, $encmedia); 1513a1598,1601 > $encurl = $datavalues{"itemenclosure$i"}; > $encmedia = $datavalues{"itemenclosuremedia$i"}; > $enclength = $datavalues{"itemenclosurelength$i"}; > 1519a1608,1610 > > $rssstream .= " \n" if $encurl; > 1580a1672,1673 > $htmlv{itemenclosure} = special_chars($datavalues{"itemenclosure$i"}); > 2366a2460,2464 > EOF > > $response .= $debug if $showdebug; > > $response .= <<"EOF";