audioconcat package

Audio Concat API.

Submodules

audioconcat.audio_files module

Basic functions for audio files.

class audioconcat.audio_files.AudioFiles(folder_files)

Bases: object

Container class for audio files to concat.

property name
audioconcat.audio_files.check_and_get_album_from_id3(files)

Check if all provided files have the same ID3 album tag and return it.

Parameters:

files – A list of files to check and get ID3 album tag from.

Returns:

album name

Raise:

RuntimeException if files does not have same album.

audioconcat.audio_files.check_and_get_artist_from_id3(files)

Check if all provided files have the same ID3 artist tag and return it.

Parameters:

files – A list of files to check and get ID3 artist tag from.

Returns:

artist name

Raise:

RuntimeException if files does not have same artist.

audioconcat.concat module

Module with concat logic.

class audioconcat.concat.FfmpegConcat(ffmpeg_exec)

Bases: object

Concat a list of files using FFmpeg.

concat(files, output)
audioconcat.concat.concat_audio_files(folder_files, output_dir, concat_impl)
audioconcat.concat.retrieve_and_concat_audio_files(input_dir, output_dir, ffmpeg_exec)

audioconcat.file_system module

Basic file system functions.

class audioconcat.file_system.FolderFiles(files)

Bases: object

Container class for files of one folder.

property extensions
property name
audioconcat.file_system.check_and_get_directory(files)

Check if all provided files have the same directory and return it.

Parameters:

files – A list of files to check and get directory from.

Returns:

Base directory of the files.

Raise:

RuntimeException if files does not have same base directory.

audioconcat.file_system.get_leaf_files(folder, whitelist=None)

Generator to retrieve a list of files per folder.

Parameters:
  • folder – Folder to start recursive search.

  • whitelist – Whitelist of file extensions to include.

Returns:

A list of all files matching the whitelist in one folder.

audioconcat.sub_commands module

Module for CLI command implementations.

class audioconcat.sub_commands.ConcatCmd

Bases: SubCommand

Retrieve and concat audio files per innermost folder.

classmethod execute(args)

Execute the command.

Must be implemented by a sub-command.

Parameters:

args – argparse arguments.

Returns:

0 on success.

class audioconcat.sub_commands.SubCommand

Bases: ABC

Abstract base class for sub commands.

A new sub command can be added by calling the init_subparser().

abstract classmethod execute(args)

Execute the command.

Must be implemented by a sub-command.

Parameters:

args – argparse arguments.

Returns:

0 on success.

classmethod init_subparser(subparsers)

Initialize the argument parser and help for the specific sub-command.

Parameters:

subparsers (argparse.ArgumentParser) – A subparser.

Returns:

void

audioconcat.util module

General utility methods.

audioconcat.util.remove_special_characters(input_str)

Remove (some) special character from string, e.g. comma or Umlaute.

Parameters:

input_str – String to remove special characters.

Returns:

String without special characters.