]> lifelog.hopto.org Git - LifeLog.git/commitdiff
Fix. merged new working tree with development.
authorWill Budic <redacted>
Mon, 20 May 2024 12:54:08 +0000 (22:54 +1000)
committerWill Budic <redacted>
Mon, 20 May 2024 12:54:08 +0000 (22:54 +1000)
htdocs/cgi-bin/CNFServices.cgi
htdocs/cgi-bin/system/modules/RSSFeedsPlugin.pm

index 824c49317f2833e45bb5dd7d4b487d95edd427dc..d9cb052565bfeab639df1713c8500996f5c0a9bf 100755 (executable)
@@ -151,8 +151,10 @@ LOG_Settings . <<__CNF_IS_COOL__;
 
 >>
 // Following is a table having a list of details for available RSS feeds to process.
-|| The more rows have here the longer it takes to fetch them, what is it, once a day, week, month?
-<<    RSS_FEEDS     <DATA> __CONST__
+|| The more rows we have here the longer it takes to fetch them, what is it, once a day, week, month?
+|| The _CONST_ meta makes the property a CNF constant just in case.
+|| The _HAS_HEADER_ meta makes it compatible with the new and old parser.
+<<    RSS_FEEDS     <DATA> __CONST__ _HAS_HEADER_
 ID`Name`URL`Expires`Description~
 
 #`CPAN`http://search.cpan.org/uploads.rdf`
index c026c2d80eedd554684563a25511fc90aea805be..4aaa7aa8bce257ef8ead6c1064dcf649bf4fbaa5 100644 (file)
@@ -50,7 +50,7 @@ sub process ($self, $parser, $property) {
             $ptr = $$ptr;
         }
     my @header = @$ptr;
-    my @data = CNFMeta::_deRefArray($$table->{data});
+    my @data = @{$$table->{data}};
     for my $idx (0 .. $#data){
         my @col = @{$data[$idx]};
         if($idx==0){
@@ -95,20 +95,23 @@ sub collectFeeds($self, $parser) {
         }
   my $page;
   my @header = @$ptr;
-  my @data   = @{$$table->{data}};
   my $cgi  = $parser->const('CGI');
   my $feed = $cgi->param('feed') if $cgi;
   my @lbls =  CNFMeta::_deRefArray($header[0]);
+     $ptr = $$table->{data};
+  my @data =  @$ptr;
   my %hdr;
      for(my $i=0;$i<@lbls;$i++){ #<- Column names are set here, if names in script are changed, They must be changed bellow.
          $hdr{$lbls[$i]} = $i
      }
-  $parser->log("Feed request:$feed") if$feed;
+  $parser->log("Feed request:$feed data.size:" .scalar(@data)) if$feed;
+  try{
   for my $idx (0 .. $#data){
          my @col = @{$data[$idx]};
+         #$parser->log("Feed spec: @col");
          my $name = $col[$hdr{Name}];
          next if($feed && $feed ne $name);
-         my $tree =  fetchFeed($self, $name, $col[$hdr{URL}], $col[$hdr{Description}]);
+         my $tree =  fetchFeed($self, $name, $col[$hdr{URL}], $col[$hdr{Expires}], $col[$hdr{Description}]);
          $parser->log("Fetched feed:".$name);
          if($tree && ref($$tree) eq 'CNFNode'){
             if(not isCNFTrue($self->{CNF_TREE_LOADED}) && isCNFTrue($self->{CNF_TREE_STORE})){
@@ -130,6 +133,9 @@ sub collectFeeds($self, $parser) {
             $parser-> warn("Feed '$name' bailed to return a CNFNode tree.")
          }
   }
+  }catch{
+    $parser-> error("RSSFeedsPlugin\@collectFeeds() Error:$@")
+  }
   $parser->data()->{PAGE} = \$page if $page;
 }
 ### PerlCNF TREE to HTML Conversion Routine, XML based RSS of various Internet feeds convert to PerlCNF previously.