def lookup_tag(name): """Look up a tag based on its key. Returns a DmapTag.""" return next((_TAGS[t] for t in _TAGS if t == name), DmapTag(_read_unknown, 'unknown tag'))
from pyatv.dmap import DmapTag from pyatv.tags import (read_bool, read_uint, read_str, read_raw, read_ignore) _LOGGER = logging.getLogger(__name__) # Internal version that works like read_ignore, but also logs def _read_unknown(data, start, length): #_LOGGER.debug('Unknown data: %s', str(data[start-8:start+length+8])) return 0 # These are the tags that we know about so far # pylint: disable=bad-whitespace _TAGS = { 'aeFP': DmapTag(read_uint, 'com.apple.itunes.req-fplay'), 'aeSV': DmapTag(read_uint, 'com.apple.itunes.music-sharing-version'), 'apro': DmapTag(read_uint, 'daap.protocolversion'), 'asgr': DmapTag(read_uint, 'com.apple.itunes.gapless-resy'), 'ated': DmapTag(read_bool, 'daap.supportsextradata'), 'caar': DmapTag(read_uint, 'dacp.albumrepeat'), 'caas': DmapTag(read_uint, 'dacp.albumshuffle'), 'caci': DmapTag('container', 'dacp.controlint'), 'cafe': DmapTag(read_bool, 'dacp.fullscreenenabled'), 'cafs': DmapTag(read_uint, 'dacp.fullscreen'), 'cana': DmapTag(read_str, 'daap.nowplayingartist'), 'cang': DmapTag(read_str, 'dacp.nowplayinggenre'), 'canl': DmapTag(read_str, 'daap.nowplayingalbum'), 'cann': DmapTag(read_str, 'daap.nowplayingtrack'), 'cant': DmapTag(read_uint, 'dacp.remainingtime'), 'capr': DmapTag(read_uint, 'dacp.protocolversion'),