incorporated changes made by graysky2's in his fork at https://github.com/graysky2/mplayer-resumer