File: index.md

package info (click to toggle)
guessit 3.8.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,196 kB
  • sloc: python: 4,731; sh: 10; makefile: 7
file content (178 lines) | stat: -rw-r--r-- 7,420 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
GuessIt
=======

[![Latest Version](https://img.shields.io/pypi/v/guessit.svg)](https://pypi.python.org/pypi/guessit)
[![LGPLv3 License](https://img.shields.io/badge/license-LGPLv3-blue.svg)]()
[![Build Status](https://img.shields.io/github/workflow/status/guessit-io/guessit/ci)](https://github.com/guessit-io/guessit/actions?query=workflow%3Aci)
[![Coveralls](https://img.shields.io/coveralls/guessit-io/guessit/master.svg)](https://coveralls.io/github/guessit-io/guessit?branch=master)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/relekang/python-semantic-release)

GuessIt is a python library that extracts as much information as
possible from a video filename.

It has a very powerful matcher that allows to guess properties from a
video using its filename only. This matcher works with both movies and
tv shows episodes.

For example, GuessIt can do the following:

    $ guessit "Treme.1x03.Right.Place,.Wrong.Time.HDTV.XviD-NoTV.avi"
    For: Treme.1x03.Right.Place,.Wrong.Time.HDTV.XviD-NoTV.avi
    GuessIt found: {
        "title": "Treme",
        "season": 1,
        "episode": 3,
        "episode_title": "Right Place, Wrong Time",
        "source": "HDTV",
        "video_codec": "Xvid",
        "release_group": "NoTV",
        "container": "avi",
        "mimetype": "video/x-msvideo",
        "type": "episode"
    }

Migration note
-----

In GuessIt 3, some properties and values were renamed in order to keep consistency and to be more intuitive.

To migrate from guessit `2.x` to `3.x`, please read
[migration2to3.md](./migration2to3.md).

To migrate from guessit `0.x` or `1.x` to `guessit 2.x`, please read
[migration.md](./migration.md).

Install
-----

Installing GuessIt is simple with [pip](http://www.pip-installer.org/):

```bash
pip install guessit
```

You can also [install GuessIt from sources](./sources.md)

Usage
-----

GuessIt can be used from command line:

```
usage: guessit [-h] [-t TYPE] [-n] [-Y] [-D] [-L ALLOWED_LANGUAGES]
               [-C ALLOWED_COUNTRIES] [-E] [-T EXPECTED_TITLE]
               [-G EXPECTED_GROUP] [--includes INCLUDES] [--excludes EXCLUDES]
               [-f INPUT_FILE] [-v] [-P SHOW_PROPERTY] [-a] [-s] [-l] [-j]
               [-y] [-i] [-c CONFIG] [--no-user-config] [--no-default-config]
               [-p] [-V] [--version]
               [filename [filename ...]]

positional arguments:
  filename              Filename or release name to guess

optional arguments:
  -h, --help            show this help message and exit

Naming:
  -t TYPE, --type TYPE  The suggested file type: movie, episode. If undefined,
                        type will be guessed.
  -n, --name-only       Parse files as name only, considering "/" and "\" like
                        other separators.
  -Y, --date-year-first
                        If short date is found, consider the first digits as
                        the year.
  -D, --date-day-first  If short date is found, consider the second digits as
                        the day.
  -L ALLOWED_LANGUAGES, --allowed-languages ALLOWED_LANGUAGES
                        Allowed language (can be used multiple times)
  -C ALLOWED_COUNTRIES, --allowed-countries ALLOWED_COUNTRIES
                        Allowed country (can be used multiple times)
  -E, --episode-prefer-number
                        Guess "serie.213.avi" as the episode 213. Without this
                        option, it will be guessed as season 2, episode 13
  -T EXPECTED_TITLE, --expected-title EXPECTED_TITLE
                        Expected title to parse (can be used multiple times)
  -G EXPECTED_GROUP, --expected-group EXPECTED_GROUP
                        Expected release group (can be used multiple times)
  --includes INCLUDES   List of properties to be detected
  --excludes EXCLUDES   List of properties to be ignored

Input:
  -f INPUT_FILE, --input-file INPUT_FILE
                        Read filenames from an input text file. File should
                        use UTF-8 charset.

Output:
  -v, --verbose         Display debug output
  -P SHOW_PROPERTY, --show-property SHOW_PROPERTY
                        Display the value of a single property (title, series,
                        video_codec, year, ...)
  -a, --advanced        Display advanced information for filename guesses, as
                        json output
  -s, --single-value    Keep only first value found for each property
  -l, --enforce-list    Wrap each found value in a list even when property has
                        a single value
  -j, --json            Display information for filename guesses as json
                        output
  -y, --yaml            Display information for filename guesses as yaml
                        output
  -i, --output-input-string
                        Add input_string property in the output

Configuration:
  -c CONFIG, --config CONFIG
                        Filepath to configuration file. Configuration file
                        contains the same options as those from command line
                        options, but option names have "-" characters replaced
                        with "_". This configuration will be merged with
                        default and user configuration files.
  --no-user-config      Disable user configuration. If not defined, guessit
                        tries to read configuration files at
                        ~/.guessit/options.(json|yml|yaml) and
                        ~/.config/guessit/options.(json|yml|yaml)
  --no-default-config   Disable default configuration. This should be done
                        only if you are providing a full configuration through
                        user configuration or --config option. If no
                        "advanced_config" is provided by another configuration
                        file, it will still be loaded from default
                        configuration.

Information:
  -p, --properties      Display properties that can be guessed.
  -V, --values          Display property values that can be guessed.
  --version             Display the guessit version.
```

It can also be used as a python module:

    >>> from guessit import guessit
    >>> guessit('Treme.1x03.Right.Place,.Wrong.Time.HDTV.XviD-NoTV.avi')
    MatchesDict([('title', 'Treme'), ('season', 1), ('episode', 3), ('episode_title', 'Right Place, Wrong Time'), ('source', 'HDTV'), ('video_codec', 'Xvid'), ('release_group', 'NoTV'), ('container', 'avi'), ('mimetype', 'video/x-msvideo'), ('type', 'episode')])

`MatchesDict` is a dict that keeps matches ordering.

Command line options can be given as dict or string to the second argument.

Configuration
-------------

Find more about Guessit configuration at [configuration page](./configuration.md).

REST API
--------

A REST API will be available soon ...

Sources are available in a dedicated [guessit-rest repository](https://github.com/Toilal/guessit-rest).

Support
-------

This project is hosted on [GitHub](https://github.com/guessit-io/guessit). Feel free to open an issue if you think you have found a bug or something is missing in guessit.

GuessIt relies on [Rebulk](https://github.com/Toilal/rebulk) project for pattern and rules registration.

License
-------

GuessIt is licensed under the [LGPLv3 license](http://www.gnu.org/licenses/lgpl.html).