Read the options given on the command line and do the required actions.

    This method is used in the entry_point `cast`.

def main():
    """ Read the options given on the command line and do the required actions.

    This method is used in the entry_point `cast`.
    """
    opts = docopt(__doc__, version="cast 0.1")

    cast = pychromecast.PyChromecast(CHROMECAST_HOST)
    ramp = cast.get_protocol(pychromecast.PROTOCOL_RAMP)

    # Wait for ramp connection to be initted.
    time.sleep(SLEEP_TIME)

    if ramp is None:
        print 'Chromecast is not up or current app does not handle RAMP.'
        return 1

    if opts['next']:
        ramp.next()
    elif opts['pause']:
        ramp.pause()
    elif opts['play']:
        ramp.play()
    elif opts['toggle']:
        ramp.playpause()
    elif opts['seek']:
        ramp.seek(opts['<second>'])
    elif opts['rewind']:
        ramp.rewind()
    elif opts['status']:
        _status_command(cast, ramp)
    elif opts['volume']:
        _volume_command(ramp, opts['<value>'])

    # Wait for command to be sent.
    time.sleep(SLEEP_TIME)