Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #6604

Re: How to schedule events on specific days/times

From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.ruby
Subject Re: How to schedule events on specific days/times
Date 2012-08-29 08:13 +0200
Message-ID <aa5q8qFrbsU1@mid.individual.net> (permalink)
References <93df489c-6c83-4363-949d-f3d4909e8c3f@googlegroups.com>

Show all headers | View raw


On 28.08.2012 22:48, z0mbix@gmail.com wrote:
> This is simple and already implemented, but what I need to do is play
> different playlists on each day of the week, and only during the
> specified times, so I need some way to schedule events to switch
> playlists at the specified days/times. I've not had to do anything
> like this before and not sure what the best approach is. Should there
> be a separate thread that wakes up every minute to check if a switch
> is required, or is there a better way to do this?

There might be solutions for scheduling around.  Did you look in RAA or 
Gem repository?  If you want to do it yourself, you can make that more 
intelligent than polling.  Basically you need to calculate the next even 
(i.e. music on) and sleep until that point in time is reached.  Then 
start playing.  If you want to be able to modify the schedule online 
(i.e. while the application is running) things get a bit more 
complicated because you may have to wake up earlier than intended.

Kind regards

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

How to schedule events on specific days/times z0mbix@gmail.com - 2012-08-28 13:48 -0700
  Re: How to schedule events on specific days/times Robert Klemme <shortcutter@googlemail.com> - 2012-08-29 08:13 +0200
    Re: How to schedule events on specific days/times Simon Krahnke <overlord@gmx.li> - 2012-09-08 13:12 +0200

csiph-web