Explore concept for general and protocol specific settings
What to investigate Most things in pyatv are currently hardcoded to somewhat "decent" values, but there are times where it would be desirable to have some flexibility regarding these values. One example is the keep-alive mechanism in MRP that I suspect doesn't work all that well for everyone. Having an option to disable it would be great.
When pairing, I provide a **kwargs solution where additional settings can be passed. For instance the remote name can be changed in DMAP. It also provides a method for passing a shared Zeroconf instance from python-zeroconf instead of creating a new one. I'm currently in a similar situation in RAOP, where I need to publish a zeroconf service and thus need a Zeroconf instance. There's no natural way of doing that right now. The simplest solution would be to pass it as an argument to stream_file, but that's just strange as python-zeroconf is an implementation detail. I don't want to pollute the API with it in semi-random places.
So... I would like something that can be passed to all the basic API functions, I.e. scan, pair and connect that can contain general pyatv settings (e.g. default timers or "names"), protocol specific settings (enable/disable something) and shared instances of 3rd party libraries (currently aiohttp and python-zeroconf). That way I can control a lot of thing internally in a simple way. I however need a way to distribute that instance in the code without polluting too much. Another concern is... should I opt for greater flexibility by just storing key-value-pairs or use something that is more strongly typed? Pros and cons in both camps.
Expected outcome Example of what this API would look like.