Exemplo n.º 1
0
def playing(request):
  # playing the requesting piece
  video_id = request.GET.get('video_id', '')
  playlist = request.GET.get('playlist', '')
  tag = request.GET.get('tag', '')
  template = loader.get_template('playing_script.html')
  deb_arg = request.GET.get('deb', '0')
  if not playlist:
    return render_landing(tag);
  
  if not video_id:
    video_id = engine.generate_recommendation(playlist).video_id
  queue = engine.generate_queue(playlist)
  
  playlist_model = Playlist.objects.get(name=playlist)
  playlists = Playlist.objects.order_by("-last_played")
  playlists_alphabetical = Playlist.objects.order_by("name")
  
  context = Context({
    'playlist': playlist_model,
    'playlists': playlists,
    'playlists_alphabetical': playlists_alphabetical,
    'queue': queue,
    'video_id': video_id, 
    'video_title': engine.get_title(playlist, video_id),
  })
  return HttpResponse(template.render(context))
Exemplo n.º 2
0
def get_title(request):
  # gets title from DB
  playlist = request.GET.get('playlist', '')
  video_id = request.GET.get('video_id', '')
  title = engine.get_title(playlist, video_id)
  return HttpResponse(title)