Skip to main content

TrakIt

Guess additional information from track titles

Latest Version

tests

License

PyPI - Python Version

Info

TrakIt is a track name parser. It is a tiny library created to solve a very specific problem. It's very common that video files do not have precise metadata information, where you can have multiple subtitle tracks tagged as Portuguese, but one of them is actually Brazilian Portuguese:

{
  "codec": "SubRip/SRT",
  "id": 19,
  "properties": {
    "codec_id": "S_TEXT/UTF8",
    "codec_private_length": 0,
    "default_track": false,
    "enabled_track": true,
    "encoding": "UTF-8",
    "forced_track": false,
    "language": "por",
    "language_ietf": "pt",
    "number": 20,
    "text_subtitles": true,
    "track_name": "Português",
    "uid": 160224385584803173
  }
}

{
  "codec": "SubRip/SRT",
  "id": 20,
  "properties": {
    "codec_id": "S_TEXT/UTF8",
    "codec_private_length": 0,
    "default_track": false,
    "enabled_track": true,
    "encoding": "UTF-8",
    "forced_track": false,
    "language": "por",
    "language_ietf": "pt",
    "number": 21,
    "text_subtitles": true,
    "track_name": "Português (Brasil)",
    "uid": 1435945803220205
  }
}

Or you have multiple audio tracks in English, but one of them is British English (British English Forced (PGS)) and others are American English (American English (PGS))

Given a track name, TrakIt can guess the language:

>> trakit "Português (Brasil)"
{
  "language": "pt-BR"
}
>> trakit -t filename "foobar.en.sdh.srt"
{
  "language": "en"
  "hearing_impaired": true
}

TrakIt is also able to identify:

  • SDH: Subtitles for the Deaf or Hard of Hearing
  • Forced flag
  • Closed captions
  • Alternate version tracks
  • Commentary tracks
>> trakit "British English (SDH) (PGS)"
{
  "language": "en-GB",
  "hearing_impaired": true
}

>> trakit "English CC (SRT)"
{
  "language": "en",
  "closed_caption": true
}

>> trakit "Cast and Crew Commentary (English AC3 Stereo)"
{
  "language": "en",
  "commentary": true
}

>> trakit "Français Forced (SRT)"
{
  "language": "fr",
  "forced": true
}

All available CLI options:

>> trakit --help
usage: trakit [-h] [-l EXPECTED_LANGUAGE] [--debug] [-y] [--version] value

positional arguments:
  value                 track title to guess

options:
  -h, --help            show this help message and exit

Configuration:
  -l EXPECTED_LANGUAGE, --expected-language EXPECTED_LANGUAGE
                        The expected language to be guessed
  -t, --type TYPE       The input type: trackname or filename. Default is trackname

Output:
  --debug               Print information for debugging trakit and for reporting bugs.
  -y, --yaml            Display output in yaml format

Information:
  --version             show program's version number and exit

TrakIt is not a release parser. Use GuessIt

TrakIt is not a video metadata extractor. Use KnowIt. KnowIt already uses trakit to enhance the extracted information

Installation

TrakIt can be installed as a regular python module by running:

$ [sudo] pip install trakit

For a better isolation with your system you should use a dedicated virtualenv or install for your user only using the --user flag.

Data

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trakit-0.3.0.tar.gz (34.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trakit-0.3.0-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file trakit-0.3.0.tar.gz.

File metadata

  • Download URL: trakit-0.3.0.tar.gz
  • Upload date:
  • Size: 34.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.13.14 Linux/6.17.0-1020-azure

File hashes

Hashes for trakit-0.3.0.tar.gz
Algorithm Hash digest
SHA256 677d1ac4c4165d172286d5e67af844036403d956a89533de2ee2b7b9a6c78624
MD5 fe0260d05e34d6266175c7a892747038
BLAKE2b-256 036aa401b7435e2457baaadc88356d385adf17dc38b7af47b5f8856e07046fe0

See more details on using hashes here.

File details

Details for the file trakit-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: trakit-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.13.14 Linux/6.17.0-1020-azure

File hashes

Hashes for trakit-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 facbb3afdf781c66fe69f57a0baa0b7ca39e94c7fb07cfc69a89832708d7eea9
MD5 aba9640a79535db3d9e3deab3e256a06
BLAKE2b-256 8baeca192cd1527d793453c443357e0be1fcd2af1c9102c5c050c1b68a369022

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page