<commit_before># `tvnamer`

`tvnamer` is a utility which to rename files from `some.show.s01e03.blah.abc.avi` to `Some Show - [01x03] - The Episode Name.avi` (by retrieving the episode name using data from [`tvdb_api`](http://github.com/dbr/tvdb_api))

It supports Python 2.7 and 3.3 onwards

## Installing

The "official" way to install `tvnamer` is via `pip`:

    pip install tvnamer

This installs the `tvnamer` command-line tool and the requirements from [the `tvnamer` package on PyPI](https://pypi.python.org/pypi/tvnamer/)

Alternatively, the community have packaged tvnamer in various platform/distro specific package managers, including:

1. [Homebrew for OS X](http://brewformulas.org/Tvnamer) - `brew install tvnamer`
2. [Debian](https://tracker.debian.org/pkg/tvnamer) - `apt-get install tvnamer`
3. [FreeBSD/DragonFlyBSD/MacPorts](https://www.freshports.org/multimedia/py-tvnamer) - `pkg install py27-tvnamer` etc


# Installing development version

If you wish to install the latest (non-stable) development version from source, download the latest version of the code, either from <http://github.com/dbr/tvnamer/tarball/master> or by running:

    git clone git://github.com/dbr/tvnamer.git

..then `cd` into the directory, and run:

    python setup.py install

You may wish to do this via virtualenv to avoid cluttering your global install

Example terminal session:

    $ virtualenv tvn-env
    [...]
    Installing setuptools, pip, wheel...done.
    $ source tvn-env/bin/activate
    (tvn-env) $ git clone git://github.com/dbr/tvnamer.git
    Cloning into 'tvnamer'...
    [...]
    (tvn-env) $ cd tvnamer/
    (tvn-env) $ python setup.py develop
    [...]
    (tvn-env) $ tvnamer --help
    [...]
    (tvn-env) $ deactivate
    $ tvnamer
    -bash: tvnamer: command not found

## Improvements over v1

tvnamer v2 is a near-complete rewrite of the tvnamer released as part of `tvdb_api`. There are many improvements thanks to the improved code structure, but the most important are:

- Support for anime filenames, such as `[Shinsen-Subs] Beet - 19 [24DAB497].mkv`
- Support for multi-episode files, such as `scrubs.s01e23e24.avi`
- Custom configuration options (via a JSON config file) and improved command line argument handling
- Better support for Unicode filenames
- Support for moving files to specific location after renaming (`/media/tv/{series name}/season {seasonnumber}/` for example)

## Bugs?

Please file issues on tvnamer's [Github Issues page](http://github.com/dbr/tvnamer/issues) (older tickets can be found on [Lighthouse](http://dbr.lighthouseapp.com/projects/36049-tvnamer))

Please make tickets for any possible bugs or feature requests, or if you discover a filename format that tvnamer cannot parse (as long as a reasonably common format, and has enough information to be parsed!), or if you are struggling with the a custom configuration (please state your desired filename output, and what problems you are encountering)

## Basic usage

From the command line, simply run:

    tvnamer the.file.s01e01.avi

For example:

    $ tvnamer brass.eye.s01e01.avi
    ####################
    # Starting tvnamer<commit_msg>Legal bits, and remove reference to old ticket system<commit_after># `tvnamer`

`tvnamer` is a utility which to rename files from `some.show.s01e03.blah.abc.avi` to `Some Show - [01x03] - The Episode Name.avi` (by retrieving the episode name using data from [`tvdb_api`](http://github.com/dbr/tvdb_api))

It supports Python 2.7 and 3.3 onwards

TV information is provided by TheTVDB.com, but we are not endorsed or certified by TheTVDB.com or its affiliates.

## Installing

The "official" way to install `tvnamer` is via `pip`:

    pip install tvnamer

This installs the `tvnamer` command-line tool and the requirements from [the `tvnamer` package on PyPI](https://pypi.python.org/pypi/tvnamer/)

Alternatively, the community have packaged tvnamer in various platform/distro specific package managers, including:

1. [Homebrew for OS X](http://brewformulas.org/Tvnamer) - `brew install tvnamer`
2. [Debian](https://tracker.debian.org/pkg/tvnamer) - `apt-get install tvnamer`
3. [FreeBSD/DragonFlyBSD/MacPorts](https://www.freshports.org/multimedia/py-tvnamer) - `pkg install py27-tvnamer` etc


# Installing development version

If you wish to install the latest (non-stable) development version from source, download the latest version of the code, either from <http://github.com/dbr/tvnamer/tarball/master> or by running:

    git clone git://github.com/dbr/tvnamer.git

..then `cd` into the directory, and run:

    python setup.py install

You may wish to do this via virtualenv to avoid cluttering your global install

Example terminal session:

    $ virtualenv tvn-env
    [...]
    Installing setuptools, pip, wheel...done.
    $ source tvn-env/bin/activate
    (tvn-env) $ git clone git://github.com/dbr/tvnamer.git
    Cloning into 'tvnamer'...
    [...]
    (tvn-env) $ cd tvnamer/
    (tvn-env) $ python setup.py develop
    [...]
    (tvn-env) $ tvnamer --help
    [...]
    (tvn-env) $ deactivate
    $ tvnamer
    -bash: tvnamer: command not found

## Improvements over v1

tvnamer v2 is a near-complete rewrite of the tvnamer released as part of `tvdb_api`. There are many improvements thanks to the improved code structure, but the most important are:

- Support for anime filenames, such as `[Shinsen-Subs] Beet - 19 [24DAB497].mkv`
- Support for multi-episode files, such as `scrubs.s01e23e24.avi`
- Custom configuration options (via a JSON config file) and improved command line argument handling
- Better support for Unicode filenames
- Support for moving files to specific location after renaming (`/media/tv/{series name}/season {seasonnumber}/` for example)

## Bugs?

Please file issues on tvnamer's [Github Issues page](http://github.com/dbr/tvnamer/issues)

Please make tickets for any possible bugs or feature requests, or if you discover a filename format that tvnamer cannot parse (as long as a reasonably common format, and has enough information to be parsed!), or if you are struggling with the a custom configuration (please state your desired filename output, and what problems you are encountering)

## Basic usage

From the command line, simply run:

    tvnamer the.file.s01e01.avi

For example:

    $ tvnamer brass.eye.s01e01.avi
    ####################
    # Starting tvnamer
{'fraction_non_alphanumeric': 0.10358877918821502, 'fraction_numerical': 0.01332079611346184, 'mean_word_length': 3.8680396643783372, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1809682', 'n_tokens_mistral': 2053, 'n_tokens_neox': 1940, 'n_words': 734}