audio_curation.audio_repo

class audio_curation.audio_repo.AudioRepo(repo_paths, archive_audio_item=None, git_remote_origin_basepath=None)[source]

An Audio file repository. The local repository, by default, is assumed to be a collection of git repository working directories (self.repo_paths) with two subfolders:

  • mp3: Containing mp3-s for every “episode” in the repository.
  • normalized_mp3: Automatically generated from mp3/*.mp3.

Remote staging/ storage can happen via git remotes and an archive item with a given id.

Current recommendations regarding git repos:

  • be mindful of Github repo size limits (1GB as of 2018)
  • setup .gitignore in the repo so as to ignore contents of normalized_mp3
  • periodically collapse git history (using update_git()) so as to avoid wasted space.
get_normalized_files()[source]

Get all non-outdated normalized-sound files from this repo.

Returns:List of :py:class:mp3_utility.Mp3File objects
get_particular_normalized_files(basename_list)[source]

Get normalized-sound files corresponding to basename_list.

Parameters:basename_list – A list of file names.
Returns:List of :py:class:mp3_utility.Mp3File objects
get_unnormalized_files()[source]

Get all

Returns:List of :py:class:mp3_utility.Mp3File objects
reprocess_files(mp3_files)[source]

When you add a new file to the repository, use this method to update the metadata, the local normalized file colleciton, archive and git locations.

update_archive_item(mp3_files_in, overwrite_all=False, start_at=None, mirror_repo_structure=False, dry_run=False)[source]

Upload a bunch of files to archive.

Parameters:
  • mp3_files_in – List of :py:class:mp3_utility.Mp3File objects
  • overwrite_all – Boolean
  • start_at – String representing the basename of the file to start the uploading with.
  • mirror_repo_structure – In archive item, place each file in a folder mirroring its local location.
  • dry_run – Boolean
update_archive_metadata(mp3_files)[source]

Update archive metadata based on mp3 file metadata.

Parameters:mp3_files – List of :py:class:mp3_utility.Mp3File objects
update_git(collapse_history=False, first_push=False)[source]

Update git repos associated with this item.

Parameters:
  • collapse_history – Boolean. Git history involving mp3 files takes up too much space - more than what providers like GitHub offer for free. This option makes this method put up the latest files without any history.
  • first_push – Boolean. Do git push –set-upstream origin master in such cases.
update_metadata(mp3_files)[source]

Update mp3 metadata of a bunch of files. Meant to be overridden.

Parameters:mp3_files – List of :py:class:mp3_utility.Mp3File objects
audio_curation.audio_repo.check_loudness(mp3_files)[source]

Get some stats about loudness levels among a bunch of mp3 files.

Parameters:mp3_files – List of :py:class:mp3_utility.Mp3File objects
audio_curation.audio_repo.update_normalized_mp3s(mp3_files)[source]

Regenerate normalized files corresponding to some mp3_files

Parameters:mp3_files – List of :py:class:mp3_utility.Mp3File objects