#!/usr/bin/env python # UploadToBlog 0.1, 2008-20-03 # http://www.dainaccio.wordpress.com # Author: Dainaccio, superdinoz at yahoo dot it # This software is released under GPLv3 license: # http://www.gnu.org/licenses/gpl.html # You're using this software at your own risk. The author shall not # be held liable for ANY problems caused by using this software. # REQUIRES wordpresslib and Zenity !! import wordpresslib, sys, os # Change with your user, password and url wordpress = "http://dainaccio.wordpress.com/xmlrpc.php" user = "dainaccio" password = "xxx" if len(sys.argv) > 1: # prepare client object wp = wordpresslib.WordPressClient(wordpress, user, password) # select blog id wp.selectBlog(0) for imgPath in sys.argv[1:]: # upload image for post imageSrc = wp.newMediaObject(imgPath) if imageSrc: os.popen("zenity --info --text=\"Done.\nURL: %s\""%imageSrc) print "Done.\nURL: %s"%imageSrc else: os.popen("zenity --error --text=\"Can't upload the file %s !\""%imageSrc) print "Can't upload the file %s !"%imageSrc else: os.popen("zenity --error --text=\"An input file is required !\"") print "An input file is required !"