code: async def print_what_is_playing(loop):
      
      details = conf.AppleTV(ADDRESS, NAME)
      details.add_service(conf.DmapService(HSGID))
  
      print('Connecting to {}'.format(details.address))
      atv = pyatv.connect_to_apple_tv(details, loop)
  
      try:
          print((await atv.metadata.playing()))
      finally:
          # Do not forget to logout
          await atv.logout()
docs: Connect to device and print what is playing.