Refactor HTML metadata parser

Rewrite the HTML metadata parser to make it faster and more robust.
Fixes #1217751 [adding XHTML book: some METADATA  is not used](https://bugs.launchpad.net/calibre/+bug/1217751)
newdb: Fix refreshdb not working in GUI

Fix calibredb not updating the running calibre instance properly.
Fixes #1218177 [Running app does not refresh list when book added with calibredb add](https://bugs.launchpad.net/calibre/+bug/1218177)
...
multisort: Sort only once on any given field
Ensure that the all_ids() call does not cause locking issues
newdb: Do not error out if the db contains null entries in the authors table
Fix warnings from pyflakes
Test for sort by id
version 1.1.0
Fix save to disk with books on an MTP device not working on windows.
Use sanitize file name instead of ascii_filename when saving to disk from device
Fix for broken file type plugins

Prevent file type plugins that spin the event loop by displaying a
dialog from causing locking errors. The lock is now acquired only after
the file type plugin has run on import.
...
newdb: Automatically fix broken link tables

Fixes #1218783 [Beim Starten von Calibre bleibt das Startlogo bestehen und Pythons meldet einen Fehler.](https://bugs.launchpad.net/calibre/+bug/1218783)
newdb: Handle databases that have empty author records

Fixes #1218465 [Can not Edit Metadata](https://bugs.launchpad.net/calibre/+bug/1218465)
newdb: Automatically sanitize ratings tables that contain rating records
Update Instapaper
Use approx_formats when creating the formats column

Have the template used for the formats column when clicking the Formats
shortcut in the create columns dialog use approximate_formats() instead
of formats.
Amazon metadata download: Update to handle website changes at amazon.com
...