[EP-tech] Re: RSS2 confused published date

Malcolm Bodger M.Bodger at westminster.ac.uk
Fri Nov 9 12:01:01 GMT 2012


Hi John,



Thanks for this. I've created a new citation but when I try to add date I get duplication (2007) 2007 in the description.

What I want to do is replace the pubDate which appears on the line above the description and is used to order the output.



Thanks,

Malcolm.

________________________________
From: eprints-tech-bounces at ecs.soton.ac.uk [eprints-tech-bounces at ecs.soton.ac.uk] on behalf of John Salter [J.Salter at leeds.ac.uk]
Sent: 08 November 2012 15:22
To: 'eprints-tech at ecs.soton.ac.uk'
Subject: [EP-tech] Re: RSS2 confused published date

Bit of a stream-of-consciousness below.
The solution is to add a new dc element to the <item>.
http://feed2.w3.org/docs/rss2.html#extendingRss - we already declare the dc namespace in the RSS2 feed, so we can add this to RSS2.pm (maybe around line 170):

$item->appendChild( $session->render_data_element(
    2,
    "dc:date",
    $eprint->get_value( 'date' ) ) );
The feed would then contain the dc:date field as well as the feed-published date.

This was my initial thinking - which wouldn't work (but possibly useful for someone somewhere)
You could change the citation style used for either the title, or the description.
From:
http://trac.eprints.org/eprints/browser/branches/3.3/system/perl_lib/EPrints/Plugin/Export/RSS2.pm
Line 155 calls render_description - which uses the 'brief' citation style
Line 168 calls render_citation - which uses 'default' by default.

You could make a new eprint citation style e.g. cfg.d/citation/eprint/rss.xml to be used for the RSS outputs, and then change #168:
$eprint->render_citation
to
$eprint->render_citation( "rss" )
BUT: this would change it for *all* RSS2 outputs.
AND: Looking at the specs for RSS2 http://feed2.w3.org/docs/rss2.html#hrelementsOfLtitemgt (and examples http://static.userland.com/gems/backend/rssTwoExample2.xml), the citation should be URL encoded - which is what the 'tree_to_utf8' is doing - which, looking at http://trac.eprints.org/eprints/browser/branches/3.3/system/perl_lib/EPrints/Utils.pm would strip out any microformats anyway - so it wouldn't achieve much. Rubbish!

Hope that's not too garbled!
Cheers,
John





________________________________
From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Malcolm Bodger
Sent: 08 November 2012 14:15
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] Re: RSS2 confused published date


Hi John,



Many thanks for this. I added the elsif loop as you suggested and it worked, except for the one where I had updated the database and added the time. I reversed this change and made the time fields null again and that worked too. I still would like to have the book's published date, which at the moment is part of the eprint description, but I'm now not sure if that's possible.



Regards,

Malcolm.

________________________________
From: eprints-tech-bounces at ecs.soton.ac.uk [eprints-tech-bounces at ecs.soton.ac.uk] on behalf of John Salter [J.Salter at leeds.ac.uk]
Sent: 07 November 2012 16:45
To: 'eprints-tech at ecs.soton.ac.uk'
Subject: [EP-tech] Re: RSS2 confused published date

>From the RSS entries, those without a published date don't have a timestamp in the Deposited date e.g.
Date Deposited: 22 Feb 2007 (http://isls-eprints-31.wmin.ac.uk/3482/)

I suspect there's some flawed logic for calculating the timestamp for the RSS feed - not setting it if any part (Y/M/D/H/m/S) isn't set.

>From this: http://perldoc.perl.org/Time/Local.html is states:
If you supply data which is not valid (month 27, second 1,000) the results will be unpredictable (so don't do that).

I'm guessing that line 142 of: http://trac.eprints.org/eprints/browser/branches/3.3/system/perl_lib/EPrints/Plugin/Export/RSS2.pm will fail when there's no timestamp in the $datestamp - and therefore the pubDate element isn't added.

Suggestions:
1. Add an elsif loop to RSS2.pm (copying lines 142-150), but change the test to:
$datestamp =~ /^(\d{4})-(\d{2})-(\d{2})$/
 - which will pick up dates without times, and then use:
 my $time = timelocal( 0, 0, 0, $3, $2-1, $1 );

2. Add time data to the eprints that is missing it..?

Cheers,
John


________________________________
From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Malcolm Bodger
Sent: 07 November 2012 12:27
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] Re: RSS2 confused published date


Hi John,



Our web people want to use the RSS2 output from from the 'browse by author' output for the staff web CVs

Opening the RSS2 feed on the 'Browse by Author' output for 'Abbey, Robert M' gives me the date and the green arrows, which I also get on the 'latest_tool' link. The dates do appear to be the deposited dates.



I'll take a look at the link you've provided.

Many thanks,

Malcolm.

________________________________
From: eprints-tech-bounces at ecs.soton.ac.uk [eprints-tech-bounces at ecs.soton.ac.uk] on behalf of John Salter [J.Salter at leeds.ac.uk]
Sent: 07 November 2012 10:55
To: 'eprints-tech at ecs.soton.ac.uk'
Subject: [EP-tech] Re: RSS2 confused published date

When I look at the RSS output (http://isls-eprints-31.wmin.ac.uk/cgi/latest_tool?output=RSS2) all items have published dates.
The 'little green arrow' sounds like you're putting the RSS through some form of renderer - which may be grouping same-RSS-published-dates together?

You may be able to add microformats to the <item> to help you with this (http://microformats.org/discuss/mail/microformats-discuss/2005-August/000670.html), or change the rendered to extract the (date) from the citation.

What renderer are you using (or is it a browser's rendering of the feed? Firefox looks OK - but no green arrows!)?

Cheers,
John



________________________________
From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Malcolm Bodger
Sent: 07 November 2012 10:29
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] Re: RSS2 confused published date


John,



Many thanks, that explains.

But, why do I not get the RSS published date on my second example?

Is it possible to replace the RSS published date with the item's published date?



Thanks,

Malcolm.

________________________________
From: eprints-tech-bounces at ecs.soton.ac.uk [eprints-tech-bounces at ecs.soton.ac.uk] on behalf of John Salter [J.Salter at leeds.ac.uk]
Sent: 07 November 2012 10:04
To: 'eprints-tech at ecs.soton.ac.uk'
Subject: [EP-tech] Re: RSS2 confused published date

Malcolm,
I think you may be confusing the RSS published date (e.g. the date that the record appeared in the RSS feed - the deposit date - which is needed for RSS to work out what's going on), and the item-published-date. I would not expect these to be the same...

Cheers,
John

________________________________
From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Malcolm Bodger
Sent: 07 November 2012 09:51
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] RSS2 confused published date

Hi,

I'm trying to get the published date to appear before that little green arrow on the RSS2 output, but what I get is the date of deposit. Here, looking at the page source, the document was published in (2007) but the top line shows the date it was deposited - 17th June 2008. The second example shows no top line even though the deposit and published date are entered. Looking at the top line in the first example, it is flagged as being the 'pubDate' so I would expect '2007' to appear and not  'Tue, 17 Jun 2008 15:19:13 +0100' Can someone give me a clue here? Why is the deposit date shown and not the published date? Why do some have no date at all? Is it something to do with null values for the published date?

Tue, 17 Jun 2008 15:19:13 +0100
A practical approach to conveyancing. 9th edition
http://isls-eprints-31.wmin.ac.uk/5176/
http://isls-eprints-31.wmin.ac.uk/5176/
Abbey, Robert M. and Richards, Mark B.  (2007) A practical approach to conveyancing. 9th edition.    Oxford University Press, Oxford, UK.  ISBN 9780199212316


A practical approach to conveyancing. 8th edition
http://isls-eprints-31.wmin.ac.uk/2040/
http://isls-eprints-31.wmin.ac.uk/2040/
Abbey, Robert M. and Richards, Mark B.  (2006) A practical approach to conveyancing. 8th edition.    Oxford University Press, Oxford, UK.  ISBN 019928945X


Regards,
Malcolm.

The University of Westminster is a charity and a company limited by guarantee. Registration number: 977818 England. Registered Office: 309 Regent Street, London W1B 2UW.

The University of Westminster is a charity and a company limited by guarantee. Registration number: 977818 England. Registered Office: 309 Regent Street, London W1B 2UW.

The University of Westminster is a charity and a company limited by guarantee. Registration number: 977818 England. Registered Office: 309 Regent Street, London W1B 2UW.

The University of Westminster is a charity and a company limited by guarantee. Registration number: 977818 England. Registered Office: 309 Regent Street, London W1B 2UW.

The University of Westminster is a charity and a company limited by guarantee. Registration number: 977818 England. Registered Office: 309 Regent Street, London W1B 2UW.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20121109/c221288c/attachment-0001.html 


More information about the Eprints-tech mailing list