예제 #1
0
파일: main.py 프로젝트: sglickman/WBOR
  def get(self):
    ## Album list disabled until it is further optimized.
    #album_list = []
    album_list = Album.get_new(num=36)
    start = datetime.date.today() - datetime.timedelta(days=6)
    end = datetime.date.today() + datetime.timedelta(days=1)
    song_num = 10
    album_num = 10
    logging.debug("Calling get top")
    top_songs, top_albums = Play.get_top(start, end, song_num, album_num)
    posts = BlogPost.get_last(num=3)
    events = Event.get_upcoming(num=3)

    template_values = {
      'news_selected': True,
      'flash': self.flashes,
      'session': self.session,
      'album_list': album_list,
      'top_songs': top_songs,
      'top_albums': top_albums,
      'posts': posts,
      'events': events,
      }
    self.response.out.write(template.render(get_path("index.html"),
                                            template_values))
예제 #2
0
파일: dj.py 프로젝트: hchapman/WBOR
  def get(self):
    if not self.session_has_program():
      self.session.add_flash(
        "You can't chart songs until you have an associated program in the "
        "system.  Please contact a member of management immediately.")
      self.redirect("/dj/")
      return

    memcache_key = "playlist_html_%s"%self.session.get('program').get('key')
    playlist_html = memcache.get(memcache_key)
    if not playlist_html:
      playlist_html = template.render("dj_chartsong_playlist_div.html",
        {'playlist': Play.get_last(num=50,
                                   program=Program.get(self.program_key),
                                   after=(datetime.date.today())),
         }
      )
      memcache.set(memcache_key, playlist_html, 60 * 60 * 24)

    last_psa = None #Psa.get_last() # cache.getLastPsa()
    new_albums = None
    #new_song_div_html = memcache.get("new_song_div_html")
    album_songs = []
    new_song_div_html = None
    if not new_song_div_html:
      new_albums = Album.get_new() #by_artist=True)
      if new_albums:
        logging.debug(new_albums)
        album_songs = Song.get(new_albums[0].tracklist)
      new_song_div_html = template.render(
        get_path("dj_chartsong_newsongdiv.html"),
        {'new_albums': new_albums,
         'album_songs': album_songs,})
      memcache.set("new_song_div_html", new_song_div_html)

    template_values = {
      'last_psa': last_psa,
      'playlist_html': playlist_html,
      'session': self.session,
      'flash': self.flashes,
      'new_albums': new_albums,
      'album_songs': album_songs,
      'new_song_div_html': new_song_div_html,
    }
    self.response.out.write(
      template.render(get_path("dj_chartsong.html"), template_values))
예제 #3
0
파일: dj.py 프로젝트: hchapman/WBOR
  def get(self):
    new_album_list = None
 #   new_album_html = memcache.get("manage_new_albums_html")
 #   if not new_album_html:
    new_album_list = Album.get_new()
    new_album_html = template.render(
        get_path("dj_manage_new_albums_list.html"),
        {'new_album_list': new_album_list})
    memcache.set("manage_new_albums_html", new_album_html)
    template_values = {
      'new_album_list': new_album_list,
      'new_album_html': new_album_html,
      'session': self.session,
      'flash': self.flashes,
    }
    self.response.out.write(
        template.render(get_path("dj_manage_albums.html"), template_values))