#!/usr/bin/env python

import argparse, sys
import pscripts.hdmi_control as hdmi 
from pdb import set_trace

parser = argparse.ArgumentParser(
    description='Control brightness on HDMI')
parser.add_argument('--increase','-i', action='store_true', help='Increase brightness')
parser.add_argument('--decrease','-d', action='store_true', help='Decrease brightness')
parser.add_argument('--step','-s', help='0 < step < 1')
a = parser.parse_args() 
# set_trace()
if ((a.increase == False and a.decrease == False) or 
    (a.increase == True and a.decrease == True)):
    parser.print_help()
    sys.exit(0)

if a.increase == True:
    if a.step:
        hdmi.increase_brightness(float(a.step))
    else:
        hdmi.increase_brightness()        
    sys.exit(0)

if a.decrease == True:
    if a.step:
        hdmi.decrease_brightness(float(a.step))
    else:
        hdmi.decrease_brightness()
    sys.exit(0)
