Page 1 of 1

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

Posted: Sat Mar 05, 2005 6:51 am
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:

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

Posted: Sat Mar 05, 2005 1:19 pm
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

Address for RSS1 feed

Posted: Sat Mar 05, 2005 6:26 pm
by drock
As requested...

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

The dates are there. Is there any way to convert from Atom to RSS2?

Re: Address for RSS1 feed

Posted: Sat Mar 05, 2005 10:18 pm
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

Ok, but..

Posted: Sat Mar 05, 2005 10:34 pm
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...

Re: Ok, but..

Posted: Sun Mar 06, 2005 12:57 pm
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