Skip to content

Commit

Permalink
Merge fdcc531 into 183f190
Browse files Browse the repository at this point in the history
  • Loading branch information
ratoaq2 committed Jun 11, 2017
2 parents 183f190 + fdcc531 commit 8efa35f
Show file tree
Hide file tree
Showing 22 changed files with 1,167 additions and 717 deletions.
6 changes: 3 additions & 3 deletions README.rst
Expand Up @@ -36,7 +36,7 @@ For example, GuessIt can do the following::
"season": 1,
"episode": 3,
"episode_title": "Right Place, Wrong Time",
"format": "HDTV",
"source": "HDTV",
"video_codec": "XviD",
"release_group": "NoTV",
"container": "avi",
Expand Down Expand Up @@ -145,7 +145,7 @@ 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'), ('format', 'HDTV'), ('video_codec', 'XviD'), ('release_group', 'NoTV'), ('container', 'avi'), ('mimetype', 'video/x-msvideo'), ('type', 'episode')])
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.

Expand All @@ -163,7 +163,7 @@ GuessIt is also available on `Docker Hub <https://hub.docker.com/r/guessit/guess
"season": 1,
"episode": 3,
"episode_title": "Right Place, Wrong Time",
"format": "HDTV",
"source": "HDTV",
"video_codec": "XviD",
"release_group": "NoTV",
"container": "avi",
Expand Down
10 changes: 5 additions & 5 deletions docs/index.rst
Expand Up @@ -36,7 +36,7 @@ For example, GuessIt can do the following::
"season": 1,
"episode": 3,
"episode_title": "Right Place, Wrong Time",
"format": "HDTV",
"source": "HDTV",
"video_codec": "XviD",
"release_group": "NoTV",
"container": "avi",
Expand All @@ -47,10 +47,10 @@ For example, GuessIt can do the following::
Migration note
--------------

GuessIt 2 has been rewriten from scratch. GuessIt is now a release name parser only, and support for additional
features like hashes computations has been dropped.
In GuessIt 3, some properties and values were renamed in order to keep consistency and to be more intuitive.

To migrate from guessit ``0.x`` or ``1.x``, please read the :ref:`migration page<migration>`.
To migrate from guessit ``2.x`` to guessit ``3.x``, please read the :ref:`migration page<migration2to3>`.
To migrate from guessit ``0.x`` or ``1.x`` to guessit ``2.x``, please read the :ref:`migration page<migration>`.

Install
-------
Expand Down Expand Up @@ -143,7 +143,7 @@ It can also be used as a python module::

>>> from guessit import guessit
>>> guessit('Treme.1x03.Right.Place,.Wrong.Time.HDTV.XviD-NoTV.avi') # doctest: +ALLOW_UNICODE
MatchesDict([('title', 'Treme'), ('season', 1), ('episode', 3), ('episode_title', 'Right Place, Wrong Time'), ('format', 'HDTV'), ('video_codec', 'XviD'), ('release_group', 'NoTV'), ('container', 'avi'), ('mimetype', 'video/x-msvideo'), ('type', 'episode')])
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.

Expand Down
44 changes: 44 additions & 0 deletions docs/migration2to3.rst
@@ -0,0 +1,44 @@
.. _migration2to3:

Migration
=========
Guessit 3 has introduced breaking changes from previous versions. You can find in this file all information required to
perform a migration from previous version ``2.x``.

API
---
No changes.

Properties
----------
Some properties have been renamed.

- ``format`` is now ``source``.


Values
------
The major changes in GuessIt 3 are around the values. Values were renamed in order to keep consistency and to be more
intuitive. Acronyms are uppercase (e.g.: ``HDTV``). Names follow the official name (e.g.: ``Blu-ray``). Words have only
the first letter capitalized (e.g.: ``Camera``) except prepositions (e.g.: ``on``) which are all lowercase.

The following values were changed:

``source`` (former ``format`` property)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ``Cam`` is now ``Camera`` or ``HD Camera``
- ``Telesync`` is now ``Telesync`` or ``HD Telesync``
- ``PPV`` is now ``Pay-per-view``
- ``DVB`` is now ``Digital TV``
- ``VOD`` is now ``Video on Demand``
- ``WEBRip`` is now ``Web`` with additional property ``other: Rip``
- ``WEB-DL`` is now ``Web``
- ``AHDTV`` is now ``Analogue HDTV``
- ``UHDTV`` is now ``Ultra HDTV``
- ``HDTC`` is now ``HD Telecine``


``other``
^^^^^^^^^
- ``Rip`` was added. E.g.: ``DVDRip`` will output ``other: Rip``

30 changes: 16 additions & 14 deletions docs/properties.rst
Expand Up @@ -10,7 +10,7 @@ So, for instance,

- ``DVDSCR`` will be guessed as ``format`` = ``DVD`` + ``other`` = ``Screener``
- ``1920x1080`` will be guessed as ``screenSize`` = ``1080p``
- ``DD5.1`` will be guessed as ``audioCodec`` = ``DolbyDigital`` + ``audioChannel`` = ``5.1``
- ``DD5.1`` will be guessed as ``audioCodec`` = ``AC3`` + ``audioChannel`` = ``5.1``


Main properties
Expand Down Expand Up @@ -39,8 +39,8 @@ Main properties

- ``3g2``, ``3gp``, ``3gp2``, ``asf``, ``ass``, ``avi``, ``divx``, ``flv``, ``idx``, ``iso``, ``m4v``, ``mk2``,
``mkv``, ``mka``, ``mov``, ``mp4``, ``mp4a``, ``mpeg``, ``mpg``, ``nfo``, ``nzb``, ``ogg``, ``ogm``, ``ogv``,
``qt``, ``ra``, ``ram``, ``rm``, ``srt``, ``ssa``, ``sub``, ``torrent``, ``ts``, ``vob``, ``wav``, ``webm``, ``wma``,
``wmv``
``qt``, ``ra``, ``ram``, ``rm``, ``srt``, ``ssa``, ``sub``, ``torrent``, ``ts``, ``vob``, ``wav``, ``webm``,
``wma``, ``wmv``


- **mimetype**
Expand Down Expand Up @@ -131,12 +131,13 @@ Episode properties
Video properties
----------------

- **format**
- **source**

Format of the initial source
Source of the release

- ``AHDTV``, ``BluRay``, ``Cam``, ``DVB``, ``DVD``, ``HD-DVD``, ``HDTC``, ``HDTV``, ``PPV``, ``SATRip``, ``Telecine``,
``Telesync``, ``TV``, ``UHDTV``, ``VHS``, ``VOD``, ``WEB-DL``, ``WEBRip``, ``Workprint``
- ``Analogue HDTV``, ``Blu-ray``, ``Camera``, ``Digital TV``, ``DVD``, ``HD Camera``, ``HD Telecine``,
``HD Telesync``, ``HD-DVD``, ``HDTV``, ``Pay-per-view``, ``Satellite``, ``Telecine``, ``Telesync``, ``TV``,
``Ultra HDTV``, ``VHS``, ``Video on Demand``, ``Web``, ``Workprint``


- **screen_size**
Expand Down Expand Up @@ -181,7 +182,7 @@ Audio properties

Codec used for audio.

- ``DTS`` ``TrueHD`` ``AAC`` ``AC3`` ``EAC3`` ``MP3`` ``Flac`` ``DolbyAtmos``
- ``DTS``, ``TrueHD``, ``AAC``, ``AC3``, ``EAC3``, ``MP3``, ``Flac``, ``DolbyAtmos``


- **audio_profile**
Expand Down Expand Up @@ -281,10 +282,11 @@ Other properties

Other property will appear under this property.

- ``3D``, ``AudioFix``, ``Bonus``, ``CC``, ``Classic``, ``Colorized``, ``Complete``, ``Converted``, ``Documentary``,
``DDC``, ``DualAudio``, ``East Coast Feed``, ``Fansub``, ``Fastsub``, ``FINAL``, ``FullHD``,
``Hardcoded Subtitles``, ``HD``, ``HDLight``, ``HQ``, ``HR``, ``Internal``, ``LD``, ``Limited``, ``LiNE``, ``MD``,
``mHD``, ``Mux``, ``NTSC``, ``Open Matte``, ``Original Aspect Ratio``, ``OV``, ``PAL``, ``Preair``, ``Proper``,
``PS Vita``, ``R5``, ``Read NFO``, ``ReEncoded``, ``Remux``, ``Retail``, ``Screener``, ``SECAM``,
``Straight to Video``, ``SyncFix``, ``Trailer``, ``UltraHD``, ``West Coast Feed``, ``WideScreen``, ``XXX``
- ``3D``, ``AudioFix``, ``Bonus``, ``Capped``, ``CC``, ``Classic``, ``Colorized``, ``Complete``,
``Converted``, ``Documentary``, ``DDC``, ``DualAudio``, ``East Coast Feed``,
``Fansub``, ``Fastsub``, ``FINAL``, ``FullHD``, ``Hardcoded Subtitles``, ``HD``, ``HDLight``, ``HQ``,
``HR``, ``Internal``, ``LD``, ``LiNE``, ``MD``, ``mHD``, ``Mux``, ``NTSC``, ``Open Matte``,
``Original Aspect Ratio``, ``OV``, ``PAL``, ``Preair``, ``Proper``, ``PS Vita``, ``R5``, ``Read NFO``,
``ReEncoded``, ``Remux``, ``Retail``, ``Rip``, ``Screener``, ``SECAM``, ``Straight to Video``,
``SyncFix``, ``Trailer``, ``UltraHD``, ``West Coast Feed``, ``WideScreen``, ``XXX``

4 changes: 2 additions & 2 deletions guessit/rules/__init__.py
Expand Up @@ -10,7 +10,7 @@

from .properties.episodes import episodes
from .properties.container import container
from .properties.format import format_
from .properties.source import source
from .properties.video_codec import video_codec
from .properties.audio_codec import audio_codec
from .properties.screen_size import screen_size
Expand Down Expand Up @@ -49,7 +49,7 @@ def rebulk_builder():

rebulk.rebulk(episodes())
rebulk.rebulk(container())
rebulk.rebulk(format_())
rebulk.rebulk(source())
rebulk.rebulk(video_codec())
rebulk.rebulk(audio_codec())
rebulk.rebulk(screen_size())
Expand Down
6 changes: 3 additions & 3 deletions guessit/rules/properties/container.py
Expand Up @@ -23,7 +23,7 @@ def container():
formatter=lambda value: value.strip(seps),
tags=['extension'],
conflict_solver=lambda match, other: other
if other.name in ['format', 'video_codec'] or
if other.name in ('source', 'video_codec') or
other.name == 'container' and 'extension' not in other.tags
else '__default__')

Expand All @@ -46,8 +46,8 @@ def container():
validator=seps_surround,
formatter=lambda s: s.lower(),
conflict_solver=lambda match, other: match
if other.name in ['format',
'video_codec'] or other.name == 'container' and 'extension' in other.tags
if other.name in ('source',
'video_codec') or other.name == 'container' and 'extension' in other.tags
else '__default__')

rebulk.string(*[sub for sub in subtitles if sub not in ['sub']], tags=['subtitle'])
Expand Down
2 changes: 1 addition & 1 deletion guessit/rules/properties/episode_title.py
Expand Up @@ -43,7 +43,7 @@ class RemoveConflictsWithEpisodeTitle(Rule):
def __init__(self, previous_names):
super(RemoveConflictsWithEpisodeTitle, self).__init__()
self.previous_names = previous_names
self.next_names = ('streaming_service', 'screen_size', 'format',
self.next_names = ('streaming_service', 'screen_size', 'source',
'video_codec', 'audio_codec', 'other', 'container')
self.affected_if_holes_after = ('part', )
self.affected_names = ('part', 'year')
Expand Down
72 changes: 0 additions & 72 deletions guessit/rules/properties/format.py

This file was deleted.

6 changes: 3 additions & 3 deletions guessit/rules/properties/language.py
Expand Up @@ -28,7 +28,7 @@ def language():
rebulk.string(*subtitle_suffixes, name="subtitle_language.suffix", ignore_case=True, private=True,
validator=seps_surround)
rebulk.string(*lang_suffixes, name="language.suffix", ignore_case=True, private=True,
validator=seps_surround, tags=['format-suffix'])
validator=seps_surround, tags=['source-suffix'])
rebulk.functional(find_languages, properties={'language': [None]})
rebulk.rules(SubtitlePrefixLanguageRule, SubtitleSuffixLanguageRule, SubtitleExtensionRule)

Expand Down Expand Up @@ -436,7 +436,7 @@ class SubtitleExtensionRule(Rule):
"""
Convert language guess as subtitle_language if next match is a subtitle extension.
Since it's a strong match, it also removes any conflicting format with it.
Since it's a strong match, it also removes any conflicting source with it.
"""
consequence = [RemoveMatch, RenameMatch('subtitle_language')]

Expand All @@ -449,4 +449,4 @@ def when(self, matches, context):
if subtitle_extension:
subtitle_lang = matches.previous(subtitle_extension, lambda match: match.name == 'language', 0)
if subtitle_lang:
return matches.conflicting(subtitle_lang, lambda m: m.name == 'format'), subtitle_lang
return matches.conflicting(subtitle_lang, lambda m: m.name == 'source'), subtitle_lang

0 comments on commit 8efa35f

Please sign in to comment.