lib/junkie/reactor.rb in junkie-0.0.15 vs lib/junkie/reactor.rb in junkie-0.1.0
- old
+ new
@@ -3,10 +3,11 @@
require 'sjunkieex'
require 'eventmachine'
require 'fiber'
require 'yaml'
require 'junkie'
+require 'junkie/push/endpoint'
require 'junkie/pyload/api'
require 'junkie/pyload/observer'
require 'junkie/errors'
require 'junkie/webinterface/interface'
@@ -18,25 +19,28 @@
DEFAULT_CONFIG = {
:series_index_file => File.join(Dir.home, '.sindex/seriesindex.xml'),
:episode_search_refresh => 15, # in minutes
}
-
def initialize
@config = Config.get_config(self)
log.info("Starting Junkie #{Junkie::VERSION}")
@channels = {
+ encrypted: EM::Channel.new,
episodes: EM::Channel.new,
notifications: EM::Channel.new,
info: EM::Channel.new,
+ push_episode_count: EM::Channel.new,
+ push_registration: EM::Channel.new,
}
@pyload_observer = Junkie::Pyload::Observer.new(@channels)
@twitter_notification = Junkie::Notification::Twitter.new(@channels)
@dumper = Junkie::Notification::Dumper.new(@channels)
+ @push_endpoint = Junkie::Push::Endpoint.new(@channels)
@found_episodes = Hash.new
build_procs # has to be called here
end
@@ -96,10 +100,10 @@
identifier = "%s@%s" % [episode.id, episode.series]
if not @found_episodes.has_key? identifier
log.info("Found new episode '#{episode}'")
- @channels[:episodes].push(episode)
+ @channels[:encrypted].push(episode)
@found_episodes[identifier] = episode
end
end
# send out the current time out of the websocket