upsies.utils.mediainfo.audio

Functions

upsies.utils.mediainfo.audio.get_audio_channels(path, default=<object object>)[source]

Return audio channels of default audio track (e.g. “5.1”) or empty_string (e.g. if path has no audio track)

Parameters:
  • path (str) –

    Path to video file

    For directories, the return value of find_main_video() is used.

  • default – Return value if path doesn’t exist, raise ContentError if not provided

Raises:

ContentError – if anything goes wrong

upsies.utils.mediainfo.audio.get_audio_format(path, default=<object object>)[source]

Return audio format of default audio track (e.g. “AAC”, “DDP Atmos”) or empty string if path has no audio track

Parameters:
  • path (str) –

    Path to video file

    For directories, the return value of find_main_video() is used.

  • default – Return value if path doesn’t exist, raise ContentError if not provided

Raises:

ContentError – if anything goes wrong

upsies.utils.mediainfo.audio.get_audio_languages(path, default=<object object>, *, exclude_commentary=True)[source]

Return sequence of two-letter (ISO 639-1) language codes from audio tracks

If an audio track does not specify a language, use default if specified, otherwise ignore that audio track.

Parameters:
  • path (str) –

    Path to release files

    For directories, the return value of find_main_video() is used.

    BDMV and VIDEO_TS releases are supported. For multi-disc releases (i.e. path contains multiple directories with “BDMV” or “VIDEO_TS” subdirectories), languages from all discs are accumulated.

  • default – Return value if path doesn’t exist, raise ContentError if not provided

  • exclude_commentary

    Ignore any track with a "Title" field that contains the string “commentary” (case-insensitive)

    Warning

    Commentary detection is not supported for BDMV and VIDEO_TS releases.

Raises:

ContentError – if anything goes wrong

upsies.utils.mediainfo.audio.get_audio_languages_from_discs(path, default=<object object>, *, exclude_commentary=True)[source]

Return sequence of two-letter (ISO 639-1) language codes from audio tracks

This function reads audio languages from .MPLS or .IFO playlists in a “VIDEO_TS” or “BDMV” subdirectory. path may be a multidisc release.

See get_audio_languages().

upsies.utils.mediainfo.audio.get_audio_languages_from_mediainfo(path, default=<object object>, *, exclude_commentary=True)[source]

Return sequence of BCP47 language codes from audio tracks

This function supports regular video files (.mkv, .mp4, .avi, etc).

See get_audio_languages().

upsies.utils.mediainfo.audio.has_commentary(path, default=<object object>)[source]

Return True if path has an audio track with “Commentary” (case-insensitive) in its Title field, False otherwise

Parameters:
  • path (str) –

    Path to video file

    For directories, the return value of find_main_video() is used.

  • default – Return value if path doesn’t exist, raise ContentError if not provided

Raises:

ContentError – if anything goes wrong

upsies.utils.mediainfo.audio.has_dual_audio(path, default=<object object>)[source]

Return True if path contains multiple audio tracks with different languages and one of them is English, False otherwise

Parameters:
  • path (str) –

    Path to video file

    For directories, the return value of find_main_video() is used.

  • default – Return value if path doesn’t exist, raise ContentError if not provided

Raises:

ContentError – if anything goes wrong

upsies.utils.mediainfo.audio.has_language(path, default=<object object>)[source]

Return True if path has one or more audio tracks and the language of the main audio track is not “zxx”

Parameters:
  • path (str) –

    Path to video file

    For directories, the return value of find_main_video() is used.

  • default – Return value if path doesn’t exist, raise ContentError if not provided

Raises:

ContentError – if anything goes wrong