from lxml import etree
from lxml.builder import E

import yaml

with open('/home/adam/Programs/mystuff/aprsNotifyJS/src/status_config.yaml') as f:
    config = yaml.safe_load(f)

for call, tactical in [(s,t) for s,t in config['trackedStations'].items() if t != None]:
    nickname = E.Nickname(
        E.Enabled("1"),
        E.AutoMultiTrack("0"),
        E.ActiveMultiTrack("0"),
        E.AlwaysMultiTrack("0"),
        E.Label(tactical),
        E.OverrideLabel("1"),
        E.Comment(),
        E.OverrideComment("0"),
        E.Table("/"),
        E.Symbol("a"),
        E.OverrideSymbol("0"),
        E.Color(),
        E.OverrideColor("0"),
        E.DefinedBy(),
        E.LastUsed("2017-07-07T10:56:53"),
        Station=call)

    print(etree.tostring(nickname, pretty_print=True).decode('ASCII'))
