Allow users to just override the zip file write part instead of entire write function.
Summary of changes:
ability to specify a media_function which if filled with a valid function can allow customizing to user needs. fallback is standard media write functionality.
context manager for sqlite because looks cleaner and autocommits on success. You can drop this part if not to your preference.
instead of mkstemp why not use NamedTemporaryFile? I like it because it automatically closes the file upon cleanup due to exit or scope change. mkstemp needs to be manually cleaned and handled which can leave files if interrupted somehow.
write package to temp file first, then on success move to final location. This way, an error won't delete an existing package that one may attempt to overwrite. Basically a safety step. This is also the same default behavior for linux zip command line utility. It first writes to temp file in same directory then moves to overwrite.
Referring to #102 and #103:
Allow users to just override the zip file write part instead of entire write function.
Summary of changes: