Gabriele Lanaro avatar Gabriele Lanaro committed ab096ae

Added an helper function to upload the image and retrieve the URL, good job

Comments (0)

Files changed (2)

     ) ;; End dolist blogs
+;; Misc
+(defun blogger-upload-image (filename)
+  "thisandthat."
+  (interactive "fSelect an Image: ")
+  (blogger-authenticate)
+  (let (url)
+    (setq url (blogger-bridge-upload-image filename))
+    (kill-new url)
+    (message "C-y to paste the uploaded image URL")
+    )
+  )
 ;; Making a keymap!!!
 (let ((map (make-keymap)))
   (suppress-keymap map)

 from blogger import Blogger
 from Pymacs import lisp,Let
+import os
 import filters
+import picasa
 interactions = {}
 class LispInteractive(object):
         blog = self.get_a_blog(blog_id)
+    def upload_image(self, filename):
+        c = picasa.Client()
+        username = lisp["blogger-username"].value()
+        password = lisp["blogger-password"].value()
+        c.login(username, password)
+        return c.add_photo(os.path.expanduser(filename))
 li = LispInteractive()
 # Exposing functions
 delete_post = li.delete_post
 update_post = li.update_post
+upload_image = li.upload_image
+# Interactive functions
+interactions = {}
+interactions[upload_image] = "fSelect image to upload: "
 # Local Variables:
 # pymacs-auto-reload: t
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.