upsies.utils.mediainfo.text
Subtitles information
Functions
- upsies.utils.mediainfo.text.get_subtitles(content_path)[source]
Return sequence of
Subtitleobjects from all subtitle sourcesThis function combines all
get_subtitles_*functions.If content_path is a multi-disc release (i.e. a directory that contains multiple directories that each contain a VIDEO_TS or BDMV subdirectory), it returns the combined subtitles of all discs.
- Parameters:
content_path – Path to release file or directory
- upsies.utils.mediainfo.text.get_subtitles_from_bluray(content_path)[source]
Return sequence of
Subtitleobjects fromBDMVsubdirectoryIf content_path is not a directory or does not contain a
BDMVsubdirectory, the returned sequence is empty.- Parameters:
content_path – Path directory that contains
BDMVsubdirectory
- upsies.utils.mediainfo.text.get_subtitles_from_dvd(content_path)[source]
Return sequence of
Subtitleobjects fromVIDEO_TSsubdirectoryIf content_path is not a directory or does not contain a
VIDEO_TSsubdirectory, the returned sequence is empty.- Parameters:
content_path – Path directory that contains
VIDEO_TSsubdirectory
- upsies.utils.mediainfo.text.get_subtitles_from_idx_files(content_path)[source]
Return sequence of
Subtitleobjects from*.idxfilesFor .idx/.sub pairs, the .idx file can contain the language.
If content_path is a directory, it is searched recursively for
*.idxfiles.If content_path is not a directory, the returned sequence is empty.
- Parameters:
content_path – Path to release file or directory
- upsies.utils.mediainfo.text.get_subtitles_from_mediainfo(content_path)[source]
Return sequence of
Subtitleobjects frommediainfooutputOnly the first video is used to find subtitles (see
find_videos()).- Parameters:
content_path – Path to release file or directory
- upsies.utils.mediainfo.text.get_subtitles_from_text_files(content_path)[source]
Return sequence of
Subtitleobjects from subtitle file namesFor a video file named “foo.mkv”, the subtitle language can be in the file name, e.g. “foo.en.srt” or “foo.eng.ass”.
If content_path is a directory, it is searched recursively for subtitle files.
If content_path is not a directory, the returned sequence is empty.
- Parameters:
content_path – Path to release file or directory
Classes
- class upsies.utils.mediainfo.text.Subtitle(*, language, forced=False, format='')[source]
Bases:
objectDataclass that stores information about a subtitle track
- Parameters:
language –
BCP47 language code with optional country code (e.g. “en”, “en-UK”, “es-419”, “zh-HANS”)
- References:
https://www.matroska.org/technical/notes.html [Language Codes] https://en.wikipedia.org/wiki/IETF_language_tag
If language is not a valid language code, the language and region attributes are empty strings.
forced (bool) – Whether the subtitle track should always be played
format (bool) – Subtitle format (e.g. “SRT”, “VobSub”, “PGS”)
If language is not a valid BCP47 code, it is set to “?”.
- property language
Language part of the language initialization argument, e.g. “en”, “es”, “zh”, etc.
- property region
Region part of the language initialization argument, e.g. “UK”, “419”, “HANS”, etc.
- property forced
Whether the subtitle track should always be played
- property format
Subtitle format (e.g. “SRT”, “VobSub”, “PGS”)