tvheadend: code cleanups.
tvheadend: fix tvheadend resets when xbmc is reset