Example #1
0
	def update(self, use_local_cache = False):
		# Front-load all non-animated content ahead of the schedule content
		# Since the schedule content is the most animated on R3, setting this content to load
		# first has a good impact on the perceived animation smoothness since table redrawing
		# doesn't have to take place during the first few frames.
		
		self.user.refresh(use_local_cache)
		self.append("user", self.user.get_public_dict())
		
		if 'playlist' in self.request.arguments:
			self.append("all_albums", playlist.fetch_all_albums(self.user))
		elif 'artist_list' in self.request.arguments:
			self.append("artist_list", playlist.fetch_all_artists(self.sid))
		elif 'init' not in self.request.arguments:
			self.append("album_diff", cache.get_local_station(self.sid, 'album_diff'))
		
		if use_local_cache:
			self.append("requests_all", cache.get_local_station(self.sid, "request_all"))
		else:
			self.append("requests_all", cache.get_station(self.sid, "request_all"))
		self.append("requests_user", self.user.get_requests())
		self.append("calendar", cache.local["calendar"])
		self.append("listeners_current", cache.get_local_station(self.sid, "listeners_current"))
		
		self.append("sched_current", self.user.make_event_jsonable(cache.get_local_station(self.sid, "sched_current"), use_local_cache))
		self.append("sched_next", self.user.make_events_jsonable(cache.get_local_station(self.sid, "sched_next"), use_local_cache))
		self.append("sched_history", self.user.make_event_jsonable(cache.get_local_station(self.sid, "sched_history"), use_local_cache))
		self.finish()