Example #1
0
def update_memcache(sid):
	_update_schedule_memcache(sid)
	update_live_voting(sid)
	cache.prime_rating_cache_for_events(sid, [ current[sid] ] + upnext[sid] + history[sid])
	cache.set_station(sid, "current_listeners", listeners.get_listeners_dict(sid), True)
	cache.set_station(sid, "album_diff", playlist.get_updated_albums_dict(sid), True)
	rainwave.playlist_objects.album.clear_updated_albums(sid)
	cache.set_station(sid, "all_albums", playlist.get_all_albums_list(sid), True)
	cache.set_station(sid, "all_albums_no_searchable", playlist.get_all_albums_list(sid, with_searchable=False), True)
	cache.set_station(sid, "all_artists", playlist.get_all_artists_list(sid), True)
	cache.set_station(sid, "all_artists_no_searchable", playlist.get_all_artists_list(sid, with_searchable=False), True)
	cache.set_station(sid, "all_groups", playlist.get_all_groups_list(sid), True)
	cache.set_station(sid, "all_groups_no_searchable", playlist.get_all_groups_list(sid, with_searchable=False), True)
	cache.set_station(sid, "all_groups_power", playlist.get_all_groups_for_power(sid), True)
	cache.set_station(sid, "all_groups_power_no_searchable", playlist.get_all_groups_for_power(sid, with_searchable=False), True)

	potential_dj_ids = []
	if getattr(current[sid], 'dj_user_id', None):
		potential_dj_ids.append(current[sid].dj_user_id)
	for evt in upnext[sid]:
		if getattr(evt, 'dj_user_id', None):
			potential_dj_ids.append(evt.dj_user_id)
	if len(history[sid]) and history[sid][-1] and getattr(history[sid][-1], 'dj_user_id', None):
		potential_dj_ids.append(history[sid][-1].dj_user_id)
	cache.set_station(sid, "dj_user_ids", potential_dj_ids)
Example #2
0
def update_memcache(sid):
    _update_schedule_memcache(sid)
    update_live_voting(sid)
    cache.prime_rating_cache_for_events(sid, [current[sid]] + upnext[sid] +
                                        history[sid])
    cache.set_station(sid, "current_listeners",
                      listeners.get_listeners_dict(sid), True)
    cache.set_station(sid, "album_diff", playlist.get_updated_albums_dict(sid),
                      True)
    rainwave.playlist_objects.album.clear_updated_albums(sid)
    cache.set_station(sid, "all_albums", playlist.get_all_albums_list(sid),
                      True)
    cache.set_station(
        sid,
        "all_albums_no_searchable",
        playlist.get_all_albums_list(sid, with_searchable=False),
        True,
    )
    cache.set_station(sid, "all_artists", playlist.get_all_artists_list(sid),
                      True)
    cache.set_station(
        sid,
        "all_artists_no_searchable",
        playlist.get_all_artists_list(sid, with_searchable=False),
        True,
    )
    cache.set_station(sid, "all_groups", playlist.get_all_groups_list(sid),
                      True)
    cache.set_station(
        sid,
        "all_groups_no_searchable",
        playlist.get_all_groups_list(sid, with_searchable=False),
        True,
    )
    cache.set_station(sid, "all_groups_power",
                      playlist.get_all_groups_for_power(sid), True)
    cache.set_station(
        sid,
        "all_groups_power_no_searchable",
        playlist.get_all_groups_for_power(sid, with_searchable=False),
        True,
    )

    potential_dj_ids = []
    if getattr(current[sid], "dj_user_id", None):
        potential_dj_ids.append(current[sid].dj_user_id)
    for evt in upnext[sid]:
        if getattr(evt, "dj_user_id", None):
            potential_dj_ids.append(evt.dj_user_id)
    if (history[sid] and history[sid][-1]
            and getattr(history[sid][-1], "dj_user_id", None)):
        potential_dj_ids.append(history[sid][-1].dj_user_id)
    cache.set_station(sid, "dj_user_ids", potential_dj_ids)
Example #3
0
def update_memcache(sid):
	_update_schedule_memcache(sid)
	cache.prime_rating_cache_for_events(sid, [ current[sid] ] + upnext[sid] + history[sid])
	cache.set_station(sid, "current_listeners", listeners.get_listeners_dict(sid), True)
	cache.set_station(sid, "album_diff", playlist.get_updated_albums_dict(sid), True)
	rainwave.playlist_objects.album.clear_updated_albums(sid)
	cache.set_station(sid, "all_albums", playlist.get_all_albums_list(sid), True)
	cache.set_station(sid, "all_artists", playlist.get_all_artists_list(sid), True)
	cache.set_station(sid, "all_groups", playlist.get_all_groups_list(sid), True)
Example #4
0
def _update_memcache(sid):
	cache.set_station(sid, "sched_current", current[sid], True)
	cache.set_station(sid, "sched_next", next[sid], True)
	cache.set_station(sid, "sched_history", history[sid], True)
	cache.set_station(sid, "sched_current_dict", current[sid].to_dict(), True)
	next_dict_list = []
	for event in next[sid]:
		next_dict_list.append(event.to_dict())
	cache.set_station(sid, "sched_next_dict", next_dict_list, True)
	history_dict_list = []
	for event in history[sid]:
		history_dict_list.append(event.to_dict())
	cache.set_station(sid, "sched_history_dict", history_dict_list, True)
	cache.prime_rating_cache_for_events([ current[sid] ] + next[sid] + history[sid])
	cache.set_station(sid, "listeners_current", listeners.get_listeners_dict(sid), True)
	cache.set_station(sid, "album_diff", playlist.get_updated_albums_dict(sid), True)
	playlist.clear_updated_albums(sid)
	cache.set_station(sid, "all_albums", playlist.get_all_albums_list(sid), True)
	cache.set_station(sid, "all_artists", playlist.get_all_artists_list(sid), True)
Example #5
0
def attach_info_to_request(request):
	# 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.

	if request.user:
		request.append("user", request.user.to_public_dict())
		
	if 'playlist' in request.request.arguments:
		request.append("all_albums", playlist.get_all_albums_list(request.user))
	elif 'artist_list' in request.request.arguments:
		request.append("artist_list", playlist.get_all_artists_list(request.sid))
	elif 'init' not in request.request.arguments:
		request.append("album_diff", cache.get_station(request.sid, 'album_diff'))
	
	request.append("requests_all", cache.get_station(request.sid, "request_all"))
	request.append("calendar", cache.get("calendar"))
	request.append("listeners_current", cache.get_station(request.sid, "listeners_current"))
	
	sched_next = []
	sched_history = []
	if request.user:
		request.append("requests_user", request.user.get_requests())
		# TODO: Some mixing of pre-dictionaried items here might help speed
		request.append("sched_current", cache.get_station(request.sid, "sched_current").to_dict(request.user))
		for evt in cache.get_station(request.sid, "sched_next"):
			sched_next.append(evt.to_dict(request.user))
		for evt in cache.get_station(request.sid, "sched_history"):
			sched_history.append(evt.to_dict(request.user))
	else:
		request.append("sched_current", cache.get_station(request.sid, "sched_current_dict"))
		sched_next = cache.get_station(request.sid, "sched_next_dict")
		sched_history = cache.get_station(request.sid, "sched_history_dict")
	request.append("sched_next", sched_next)
	request.append("sched_history", sched_history)
Example #6
0
def _update_memcache(sid):
    cache.set_station(sid, "sched_current", current[sid], True)
    cache.set_station(sid, "sched_next", next[sid], True)
    cache.set_station(sid, "sched_history", history[sid], True)
    cache.set_station(sid, "sched_current_dict", current[sid].to_dict(), True)
    next_dict_list = []
    for event in next[sid]:
        next_dict_list.append(event.to_dict())
    cache.set_station(sid, "sched_next_dict", next_dict_list, True)
    history_dict_list = []
    for event in history[sid]:
        history_dict_list.append(event.to_dict())
    cache.set_station(sid, "sched_history_dict", history_dict_list, True)
    cache.prime_rating_cache_for_events([current[sid]] + next[sid] +
                                        history[sid])
    cache.set_station(sid, "listeners_current",
                      listeners.get_listeners_dict(sid), True)
    cache.set_station(sid, "album_diff", playlist.get_updated_albums_dict(sid),
                      True)
    playlist.clear_updated_albums(sid)
    cache.set_station(sid, "all_albums", playlist.get_all_albums_list(sid),
                      True)
    cache.set_station(sid, "all_artists", playlist.get_all_artists_list(sid),
                      True)