lib/cinch/plugins/schedule.rb
def command_next(m, show_keyword)
        show = Shows.find_show(show_keyword) if show_keyword and !show_keyword.strip.empty?

        if show
          next_event = @calendar.next_event(show.title)
        else
          next_event = @calendar.next_event
        end

        if next_event
          tz = TZInfo::Timezone.get('America/New_York')
          time = tz.utc_to_local(next_event.start_time)

          date_string = time.strftime("%A, %-m/%-d/%Y")
          time_string = time.strftime("%-I:%M%P EST")
          nearest_seconds_until = ((next_event.start_time - DateTime.now) * 24 * 60 * 60).to_i
          if show
            m.user.send "The next #{next_event.summary} is in #{ChronicDuration.output(nearest_seconds_until, :format => :long)} (#{time_string} on #{date_string})"
          else
            m.user.send "Next show is #{next_event.summary} in #{ChronicDuration.output(nearest_seconds_until, :format => :long)} (#{time_string} on #{date_string})"
          end
        else
          m.user.send "No upcoming show found for #{show.title}"
        end

      end
# Replies to the user with information about the next show
# !next b2w -> The next Back to Work is in 3 hours 30 minutes (6/2/2011)
Replies to the user with information about the next show
next b2w -> The next Back to Work is in 3 hours 30 minutes (6/2/2011)
Replies to the user with information about the next show next b2w - > The next Back to Work is in 3 hours 30 minutes ( 6 / 2 / 2011 )
def command_next(m, show_keyword)
        show = Shows.find_show(show_keyword) if show_keyword and !show_keyword.strip.empty?
        if show
          next_event = @calendar.next_event(show.title)
        else
          next_event = @calendar.next_event
        end
        if next_event
          tz = TZInfo::Timezone.get('America/New_York')
          time = tz.utc_to_local(next_event.start_time)
          date_string = time.strftime("%A, %-m/%-d/%Y")
          time_string = time.strftime("%-I:%M%P EST")
          nearest_seconds_until = ((next_event.start_time - DateTime.now) * 24 * 60 * 60).to_i
          if show
            m.user.send "The next #{next_event.summary} is in #{ChronicDuration.output(nearest_seconds_until, :format => :long)} (#{time_string} on #{date_string})"
          else
            m.user.send "Next show is #{next_event.summary} in #{ChronicDuration.output(nearest_seconds_until, :format => :long)} (#{time_string} on #{date_string})"
          end
        else
          m.user.send "No upcoming show found for #{show.title}"
        end
      end
def command_next ( m , show_keyword ) show = Shows . find_show ( show_keyword ) if show_keyword and ! show_keyword . strip . empty? if show next_event = @calendar . next_event ( show . title ) else next_event = @calendar . next_event end if next_event tz = TZInfo :: Timezone . get ( 'America/New_York' ) time = tz . utc_to_local ( next_event . start_time ) date_string = time . strftime ( "%A, %-m/%-d/%Y" ) time_string = time . strftime ( "%-I:%M%P EST" ) nearest_seconds_until = ( ( next_event . start_time - DateTime . now ) * 24 * 60 * 60 ) . to_i if show m . user . send "The next #{next_event.summary} is in #{ChronicDuration.output(nearest_seconds_until, :format => :long)} (#{time_string} on #{date_string})" else m . user . send "Next show is #{next_event.summary} in #{ChronicDuration.output(nearest_seconds_until, :format => :long)} (#{time_string} on #{date_string})" end else m . user . send "No upcoming show found for #{show.title}" end end
Replies to the user with information about the next show
next b2w -> The next Back to Work is in 3 hours 30 minutes (6/2/2011)
Replies to the user with information about the next show next b2w - > The next Back to Work is in 3 hours 30 minutes ( 6 / 2 / 2011 )
m
show_keyword