use xbmc.sleep
refactor main
add progress dialog
add utility method for sending json-rpc
cosmetics