adding script to write local media cache