emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Blogging org entries using google command line.
@ 2010-09-08 21:11 Richard Riley
  2010-09-08 22:32 ` Eric Schulte
  2010-09-09  0:30 ` Tim Burt
  0 siblings, 2 replies; 11+ messages in thread
From: Richard Riley @ 2010-09-08 21:11 UTC (permalink / raw)
  To: emacs-orgmode


Using the google command line you can get some super access to all your
Google resources - including docs, calendars &  blogs.

http://code.google.com/p/googlecl/

Once you have installed it and set up your OAUTH you can easily
manipulate/add/delete things in your google hosted data.

While not polished and featuring hard coded blog name the following
function uses the google command line tool to blog the current
org-entry.

--8<---------------cut here---------------start------------->8---
  (defun rgr/org-blog-entry ()
    (interactive)
    (save-excursion
      (let ((tmpheading (org-get-heading)))
          (goto-char (org-entry-beginning-position))
          (set-mark (org-entry-end-position))
          (let*((tmpfile (make-temp-file "org-blog-html-"))
               (blog-command (concat "google blogger post --blog \"Open Sauce\" --title '" tmpheading "' "  tmpfile )))
            (org-export-as-html 1 nil nil (find-file-noselect tmpfile) t)
	    (with-current-buffer (get-file-buffer tmpfile) (save-buffer))
            (start-process-shell-command "Google Blog" "*googlecl*" blog-command)))))
--8<---------------cut here---------------end--------------->8---

At some point I'll try and make it more generic with customised options
if no one beats me to it ..

regards

r.


-- 
☘ http://www.shamrockirishbar.com, http://www.richardriley.net

"Learning French is trivial: the word for horse is 'cheval' and
 everything follows thusly."

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Blogging org entries using google command line.
  2010-09-08 21:11 Blogging org entries using google command line Richard Riley
@ 2010-09-08 22:32 ` Eric Schulte
  2010-09-09  0:12   ` Richard Riley
  2010-09-09  0:30 ` Tim Burt
  1 sibling, 1 reply; 11+ messages in thread
From: Eric Schulte @ 2010-09-08 22:32 UTC (permalink / raw)
  To: Richard Riley; +Cc: emacs-orgmode

Hey Richard,

That looks interesting.  See the gdoc-write code block defined in the
library-of-babel in the org repo at contrib/babel/library-of-babel.org
which allows saving Org-mode data to google docs using the google
command line.

Maybe your function would be suitable for addition to the
library-of-babel?

Cheers -- Eric

Richard Riley <rileyrg@gmail.com> writes:

> Using the google command line you can get some super access to all your
> Google resources - including docs, calendars &  blogs.
>
> http://code.google.com/p/googlecl/
>
> Once you have installed it and set up your OAUTH you can easily
> manipulate/add/delete things in your google hosted data.
>
> While not polished and featuring hard coded blog name the following
> function uses the google command line tool to blog the current
> org-entry.
>
>   (defun rgr/org-blog-entry ()
>     (interactive)
>     (save-excursion
>       (let ((tmpheading (org-get-heading)))
>           (goto-char (org-entry-beginning-position))
>           (set-mark (org-entry-end-position))
>           (let*((tmpfile (make-temp-file "org-blog-html-"))
>                (blog-command (concat "google blogger post --blog \"Open Sauce\" --title '" tmpheading "' "  tmpfile )))
>             (org-export-as-html 1 nil nil (find-file-noselect tmpfile) t)
> 	    (with-current-buffer (get-file-buffer tmpfile) (save-buffer))
>             (start-process-shell-command "Google Blog" "*googlecl*" blog-command)))))
>
> At some point I'll try and make it more generic with customised options
> if no one beats me to it ..
>
> regards
>
> r.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Blogging org entries using google command line.
  2010-09-08 22:32 ` Eric Schulte
@ 2010-09-09  0:12   ` Richard Riley
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Riley @ 2010-09-09  0:12 UTC (permalink / raw)
  To: emacs-orgmode

"Eric Schulte" <schulte.eric@gmail.com> writes:

> Hey Richard,
>
> That looks interesting.  See the gdoc-write code block defined in the
> library-of-babel in the org repo at contrib/babel/library-of-babel.org
> which allows saving Org-mode data to google docs using the google
> command line.
>
> Maybe your function would be suitable for addition to the
> library-of-babel?

I'll clean it up, add customisation options etc and then repost. I'd
like to add calendar stuff too but its hard to find reasonable
documentation on how to specify specific date/ranges/times for some
reason.

regards

r.


>
> Cheers -- Eric
>
> Richard Riley <rileyrg@gmail.com> writes:
>
>> Using the google command line you can get some super access to all your
>> Google resources - including docs, calendars &  blogs.
>>
>> http://code.google.com/p/googlecl/
>>
>> Once you have installed it and set up your OAUTH you can easily
>> manipulate/add/delete things in your google hosted data.
>>
>> While not polished and featuring hard coded blog name the following
>> function uses the google command line tool to blog the current
>> org-entry.
>>
>>   (defun rgr/org-blog-entry ()
>>     (interactive)
>>     (save-excursion
>>       (let ((tmpheading (org-get-heading)))
>>           (goto-char (org-entry-beginning-position))
>>           (set-mark (org-entry-end-position))
>>           (let*((tmpfile (make-temp-file "org-blog-html-"))
>>                (blog-command (concat "google blogger post --blog \"Open Sauce\" --title '" tmpheading "' "  tmpfile )))
>>             (org-export-as-html 1 nil nil (find-file-noselect tmpfile) t)
>> 	    (with-current-buffer (get-file-buffer tmpfile) (save-buffer))
>>             (start-process-shell-command "Google Blog" "*googlecl*" blog-command)))))
>>
>> At some point I'll try and make it more generic with customised options
>> if no one beats me to it ..
>>
>> regards
>>
>> r.
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

-- 
☘ http://www.shamrockirishbar.com, http://www.richardriley.net

"Learning French is trivial: the word for horse is 'cheval' and
 everything follows thusly."

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Blogging org entries using google command line.
  2010-09-08 21:11 Blogging org entries using google command line Richard Riley
  2010-09-08 22:32 ` Eric Schulte
@ 2010-09-09  0:30 ` Tim Burt
  2010-09-09  1:05   ` Richard Riley
  1 sibling, 1 reply; 11+ messages in thread
From: Tim Burt @ 2010-09-09  0:30 UTC (permalink / raw)
  To: Richard Riley; +Cc: emacs-orgmode


Could Richard Riley have solved my problem?  Yes he did.
http://naturallogofx.rketburt.org/2010/09/could-richard-riley-have-solved-my.html

Thank you, thank you, thank you,
Tim

Richard Riley <rileyrg@gmail.com> writes:

> Using the google command line you can get some super access to all your
> Google resources - including docs, calendars &  blogs.
>
> http://code.google.com/p/googlecl/
>
> Once you have installed it and set up your OAUTH you can easily
> manipulate/add/delete things in your google hosted data.
>
> While not polished and featuring hard coded blog name the following
> function uses the google command line tool to blog the current
> org-entry.
>
>   (defun rgr/org-blog-entry ()
>     (interactive)
>     (save-excursion
>       (let ((tmpheading (org-get-heading)))
>           (goto-char (org-entry-beginning-position))
>           (set-mark (org-entry-end-position))
>           (let*((tmpfile (make-temp-file "org-blog-html-"))
>                (blog-command (concat "google blogger post --blog \"Open Sauce\" --title '" tmpheading "' "  tmpfile )))
>             (org-export-as-html 1 nil nil (find-file-noselect tmpfile) t)
> 	    (with-current-buffer (get-file-buffer tmpfile) (save-buffer))
>             (start-process-shell-command "Google Blog" "*googlecl*" blog-command)))))
>
> At some point I'll try and make it more generic with customised options
> if no one beats me to it ..
>
> regards
>
> r.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Blogging org entries using google command line.
  2010-09-09  0:30 ` Tim Burt
@ 2010-09-09  1:05   ` Richard Riley
  2010-09-09  2:04     ` Tim Burt
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Riley @ 2010-09-09  1:05 UTC (permalink / raw)
  To: emacs-orgmode



Tim Burt <tcburt@rochester.rr.com> writes:

> Could Richard Riley have solved my problem?  Yes he did.
> http://naturallogofx.rketburt.org/2010/09/could-richard-riley-have-solved-my.html

Glad its of some use. It (googlecl) has been on my "must check it out"
list for a while ;)

Its just at test stage but taking shape - I'm having to relearn elisp
again ... I'll "git" (!) it in the next few days. But here's the latest code
posted using itself and cleaned up a bit. Note the two defvars to
set. You can prefix (C-u) the call to get prompted for the blog name. 

http://splash-of-open-sauce.blogspot.com/2010/09/improved-code-for-googlecl-blog_08.html

As a side note, I intend to create a module org-googlecl (org google
command line) with corresponding namespace for customisations. I'm sure
then that people more familiar with the publishing portion of org can
supe it up a bit more.

cheers

r.

>
> Thank you, thank you, thank you,
> Tim
>
> Richard Riley <rileyrg@gmail.com> writes:
>
>> Using the google command line you can get some super access to all your
>> Google resources - including docs, calendars &  blogs.
>>
>> http://code.google.com/p/googlecl/
>>
>> Once you have installed it and set up your OAUTH you can easily
>> manipulate/add/delete things in your google hosted data.
>>
>> While not polished and featuring hard coded blog name the following
>> function uses the google command line tool to blog the current
>> org-entry.
>>
>>   (defun rgr/org-blog-entry ()
>>     (interactive)
>>     (save-excursion
>>       (let ((tmpheading (org-get-heading)))
>>           (goto-char (org-entry-beginning-position))
>>           (set-mark (org-entry-end-position))
>>           (let*((tmpfile (make-temp-file "org-blog-html-"))
>>                (blog-command (concat "google blogger post --blog \"Open Sauce\" --title '" tmpheading "' "  tmpfile )))
>>             (org-export-as-html 1 nil nil (find-file-noselect tmpfile) t)
>> 	    (with-current-buffer (get-file-buffer tmpfile) (save-buffer))
>>             (start-process-shell-command "Google Blog" "*googlecl*" blog-command)))))
>>
>> At some point I'll try and make it more generic with customised options
>> if no one beats me to it ..
>>
>> regards
>>
>> r.
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

-- 
☘ http://www.shamrockirishbar.com, http://www.richardriley.net

"Learning French is trivial: the word for horse is 'cheval' and
 everything follows thusly."

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Re: Blogging org entries using google command line.
  2010-09-09  1:05   ` Richard Riley
@ 2010-09-09  2:04     ` Tim Burt
  2010-09-09  3:35       ` Richard Riley
  0 siblings, 1 reply; 11+ messages in thread
From: Tim Burt @ 2010-09-09  2:04 UTC (permalink / raw)
  To: Richard Riley; +Cc: emacs-orgmode

Richard Riley <rileyrg@gmail.com> writes:

> Tim Burt <tcburt@rochester.rr.com> writes:
>
>> Could Richard Riley have solved my problem?  Yes he did.
>> http://naturallogofx.rketburt.org/2010/09/could-richard-riley-have-solved-my.html
>
> Glad its of some use. It (googlecl) has been on my "must check it out"
> list for a while ;)
>
> Its just at test stage but taking shape - I'm having to relearn elisp
> again ... I'll "git" (!) it in the next few days. But here's the latest code
> posted using itself and cleaned up a bit. Note the two defvars to
> set. You can prefix (C-u) the call to get prompted for the blog name. 
>
> http://splash-of-open-sauce.blogspot.com/2010/09/improved-code-for-googlecl-blog_08.html

Nice improvements.  Will use.

> As a side note, I intend to create a module org-googlecl (org google
> command line) with corresponding namespace for customisations. I'm sure
> then that people more familiar with the publishing portion of org can
> supe it up a bit more.

I look forward to that.  

Again, many thanks.

>
> cheers
>
> r.
>
>>
>> Thank you, thank you, thank you,
>> Tim
>>
>> Richard Riley <rileyrg@gmail.com> writes:
>>
>>> Using the google command line you can get some super access to all your
>>> Google resources - including docs, calendars &  blogs.
>>>
>>> http://code.google.com/p/googlecl/
>>>
>>> Once you have installed it and set up your OAUTH you can easily
>>> manipulate/add/delete things in your google hosted data.
>>>
>>> While not polished and featuring hard coded blog name the following
>>> function uses the google command line tool to blog the current
>>> org-entry.
>>>
>>>   (defun rgr/org-blog-entry ()
>>>     (interactive)
>>>     (save-excursion
>>>       (let ((tmpheading (org-get-heading)))
>>>           (goto-char (org-entry-beginning-position))
>>>           (set-mark (org-entry-end-position))
>>>           (let*((tmpfile (make-temp-file "org-blog-html-"))
>>>                (blog-command (concat "google blogger post --blog \"Open Sauce\" --title '" tmpheading "' "  tmpfile )))
>>>             (org-export-as-html 1 nil nil (find-file-noselect tmpfile) t)
>>> 	    (with-current-buffer (get-file-buffer tmpfile) (save-buffer))
>>>             (start-process-shell-command "Google Blog" "*googlecl*" blog-command)))))
>>>
>>> At some point I'll try and make it more generic with customised options
>>> if no one beats me to it ..
>>>
>>> regards
>>>
>>> r.
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Blogging org entries using google command line.
  2010-09-09  2:04     ` Tim Burt
@ 2010-09-09  3:35       ` Richard Riley
  2010-09-10  8:01         ` Yavuz Arkun
  2010-09-12 16:40         ` David Maus
  0 siblings, 2 replies; 11+ messages in thread
From: Richard Riley @ 2010-09-09  3:35 UTC (permalink / raw)
  To: emacs-orgmode


ok, last change of the day : this removes the tags from the blogged
heading (is there not an easier way?) and also converts the tags format
into a comman seperated list suitable for googlecl/blogger labels. I'll
put it up into git soon.

--8<---------------cut here---------------start------------->8---
;; Interface to the google command line utility.
;; org-googlecl-blog : posts the current org entry to your google blogger/blogspot blog.
;; See http://code.google.com/p/googlecl/ for details on downloading and installing the tool.
;; Another good reason for postactions on creating new-entries - possibly using a inherited tag, if
;; googlecl-auto-blog tag is set we could call this function directly with no user intervention.

;; email :rileyrgATgooglemailDOTcom

(defcustom org-googlecl-blogname "My Blog Name"
  "The name of the default blogger/blogspot blog you wish to blog to."
  :group 'org-googlecl
  :type 'string)

(defcustom org-googlecl-username "changeme@googlemail.com"
  "The google user id you wish to authenticate with. e.g mydevusername@googlemail.com"
  :group 'org-googlecl
  :type 'string)

  (defun org-googlecl-blog  ()
    (interactive)
    (if current-prefix-arg
        ; WOuld be nice to be able to query possible blogs and allow tab completion on legal names.
        (setq org-googlecl-blogname (read-from-minibuffer "Blog Name:")))
    (save-excursion
      (goto-char (org-entry-beginning-position))
      (let ((tmpheading (org-trim (replace-regexp-in-string (org-get-tags-string) "" (org-get-heading)) ))
            (tmptags (mapconcat  'identity (org-get-tags) ",")))
          (set-mark (org-entry-end-position))
          (let*((tmpfile (make-temp-file "org-blog-html-"))
               (blog-command (concat "google blogger post --blog \"" org-googlecl-blogname "\" --title \"" tmpheading "\" --user \"" org-googlecl-username (if (length tmptags) (concat "\" --tags \"" tmptags "\" "))  tmpfile )))
            (org-export-as-html 1 nil nil (find-file-noselect tmpfile) t)
            (with-current-buffer (get-file-buffer tmpfile) (save-buffer))
            (start-process-shell-command "Google Blog" "*googlecl*" blog-command)
            ))))

(provide 'org-googlecl)
--8<---------------cut here---------------end--------------->8---

r.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Blogging org entries using google command line.
  2010-09-09  3:35       ` Richard Riley
@ 2010-09-10  8:01         ` Yavuz Arkun
  2010-09-10 17:00           ` Richard Riley
  2010-09-12 16:40         ` David Maus
  1 sibling, 1 reply; 11+ messages in thread
From: Yavuz Arkun @ 2010-09-10  8:01 UTC (permalink / raw)
  To: emacs-orgmode

I would like to make one side note:

Before I could use org-googlecl-blog to post successfully, I had to use the
command tool 'google' itself once from the terminal, so that the authorization
step via web browser can be completed. (Otherwise, 'google' starts the web
browser with the authorization page and waits for user to hit return, which
never comes.)

Thanks for the code.

Yavuz

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Blogging org entries using google command line.
  2010-09-10  8:01         ` Yavuz Arkun
@ 2010-09-10 17:00           ` Richard Riley
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Riley @ 2010-09-10 17:00 UTC (permalink / raw)
  To: emacs-orgmode





Yavuz Arkun <yarkun@gmail.com> writes:

> I would like to make one side note:
>
> Before I could use org-googlecl-blog to post successfully, I had to use the
> command tool 'google' itself once from the terminal, so that the authorization
> step via web browser can be completed. (Otherwise, 'google' starts the web
> browser with the authorization page and waits for user to hit return, which
> never comes.)


I updated the README with a warning about that.

It's now in git and there is a more general googlecl-blog function which
org-googlecl-blog makes use of. It includes all subtrees in any org-item
blog too. 

http://github.com/rileyrg/org-googlecl

(if the git seems a mess its because it probably is - I was fannying
around with tags none too successfully and had to clean it up a bit ;)

regards

r.


>
> Thanks for the code.
>
> Yavuz
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

-- 
☘ http://www.shamrockirishbar.com, http://www.richardriley.net

"Learning French is trivial: the word for horse is 'cheval' and
 everything follows thusly."

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Re: Blogging org entries using google command line.
  2010-09-09  3:35       ` Richard Riley
  2010-09-10  8:01         ` Yavuz Arkun
@ 2010-09-12 16:40         ` David Maus
  2010-09-12 16:57           ` Richard Riley
  1 sibling, 1 reply; 11+ messages in thread
From: David Maus @ 2010-09-12 16:40 UTC (permalink / raw)
  To: Richard Riley; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 777 bytes --]

Richard Riley wrote:

>ok, last change of the day : this removes the tags from the blogged
>heading (is there not an easier way?)

What about `org-heading-components:

,----
| org-heading-components is a compiled Lisp function in `org.el'.
|
| (org-heading-components)
|
| Return the components of the current heading.
| This is a list with the following elements:
| - the level as an integer
| - the reduced level, different if `org-odd-levels-only' is set.
| - the TODO keyword, or nil
| - the priority character, like ?A, or nil if no priority is given
| - the headline text itself, or the tags string if no headline text
| - the tags string, or nil.
|
| [back]
`----

HTH,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Blogging org entries using google command line.
  2010-09-12 16:40         ` David Maus
@ 2010-09-12 16:57           ` Richard Riley
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Riley @ 2010-09-12 16:57 UTC (permalink / raw)
  To: emacs-orgmode

David Maus <dmaus@ictsoc.de> writes:

> Richard Riley wrote:
>
>>ok, last change of the day : this removes the tags from the blogged
>>heading (is there not an easier way?)
>
> What about `org-heading-components:

Aha yes. very good. Another elisp list feature learnt! "nth".

    (let ((blabels (mapconcat  'identity (org-get-tags) ","))
	  (btitle (nth 4 (org-heading-components))))

Much cleaner - thanks.

http://github.com/rileyrg/org-googlecl/commit/b1ed999768a8881871654350a9615dddaceb3cf7

(Isn't magit great?!)

r.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-09-12 16:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-08 21:11 Blogging org entries using google command line Richard Riley
2010-09-08 22:32 ` Eric Schulte
2010-09-09  0:12   ` Richard Riley
2010-09-09  0:30 ` Tim Burt
2010-09-09  1:05   ` Richard Riley
2010-09-09  2:04     ` Tim Burt
2010-09-09  3:35       ` Richard Riley
2010-09-10  8:01         ` Yavuz Arkun
2010-09-10 17:00           ` Richard Riley
2010-09-12 16:40         ` David Maus
2010-09-12 16:57           ` Richard Riley

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).