[typo] LiveJournal Crossposter written - a gross hack, and some questions.

Chris Patti cpatti at gmail.com
Wed May 30 12:48:55 EDT 2007

Hello all;

I needed a working cog in far less time than it will take for me to
understand the intricacies of RAILS plugins and how they interact with
Typo.  So, for now, here is the solution I implemented.  It uses the
command line LJ posting client 'Clive' -
http://sourceforge.net/projects/ljclive/ to do the actual cross
posting.  Eventually I'll re-implement it to use one of the fully
forged Ruby LiveJournal posting APIs.

Here are the diffs to models/article.rb:
[feoh at mail]/blog/blind_not_dumb/app/models% diff article.rb.1 article.rb
>   after_create :lj_crosspost
>   def lj_crosspost
>     if (self.body =~ /lj-crosspost: yes/i)
>       logger.debug('article: lj_crosspost: Crossposting at ' + Time.now.to_s);
>       ljpost = BlueCloth.new(self.body).to_html();
>       ljpost.gsub!(/<.?p>/,"");
>       logger.debug('ljpost is: ' + ljpost);
>       ljpost_path="/tmp/lj_crosspost_#{$$}";
>       ljpost_file = File.open(ljpost_path,"w") do |ljc|
>         ljc.puts(ljpost);
>       end
>       logger.debug("about to run command: " + "cat #{ljpost_path}|/usr/local/bin/clive -u myljuser -w myljpassword -s \"#{self.title}\"");
>       logger.debug('output of ljpost command is: ' + `cat #{ljpost_path}|/usr/local/bin/clive -u feoh -w d1rtylaundry -s "#{self.title}"`);
>     end
>   end

A few questions:

* Is there some better place than the article model for me to be
grafting in this kind of cross posting
post processing?
* Where should I start looking if I want to implement this as a plugin?

Thanks for any clues.

 Chris Patti --- Y!: feoh -- AIM: chrisfeohpatti --- E-Mail:  cpatti at gmail.com
"The greatest dangers to liberty lurk in insidious encroachment by men of
  zeal,well-meaning but without understanding."-- Justice Louis O. Brandeis
 (Olmstead vs. United States)

More information about the Typo-list mailing list