def player(request): stations = Station.objects.all() p = get_player_instance() return render(request, 'webradio/player.html', { 'stations': stations, 'player': p })
def control_station_previous(request): """ Plays the previous station. """ if Station.objects.count() == 0: return HttpResponseRedirect(reverse('webradio.views.player')) p = get_player_instance() current_station = p.get_current_station() try: previous_station = Station.objects.filter(id__lt=current_station.id).order_by('-id')[0] except: previous_station = Station.objects.all().order_by('-id')[0] previous_station.play() return HttpResponseRedirect(reverse('webradio.views.player'))
def control_station_previous(request): """ Plays the previous station. """ if Station.objects.count() == 0: return HttpResponseRedirect(reverse('webradio.views.player')) p = get_player_instance() current_station = p.get_current_station() try: previous_station = Station.objects.filter( id__lt=current_station.id).order_by('-id')[0] except: previous_station = Station.objects.all().order_by('-id')[0] previous_station.play() return HttpResponseRedirect(reverse('webradio.views.player'))
def control_get_info(request): """ Returns information about the currently played back station/track. @return: JSON """ p = get_player_instance() station = p.get_current_station() info = {} info['title'] = p.get_now_playing() if station is None: info['station'] = 'No Station' else: info['station'] = station.name info['is_playing'] = p.is_playing() return HttpResponse(json.dumps(info), mimetype="application/json")
def control_get_info(request): """ Returns information about the currently played back station/track. @return: JSON """ p = get_player_instance() station = p.get_current_station() info = {} info['title'] = p.get_now_playing() if station is None: info['station'] = 'No Station' else: info['station'] = station.name info['is_playing'] = p.is_playing() return HttpResponse(json.dumps(info), mimetype="application/json")
def control_play_pause(request): p = get_player_instance() p.play_pause() return HttpResponseRedirect(reverse('webradio.views.player'))
def control_play_pause(request): p = get_player_instance() p.play_pause() return HttpResponseRedirect(reverse('webradio.views.player'))
def player(request): stations = Station.objects.all() p = get_player_instance() return render(request, 'webradio/player.html', {'stations': stations, 'player': p})
def play(self): """ Plays this station. """ p = get_player_instance() return p.play_station(self)
def play(self): """ Plays this station. """ p = get_player_instance() return p.play_station(self)