MythTV is the magic word. At least it was ten years ago when we were still watching TV. It comes with server and client packages. Kodi can also serve as a client. You can set up automatic recordings, timeshift, it can serve other videos and music. It’s great.