Add error checking for queries
Add function get episode lengths from database
Set export directory if not specified
Move encoding stage into media episode class