Skip to content
Browse files

Fixed bugs in the posting thingy (and made the date stuff slightly more

duck-shaped).
  • Loading branch information...
1 parent 59dbfb2 commit 1ecf3a3549f1b11b34f2d5744a6fadbeeb967a2b @dagbrown committed with Dave Brown
Showing with 15 additions and 9 deletions.
  1. +15 −9 lib/livejournal.rb
View
24 lib/livejournal.rb
@@ -1,11 +1,12 @@
#!/usr/bin/ruby
+require "rubygems"
+gem "hpricot"
require "xmlrpc/client"
require "md5"
-gem "hpricot"
-require "hpricot"
require "yaml"
+require "hpricot"
class LiveJournal
private
@@ -124,10 +125,15 @@ def export_comments start_id=0
# Optional fields date, mood, music,
def post subject, text, options = {}
date = if options[:date] then
- DateTime.parse(options[:date])
- else
- DateTime.now
- end
+ if String === options[:date] then
+ DateTime.parse(options[:date])
+ else
+ options[:date]
+ end
+ else
+ DateTime.now
+ end
+
callhash = {
:event => text,
@@ -136,7 +142,7 @@ def post subject, text, options = {}
:mon => date.month,
:day => date.day,
:hour => date.hour,
- :min => date.minute,
+ :min => date.min,
:lineendings => "unix",
:props => {}
}
@@ -153,8 +159,8 @@ def post subject, text, options = {}
:picture => :picture_keyword,
:noemail => :opt_noemail
}.each do |option_name, lj_option_name|
- if options[:option_name] then
- callhash[:props][lj_option_name] = options[:option_name]
+ if options[option_name] then
+ callhash[:props][lj_option_name] = options[option_name]
end
end

0 comments on commit 1ecf3a3

Please sign in to comment.
Something went wrong with that request. Please try again.