Permalink
Browse files

fix reply_sound

  • Loading branch information...
1 parent fe51150 commit e93b3bf21addf4e8403315c59e6f3323a8939610 @sorah sorah committed Mar 7, 2010
Showing with 14 additions and 17 deletions.
  1. +14 −17 lib/plugins/reply_sound.rb
View
@@ -3,26 +3,23 @@
# FIXME: This plugin is Mac only now.
if RUBY_PLATFORM =~ /darwin/i
-config.plugins.reply_sound.set_default(:interval, 600)
-config.plugins.reply_sound.set_default(:sound_file, '/System/Library/Sounds/Hero.aiff')
+ config.plugins.reply_sound.set_default(:interval, 600)
+ config.plugins.reply_sound.set_default(:sound_file, '/System/Library/Sounds/Hero.aiff')
-reply_sound_cache = nil
-reply_sound_cache_ids = []
+ reply_sound_cache = nil
+ reply_sound_cache_ids = []
-Termtter::Client.add_task(:name => :reply_sound,
- :interval => config.plugins.reply_sound.interval) do
- replies = Termtter::API.twitter.replies
- new_replies = replies.delete_if{|x| reply_sound_cache_ids.index(x[:id]) }
- if !reply_sound_cache.nil? && new_replies.size > 0
- system 'afplay "'+config.plugins.reply_sound.sound_file+'" 2>/dev/null &'
- Termtter::Client.output(new_replies,:new_replies,:replies)
+ Termtter::Client.add_task(:name => :reply_sound,
+ :interval => config.plugins.reply_sound.interval) do
+ replies = Termtter::API.twitter.replies
+ new_replies = replies.delete_if{|x| reply_sound_cache_ids.index(x[:id]) }
+ if !reply_sound_cache.nil? && new_replies.size > 0
+ system 'afplay "'+config.plugins.reply_sound.sound_file+'" 2>/dev/null &'
+ Termtter::Client.output(new_replies,:new_replies,:replies)
+ end
+ reply_sound_cache = replies
+ reply_sound_cache_ids += replies.map{|x| x[:id]}
end
- reply_sound_cache = replies
- reply_sound_cache_ids += replies.map{|x| x[:id]}
-end
-
-
-
else
puts TermColor.parse("<red>WARNING: reply_sound plugin is available on Mac OS X now.</red>")
end

0 comments on commit e93b3bf

Please sign in to comment.