Importing from Blogger using Atom ---> RSS1.0

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
drock
Posts: 3
Joined: Sat Mar 05, 2005 6:44 am

Importing from Blogger using Atom ---> RSS1.0

Post by drock »

It took me a while to figure out that I needed to convert my atom feed to an RSS feed in order to import my posts from Blogger, BUT....

It didn't import my corresponding dates. All of my posts from Blogger are now posted as the same date - the date I imported them.

How can I import the dates as well or is that not possible?

Please help!

D. :shock:
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Importing from Blogger using Atom ---> RSS1.0

Post by garvinhicking »

Our native feed import only really works well with RSS2.0. See if your dates are correctly put in your RSS1.0 feed? What is your URL to that feed, then I can look at it.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
drock
Posts: 3
Joined: Sat Mar 05, 2005 6:44 am

Address for RSS1 feed

Post by drock »

As requested...

http://www.ohillrules.com/rss1.xml

The dates are there. Is there any way to convert from Atom to RSS2?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Address for RSS1 feed

Post by garvinhicking »

As it seems, PHPs 'strtotime' function does not parse ISO 8601 date formats.

Thus I patched the file include/admin/importers/generic.inc.php.

Find this code (line 90-94):

Code: Select all

        $entry['title'] = $this->decode($item['title']);
        $entry['timestamp'] = $this->decode(strtotime(isset($item['pubdate']) ? $item['pubdate'] : $item['dc:date']));
        if ($entry['timestamp'] == -1) {
            $entry['timestamp'] = time();
        }
and replace it with:

Code: Select all

        $entry['title'] = $this->decode($item['title']);
        $entry['timestamp'] = $this->decode(strtotime(isset($item['pubdate']) ? $item['pubdate'] : $item['dc:date']));
        if ($entry['timestamp'] == -1) {
            // strtotime does not seem to parse ISO 8601 dates
            if (preg_match('@^([0-9]{4})\-([0-9]{2})\-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})\-([0-9]{2}):([0-9]{2})$@', isset($item['pubdate']) ? $item['pubdate'] : $item['dc:date'], $timematch)) {
                $entry['timestamp'] = mktime($timematch[4] - $timematch[7], $timematch[5] - $timematch[8], $timematch[6], $timematch[3], $timematch[2], $timematch[1]);
            } else {
                $entry['timestamp'] = time();
            }
        }
Please tell me if this works out for you! :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
drock
Posts: 3
Joined: Sat Mar 05, 2005 6:44 am

Ok, but..

Post by drock »

Since there is no mass delete of entries, it will take me some time to clear out the 150 entries that I imported already. Unless the code your having me imput will go back and redo...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Ok, but..

Post by garvinhicking »

Drock, if you have direct SQL access to your database just do a:

DELETE FROM serendipity_entries;

and you will remove all entries. Mass deletion of entries is currently not planned, as it is also a possible evil feature. But we will look into it for 0.9 maybe...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply