Feed Builder Addon - Build RSS 2.0 Feeds

All new Coranto Addons, updates and patches to addons, will be released here...also, get support for addons within!

Moderators: Spunkmeyer, Dale Ray, SrNupsen, Bluetooth, Jackanape

Feed Builder Addon - Build RSS 2.0 Feeds

Postby Dale Ray » Tue Jul 11, 2006 2:38 pm

Feed Builder addon

This addon builds RSS 2.0 feeds by using a new profile type. Based on RSS Feed by Elvii (90% his, the bad 10% is mine).

I have tested this briefly on a local host setup with Coranto 1.24. Make sure you backup your files before testing this. This is a BETA - use at your own risk.

Please read the docs (available from the addon page).

Let me know how it works.
Last edited by Dale Ray on Sun Dec 10, 2006 6:51 pm, edited 2 times in total.
Dale Ray
User avatar
Dale Ray
 
Posts: 1001
Joined: Sun Jan 19, 2003 6:02 pm
Location: NW Indiana

Postby Musicvid » Tue Jul 11, 2006 4:48 pm

Dale,
A really nicely laid-out profile. Looks like you've thought of almost everything, and thanks for them credit mention.

When I Build News with your addon enabled, I get a flock error thus:
Error: Unable to flock '/home/webs/o/www.ovationplayers.com/news/FeedBuilder_RSS.xml'. Resource temporarily unavailable


Also, right now the item descriptions are missing completely.

I may have a few small suggestions and I'll share with you my code for adding images to the item descriptions when the flock thing is working.

Excellent effort, I was too impatient to dig into the addon myself, but this may be the simplest long-term solution. Congratulations!
Musicvid
 
Posts: 138
Joined: Wed Jan 17, 2007 1:05 am
Location: Western America

Postby SrNupsen » Tue Jul 11, 2006 5:27 pm

Musicvid: Which Coranto version are you using? I get that error when running the original RSS addon with Coranto 1.31.5 series, and just wanted to check if there might be a connection.
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby Musicvid » Tue Jul 11, 2006 6:17 pm

SrNupsen wrote:Musicvid: Which Coranto version are you using? I get that error when running the original RSS addon with Coranto 1.31.5 series, and just wanted to check if there might be a connection.


Yes, I am using 1.31.5, so the connection is probably with the original addon rather than Dale's code.

I have never tried using the original addon with 1.31.5 because I was interested in writing my own style and template. But now that Dale has resurrected the addon, I am interested in seeing how it will work with Rss 2.0 and Coranto 1.3x.x
Musicvid
 
Posts: 138
Joined: Wed Jan 17, 2007 1:05 am
Location: Western America

Postby Dale Ray » Tue Jul 11, 2006 8:41 pm

In cra_feed_builder.pl a minor error is generated if some, but not all, of the required image elements are not present. This is the routine that prints the end tags to the profile and then - if needed - displays the error about the image elements. In my testing this code only gets executed when there is an error.
Code: Select all
# Finish off a profile.
my $BuildNews_CloseFile = <<'END_CODE';
   if ($ProfType{$key} eq 'RSS Feed') {
      print $value "</channel>\n</rss>";
   }
   if ($FeedBldr_ImgMsg) {
   $addon->minorError($FeedBldr_ImgMsg);
   }
END_CODE

$addon->hook('BuildNews_CloseFile', \$BuildNews_CloseFile);


I dug around in crcore.pl and cradmin.pl for a while to try to find out why the inclusion of an error makes a difference, but I can not see why. Can anyone else duplicate this?

In crcore.pl for V1.24 you have this:
Code: Select all
while (($key, $value) = each %FilesOpened) {
      # HOOK: BuildNews_CloseFile
      if($Addons{'BuildNews_CloseFile'}){my $w;foreach $w (@{$Addons{'BuildNews_CloseFile'}}){my $addon=$w->[2];eval ${$w->[0]};AErr($addon,$@)if $@;};}


in crcore.pl for V 1.31.5 you have this:
Code: Select all
   foreach $key (keys %FilesOpened) {
      my $br = ($CConfig{'XHTMLbr'} ? '<br />' : '<br>');
      # Using value instead of FilesOpened hash for backward compatbility
      $value = CRopen(">>$ProfFilePath{$key}/$newsprofiles{$key}->{'textfile'}");

      # HOOK: BuildNews_CloseFile
      if($Addons{'BuildNews_CloseFile'}){my $w;foreach $w (@{$Addons{'BuildNews_CloseFile'}}){my $addon=$w->[2];eval ${$w->[0]};AErr($addon,$@)if $@;};}


My local test setup is Apache, runnings on Windows XP. I don't get the flock error, but the output file does not get closed properly in all cases. I don't know if it has anything to do with the code in crcore.pl, but i posted the excerpts because they are different.

muscvid - the layout and structure of the addon is elvii's. I am just trying to update it to build 2.0 compliant files, but thanks for the compliment anyway. My main hope is to not create any new bugs when I tackle something like this. Hopefully this bug can be tracked down.
Dale Ray
User avatar
Dale Ray
 
Posts: 1001
Joined: Sun Jan 19, 2003 6:02 pm
Location: NW Indiana

Postby Dale Ray » Wed Jul 12, 2006 4:34 am

OK - installed Coranto 1.31.5 and tested Feed Builder on a remore host running Linux.

With an RSS feed profile enabled I get this error:

Code: Select all
Error: Unable to flock '/thepath/coranto/_news/RSS_Test.xml'. Resource temporarily unavailable


which is the same as musicvid. This happens regardless of the image settings, so this is different from the local setup.

No error if flock is disabled in cruser.pl, but the final routine to finish the rss file is not executed and the file is incomplete, missing the closing channel and rss tags.

On the other hand - on a fresh install of v 1.24 on the same server it runs fine with no errors and creates a valid RSS feed.
Dale Ray
User avatar
Dale Ray
 
Posts: 1001
Joined: Sun Jan 19, 2003 6:02 pm
Location: NW Indiana

Postby Parahead » Wed Jul 12, 2006 6:06 pm

Dale Ray wrote:On the other hand - on a fresh install of v 1.24 on the same server it runs fine with no errors and creates a valid RSS feed.
I will try and look into this... Do you get a more detailed error message than just the line with "unable to flock"? Like a stack trace or something stating which line the error occured at (if it is in the CRopen method or in the addon [as a result of flock in CRopen])? I really have not looked into the code of the addon and I need to verify it a little more, so take this with a pinch of salt, but one thing that has been changed between 1.24 and 1.31.x is the open/closing of files during the build process. The reason for this was that previously all profile outputfiles where openend and remained opened during the build, which in large installations can cause the operating system to run out of file handles.

However, if the addon opens/write to a file itself and *leave* it opened, it may be so that the call (in 1.31.x) to the CRopen method just above the BuildNews_CloseFile hook fail. Since 1.24 assumed it was already opened this was not a problem there and maybe the code in 1.31.x should be improved to check if the file is already opened before trying to open it again (at least above the BuildNews_CloseFile hook). But like I said, this is only a theory and I need to check it out a little deeper...
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby Dale Ray » Thu Jul 13, 2006 4:11 am

The error reported in my other post is all I am getting.

This appears to be the code to the output file:

Code: Select all
# Open file prior to building news
my $BuildNews_NewType_Open = <<'END_CODE';
   if ($ProfType{$i} eq 'RSS Feed') {
      $FilesOpened{$i} = $addon->open(">$ProfFilePath{$i}/$newsprofiles{$i}->{'textfile'}");
      FeedBldr_Initialize($addon, $i, $FilesOpened{$i});
   }
END_CODE

$addon->hook('BuildNews_NewType_Open', \$BuildNews_NewType_Open);

Is there another way to do this that will work with 1.24 and 1.31.5?
Dale Ray
User avatar
Dale Ray
 
Posts: 1001
Joined: Sun Jan 19, 2003 6:02 pm
Location: NW Indiana

Postby Parahead » Mon Jul 17, 2006 7:35 pm

Dale Ray wrote:Is there another way to do this that will work with 1.24 and 1.31.5?
Yes, I am sure there is. Somewhere when the addon has done all its writing (or "print $filehandle") to the file and before the hook BuildNews_CloseFile it should be closed... I still haven't looked into the addons code so I can't give you a more detailed advice, sorry...

Or as I mentioned above, an improved check in the Coranto core for if the files are opened before opening them again at the hook BuildNews_CloseFile is what I have in mind to implement. This is a more backwards friendly approach anyway if other addons experience the same thing.

The "problem" is that Coranto has a supporting sub CRopen which all addons uses, but when closing the file, a simple call to the Perl method close is all that is required and Coranto does not get feedback about this. I simply need to do some reading about the best way to take care of this (eg. how to detect if a file is opened before trying to open it)...
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby Dale Ray » Mon Jul 17, 2006 8:10 pm

Parahead,

Thanks for spending time on this.

In the mean time it works fine with V 1.24 so if anyone wants to try it I would appreciate feedback.
Dale Ray
User avatar
Dale Ray
 
Posts: 1001
Joined: Sun Jan 19, 2003 6:02 pm
Location: NW Indiana

Postby AndyP » Sat Jul 29, 2006 8:56 pm

Thanks guys for the effort, this will be one I definitely will be trying out :D
AndyP
 
Posts: 165
Joined: Wed Jan 10, 2007 10:10 pm

Postby Dale Ray » Sat Aug 19, 2006 6:10 am

If you have tried Feed Builder and had problems with the inclusion of the description in your feed please download it and try again.

One variable name was messed up in the last release and the description was not being included in the feed.

If you have been using the last version (o.01) you might want to check the feeds generated and make sure they are working as you want.

I would advise upgrading to the latest version. Simply copy it over the previous version.

This is version 0.02 and is available from the same download link. In other words the link in this message and the link in the first message of this thread will get you the latest version.

My apologies for any problems this caused and my thanks to MrCodeDude for pointing out the problem.

Feedback on whether this works (or doesn't) is appreciated.
Last edited by Dale Ray on Mon Aug 21, 2006 9:12 pm, edited 1 time in total.
Dale Ray
User avatar
Dale Ray
 
Posts: 1001
Joined: Sun Jan 19, 2003 6:02 pm
Location: NW Indiana

Postby Dale Ray » Sat Aug 19, 2006 7:01 pm

Version 0.03

This should fix inconsistencies with the dates (they should now be displayed with the server time)

ToDo:

add setting to use GMT if the user desires
add setting to use the time offset as defined in Coranto

The link in any of the posts here will always download the latest version.
Last edited by Dale Ray on Mon Aug 21, 2006 9:12 pm, edited 1 time in total.
Dale Ray
User avatar
Dale Ray
 
Posts: 1001
Joined: Sun Jan 19, 2003 6:02 pm
Location: NW Indiana

Postby Dale Ray » Sun Aug 20, 2006 8:15 am

Version 0.04

Added ability to select whether to include HTML in the description.

Added user setting for truncating the description field.

Cleaned up the documentation and the settings page.
Last edited by Dale Ray on Mon Aug 21, 2006 9:13 pm, edited 1 time in total.
Dale Ray
User avatar
Dale Ray
 
Posts: 1001
Joined: Sun Jan 19, 2003 6:02 pm
Location: NW Indiana

Postby Dale Ray » Sun Aug 20, 2006 11:05 pm

Version 0.05 Feed Builder
Builds RSS 2.0 valid feeds

Changes in this version:

Added ability to choose between GMT and local server time.
Added Managing Editor channel element.
Added Enclosure item element.
Added ability for user to change the copyright channel element.

The addition of the enclosure element should allow you to include links music, video, or other multi-media files in your feed.

Wikipedia Entry on RSS enclosures

If you are using Multi-Part to handle your uploads and try this I would like to know if the Feed Builder addon works OK with the Multi-Part fields.

Updated documentation (please read)

Changes in version 0.04

Added ability to select whether to include HTML in the description.
Added user setting for truncating the description field.

Changes in version 0.03

Fixed bug in time display.

Changes in version 0.02

Fixed bug that prevented the description from being included in the feed.

As always, feedback welcome.
Last edited by Dale Ray on Mon Aug 21, 2006 9:13 pm, edited 1 time in total.
Dale Ray
User avatar
Dale Ray
 
Posts: 1001
Joined: Sun Jan 19, 2003 6:02 pm
Location: NW Indiana

Next

Return to Addon Release and Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron