Media
*****

Media helpers for experiments.

This module covers two related jobs: serving pregenerated files from
the experiment "static/" directory, and lower-level audio/S3 utilities
(batch packing, WAV recoding, bucket setup).

psynet.media.make_batch_file(in_files, output_path)

   Concatenate files into a single batch file, each prefixed by its
   4-byte size.

   Use "unpack_batch_file()" to split the batch again.

   Parameters:
      * **in_files** (*list** of **str*) -- Paths of the files to
        pack, in order.

      * **output_path** (*str*) -- Path of the batch file to write.

psynet.media.setup_bucket_for_presigned_urls(bucket_name, public_read=False)

   Configure an S3 bucket so browsers can GET and PUT objects through
   presigned URLs.

   Replaces the bucket's CORS rules. Typically run from a
   "PreDeployRoutine".

   Parameters:
      * **bucket_name** (*str*) -- Name of the S3 bucket.

      * **public_read** (*bool*) -- Also add a bucket policy allowing
        public reads of all objects.

psynet.media.static_url_for(path, *, experiment_root=None)

   Return the public "/static/..." URL for a file under "static/".

   Parameters:
      * **path** ("Union"["str", "Path"]) -- File path, absolute or
        relative to the experiment directory.

      * **experiment_root** ("Union"["str", "Path", "None"]) --
        Experiment directory. Defaults to the current working
        directory.

   Return type:
      "str"

psynet.media.unpack_batch_file(input_path, output_paths)

   Converts a batch file into a list of files. It's the inverse of
   make_batch_file. :type input_path: "str" :param input_path: :type
   input_path: str, path to the batch file :type output_paths:
   "list"["str"] :param output_paths: :type output_paths: list of str,
   paths to the output files :param Returns output_paths: :param
   -------:
