Fix memory leak on add channel
Reduce code duplication
Remove autodestructor
formatting: fix some indentation and remove deprecated function.
Replace all use of write() with tvh_write().

tvh_write() will deal with incomplete/interrupted writes and will ensure
the write operation is completed unless a fatal error occurs.
Merge remote-tracking branch 'origin/pr/199'
Merge remote-tracking branch 'origin/pr/200'
Merge remote-tracking branch 'origin/pr/201'
webui: simplification of the tvheadend_webroot processing.
[PR-174] - Icon caching support to reduce overhead on upstream providers.
[PR-174] - Replaced user submitted icon cache with more generic image cache.

This allows file:// paths to be specified for channel icons even if image
cache support is disabled.

The image cache functionality is compile time optional (for those without
curl support) and also run-time configurable for those that don't want it.

All images, including EPG ones should be cached.