if 0: text = args2text (info = info, event = body, usejournal = usejournal, subject = subject, props = props, security = options.security) pass # process the text # subject, usejournal, body, props, security = text2args (info, text) print 'Sorry, non-batch mode is not supported yet' sys.exit (1) body = unicode (body, encoding) if subject is not None: subject = unicode (subject, encoding) if props.has_key ('current_mood'): props['current_mood'] = unicode (props['current_mood'], encoding) if props.has_key ('current_music'): props['current_music'] = unicode (props['current_music'], encoding) entry = lj.postevent (body, usejournal = usejournal, subject = subject, props = props, security = security) print 'Posted.\nLink to the post: http://www.livejournal.com/talkread.bml?journal=%s&itemid=%s' % (usejournal or server.username, entry.itemid*256 + entry.anum) # vim:ts=2:sw=2:noet
output += "</ul><small>Automagically shipped by <a href=\"http://github.com/palfrey/murmur/\">Murmur</a></small></lj-cut>" try: print output except UnicodeEncodeError: print "Can't print output due to unicode issues" if opts.post: from livejournal import LiveJournal, list2list, list2mask subject = u"Daily mutterings" body = output username = m.config.get("livejournal","username") password = m.config.get("livejournal","password") usejournal = username try: xmlrpc = m.config.get("livejournal","xmlrpc") lj = LiveJournal (0, base=xmlrpc) except NoOptionError: # default to LJ lj = LiveJournal (0) info = lj.login (username, password) security = list2mask (m.config.get("livejournal","security"), info.friendgroups) entry = lj.postevent (unicode(body), subject = subject, security = security, props = {"taglist":"twitter"}) print 'Posted'
if options.mood is not None: props['current_mood'] = options.mood if options.music is not None: props['current_music'] = options.music config = Config () config.load (evalue ('~/.ljrc', options.config)) server = getattr (config, options.server) lj = LiveJournal (config.misc.version) info = lj.login (server.username, server.password) if 0: if subject is not None: subject = unicode (subject, 'koi8-r') event = unicode (event, 'koi8-r') entry = lj.postevent (event, subject = subject, props = props, security = list2mask (options.security, info.friendgroups)) print 'Posted.\nLink to the post: http://www.livejournal.com/talkread.bml?journal=%s&itemid=%s' % (server.username, entry.itemid*256 + entry.anum) else: sys.stdout.write (args2text (info = info, event = event, subject = subject, props = props, security = options.security))