TrakIt
Guess additional information from track titles
- Project page
https://github.com/ratoaq2/trakit
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 requires Python 3.11 or later.
TrakIt is a command line tool. The simplest way to run it, with no install step, is uvx (part of uv):
$ uvx trakit "Português (Brasil)"
To install it instead, so it stays available on your PATH:
$ uv tool install trakit
pip is also supported. Use a dedicated virtualenv or the --user flag for a
better isolation with your system:
$ pip install --user trakit
TrakIt is also a library. To add it as a dependency to a uv-managed project:
$ uv add trakit
The -y/--yaml option needs the optional yaml extra:
$ uv tool install "trakit[yaml]"
Development
TrakIt uses uv to manage its environment and dependencies.
$ uv sync --all-extras
$ bash scripts/test.sh
This runs ruff (lint and format check), mypy and the test suite.
pre-commit hooks mirror the same checks and run automatically on git commit:
$ uv run pre-commit install --hook-type pre-commit --hook-type commit-msg
See CONTRIBUTING.md for the branch, commit, and pull request rules.
Data
- Available languages are the same supported by Diaoul/babelfish
- Localized country names were fetched from mledoze/countries
- Localized language names were fetched from mozilla/language-mapping-list
Metadata
Release files for trakit 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| trakit-0.5.0.tar.gz | 38.4 kB | Without provenance | Details for trakit-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| trakit-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for trakit-0.5.0-py3-none-any.whl |
Total release size: 58.7 kB
Release files / trakit-0.5.0.tar.gz
| Download URL | trakit-0.5.0.tar.gz |
|---|---|
| Size | 38.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
592a6aac08b16f04d020590662365b34116fddf79b3bad0716b4d73d0ec3b063
|
|
BLAKE2b-256 checksum How to use checksums |
1a94f9e905bbc91a294a30b61c7d13d8216a4e301217fdcfd0298062760d725a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / trakit-0.5.0-py3-none-any.whl
| Download URL | trakit-0.5.0-py3-none-any.whl |
|---|---|
| Size | 20.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83a8d7989c9982cbdc139196fc8905d7afe1d582dec282d927d06ff592233b53
|
|
BLAKE2b-256 checksum How to use checksums |
6cc6f16a2666ce9cf508c3b10f6995c467d5b531851ef51c711a8653f8b3e9ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for trakit 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.