You need a Toslink receiver for the optical and an S/PDIF reveiver IC (or a small FPGA) and a DAC.
Fun fact: with a few resistor changes to the input, you can put the electrical S/PDIF signal through one of those video sender transmitters and pull decodeable S/PDIF out the receiver - bandwidth is about the same as video but the levels are different. Nice clean digital distribution without noise, until someone microwaves popcorn to go with the movie, in which case at least it cuts off cleanly.