Permalink
Browse files

Clean up blogger2blogofile.py a bit.

* Make permalinks use the path only, a blogger.com permalink is
  useless because it will just be ignored with the user's new site.url
* Clean up usage instructions (End users aren't going to care about
  the unit test.)
* Added usage instructions to the top of the file.
  • Loading branch information...
1 parent 8efe89a commit aca701c9297f2221ccf78b1a7ce3af2682985e64 @EnigmaCurry committed Feb 27, 2011
Showing with 17 additions and 5 deletions.
  1. +17 −5 converters/blogger2blogofile.py
View
22 converters/blogger2blogofile.py 100755 → 100644
@@ -1,14 +1,26 @@
#!/usr/bin/env python
+__author__ = "Seth de l'Isle"
+
+#### Usage:
+## You can generate a Blogger export file by logging into blogger,
+## then going to Settings -> Basic -> Export Blog. You will get a
+## file to download with the current date in the name and a .xml
+## extension. Running blogger2blogofile.py in that directory, with
+## the filename of the export file as the only argument will generate
+## a _posts directory ready for use with Blogofile.
+
+
import sys
try:
import feedparser
except ImportError:
- print >> sys.stderr, """Couldn\'t load the universal feedparser module.
+ print >> sys.stderr, """This tool requires the universal feedparser module.
+
Depending on your tools, try:
- apt-get install python-feedparser or easy_install.py
+ apt-get install python-feedparser
or:
- easy_install.py feedparser
+ easy_install feedparser
or check out the download files at http://code.google.com/p/feedparser/downloads/list
"""
@@ -68,7 +80,7 @@ def build_header(self):
'author': self.feedEntry.author_detail.name}
if 'link' in self.feedEntry.keys():
- data['permalink'] = self.feedEntry['link']
+ data['permalink'] = urlparse.urlparse(self.feedEntry['link']).path
self.data = data
@@ -193,7 +205,7 @@ def test_write_posts(self):
def display_error_and_usage(error):
print >> sys.stderr, error
- print >> sys.stderr, "Usage: bloggerfile.py (-t [unittest options]) | BloggerExportfile.xml"
+ print >> sys.stderr, "Usage: bloggerfile.py BloggerExportfile.xml"
sys.exit()
if __name__ == '__main__':

0 comments on commit aca701c

Please sign in to comment.