def add_photo(args): if len(args) < 2: usage() album_id = args[0] files = args[1:] imgsrc = ImgSrc(username, password) store_id = imgsrc.get_store() album = ImgSrcAlbum(album_id, store_id, (username, password)) for file in files: if urlparse.urlparse(file)[0] == '': url = ''.join(["file://", urllib.pathname2url(os.path.abspath(file))]) else: url = file album.add_photo(url) print "Image '%s' uploaded!" % url