#!/usr/bin/env python

import re


PATH = '/proc/asound/DACE07K/pcm0p/sub0/hw_params'

try:
    with open(PATH, 'r') as f:
        dac = f.readlines()

    if dac[0] == 'closed\n':
        print('%{F#4a4f4f}\uF027 CLOSED%{F-}')
    else:
        print('%{{F#4a4f4f}}\uF028%{{F-}} {}bit, {}KHz'.format(
            re.search(r'\s.(\d{2})', dac[1]).group(1),
            re.search(r'\s(\d{2})', dac[4]).group(1)))

except FileNotFoundError:
    print('%{F#60584E}DAC UNPLUGGED%{F-}')
