Exemplo n.º 1
0
def options(request):
    # get sound info
    am = AudioManager()
    current_volume = am.get_percent_volume()
    current_mute = am.get_mute_status()

    # get actual mp3 backup file
    actual_backup = _get_mp3_in_backup_folder()

    if request.method == 'POST':
        form = BackupMP3Form(request.POST, request.FILES)
        if form.is_valid():
            # remove backup save in database
            BackupMP3.objects.all().delete()
            # remove file in backup folder
            _delete_mp3_from_backup_folder()
            form.save()
            return redirect('webgui.views.options')
    else:
        form = BackupMP3Form()

    return render(request, 'options.html', {'currentVolume': current_volume,
                                            'currentMute': current_mute,
                                            'form': form,
                                            'backup': actual_backup})
Exemplo n.º 2
0
def options(request):
    # get sound info
    am = AudioManager()
    current_volume = am.get_percent_volume()
    current_mute = am.get_mute_status()

    # get actual mp3 backup file
    actual_backup = _get_mp3_in_backup_folder()

    if request.method == 'POST':
        form = BackupMP3Form(request.POST, request.FILES)
        if form.is_valid():
            # remove backup save in database
            BackupMP3.objects.all().delete()
            # remove file in backup folder
            _delete_mp3_from_backup_folder()
            form.save()
            return redirect('webgui.views.options')
    else:
        form = BackupMP3Form()

    return render(
        request, 'options.html', {
            'currentVolume': current_volume,
            'currentMute': current_mute,
            'form': form,
            'backup': actual_backup
        })
Exemplo n.º 3
0
def homepage(request):
    try:
        radio = Webradio.objects.get(selected=1)
    except Webradio.DoesNotExist:
        radio = None
    player = Player()
    listalarmclock = Alarmclock.objects.all()
    # clock
    clock = strftime("%H:%M:%S")
    # get sound info
    am = AudioManager()
    currentvolume = am.get_percent_volume()
    currentmute = am.get_mute_status()
    return render(
        request, 'homepage.html', {
            'radio': radio,
            'player': player,
            'listalarmclock': listalarmclock,
            'clock': clock,
            'currentVolume': currentvolume,
            'currentMute': currentmute
        })
Exemplo n.º 4
0
def volumetmute(request):
    am = AudioManager()
    am.togglemute()
    return redirect('webgui.views.options')
Exemplo n.º 5
0
def volumeset(request, volume):
    am = AudioManager()
    am.set_volume(int(volume))
    return redirect('webgui.views.options')
Exemplo n.º 6
0
def volumedown(request, count):
    am = AudioManager()
    am.volume_down()
    return redirect('webgui.views.options')
Exemplo n.º 7
0
def volumetmute(request):
    am = AudioManager()
    am.togglemute()
    return redirect('webgui.views.options')
Exemplo n.º 8
0
def volumeset(request, volume):
    am = AudioManager()
    am.set_volume(int(volume))
    return redirect('webgui.views.options')
Exemplo n.º 9
0
def volumedown(request, count):
    am = AudioManager()
    am.volume_down()
    return redirect('webgui.views.options')
Exemplo n.º 10
0
def volumeup(request, count):
    am = AudioManager()
    am.volume_up()
    return redirect('webgui.views.homepage')