diff --git a/channels/ilcorsaronero.py b/channels/ilcorsaronero.py index b456435f..f3f336b2 100644 --- a/channels/ilcorsaronero.py +++ b/channels/ilcorsaronero.py @@ -40,13 +40,18 @@ def mainlist(item): @support.scrape def peliculas(item): - ptn = True - patron = r'>(?P[^"<]+) ]+>(?P[^<]+)<[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<size>[^<]+)<[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<seed>[^<]+)' + sceneTitle = True + if item.args[1] in ['tvshow', 'anime']: + patron = r'>[^"<]+' + else: + patron = r'>(?P<quality>[^"<]+)' + patron += '</td> <TD[^>]+><A class="tab" HREF="(?P<url>[^"]+)"\s*>(?P<title>[^<]+)<[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<size>[^<]+)<[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<seed>[^<]+)' def itemHook(item): # item.title = item.title.replace('.',' ') item.contentType = item.args[1] thumb = (item.args[1] if type(item.args) == list else item.args) + '.png' item.thumbnail = support.thumb(thumb=thumb) + return item if 'search' not in item.args: support.log('OK') @@ -58,7 +63,7 @@ def peliculas(item): contentType=item.contentType, title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), url=item.url, - args=item.args[0] + 1, + args=[item.args[0] + 1, item.args[1]], thumbnail=support.thumb())) return itemlist return locals() diff --git a/core/support.py b/core/support.py index 2c48fd0c..2b8ac3d5 100755 --- a/core/support.py +++ b/core/support.py @@ -7,7 +7,7 @@ import os import re import sys -from lib.PTN import PTN +from lib.guessit import guessit PY3 = False if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int @@ -174,7 +174,7 @@ def cleantitle(title): cleantitle = title.replace('"', "'").replace('×', 'x').replace('–', '-').strip() return cleantitle -def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, typeContentDict, typeActionDict, blacklist, search, pag, function, lang, ptn): +def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, typeContentDict, typeActionDict, blacklist, search, pag, function, lang, sceneTitle): itemlist = [] log("scrapeBlock qui") if debug: @@ -270,24 +270,39 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t # make formatted Title [longtitle] s = ' - ' title = episode + (s if episode and title else '') + title - longtitle = title + (s if title and title2 else '') + title2 + longtitle = title + (s if title and title2 else '') + title2 + '\n' - lang1, longtitle = scrapeLang(scraped, lang, longtitle) - - if ptn: - titlePTN = PTN().parse(title.replace('.',' ')) - title = longtitle = titlePTN.get('title', '') + if sceneTitle: + parsedTitle = guessit(title) + title = longtitle = parsedTitle.get('title', '') log('TITOLO',title) - if titlePTN.get('quality', '') or titlePTN.get('resolution', ''): - quality = titlePTN.get('quality', '') + " " + titlePTN.get('resolution', '') + if parsedTitle.get('source'): + quality = str(parsedTitle.get('source')) + if parsedTitle.get('screen_size'): + quality += ' ' + str(parsedTitle.get('screen_size', '')) if not scraped['year']: - infolabels['year'] = titlePTN.get('year', '') - if titlePTN.get('episode', None) and titlePTN.get('season', None): - longtitle = str(titlePTN.get('season')) + 'x' + str(titlePTN.get('episode')).zfill(2) + s + title - elif titlePTN.get('season', None): - longtitle = config.get_localized_string(60027) % str(titlePTN.get('season')) + s + title + infolabels['year'] = parsedTitle.get('year', '') + if parsedTitle.get('episode') and parsedTitle.get('season'): + longtitle = title + s + + if type(parsedTitle.get('season')) == list: + longtitle += str(parsedTitle.get('season')[0]) + '-' + str(parsedTitle.get('season')[-1]) + else: + longtitle += str(parsedTitle.get('season')) + + if type(parsedTitle.get('episode')) == list: + longtitle += 'x' + str(parsedTitle.get('episode')[0]).zfill(2) + '-' + str(parsedTitle.get('episode')[-1]).zfill(2) + else: + longtitle += 'x' + str(parsedTitle.get('episode')).zfill(2) + elif parsedTitle.get('season') and type(parsedTitle.get('season')) == list: + longtitle += s + config.get_localized_string(30140) + " " +str(parsedTitle.get('season')[0]) + '-' + str(parsedTitle.get('season')[-1]) + elif parsedTitle.get('season'): + longtitle += s + config.get_localized_string(60027) % str(parsedTitle.get('season')) + if parsedTitle.get('episode_title'): + longtitle += s + parsedTitle.get('episode_title') longtitle = typo(longtitle, 'bold') + lang1, longtitle = scrapeLang(scraped, lang, longtitle) longtitle += typo(quality, '_ [] color kod') if quality else '' longtitle += typo(scraped['size'], '_ [] color kod') if scraped['size'] else '' longtitle += typo(scraped['seed'] + ' SEEDS', '_ [] color kod') if scraped['seed'] else '' @@ -397,7 +412,7 @@ def scrape(func): if 'pagination' in args and inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes']: pagination = args['pagination'] if args['pagination'] else 20 else: pagination = '' lang = args['deflang'] if 'deflang' in args else '' - ptn = args.get('ptn', False) + sceneTitle = args.get('sceneTitle') pag = item.page if item.page else 1 # pagination matches = [] @@ -420,7 +435,7 @@ def scrape(func): if 'season' in bl and bl['season']: item.season = bl['season'] blockItemlist, blockMatches = scrapeBlock(item, args, bl['block'], patron, headers, action, pagination, debug, - typeContentDict, typeActionDict, blacklist, search, pag, function, lang, ptn) + typeContentDict, typeActionDict, blacklist, search, pag, function, lang, sceneTitle) for it in blockItemlist: if 'lang' in bl: it.contentLanguage, it.title = scrapeLang(bl, it.contentLanguage, it.title) @@ -431,7 +446,7 @@ def scrape(func): matches.extend(blockMatches) elif patron: itemlist, matches = scrapeBlock(item, args, data, patron, headers, action, pagination, debug, typeContentDict, - typeActionDict, blacklist, search, pag, function, lang, ptn) + typeActionDict, blacklist, search, pag, function, lang, sceneTitle) if 'itemlistHook' in args: itemlist = args['itemlistHook'](itemlist) diff --git a/lib/PTN/__init__.py b/lib/PTN/__init__.py deleted file mode 100755 index d4346dbd..00000000 --- a/lib/PTN/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -from .parse import PTN -# https://github.com/divijbindlish/parse-torrent-name -__author__ = 'Divij Bindlish' -__email__ = 'dvjbndlsh93@gmail.com' -__version__ = '1.1.1' -__license__ = 'MIT' - -ptn = PTN() - - -def parse(name): - return ptn.parse(name) diff --git a/lib/PTN/parse.py b/lib/PTN/parse.py deleted file mode 100755 index 688dbe38..00000000 --- a/lib/PTN/parse.py +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import re -from .patterns import patterns, types - - -class PTN(object): - def _escape_regex(self, string): - return re.sub('[\-\[\]{}()*+?.,\\\^$|#\s]', '\\$&', string) - - def __init__(self): - self.torrent = None - self.excess_raw = None - self.group_raw = None - self.start = None - self.end = None - self.title_raw = None - self.parts = None - - def _part(self, name, match, raw, clean): - # The main core instructuions - self.parts[name] = clean - - if len(match) != 0: - # The instructions for extracting title - index = self.torrent['name'].find(match[0]) - if index == 0: - self.start = len(match[0]) - elif self.end is None or index < self.end: - self.end = index - - if name != 'excess': - # The instructions for adding excess - if name == 'group': - self.group_raw = raw - if raw is not None: - self.excess_raw = self.excess_raw.replace(raw, '') - - def _late(self, name, clean): - if name == 'group': - self._part(name, [], None, clean) - elif name == 'episodeName': - clean = re.sub('[\._]', ' ', clean) - clean = re.sub('_+$', '', clean) - self._part(name, [], None, clean.strip()) - - def parse(self, name): - self.parts = {} - self.torrent = {'name': name} - self.excess_raw = name - self.group_raw = '' - self.start = 0 - self.end = None - self.title_raw = None - - for key, pattern in patterns: - if key not in ('season', 'episode', 'website'): - pattern = r'\b%s\b' % pattern - - clean_name = re.sub('_', ' ', self.torrent['name']) - match = re.findall(pattern, clean_name, re.I) - if len(match) == 0: - continue - - index = {} - if isinstance(match[0], tuple): - match = list(match[0]) - if len(match) > 1: - index['raw'] = 0 - index['clean'] = 1 - else: - index['raw'] = 0 - index['clean'] = 0 - - if key in types.keys() and types[key] == 'boolean': - clean = True - else: - clean = match[index['clean']] - if key in types.keys() and types[key] == 'integer': - clean = int(clean) - if key == 'group': - if re.search(patterns[5][1], clean, re.I) \ - or re.search(patterns[4][1], clean): - continue # Codec and quality. - if re.match('[^ ]+ [^ ]+ .+', clean): - key = 'episodeName' - if key == 'episode': - sub_pattern = self._escape_regex(match[index['raw']]) - self.torrent['map'] = re.sub( - sub_pattern, '{episode}', self.torrent['name'] - ) - self._part(key, match, match[index['raw']], clean) - - # Start process for title - raw = self.torrent['name'] - if self.end is not None: - raw = raw[self.start:self.end].split('(')[0] - - clean = re.sub('^ -', '', raw) - if clean.find(' ') == -1 and clean.find('.') != -1: - clean = re.sub('\.', ' ', clean) - clean = re.sub('_', ' ', clean) - clean = re.sub('([\[\(_]|- )$', '', clean).strip() - - self._part('title', [], raw, clean) - - # Start process for end - clean = re.sub('(^[-\. ()]+)|([-\. ]+$)', '', self.excess_raw) - clean = re.sub('[\(\)\/]', ' ', clean) - match = re.split('\.\.+| +', clean) - if len(match) > 0 and isinstance(match[0], tuple): - match = list(match[0]) - - clean = filter(bool, match) - clean = [item for item in filter(lambda a: a != '-', clean)] - clean = [item.strip('-') for item in clean] - if len(clean) != 0: - group_pattern = clean[-1] + self.group_raw - if self.torrent['name'].find(group_pattern) == \ - len(self.torrent['name']) - len(group_pattern): - self._late('group', clean.pop() + self.group_raw) - - if 'map' in self.torrent.keys() and len(clean) != 0: - episode_name_pattern = ( - '{episode}' - '' + re.sub('_+$', '', clean[0]) - ) - if self.torrent['map'].find(episode_name_pattern) != -1: - self._late('episodeName', clean.pop(0)) - - if len(clean) != 0: - if len(clean) == 1: - clean = clean[0] - self._part('excess', [], self.excess_raw, clean) - return self.parts diff --git a/lib/PTN/patterns.py b/lib/PTN/patterns.py deleted file mode 100755 index 05261e30..00000000 --- a/lib/PTN/patterns.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -patterns = [ - ('season', '(s?([0-9]{1,2}))[ex]'), - ('episode', '([ex]([0-9]{2})(?:[^0-9]|$))'), - ('year', '([\[\(]?((?:19[0-9]|20[01])[0-9])[\]\)]?)'), - ('resolution', '([0-9]{3,4}p)'), - ('quality', ('((?:PPV\.)?[HP]DTV|(?:HD)?CAM|B[DR]Rip|(?:HD-?)?TS|' - '(?:PPV )?WEB-?DL(?: DVDRip)?|HDRip|DVDRip|DVDRIP|' - 'CamRip|W[EB]BRip|BluRay|DvDScr|hdtv|telesync)')), - ('codec', '(xvid|[hx]\.?26[45])'), - ('audio', ('(MP3|DD5\.?1|Dual[\- ]Audio|LiNE|DTS|' - 'AAC[.-]LC|AAC(?:\.?2\.0)?|' - 'AC3(?:\.5\.1)?)')), - ('group', '(- ?([^-]+(?:-={[^-]+-?$)?))$'), - ('region', 'R[0-9]'), - ('extended', '(EXTENDED(:?.CUT)?)'), - ('hardcoded', 'HC'), - ('proper', 'PROPER'), - ('repack', 'REPACK'), - ('container', '(MKV|AVI|MP4)'), - ('widescreen', 'WS'), - ('website', '^(\[ ?([^\]]+?) ?\])'), - ('language', '(rus\.eng|ita\.eng)'), - ('sbs', '(?:Half-)?SBS'), - ('unrated', 'UNRATED'), - ('size', '(\d+(?:\.\d+)?(?:GB|MB))'), - ('3d', '3D') -] - -types = { - 'season': 'integer', - 'episode': 'integer', - 'year': 'integer', - 'extended': 'boolean', - 'hardcoded': 'boolean', - 'proper': 'boolean', - 'repack': 'boolean', - 'widescreen': 'boolean', - 'unrated': 'boolean', - '3d': 'boolean' -} diff --git a/lib/babelfish/__init__.py b/lib/babelfish/__init__.py new file mode 100644 index 00000000..559705a2 --- /dev/null +++ b/lib/babelfish/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2013 the BabelFish authors. All rights reserved. +# Use of this source code is governed by the 3-clause BSD license +# that can be found in the LICENSE file. +# +__title__ = 'babelfish' +__version__ = '0.5.5-dev' +__author__ = 'Antoine Bertin' +__license__ = 'BSD' +__copyright__ = 'Copyright 2015 the BabelFish authors' + +import sys + +if sys.version_info[0] >= 3: + basestr = str +else: + basestr = basestring + +from .converters import (LanguageConverter, LanguageReverseConverter, LanguageEquivalenceConverter, CountryConverter, + CountryReverseConverter) +from .country import country_converters, COUNTRIES, COUNTRY_MATRIX, Country +from .exceptions import Error, LanguageConvertError, LanguageReverseError, CountryConvertError, CountryReverseError +from .language import language_converters, LANGUAGES, LANGUAGE_MATRIX, Language +from .script import SCRIPTS, SCRIPT_MATRIX, Script diff --git a/lib/babelfish/converters/__init__.py b/lib/babelfish/converters/__init__.py new file mode 100644 index 00000000..feb687b0 --- /dev/null +++ b/lib/babelfish/converters/__init__.py @@ -0,0 +1,287 @@ +# Copyright (c) 2013 the BabelFish authors. All rights reserved. +# Use of this source code is governed by the 3-clause BSD license +# that can be found in the LICENSE file. +# +import collections +from pkg_resources import iter_entry_points, EntryPoint +from ..exceptions import LanguageConvertError, LanguageReverseError + + +# from https://github.com/kennethreitz/requests/blob/master/requests/structures.py +class CaseInsensitiveDict(collections.MutableMapping): + """A case-insensitive ``dict``-like object. + + Implements all methods and operations of + ``collections.MutableMapping`` as well as dict's ``copy``. Also + provides ``lower_items``. + + All keys are expected to be strings. The structure remembers the + case of the last key to be set, and ``iter(instance)``, + ``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()`` + will contain case-sensitive keys. However, querying and contains + testing is case insensitive: + + cid = CaseInsensitiveDict() + cid['English'] = 'eng' + cid['ENGLISH'] == 'eng' # True + list(cid) == ['English'] # True + + If the constructor, ``.update``, or equality comparison + operations are given keys that have equal ``.lower()``s, the + behavior is undefined. + + """ + def __init__(self, data=None, **kwargs): + self._store = dict() + if data is None: + data = {} + self.update(data, **kwargs) + + def __setitem__(self, key, value): + # Use the lowercased key for lookups, but store the actual + # key alongside the value. + self._store[key.lower()] = (key, value) + + def __getitem__(self, key): + return self._store[key.lower()][1] + + def __delitem__(self, key): + del self._store[key.lower()] + + def __iter__(self): + return (casedkey for casedkey, mappedvalue in self._store.values()) + + def __len__(self): + return len(self._store) + + def lower_items(self): + """Like iteritems(), but with all lowercase keys.""" + return ( + (lowerkey, keyval[1]) + for (lowerkey, keyval) + in self._store.items() + ) + + def __eq__(self, other): + if isinstance(other, collections.Mapping): + other = CaseInsensitiveDict(other) + else: + return NotImplemented + # Compare insensitively + return dict(self.lower_items()) == dict(other.lower_items()) + + # Copy is required + def copy(self): + return CaseInsensitiveDict(self._store.values()) + + def __repr__(self): + return '%s(%r)' % (self.__class__.__name__, dict(self.items())) + + +class LanguageConverter(object): + """A :class:`LanguageConverter` supports converting an alpha3 language code with an + alpha2 country code and a script code into a custom code + + .. attribute:: codes + + Set of possible custom codes + + """ + def convert(self, alpha3, country=None, script=None): + """Convert an alpha3 language code with an alpha2 country code and a script code + into a custom code + + :param string alpha3: ISO-639-3 language code + :param country: ISO-3166 country code, if any + :type country: string or None + :param script: ISO-15924 script code, if any + :type script: string or None + :return: the corresponding custom code + :rtype: string + :raise: :class:`~babelfish.exceptions.LanguageConvertError` + + """ + raise NotImplementedError + + +class LanguageReverseConverter(LanguageConverter): + """A :class:`LanguageConverter` able to reverse a custom code into a alpha3 + ISO-639-3 language code, alpha2 ISO-3166-1 country code and ISO-15924 script code + + """ + def reverse(self, code): + """Reverse a custom code into alpha3, country and script code + + :param string code: custom code to reverse + :return: the corresponding alpha3 ISO-639-3 language code, alpha2 ISO-3166-1 country code and ISO-15924 script code + :rtype: tuple + :raise: :class:`~babelfish.exceptions.LanguageReverseError` + + """ + raise NotImplementedError + + +class LanguageEquivalenceConverter(LanguageReverseConverter): + """A :class:`LanguageEquivalenceConverter` is a utility class that allows you to easily define a + :class:`LanguageReverseConverter` by only specifying the dict from alpha3 to their corresponding symbols. + + You must specify the dict of equivalence as a class variable named SYMBOLS. + + If you also set the class variable CASE_SENSITIVE to ``True`` then the reverse conversion function will be + case-sensitive (it is case-insensitive by default). + + Example:: + + class MyCodeConverter(babelfish.LanguageEquivalenceConverter): + CASE_SENSITIVE = True + SYMBOLS = {'fra': 'mycode1', 'eng': 'mycode2'} + + """ + CASE_SENSITIVE = False + + def __init__(self): + self.codes = set() + self.to_symbol = {} + if self.CASE_SENSITIVE: + self.from_symbol = {} + else: + self.from_symbol = CaseInsensitiveDict() + + for alpha3, symbol in self.SYMBOLS.items(): + self.to_symbol[alpha3] = symbol + self.from_symbol[symbol] = (alpha3, None, None) + self.codes.add(symbol) + + def convert(self, alpha3, country=None, script=None): + try: + return self.to_symbol[alpha3] + except KeyError: + raise LanguageConvertError(alpha3, country, script) + + def reverse(self, code): + try: + return self.from_symbol[code] + except KeyError: + raise LanguageReverseError(code) + + +class CountryConverter(object): + """A :class:`CountryConverter` supports converting an alpha2 country code + into a custom code + + .. attribute:: codes + + Set of possible custom codes + + """ + def convert(self, alpha2): + """Convert an alpha2 country code into a custom code + + :param string alpha2: ISO-3166-1 language code + :return: the corresponding custom code + :rtype: string + :raise: :class:`~babelfish.exceptions.CountryConvertError` + + """ + raise NotImplementedError + + +class CountryReverseConverter(CountryConverter): + """A :class:`CountryConverter` able to reverse a custom code into a alpha2 + ISO-3166-1 country code + + """ + def reverse(self, code): + """Reverse a custom code into alpha2 code + + :param string code: custom code to reverse + :return: the corresponding alpha2 ISO-3166-1 country code + :rtype: string + :raise: :class:`~babelfish.exceptions.CountryReverseError` + + """ + raise NotImplementedError + + +class ConverterManager(object): + """Manager for babelfish converters behaving like a dict with lazy loading + + Loading is done in this order: + + * Entry point converters + * Registered converters + * Internal converters + + .. attribute:: entry_point + + The entry point where to look for converters + + .. attribute:: internal_converters + + Internal converters with entry point syntax + + """ + entry_point = '' + internal_converters = [] + + def __init__(self): + #: Registered converters with entry point syntax + self.registered_converters = [] + + #: Loaded converters + self.converters = {} + + def __getitem__(self, name): + """Get a converter, lazy loading it if necessary""" + if name in self.converters: + return self.converters[name] + for ep in iter_entry_points(self.entry_point): + if ep.name == name: + self.converters[ep.name] = ep.load()() + return self.converters[ep.name] + for ep in (EntryPoint.parse(c) for c in self.registered_converters + self.internal_converters): + if ep.name == name: + # `require` argument of ep.load() is deprecated in newer versions of setuptools + if hasattr(ep, 'resolve'): + plugin = ep.resolve() + elif hasattr(ep, '_load'): + plugin = ep._load() + else: + plugin = ep.load(require=False) + self.converters[ep.name] = plugin() + return self.converters[ep.name] + raise KeyError(name) + + def __setitem__(self, name, converter): + """Load a converter""" + self.converters[name] = converter + + def __delitem__(self, name): + """Unload a converter""" + del self.converters[name] + + def __iter__(self): + """Iterator over loaded converters""" + return iter(self.converters) + + def register(self, entry_point): + """Register a converter + + :param string entry_point: converter to register (entry point syntax) + :raise: ValueError if already registered + + """ + if entry_point in self.registered_converters: + raise ValueError('Already registered') + self.registered_converters.insert(0, entry_point) + + def unregister(self, entry_point): + """Unregister a converter + + :param string entry_point: converter to unregister (entry point syntax) + + """ + self.registered_converters.remove(entry_point) + + def __contains__(self, name): + return name in self.converters diff --git a/lib/babelfish/converters/alpha2.py b/lib/babelfish/converters/alpha2.py new file mode 100644 index 00000000..aca973dd --- /dev/null +++ b/lib/babelfish/converters/alpha2.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2013 the BabelFish authors. All rights reserved. +# Use of this source code is governed by the 3-clause BSD license +# that can be found in the LICENSE file. +# +from __future__ import unicode_literals +from . import LanguageEquivalenceConverter +from ..language import LANGUAGE_MATRIX + + +class Alpha2Converter(LanguageEquivalenceConverter): + CASE_SENSITIVE = True + SYMBOLS = {} + for iso_language in LANGUAGE_MATRIX: + if iso_language.alpha2: + SYMBOLS[iso_language.alpha3] = iso_language.alpha2 diff --git a/lib/babelfish/converters/alpha3b.py b/lib/babelfish/converters/alpha3b.py new file mode 100644 index 00000000..e90c5f5e --- /dev/null +++ b/lib/babelfish/converters/alpha3b.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2013 the BabelFish authors. All rights reserved. +# Use of this source code is governed by the 3-clause BSD license +# that can be found in the LICENSE file. +# +from __future__ import unicode_literals +from . import LanguageEquivalenceConverter +from ..language import LANGUAGE_MATRIX + + +class Alpha3BConverter(LanguageEquivalenceConverter): + CASE_SENSITIVE = True + SYMBOLS = {} + for iso_language in LANGUAGE_MATRIX: + if iso_language.alpha3b: + SYMBOLS[iso_language.alpha3] = iso_language.alpha3b diff --git a/lib/babelfish/converters/alpha3t.py b/lib/babelfish/converters/alpha3t.py new file mode 100644 index 00000000..6de6e4c6 --- /dev/null +++ b/lib/babelfish/converters/alpha3t.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2013 the BabelFish authors. All rights reserved. +# Use of this source code is governed by the 3-clause BSD license +# that can be found in the LICENSE file. +# +from __future__ import unicode_literals +from . import LanguageEquivalenceConverter +from ..language import LANGUAGE_MATRIX + + +class Alpha3TConverter(LanguageEquivalenceConverter): + CASE_SENSITIVE = True + SYMBOLS = {} + for iso_language in LANGUAGE_MATRIX: + if iso_language.alpha3t: + SYMBOLS[iso_language.alpha3] = iso_language.alpha3t diff --git a/lib/babelfish/converters/countryname.py b/lib/babelfish/converters/countryname.py new file mode 100644 index 00000000..ff36c878 --- /dev/null +++ b/lib/babelfish/converters/countryname.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2013 the BabelFish authors. All rights reserved. +# Use of this source code is governed by the 3-clause BSD license +# that can be found in the LICENSE file. +# +from __future__ import unicode_literals +from . import CountryReverseConverter, CaseInsensitiveDict +from ..country import COUNTRY_MATRIX +from ..exceptions import CountryConvertError, CountryReverseError + + +class CountryNameConverter(CountryReverseConverter): + def __init__(self): + self.codes = set() + self.to_name = {} + self.from_name = CaseInsensitiveDict() + for country in COUNTRY_MATRIX: + self.codes.add(country.name) + self.to_name[country.alpha2] = country.name + self.from_name[country.name] = country.alpha2 + + def convert(self, alpha2): + if alpha2 not in self.to_name: + raise CountryConvertError(alpha2) + return self.to_name[alpha2] + + def reverse(self, name): + if name not in self.from_name: + raise CountryReverseError(name) + return self.from_name[name] diff --git a/lib/babelfish/converters/name.py b/lib/babelfish/converters/name.py new file mode 100644 index 00000000..8dd865b7 --- /dev/null +++ b/lib/babelfish/converters/name.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2013 the BabelFish authors. All rights reserved. +# Use of this source code is governed by the 3-clause BSD license +# that can be found in the LICENSE file. +# +from __future__ import unicode_literals +from . import LanguageEquivalenceConverter +from ..language import LANGUAGE_MATRIX + + +class NameConverter(LanguageEquivalenceConverter): + CASE_SENSITIVE = False + SYMBOLS = {} + for iso_language in LANGUAGE_MATRIX: + if iso_language.name: + SYMBOLS[iso_language.alpha3] = iso_language.name diff --git a/lib/babelfish/converters/opensubtitles.py b/lib/babelfish/converters/opensubtitles.py new file mode 100644 index 00000000..5b18e648 --- /dev/null +++ b/lib/babelfish/converters/opensubtitles.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2013 the BabelFish authors. All rights reserved. +# Use of this source code is governed by the 3-clause BSD license +# that can be found in the LICENSE file. +# +from __future__ import unicode_literals +from . import LanguageReverseConverter, CaseInsensitiveDict +from ..exceptions import LanguageReverseError +from ..language import language_converters + + +class OpenSubtitlesConverter(LanguageReverseConverter): + def __init__(self): + self.alpha3b_converter = language_converters['alpha3b'] + self.alpha2_converter = language_converters['alpha2'] + self.to_opensubtitles = {('por', 'BR'): 'pob', ('gre', None): 'ell', ('srp', None): 'scc', ('srp', 'ME'): 'mne'} + self.from_opensubtitles = CaseInsensitiveDict({'pob': ('por', 'BR'), 'pb': ('por', 'BR'), 'ell': ('ell', None), + 'scc': ('srp', None), 'mne': ('srp', 'ME')}) + self.codes = (self.alpha2_converter.codes | self.alpha3b_converter.codes | set(self.from_opensubtitles.keys())) + + def convert(self, alpha3, country=None, script=None): + alpha3b = self.alpha3b_converter.convert(alpha3, country, script) + if (alpha3b, country) in self.to_opensubtitles: + return self.to_opensubtitles[(alpha3b, country)] + return alpha3b + + def reverse(self, opensubtitles): + if opensubtitles in self.from_opensubtitles: + return self.from_opensubtitles[opensubtitles] + for conv in [self.alpha3b_converter, self.alpha2_converter]: + try: + return conv.reverse(opensubtitles) + except LanguageReverseError: + pass + raise LanguageReverseError(opensubtitles) diff --git a/lib/babelfish/converters/scope.py b/lib/babelfish/converters/scope.py new file mode 100644 index 00000000..73540063 --- /dev/null +++ b/lib/babelfish/converters/scope.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2013 the BabelFish authors. All rights reserved. +# Use of this source code is governed by the 3-clause BSD license +# that can be found in the LICENSE file. +# +from __future__ import unicode_literals +from . import LanguageConverter +from ..exceptions import LanguageConvertError +from ..language import LANGUAGE_MATRIX + + +class ScopeConverter(LanguageConverter): + FULLNAME = {'I': 'individual', 'M': 'macrolanguage', 'S': 'special'} + SYMBOLS = {} + for iso_language in LANGUAGE_MATRIX: + SYMBOLS[iso_language.alpha3] = iso_language.scope + codes = set(SYMBOLS.values()) + + def convert(self, alpha3, country=None, script=None): + if self.SYMBOLS[alpha3] in self.FULLNAME: + return self.FULLNAME[self.SYMBOLS[alpha3]] + raise LanguageConvertError(alpha3, country, script) diff --git a/lib/babelfish/converters/type.py b/lib/babelfish/converters/type.py new file mode 100644 index 00000000..3b7378c2 --- /dev/null +++ b/lib/babelfish/converters/type.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2013 the BabelFish authors. All rights reserved. +# Use of this source code is governed by the 3-clause BSD license +# that can be found in the LICENSE file. +# +from __future__ import unicode_literals +from . import LanguageConverter +from ..exceptions import LanguageConvertError +from ..language import LANGUAGE_MATRIX + + +class LanguageTypeConverter(LanguageConverter): + FULLNAME = {'A': 'ancient', 'C': 'constructed', 'E': 'extinct', 'H': 'historical', 'L': 'living', 'S': 'special'} + SYMBOLS = {} + for iso_language in LANGUAGE_MATRIX: + SYMBOLS[iso_language.alpha3] = iso_language.type + codes = set(SYMBOLS.values()) + + def convert(self, alpha3, country=None, script=None): + if self.SYMBOLS[alpha3] in self.FULLNAME: + return self.FULLNAME[self.SYMBOLS[alpha3]] + raise LanguageConvertError(alpha3, country, script) diff --git a/lib/babelfish/country.py b/lib/babelfish/country.py new file mode 100644 index 00000000..4c24b52b --- /dev/null +++ b/lib/babelfish/country.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2013 the BabelFish authors. All rights reserved. +# Use of this source code is governed by the 3-clause BSD license +# that can be found in the LICENSE file. +# +from __future__ import unicode_literals +from collections import namedtuple +from functools import partial +from pkg_resources import resource_stream # @UnresolvedImport +from .converters import ConverterManager +from . import basestr + + +COUNTRIES = {} +COUNTRY_MATRIX = [] + +#: The namedtuple used in the :data:`COUNTRY_MATRIX` +IsoCountry = namedtuple('IsoCountry', ['name', 'alpha2']) + +f = resource_stream('babelfish', 'data/iso-3166-1.txt') +f.readline() +for l in f: + iso_country = IsoCountry(*l.decode('utf-8').strip().split(';')) + COUNTRIES[iso_country.alpha2] = iso_country.name + COUNTRY_MATRIX.append(iso_country) +f.close() + + +class CountryConverterManager(ConverterManager): + """:class:`~babelfish.converters.ConverterManager` for country converters""" + entry_point = 'babelfish.country_converters' + internal_converters = ['name = babelfish.converters.countryname:CountryNameConverter'] + +country_converters = CountryConverterManager() + + +class CountryMeta(type): + """The :class:`Country` metaclass + + Dynamically redirect :meth:`Country.frommycode` to :meth:`Country.fromcode` with the ``mycode`` `converter` + + """ + def __getattr__(cls, name): + if name.startswith('from'): + return partial(cls.fromcode, converter=name[4:]) + return type.__getattribute__(cls, name) + + +class Country(CountryMeta(str('CountryBase'), (object,), {})): + """A country on Earth + + A country is represented by a 2-letter code from the ISO-3166 standard + + :param string country: 2-letter ISO-3166 country code + + """ + def __init__(self, country): + if country not in COUNTRIES: + raise ValueError('%r is not a valid country' % country) + + #: ISO-3166 2-letter country code + self.alpha2 = country + + @classmethod + def fromcode(cls, code, converter): + """Create a :class:`Country` by its `code` using `converter` to + :meth:`~babelfish.converters.CountryReverseConverter.reverse` it + + :param string code: the code to reverse + :param string converter: name of the :class:`~babelfish.converters.CountryReverseConverter` to use + :return: the corresponding :class:`Country` instance + :rtype: :class:`Country` + + """ + return cls(country_converters[converter].reverse(code)) + + def __getstate__(self): + return self.alpha2 + + def __setstate__(self, state): + self.alpha2 = state + + def __getattr__(self, name): + try: + return country_converters[name].convert(self.alpha2) + except KeyError: + raise AttributeError(name) + + def __hash__(self): + return hash(self.alpha2) + + def __eq__(self, other): + if isinstance(other, basestr): + return str(self) == other + if not isinstance(other, Country): + return False + return self.alpha2 == other.alpha2 + + def __ne__(self, other): + return not self == other + + def __repr__(self): + return '<Country [%s]>' % self + + def __str__(self): + return self.alpha2 diff --git a/lib/babelfish/data/get_files.py b/lib/babelfish/data/get_files.py new file mode 100644 index 00000000..aaa090cc --- /dev/null +++ b/lib/babelfish/data/get_files.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2013 the BabelFish authors. All rights reserved. +# Use of this source code is governed by the 3-clause BSD license +# that can be found in the LICENSE file. +# +from __future__ import unicode_literals +import os.path +import tempfile +import zipfile +import requests + + +DATA_DIR = os.path.dirname(__file__) + +# iso-3166-1.txt +print('Downloading ISO-3166-1 standard (ISO country codes)...') +with open(os.path.join(DATA_DIR, 'iso-3166-1.txt'), 'w') as f: + r = requests.get('http://www.iso.org/iso/home/standards/country_codes/country_names_and_code_elements_txt.htm') + f.write(r.content.strip()) + +# iso-639-3.tab +print('Downloading ISO-639-3 standard (ISO language codes)...') +with tempfile.TemporaryFile() as f: + r = requests.get('http://www-01.sil.org/iso639-3/iso-639-3_Code_Tables_20130531.zip') + f.write(r.content) + with zipfile.ZipFile(f) as z: + z.extract('iso-639-3.tab', DATA_DIR) + +# iso-15924 +print('Downloading ISO-15924 standard (ISO script codes)...') +with tempfile.TemporaryFile() as f: + r = requests.get('http://www.unicode.org/iso15924/iso15924.txt.zip') + f.write(r.content) + with zipfile.ZipFile(f) as z: + z.extract('iso15924-utf8-20131012.txt', DATA_DIR) + +# opensubtitles supported languages +print('Downloading OpenSubtitles supported languages...') +with open(os.path.join(DATA_DIR, 'opensubtitles_languages.txt'), 'w') as f: + r = requests.get('http://www.opensubtitles.org/addons/export_languages.php') + f.write(r.content) + +print('Done!') diff --git a/lib/babelfish/data/iso-3166-1.txt b/lib/babelfish/data/iso-3166-1.txt new file mode 100644 index 00000000..da105072 --- /dev/null +++ b/lib/babelfish/data/iso-3166-1.txt @@ -0,0 +1,250 @@ +Country Name;ISO 3166-1-alpha-2 code +AFGHANISTAN;AF +ÅLAND ISLANDS;AX +ALBANIA;AL +ALGERIA;DZ +AMERICAN SAMOA;AS +ANDORRA;AD +ANGOLA;AO +ANGUILLA;AI +ANTARCTICA;AQ +ANTIGUA AND BARBUDA;AG +ARGENTINA;AR +ARMENIA;AM +ARUBA;AW +AUSTRALIA;AU +AUSTRIA;AT +AZERBAIJAN;AZ +BAHAMAS;BS +BAHRAIN;BH +BANGLADESH;BD +BARBADOS;BB +BELARUS;BY +BELGIUM;BE +BELIZE;BZ +BENIN;BJ +BERMUDA;BM +BHUTAN;BT +BOLIVIA, PLURINATIONAL STATE OF;BO +BONAIRE, SINT EUSTATIUS AND SABA;BQ +BOSNIA AND HERZEGOVINA;BA +BOTSWANA;BW +BOUVET ISLAND;BV +BRAZIL;BR +BRITISH INDIAN OCEAN TERRITORY;IO +BRUNEI DARUSSALAM;BN +BULGARIA;BG +BURKINA FASO;BF +BURUNDI;BI +CAMBODIA;KH +CAMEROON;CM +CANADA;CA +CAPE VERDE;CV +CAYMAN ISLANDS;KY +CENTRAL AFRICAN REPUBLIC;CF +CHAD;TD +CHILE;CL +CHINA;CN +CHRISTMAS ISLAND;CX +COCOS (KEELING) ISLANDS;CC +COLOMBIA;CO +COMOROS;KM +CONGO;CG +CONGO, THE DEMOCRATIC REPUBLIC OF THE;CD +COOK ISLANDS;CK +COSTA RICA;CR +CÔTE D'IVOIRE;CI +CROATIA;HR +CUBA;CU +CURAÇAO;CW +CYPRUS;CY +CZECH REPUBLIC;CZ +DENMARK;DK +DJIBOUTI;DJ +DOMINICA;DM +DOMINICAN REPUBLIC;DO +ECUADOR;EC +EGYPT;EG +EL SALVADOR;SV +EQUATORIAL GUINEA;GQ +ERITREA;ER +ESTONIA;EE +ETHIOPIA;ET +FALKLAND ISLANDS (MALVINAS);FK +FAROE ISLANDS;FO +FIJI;FJ +FINLAND;FI +FRANCE;FR +FRENCH GUIANA;GF +FRENCH POLYNESIA;PF +FRENCH SOUTHERN TERRITORIES;TF +GABON;GA +GAMBIA;GM +GEORGIA;GE +GERMANY;DE +GHANA;GH +GIBRALTAR;GI +GREECE;GR +GREENLAND;GL +GRENADA;GD +GUADELOUPE;GP +GUAM;GU +GUATEMALA;GT +GUERNSEY;GG +GUINEA;GN +GUINEA-BISSAU;GW +GUYANA;GY +HAITI;HT +HEARD ISLAND AND MCDONALD ISLANDS;HM +HOLY SEE (VATICAN CITY STATE);VA +HONDURAS;HN +HONG KONG;HK +HUNGARY;HU +ICELAND;IS +INDIA;IN +INDONESIA;ID +IRAN, ISLAMIC REPUBLIC OF;IR +IRAQ;IQ +IRELAND;IE +ISLE OF MAN;IM +ISRAEL;IL +ITALY;IT +JAMAICA;JM +JAPAN;JP +JERSEY;JE +JORDAN;JO +KAZAKHSTAN;KZ +KENYA;KE +KIRIBATI;KI +KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF;KP +KOREA, REPUBLIC OF;KR +KUWAIT;KW +KYRGYZSTAN;KG +LAO PEOPLE'S DEMOCRATIC REPUBLIC;LA +LATVIA;LV +LEBANON;LB +LESOTHO;LS +LIBERIA;LR +LIBYA;LY +LIECHTENSTEIN;LI +LITHUANIA;LT +LUXEMBOURG;LU +MACAO;MO +MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF;MK +MADAGASCAR;MG +MALAWI;MW +MALAYSIA;MY +MALDIVES;MV +MALI;ML +MALTA;MT +MARSHALL ISLANDS;MH +MARTINIQUE;MQ +MAURITANIA;MR +MAURITIUS;MU +MAYOTTE;YT +MEXICO;MX +MICRONESIA, FEDERATED STATES OF;FM +MOLDOVA, REPUBLIC OF;MD +MONACO;MC +MONGOLIA;MN +MONTENEGRO;ME +MONTSERRAT;MS +MOROCCO;MA +MOZAMBIQUE;MZ +MYANMAR;MM +NAMIBIA;NA +NAURU;NR +NEPAL;NP +NETHERLANDS;NL +NEW CALEDONIA;NC +NEW ZEALAND;NZ +NICARAGUA;NI +NIGER;NE +NIGERIA;NG +NIUE;NU +NORFOLK ISLAND;NF +NORTHERN MARIANA ISLANDS;MP +NORWAY;NO +OMAN;OM +PAKISTAN;PK +PALAU;PW +PALESTINE, STATE OF;PS +PANAMA;PA +PAPUA NEW GUINEA;PG +PARAGUAY;PY +PERU;PE +PHILIPPINES;PH +PITCAIRN;PN +POLAND;PL +PORTUGAL;PT +PUERTO RICO;PR +QATAR;QA +RÉUNION;RE +ROMANIA;RO +RUSSIAN FEDERATION;RU +RWANDA;RW +SAINT BARTHÉLEMY;BL +SAINT HELENA, ASCENSION AND TRISTAN DA CUNHA;SH +SAINT KITTS AND NEVIS;KN +SAINT LUCIA;LC +SAINT MARTIN (FRENCH PART);MF +SAINT PIERRE AND MIQUELON;PM +SAINT VINCENT AND THE GRENADINES;VC +SAMOA;WS +SAN MARINO;SM +SAO TOME AND PRINCIPE;ST +SAUDI ARABIA;SA +SENEGAL;SN +SERBIA;RS +SEYCHELLES;SC +SIERRA LEONE;SL +SINGAPORE;SG +SINT MAARTEN (DUTCH PART);SX +SLOVAKIA;SK +SLOVENIA;SI +SOLOMON ISLANDS;SB +SOMALIA;SO +SOUTH AFRICA;ZA +SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS;GS +SOUTH SUDAN;SS +SPAIN;ES +SRI LANKA;LK +SUDAN;SD +SURINAME;SR +SVALBARD AND JAN MAYEN;SJ +SWAZILAND;SZ +SWEDEN;SE +SWITZERLAND;CH +SYRIAN ARAB REPUBLIC;SY +TAIWAN, PROVINCE OF CHINA;TW +TAJIKISTAN;TJ +TANZANIA, UNITED REPUBLIC OF;TZ +THAILAND;TH +TIMOR-LESTE;TL +TOGO;TG +TOKELAU;TK +TONGA;TO +TRINIDAD AND TOBAGO;TT +TUNISIA;TN +TURKEY;TR +TURKMENISTAN;TM +TURKS AND CAICOS ISLANDS;TC +TUVALU;TV +UGANDA;UG +UKRAINE;UA +UNITED ARAB EMIRATES;AE +UNITED KINGDOM;GB +UNITED STATES;US +UNITED STATES MINOR OUTLYING ISLANDS;UM +URUGUAY;UY +UZBEKISTAN;UZ +VANUATU;VU +VENEZUELA, BOLIVARIAN REPUBLIC OF;VE +VIET NAM;VN +VIRGIN ISLANDS, BRITISH;VG +VIRGIN ISLANDS, U.S.;VI +WALLIS AND FUTUNA;WF +WESTERN SAHARA;EH +YEMEN;YE +ZAMBIA;ZM +ZIMBABWE;ZW \ No newline at end of file diff --git a/lib/babelfish/data/iso-639-3.tab b/lib/babelfish/data/iso-639-3.tab new file mode 100644 index 00000000..f66d683b --- /dev/null +++ b/lib/babelfish/data/iso-639-3.tab @@ -0,0 +1,7875 @@ +Id Part2B Part2T Part1 Scope Language_Type Ref_Name Comment +aaa I L Ghotuo +aab I L Alumu-Tesu +aac I L Ari +aad I L Amal +aae I L Arbëreshë Albanian +aaf I L Aranadan +aag I L Ambrak +aah I L Abu' Arapesh +aai I L Arifama-Miniafia +aak I L Ankave +aal I L Afade +aam I L Aramanik +aan I L Anambé +aao I L Algerian Saharan Arabic +aap I L Pará Arára +aaq I E Eastern Abnaki +aar aar aar aa I L Afar +aas I L Aasáx +aat I L Arvanitika Albanian +aau I L Abau +aaw I L Solong +aax I L Mandobo Atas +aaz I L Amarasi +aba I L Abé +abb I L Bankon +abc I L Ambala Ayta +abd I L Manide +abe I E Western Abnaki +abf I L Abai Sungai +abg I L Abaga +abh I L Tajiki Arabic +abi I L Abidji +abj I E Aka-Bea +abk abk abk ab I L Abkhazian +abl I L Lampung Nyo +abm I L Abanyom +abn I L Abua +abo I L Abon +abp I L Abellen Ayta +abq I L Abaza +abr I L Abron +abs I L Ambonese Malay +abt I L Ambulas +abu I L Abure +abv I L Baharna Arabic +abw I L Pal +abx I L Inabaknon +aby I L Aneme Wake +abz I L Abui +aca I L Achagua +acb I L Áncá +acd I L Gikyode +ace ace ace I L Achinese +acf I L Saint Lucian Creole French +ach ach ach I L Acoli +aci I E Aka-Cari +ack I E Aka-Kora +acl I E Akar-Bale +acm I L Mesopotamian Arabic +acn I L Achang +acp I L Eastern Acipa +acq I L Ta'izzi-Adeni Arabic +acr I L Achi +acs I E Acroá +act I L Achterhoeks +acu I L Achuar-Shiwiar +acv I L Achumawi +acw I L Hijazi Arabic +acx I L Omani Arabic +acy I L Cypriot Arabic +acz I L Acheron +ada ada ada I L Adangme +adb I L Adabe +add I L Dzodinka +ade I L Adele +adf I L Dhofari Arabic +adg I L Andegerebinha +adh I L Adhola +adi I L Adi +adj I L Adioukrou +adl I L Galo +adn I L Adang +ado I L Abu +adp I L Adap +adq I L Adangbe +adr I L Adonara +ads I L Adamorobe Sign Language +adt I L Adnyamathanha +adu I L Aduge +adw I L Amundava +adx I L Amdo Tibetan +ady ady ady I L Adyghe +adz I L Adzera +aea I E Areba +aeb I L Tunisian Arabic +aec I L Saidi Arabic +aed I L Argentine Sign Language +aee I L Northeast Pashayi +aek I L Haeke +ael I L Ambele +aem I L Arem +aen I L Armenian Sign Language +aeq I L Aer +aer I L Eastern Arrernte +aes I E Alsea +aeu I L Akeu +aew I L Ambakich +aey I L Amele +aez I L Aeka +afb I L Gulf Arabic +afd I L Andai +afe I L Putukwam +afg I L Afghan Sign Language +afh afh afh I C Afrihili +afi I L Akrukay +afk I L Nanubae +afn I L Defaka +afo I L Eloyi +afp I L Tapei +afr afr afr af I L Afrikaans +afs I L Afro-Seminole Creole +aft I L Afitti +afu I L Awutu +afz I L Obokuitai +aga I E Aguano +agb I L Legbo +agc I L Agatu +agd I L Agarabi +age I L Angal +agf I L Arguni +agg I L Angor +agh I L Ngelima +agi I L Agariya +agj I L Argobba +agk I L Isarog Agta +agl I L Fembe +agm I L Angaataha +agn I L Agutaynen +ago I L Tainae +agq I L Aghem +agr I L Aguaruna +ags I L Esimbi +agt I L Central Cagayan Agta +agu I L Aguacateco +agv I L Remontado Dumagat +agw I L Kahua +agx I L Aghul +agy I L Southern Alta +agz I L Mt. Iriga Agta +aha I L Ahanta +ahb I L Axamb +ahg I L Qimant +ahh I L Aghu +ahi I L Tiagbamrin Aizi +ahk I L Akha +ahl I L Igo +ahm I L Mobumrin Aizi +ahn I L Àhàn +aho I E Ahom +ahp I L Aproumu Aizi +ahr I L Ahirani +ahs I L Ashe +aht I L Ahtena +aia I L Arosi +aib I L Ainu (China) +aic I L Ainbai +aid I E Alngith +aie I L Amara +aif I L Agi +aig I L Antigua and Barbuda Creole English +aih I L Ai-Cham +aii I L Assyrian Neo-Aramaic +aij I L Lishanid Noshan +aik I L Ake +ail I L Aimele +aim I L Aimol +ain ain ain I L Ainu (Japan) +aio I L Aiton +aip I L Burumakok +aiq I L Aimaq +air I L Airoran +ais I L Nataoran Amis +ait I E Arikem +aiw I L Aari +aix I L Aighon +aiy I L Ali +aja I L Aja (Sudan) +ajg I L Aja (Benin) +aji I L Ajië +ajn I L Andajin +ajp I L South Levantine Arabic +ajt I L Judeo-Tunisian Arabic +aju I L Judeo-Moroccan Arabic +ajw I E Ajawa +ajz I L Amri Karbi +aka aka aka ak M L Akan +akb I L Batak Angkola +akc I L Mpur +akd I L Ukpet-Ehom +ake I L Akawaio +akf I L Akpa +akg I L Anakalangu +akh I L Angal Heneng +aki I L Aiome +akj I E Aka-Jeru +akk akk akk I A Akkadian +akl I L Aklanon +akm I E Aka-Bo +ako I L Akurio +akp I L Siwu +akq I L Ak +akr I L Araki +aks I L Akaselem +akt I L Akolet +aku I L Akum +akv I L Akhvakh +akw I L Akwa +akx I E Aka-Kede +aky I E Aka-Kol +akz I L Alabama +ala I L Alago +alc I L Qawasqar +ald I L Alladian +ale ale ale I L Aleut +alf I L Alege +alh I L Alawa +ali I L Amaimon +alj I L Alangan +alk I L Alak +all I L Allar +alm I L Amblong +aln I L Gheg Albanian +alo I L Larike-Wakasihu +alp I L Alune +alq I L Algonquin +alr I L Alutor +als I L Tosk Albanian +alt alt alt I L Southern Altai +alu I L 'Are'are +alw I L Alaba-K’abeena +alx I L Amol +aly I L Alyawarr +alz I L Alur +ama I E Amanayé +amb I L Ambo +amc I L Amahuaca +ame I L Yanesha' +amf I L Hamer-Banna +amg I L Amurdak +amh amh amh am I L Amharic +ami I L Amis +amj I L Amdang +amk I L Ambai +aml I L War-Jaintia +amm I L Ama (Papua New Guinea) +amn I L Amanab +amo I L Amo +amp I L Alamblak +amq I L Amahai +amr I L Amarakaeri +ams I L Southern Amami-Oshima +amt I L Amto +amu I L Guerrero Amuzgo +amv I L Ambelau +amw I L Western Neo-Aramaic +amx I L Anmatyerre +amy I L Ami +amz I E Atampaya +ana I E Andaqui +anb I E Andoa +anc I L Ngas +and I L Ansus +ane I L Xârâcùù +anf I L Animere +ang ang ang I H Old English (ca. 450-1100) +anh I L Nend +ani I L Andi +anj I L Anor +ank I L Goemai +anl I L Anu-Hkongso Chin +anm I L Anal +ann I L Obolo +ano I L Andoque +anp anp anp I L Angika +anq I L Jarawa (India) +anr I L Andh +ans I E Anserma +ant I L Antakarinya +anu I L Anuak +anv I L Denya +anw I L Anaang +anx I L Andra-Hus +any I L Anyin +anz I L Anem +aoa I L Angolar +aob I L Abom +aoc I L Pemon +aod I L Andarum +aoe I L Angal Enen +aof I L Bragat +aog I L Angoram +aoh I E Arma +aoi I L Anindilyakwa +aoj I L Mufian +aok I L Arhö +aol I L Alor +aom I L Ömie +aon I L Bumbita Arapesh +aor I E Aore +aos I L Taikat +aot I L A'tong +aou I L A'ou +aox I L Atorada +aoz I L Uab Meto +apb I L Sa'a +apc I L North Levantine Arabic +apd I L Sudanese Arabic +ape I L Bukiyip +apf I L Pahanan Agta +apg I L Ampanang +aph I L Athpariya +api I L Apiaká +apj I L Jicarilla Apache +apk I L Kiowa Apache +apl I L Lipan Apache +apm I L Mescalero-Chiricahua Apache +apn I L Apinayé +apo I L Ambul +app I L Apma +apq I L A-Pucikwar +apr I L Arop-Lokep +aps I L Arop-Sissano +apt I L Apatani +apu I L Apurinã +apv I E Alapmunte +apw I L Western Apache +apx I L Aputai +apy I L Apalaí +apz I L Safeyoka +aqc I L Archi +aqd I L Ampari Dogon +aqg I L Arigidi +aqm I L Atohwaim +aqn I L Northern Alta +aqp I E Atakapa +aqr I L Arhâ +aqz I L Akuntsu +ara ara ara ar M L Arabic +arb I L Standard Arabic +arc arc arc I A Official Aramaic (700-300 BCE) +ard I E Arabana +are I L Western Arrarnta +arg arg arg an I L Aragonese +arh I L Arhuaco +ari I L Arikara +arj I E Arapaso +ark I L Arikapú +arl I L Arabela +arn arn arn I L Mapudungun +aro I L Araona +arp arp arp I L Arapaho +arq I L Algerian Arabic +arr I L Karo (Brazil) +ars I L Najdi Arabic +aru I E Aruá (Amazonas State) +arv I L Arbore +arw arw arw I L Arawak +arx I L Aruá (Rodonia State) +ary I L Moroccan Arabic +arz I L Egyptian Arabic +asa I L Asu (Tanzania) +asb I L Assiniboine +asc I L Casuarina Coast Asmat +asd I L Asas +ase I L American Sign Language +asf I L Australian Sign Language +asg I L Cishingini +ash I E Abishira +asi I L Buruwai +asj I L Sari +ask I L Ashkun +asl I L Asilulu +asm asm asm as I L Assamese +asn I L Xingú Asuriní +aso I L Dano +asp I L Algerian Sign Language +asq I L Austrian Sign Language +asr I L Asuri +ass I L Ipulo +ast ast ast I L Asturian +asu I L Tocantins Asurini +asv I L Asoa +asw I L Australian Aborigines Sign Language +asx I L Muratayak +asy I L Yaosakor Asmat +asz I L As +ata I L Pele-Ata +atb I L Zaiwa +atc I E Atsahuaca +atd I L Ata Manobo +ate I L Atemble +atg I L Ivbie North-Okpela-Arhe +ati I L Attié +atj I L Atikamekw +atk I L Ati +atl I L Mt. Iraya Agta +atm I L Ata +atn I L Ashtiani +ato I L Atong +atp I L Pudtol Atta +atq I L Aralle-Tabulahan +atr I L Waimiri-Atroari +ats I L Gros Ventre +att I L Pamplona Atta +atu I L Reel +atv I L Northern Altai +atw I L Atsugewi +atx I L Arutani +aty I L Aneityum +atz I L Arta +aua I L Asumboa +aub I L Alugu +auc I L Waorani +aud I L Anuta +aue I L =/Kx'au//'ein +aug I L Aguna +auh I L Aushi +aui I L Anuki +auj I L Awjilah +auk I L Heyo +aul I L Aulua +aum I L Asu (Nigeria) +aun I L Molmo One +auo I E Auyokawa +aup I L Makayam +auq I L Anus +aur I L Aruek +aut I L Austral +auu I L Auye +auw I L Awyi +aux I E Aurá +auy I L Awiyaana +auz I L Uzbeki Arabic +ava ava ava av I L Avaric +avb I L Avau +avd I L Alviri-Vidari +ave ave ave ae I A Avestan +avi I L Avikam +avk I C Kotava +avl I L Eastern Egyptian Bedawi Arabic +avm I E Angkamuthi +avn I L Avatime +avo I E Agavotaguerra +avs I E Aushiri +avt I L Au +avu I L Avokaya +avv I L Avá-Canoeiro +awa awa awa I L Awadhi +awb I L Awa (Papua New Guinea) +awc I L Cicipu +awe I L Awetí +awg I E Anguthimri +awh I L Awbono +awi I L Aekyom +awk I E Awabakal +awm I L Arawum +awn I L Awngi +awo I L Awak +awr I L Awera +aws I L South Awyu +awt I L Araweté +awu I L Central Awyu +awv I L Jair Awyu +aww I L Awun +awx I L Awara +awy I L Edera Awyu +axb I E Abipon +axe I E Ayerrerenge +axg I E Mato Grosso Arára +axk I L Yaka (Central African Republic) +axl I E Lower Southern Aranda +axm I H Middle Armenian +axx I L Xârâgurè +aya I L Awar +ayb I L Ayizo Gbe +ayc I L Southern Aymara +ayd I E Ayabadhu +aye I L Ayere +ayg I L Ginyanga +ayh I L Hadrami Arabic +ayi I L Leyigha +ayk I L Akuku +ayl I L Libyan Arabic +aym aym aym ay M L Aymara +ayn I L Sanaani Arabic +ayo I L Ayoreo +ayp I L North Mesopotamian Arabic +ayq I L Ayi (Papua New Guinea) +ayr I L Central Aymara +ays I L Sorsogon Ayta +ayt I L Magbukun Ayta +ayu I L Ayu +ayy I E Tayabas Ayta +ayz I L Mai Brat +aza I L Azha +azb I L South Azerbaijani +azd I L Eastern Durango Nahuatl +aze aze aze az M L Azerbaijani +azg I L San Pedro Amuzgos Amuzgo +azj I L North Azerbaijani +azm I L Ipalapa Amuzgo +azn I L Western Durango Nahuatl +azo I L Awing +azt I L Faire Atta +azz I L Highland Puebla Nahuatl +baa I L Babatana +bab I L Bainouk-Gunyuño +bac I L Badui +bae I E Baré +baf I L Nubaca +bag I L Tuki +bah I L Bahamas Creole English +baj I L Barakai +bak bak bak ba I L Bashkir +bal bal bal M L Baluchi +bam bam bam bm I L Bambara +ban ban ban I L Balinese +bao I L Waimaha +bap I L Bantawa +bar I L Bavarian +bas bas bas I L Basa (Cameroon) +bau I L Bada (Nigeria) +bav I L Vengo +baw I L Bambili-Bambui +bax I L Bamun +bay I L Batuley +bba I L Baatonum +bbb I L Barai +bbc I L Batak Toba +bbd I L Bau +bbe I L Bangba +bbf I L Baibai +bbg I L Barama +bbh I L Bugan +bbi I L Barombi +bbj I L Ghomálá' +bbk I L Babanki +bbl I L Bats +bbm I L Babango +bbn I L Uneapa +bbo I L Northern Bobo Madaré +bbp I L West Central Banda +bbq I L Bamali +bbr I L Girawa +bbs I L Bakpinka +bbt I L Mburku +bbu I L Kulung (Nigeria) +bbv I L Karnai +bbw I L Baba +bbx I L Bubia +bby I L Befang +bbz I L Babalia Creole Arabic +bca I L Central Bai +bcb I L Bainouk-Samik +bcc I L Southern Balochi +bcd I L North Babar +bce I L Bamenyam +bcf I L Bamu +bcg I L Baga Binari +bch I L Bariai +bci I L Baoulé +bcj I L Bardi +bck I L Bunaba +bcl I L Central Bikol +bcm I L Bannoni +bcn I L Bali (Nigeria) +bco I L Kaluli +bcp I L Bali (Democratic Republic of Congo) +bcq I L Bench +bcr I L Babine +bcs I L Kohumono +bct I L Bendi +bcu I L Awad Bing +bcv I L Shoo-Minda-Nye +bcw I L Bana +bcy I L Bacama +bcz I L Bainouk-Gunyaamolo +bda I L Bayot +bdb I L Basap +bdc I L Emberá-Baudó +bdd I L Bunama +bde I L Bade +bdf I L Biage +bdg I L Bonggi +bdh I L Baka (Sudan) +bdi I L Burun +bdj I L Bai +bdk I L Budukh +bdl I L Indonesian Bajau +bdm I L Buduma +bdn I L Baldemu +bdo I L Morom +bdp I L Bende +bdq I L Bahnar +bdr I L West Coast Bajau +bds I L Burunge +bdt I L Bokoto +bdu I L Oroko +bdv I L Bodo Parja +bdw I L Baham +bdx I L Budong-Budong +bdy I L Bandjalang +bdz I L Badeshi +bea I L Beaver +beb I L Bebele +bec I L Iceve-Maci +bed I L Bedoanas +bee I L Byangsi +bef I L Benabena +beg I L Belait +beh I L Biali +bei I L Bekati' +bej bej bej I L Beja +bek I L Bebeli +bel bel bel be I L Belarusian +bem bem bem I L Bemba (Zambia) +ben ben ben bn I L Bengali +beo I L Beami +bep I L Besoa +beq I L Beembe +bes I L Besme +bet I L Guiberoua Béte +beu I L Blagar +bev I L Daloa Bété +bew I L Betawi +bex I L Jur Modo +bey I L Beli (Papua New Guinea) +bez I L Bena (Tanzania) +bfa I L Bari +bfb I L Pauri Bareli +bfc I L Northern Bai +bfd I L Bafut +bfe I L Betaf +bff I L Bofi +bfg I L Busang Kayan +bfh I L Blafe +bfi I L British Sign Language +bfj I L Bafanji +bfk I L Ban Khor Sign Language +bfl I L Banda-Ndélé +bfm I L Mmen +bfn I L Bunak +bfo I L Malba Birifor +bfp I L Beba +bfq I L Badaga +bfr I L Bazigar +bfs I L Southern Bai +bft I L Balti +bfu I L Gahri +bfw I L Bondo +bfx I L Bantayanon +bfy I L Bagheli +bfz I L Mahasu Pahari +bga I L Gwamhi-Wuri +bgb I L Bobongko +bgc I L Haryanvi +bgd I L Rathwi Bareli +bge I L Bauria +bgf I L Bangandu +bgg I L Bugun +bgi I L Giangan +bgj I L Bangolan +bgk I L Bit +bgl I L Bo (Laos) +bgm I L Baga Mboteni +bgn I L Western Balochi +bgo I L Baga Koga +bgp I L Eastern Balochi +bgq I L Bagri +bgr I L Bawm Chin +bgs I L Tagabawa +bgt I L Bughotu +bgu I L Mbongno +bgv I L Warkay-Bipim +bgw I L Bhatri +bgx I L Balkan Gagauz Turkish +bgy I L Benggoi +bgz I L Banggai +bha I L Bharia +bhb I L Bhili +bhc I L Biga +bhd I L Bhadrawahi +bhe I L Bhaya +bhf I L Odiai +bhg I L Binandere +bhh I L Bukharic +bhi I L Bhilali +bhj I L Bahing +bhl I L Bimin +bhm I L Bathari +bhn I L Bohtan Neo-Aramaic +bho bho bho I L Bhojpuri +bhp I L Bima +bhq I L Tukang Besi South +bhr I L Bara Malagasy +bhs I L Buwal +bht I L Bhattiyali +bhu I L Bhunjia +bhv I L Bahau +bhw I L Biak +bhx I L Bhalay +bhy I L Bhele +bhz I L Bada (Indonesia) +bia I L Badimaya +bib I L Bissa +bic I L Bikaru +bid I L Bidiyo +bie I L Bepour +bif I L Biafada +big I L Biangai +bij I L Vaghat-Ya-Bijim-Legeri +bik bik bik M L Bikol +bil I L Bile +bim I L Bimoba +bin bin bin I L Bini +bio I L Nai +bip I L Bila +biq I L Bipi +bir I L Bisorio +bis bis bis bi I L Bislama +bit I L Berinomo +biu I L Biete +biv I L Southern Birifor +biw I L Kol (Cameroon) +bix I L Bijori +biy I L Birhor +biz I L Baloi +bja I L Budza +bjb I E Banggarla +bjc I L Bariji +bje I L Biao-Jiao Mien +bjf I L Barzani Jewish Neo-Aramaic +bjg I L Bidyogo +bjh I L Bahinemo +bji I L Burji +bjj I L Kanauji +bjk I L Barok +bjl I L Bulu (Papua New Guinea) +bjm I L Bajelani +bjn I L Banjar +bjo I L Mid-Southern Banda +bjp I L Fanamaket +bjr I L Binumarien +bjs I L Bajan +bjt I L Balanta-Ganja +bju I L Busuu +bjv I L Bedjond +bjw I L Bakwé +bjx I L Banao Itneg +bjy I E Bayali +bjz I L Baruga +bka I L Kyak +bkc I L Baka (Cameroon) +bkd I L Binukid +bkf I L Beeke +bkg I L Buraka +bkh I L Bakoko +bki I L Baki +bkj I L Pande +bkk I L Brokskat +bkl I L Berik +bkm I L Kom (Cameroon) +bkn I L Bukitan +bko I L Kwa' +bkp I L Boko (Democratic Republic of Congo) +bkq I L Bakairí +bkr I L Bakumpai +bks I L Northern Sorsoganon +bkt I L Boloki +bku I L Buhid +bkv I L Bekwarra +bkw I L Bekwel +bkx I L Baikeno +bky I L Bokyi +bkz I L Bungku +bla bla bla I L Siksika +blb I L Bilua +blc I L Bella Coola +bld I L Bolango +ble I L Balanta-Kentohe +blf I L Buol +blg I L Balau +blh I L Kuwaa +bli I L Bolia +blj I L Bolongan +blk I L Pa'o Karen +bll I E Biloxi +blm I L Beli (Sudan) +bln I L Southern Catanduanes Bikol +blo I L Anii +blp I L Blablanga +blq I L Baluan-Pam +blr I L Blang +bls I L Balaesang +blt I L Tai Dam +blv I L Bolo +blw I L Balangao +blx I L Mag-Indi Ayta +bly I L Notre +blz I L Balantak +bma I L Lame +bmb I L Bembe +bmc I L Biem +bmd I L Baga Manduri +bme I L Limassa +bmf I L Bom +bmg I L Bamwe +bmh I L Kein +bmi I L Bagirmi +bmj I L Bote-Majhi +bmk I L Ghayavi +bml I L Bomboli +bmm I L Northern Betsimisaraka Malagasy +bmn I E Bina (Papua New Guinea) +bmo I L Bambalang +bmp I L Bulgebi +bmq I L Bomu +bmr I L Muinane +bms I L Bilma Kanuri +bmt I L Biao Mon +bmu I L Somba-Siawari +bmv I L Bum +bmw I L Bomwali +bmx I L Baimak +bmy I L Bemba (Democratic Republic of Congo) +bmz I L Baramu +bna I L Bonerate +bnb I L Bookan +bnc M L Bontok +bnd I L Banda (Indonesia) +bne I L Bintauna +bnf I L Masiwang +bng I L Benga +bni I L Bangi +bnj I L Eastern Tawbuid +bnk I L Bierebo +bnl I L Boon +bnm I L Batanga +bnn I L Bunun +bno I L Bantoanon +bnp I L Bola +bnq I L Bantik +bnr I L Butmas-Tur +bns I L Bundeli +bnu I L Bentong +bnv I L Bonerif +bnw I L Bisis +bnx I L Bangubangu +bny I L Bintulu +bnz I L Beezen +boa I L Bora +bob I L Aweer +bod tib bod bo I L Tibetan +boe I L Mundabli +bof I L Bolon +bog I L Bamako Sign Language +boh I L Boma +boi I E Barbareño +boj I L Anjam +bok I L Bonjo +bol I L Bole +bom I L Berom +bon I L Bine +boo I L Tiemacèwè Bozo +bop I L Bonkiman +boq I L Bogaya +bor I L Borôro +bos bos bos bs I L Bosnian +bot I L Bongo +bou I L Bondei +bov I L Tuwuli +bow I E Rema +box I L Buamu +boy I L Bodo (Central African Republic) +boz I L Tiéyaxo Bozo +bpa I L Daakaka +bpb I E Barbacoas +bpd I L Banda-Banda +bpg I L Bonggo +bph I L Botlikh +bpi I L Bagupi +bpj I L Binji +bpk I L Orowe +bpl I L Broome Pearling Lugger Pidgin +bpm I L Biyom +bpn I L Dzao Min +bpo I L Anasi +bpp I L Kaure +bpq I L Banda Malay +bpr I L Koronadal Blaan +bps I L Sarangani Blaan +bpt I E Barrow Point +bpu I L Bongu +bpv I L Bian Marind +bpw I L Bo (Papua New Guinea) +bpx I L Palya Bareli +bpy I L Bishnupriya +bpz I L Bilba +bqa I L Tchumbuli +bqb I L Bagusa +bqc I L Boko (Benin) +bqd I L Bung +bqf I E Baga Kaloum +bqg I L Bago-Kusuntu +bqh I L Baima +bqi I L Bakhtiari +bqj I L Bandial +bqk I L Banda-Mbrès +bql I L Bilakura +bqm I L Wumboko +bqn I L Bulgarian Sign Language +bqo I L Balo +bqp I L Busa +bqq I L Biritai +bqr I L Burusu +bqs I L Bosngun +bqt I L Bamukumbit +bqu I L Boguru +bqv I L Koro Wachi +bqw I L Buru (Nigeria) +bqx I L Baangi +bqy I L Bengkala Sign Language +bqz I L Bakaka +bra bra bra I L Braj +brb I L Lave +brc I E Berbice Creole Dutch +brd I L Baraamu +bre bre bre br I L Breton +brf I L Bera +brg I L Baure +brh I L Brahui +bri I L Mokpwe +brj I L Bieria +brk I E Birked +brl I L Birwa +brm I L Barambu +brn I L Boruca +bro I L Brokkat +brp I L Barapasi +brq I L Breri +brr I L Birao +brs I L Baras +brt I L Bitare +bru I L Eastern Bru +brv I L Western Bru +brw I L Bellari +brx I L Bodo (India) +bry I L Burui +brz I L Bilbil +bsa I L Abinomn +bsb I L Brunei Bisaya +bsc I L Bassari +bse I L Wushi +bsf I L Bauchi +bsg I L Bashkardi +bsh I L Kati +bsi I L Bassossi +bsj I L Bangwinji +bsk I L Burushaski +bsl I E Basa-Gumna +bsm I L Busami +bsn I L Barasana-Eduria +bso I L Buso +bsp I L Baga Sitemu +bsq I L Bassa +bsr I L Bassa-Kontagora +bss I L Akoose +bst I L Basketo +bsu I L Bahonsuai +bsv I E Baga Sobané +bsw I L Baiso +bsx I L Yangkam +bsy I L Sabah Bisaya +bta I L Bata +btc I L Bati (Cameroon) +btd I L Batak Dairi +bte I E Gamo-Ningi +btf I L Birgit +btg I L Gagnoa Bété +bth I L Biatah Bidayuh +bti I L Burate +btj I L Bacanese Malay +btl I L Bhatola +btm I L Batak Mandailing +btn I L Ratagnon +bto I L Rinconada Bikol +btp I L Budibud +btq I L Batek +btr I L Baetora +bts I L Batak Simalungun +btt I L Bete-Bendi +btu I L Batu +btv I L Bateri +btw I L Butuanon +btx I L Batak Karo +bty I L Bobot +btz I L Batak Alas-Kluet +bua bua bua M L Buriat +bub I L Bua +buc I L Bushi +bud I L Ntcham +bue I E Beothuk +buf I L Bushoong +bug bug bug I L Buginese +buh I L Younuo Bunu +bui I L Bongili +buj I L Basa-Gurmana +buk I L Bugawac +bul bul bul bg I L Bulgarian +bum I L Bulu (Cameroon) +bun I L Sherbro +buo I L Terei +bup I L Busoa +buq I L Brem +bus I L Bokobaru +but I L Bungain +buu I L Budu +buv I L Bun +buw I L Bubi +bux I L Boghom +buy I L Bullom So +buz I L Bukwen +bva I L Barein +bvb I L Bube +bvc I L Baelelea +bvd I L Baeggu +bve I L Berau Malay +bvf I L Boor +bvg I L Bonkeng +bvh I L Bure +bvi I L Belanda Viri +bvj I L Baan +bvk I L Bukat +bvl I L Bolivian Sign Language +bvm I L Bamunka +bvn I L Buna +bvo I L Bolgo +bvp I L Bumang +bvq I L Birri +bvr I L Burarra +bvt I L Bati (Indonesia) +bvu I L Bukit Malay +bvv I E Baniva +bvw I L Boga +bvx I L Dibole +bvy I L Baybayanon +bvz I L Bauzi +bwa I L Bwatoo +bwb I L Namosi-Naitasiri-Serua +bwc I L Bwile +bwd I L Bwaidoka +bwe I L Bwe Karen +bwf I L Boselewa +bwg I L Barwe +bwh I L Bishuo +bwi I L Baniwa +bwj I L Láá Láá Bwamu +bwk I L Bauwaki +bwl I L Bwela +bwm I L Biwat +bwn I L Wunai Bunu +bwo I L Boro (Ethiopia) +bwp I L Mandobo Bawah +bwq I L Southern Bobo Madaré +bwr I L Bura-Pabir +bws I L Bomboma +bwt I L Bafaw-Balong +bwu I L Buli (Ghana) +bww I L Bwa +bwx I L Bu-Nao Bunu +bwy I L Cwi Bwamu +bwz I L Bwisi +bxa I L Tairaha +bxb I L Belanda Bor +bxc I L Molengue +bxd I L Pela +bxe I L Birale +bxf I L Bilur +bxg I L Bangala +bxh I L Buhutu +bxi I E Pirlatapa +bxj I L Bayungu +bxk I L Bukusu +bxl I L Jalkunan +bxm I L Mongolia Buriat +bxn I L Burduna +bxo I L Barikanchi +bxp I L Bebil +bxq I L Beele +bxr I L Russia Buriat +bxs I L Busam +bxu I L China Buriat +bxv I L Berakou +bxw I L Bankagooma +bxx I L Borna (Democratic Republic of Congo) +bxz I L Binahari +bya I L Batak +byb I L Bikya +byc I L Ubaghara +byd I L Benyadu' +bye I L Pouye +byf I L Bete +byg I E Baygo +byh I L Bhujel +byi I L Buyu +byj I L Bina (Nigeria) +byk I L Biao +byl I L Bayono +bym I L Bidyara +byn byn byn I L Bilin +byo I L Biyo +byp I L Bumaji +byq I E Basay +byr I L Baruya +bys I L Burak +byt I E Berti +byv I L Medumba +byw I L Belhariya +byx I L Qaqet +byy I L Buya +byz I L Banaro +bza I L Bandi +bzb I L Andio +bzc I L Southern Betsimisaraka Malagasy +bzd I L Bribri +bze I L Jenaama Bozo +bzf I L Boikin +bzg I L Babuza +bzh I L Mapos Buang +bzi I L Bisu +bzj I L Belize Kriol English +bzk I L Nicaragua Creole English +bzl I L Boano (Sulawesi) +bzm I L Bolondo +bzn I L Boano (Maluku) +bzo I L Bozaba +bzp I L Kemberano +bzq I L Buli (Indonesia) +bzr I E Biri +bzs I L Brazilian Sign Language +bzt I C Brithenig +bzu I L Burmeso +bzv I L Naami +bzw I L Basa (Nigeria) +bzx I L Kɛlɛngaxo Bozo +bzy I L Obanliku +bzz I L Evant +caa I L Chortí +cab I L Garifuna +cac I L Chuj +cad cad cad I L Caddo +cae I L Lehar +caf I L Southern Carrier +cag I L Nivaclé +cah I L Cahuarano +caj I E Chané +cak I L Kaqchikel +cal I L Carolinian +cam I L Cemuhî +can I L Chambri +cao I L Chácobo +cap I L Chipaya +caq I L Car Nicobarese +car car car I L Galibi Carib +cas I L Tsimané +cat cat cat ca I L Catalan +cav I L Cavineña +caw I L Callawalla +cax I L Chiquitano +cay I L Cayuga +caz I E Canichana +cbb I L Cabiyarí +cbc I L Carapana +cbd I L Carijona +cbe I E Chipiajes +cbg I L Chimila +cbh I E Cagua +cbi I L Chachi +cbj I L Ede Cabe +cbk I L Chavacano +cbl I L Bualkhaw Chin +cbn I L Nyahkur +cbo I L Izora +cbr I L Cashibo-Cacataibo +cbs I L Cashinahua +cbt I L Chayahuita +cbu I L Candoshi-Shapra +cbv I L Cacua +cbw I L Kinabalian +cby I L Carabayo +cca I E Cauca +ccc I L Chamicuro +ccd I L Cafundo Creole +cce I L Chopi +ccg I L Samba Daka +cch I L Atsam +ccj I L Kasanga +ccl I L Cutchi-Swahili +ccm I L Malaccan Creole Malay +cco I L Comaltepec Chinantec +ccp I L Chakma +ccr I E Cacaopera +cda I L Choni +cde I L Chenchu +cdf I L Chiru +cdg I L Chamari +cdh I L Chambeali +cdi I L Chodri +cdj I L Churahi +cdm I L Chepang +cdn I L Chaudangsi +cdo I L Min Dong Chinese +cdr I L Cinda-Regi-Tiyal +cds I L Chadian Sign Language +cdy I L Chadong +cdz I L Koda +cea I E Lower Chehalis +ceb ceb ceb I L Cebuano +ceg I L Chamacoco +cek I L Eastern Khumi Chin +cen I L Cen +ces cze ces cs I L Czech +cet I L Centúúm +cfa I L Dijim-Bwilim +cfd I L Cara +cfg I L Como Karim +cfm I L Falam Chin +cga I L Changriwa +cgc I L Kagayanen +cgg I L Chiga +cgk I L Chocangacakha +cha cha cha ch I L Chamorro +chb chb chb I E Chibcha +chc I E Catawba +chd I L Highland Oaxaca Chontal +che che che ce I L Chechen +chf I L Tabasco Chontal +chg chg chg I E Chagatai +chh I L Chinook +chj I L Ojitlán Chinantec +chk chk chk I L Chuukese +chl I L Cahuilla +chm chm chm M L Mari (Russia) +chn chn chn I L Chinook jargon +cho cho cho I L Choctaw +chp chp chp I L Chipewyan +chq I L Quiotepec Chinantec +chr chr chr I L Cherokee +cht I E Cholón +chu chu chu cu I A Church Slavic +chv chv chv cv I L Chuvash +chw I L Chuwabu +chx I L Chantyal +chy chy chy I L Cheyenne +chz I L Ozumacín Chinantec +cia I L Cia-Cia +cib I L Ci Gbe +cic I L Chickasaw +cid I E Chimariko +cie I L Cineni +cih I L Chinali +cik I L Chitkuli Kinnauri +cim I L Cimbrian +cin I L Cinta Larga +cip I L Chiapanec +cir I L Tiri +ciw I L Chippewa +ciy I L Chaima +cja I L Western Cham +cje I L Chru +cjh I E Upper Chehalis +cji I L Chamalal +cjk I L Chokwe +cjm I L Eastern Cham +cjn I L Chenapian +cjo I L Ashéninka Pajonal +cjp I L Cabécar +cjs I L Shor +cjv I L Chuave +cjy I L Jinyu Chinese +ckb I L Central Kurdish +ckh I L Chak +ckl I L Cibak +ckn I L Kaang Chin +cko I L Anufo +ckq I L Kajakse +ckr I L Kairak +cks I L Tayo +ckt I L Chukot +cku I L Koasati +ckv I L Kavalan +ckx I L Caka +cky I L Cakfem-Mushere +ckz I L Cakchiquel-Quiché Mixed Language +cla I L Ron +clc I L Chilcotin +cld I L Chaldean Neo-Aramaic +cle I L Lealao Chinantec +clh I L Chilisso +cli I L Chakali +clj I L Laitu Chin +clk I L Idu-Mishmi +cll I L Chala +clm I L Clallam +clo I L Lowland Oaxaca Chontal +clt I L Lautu Chin +clu I L Caluyanun +clw I L Chulym +cly I L Eastern Highland Chatino +cma I L Maa +cme I L Cerma +cmg I H Classical Mongolian +cmi I L Emberá-Chamí +cml I L Campalagian +cmm I E Michigamea +cmn I L Mandarin Chinese +cmo I L Central Mnong +cmr I L Mro-Khimi Chin +cms I A Messapic +cmt I L Camtho +cna I L Changthang +cnb I L Chinbon Chin +cnc I L Côông +cng I L Northern Qiang +cnh I L Haka Chin +cni I L Asháninka +cnk I L Khumi Chin +cnl I L Lalana Chinantec +cno I L Con +cns I L Central Asmat +cnt I L Tepetotutla Chinantec +cnu I L Chenoua +cnw I L Ngawn Chin +cnx I H Middle Cornish +coa I L Cocos Islands Malay +cob I E Chicomuceltec +coc I L Cocopa +cod I L Cocama-Cocamilla +coe I L Koreguaje +cof I L Colorado +cog I L Chong +coh I L Chonyi-Dzihana-Kauma +coj I E Cochimi +cok I L Santa Teresa Cora +col I L Columbia-Wenatchi +com I L Comanche +con I L Cofán +coo I L Comox +cop cop cop I E Coptic +coq I E Coquille +cor cor cor kw I L Cornish +cos cos cos co I L Corsican +cot I L Caquinte +cou I L Wamey +cov I L Cao Miao +cow I E Cowlitz +cox I L Nanti +coy I E Coyaima +coz I L Chochotec +cpa I L Palantla Chinantec +cpb I L Ucayali-Yurúa Ashéninka +cpc I L Ajyíninka Apurucayali +cpg I E Cappadocian Greek +cpi I L Chinese Pidgin English +cpn I L Cherepon +cpo I L Kpeego +cps I L Capiznon +cpu I L Pichis Ashéninka +cpx I L Pu-Xian Chinese +cpy I L South Ucayali Ashéninka +cqd I L Chuanqiandian Cluster Miao +cqu I L Chilean Quechua +cra I L Chara +crb I E Island Carib +crc I L Lonwolwol +crd I L Coeur d'Alene +cre cre cre cr M L Cree +crf I E Caramanta +crg I L Michif +crh crh crh I L Crimean Tatar +cri I L Sãotomense +crj I L Southern East Cree +crk I L Plains Cree +crl I L Northern East Cree +crm I L Moose Cree +crn I L El Nayar Cora +cro I L Crow +crq I L Iyo'wujwa Chorote +crr I E Carolina Algonquian +crs I L Seselwa Creole French +crt I L Iyojwa'ja Chorote +crv I L Chaura +crw I L Chrau +crx I L Carrier +cry I L Cori +crz I E Cruzeño +csa I L Chiltepec Chinantec +csb csb csb I L Kashubian +csc I L Catalan Sign Language +csd I L Chiangmai Sign Language +cse I L Czech Sign Language +csf I L Cuba Sign Language +csg I L Chilean Sign Language +csh I L Asho Chin +csi I E Coast Miwok +csj I L Songlai Chin +csk I L Jola-Kasa +csl I L Chinese Sign Language +csm I L Central Sierra Miwok +csn I L Colombian Sign Language +cso I L Sochiapam Chinantec +csq I L Croatia Sign Language +csr I L Costa Rican Sign Language +css I E Southern Ohlone +cst I L Northern Ohlone +csv I L Sumtu Chin +csw I L Swampy Cree +csy I L Siyin Chin +csz I L Coos +cta I L Tataltepec Chatino +ctc I L Chetco +ctd I L Tedim Chin +cte I L Tepinapa Chinantec +ctg I L Chittagonian +cth I L Thaiphum Chin +ctl I L Tlacoatzintepec Chinantec +ctm I E Chitimacha +ctn I L Chhintange +cto I L Emberá-Catío +ctp I L Western Highland Chatino +cts I L Northern Catanduanes Bikol +ctt I L Wayanad Chetti +ctu I L Chol +ctz I L Zacatepec Chatino +cua I L Cua +cub I L Cubeo +cuc I L Usila Chinantec +cug I L Cung +cuh I L Chuka +cui I L Cuiba +cuj I L Mashco Piro +cuk I L San Blas Kuna +cul I L Culina +cum I E Cumeral +cuo I E Cumanagoto +cup I E Cupeño +cuq I L Cun +cur I L Chhulung +cut I L Teutila Cuicatec +cuu I L Tai Ya +cuv I L Cuvok +cuw I L Chukwa +cux I L Tepeuxila Cuicatec +cvg I L Chug +cvn I L Valle Nacional Chinantec +cwa I L Kabwa +cwb I L Maindo +cwd I L Woods Cree +cwe I L Kwere +cwg I L Chewong +cwt I L Kuwaataay +cya I L Nopala Chatino +cyb I E Cayubaba +cym wel cym cy I L Welsh +cyo I L Cuyonon +czh I L Huizhou Chinese +czk I E Knaanic +czn I L Zenzontepec Chatino +czo I L Min Zhong Chinese +czt I L Zotung Chin +daa I L Dangaléat +dac I L Dambi +dad I L Marik +dae I L Duupa +dag I L Dagbani +dah I L Gwahatike +dai I L Day +daj I L Dar Fur Daju +dak dak dak I L Dakota +dal I L Dahalo +dam I L Damakawa +dan dan dan da I L Danish +dao I L Daai Chin +daq I L Dandami Maria +dar dar dar I L Dargwa +das I L Daho-Doo +dau I L Dar Sila Daju +dav I L Taita +daw I L Davawenyo +dax I L Dayi +daz I L Dao +dba I L Bangime +dbb I L Deno +dbd I L Dadiya +dbe I L Dabe +dbf I L Edopi +dbg I L Dogul Dom Dogon +dbi I L Doka +dbj I L Ida'an +dbl I L Dyirbal +dbm I L Duguri +dbn I L Duriankere +dbo I L Dulbu +dbp I L Duwai +dbq I L Daba +dbr I L Dabarre +dbt I L Ben Tey Dogon +dbu I L Bondum Dom Dogon +dbv I L Dungu +dbw I L Bankan Tey Dogon +dby I L Dibiyaso +dcc I L Deccan +dcr I E Negerhollands +dda I E Dadi Dadi +ddd I L Dongotono +dde I L Doondo +ddg I L Fataluku +ddi I L West Goodenough +ddj I L Jaru +ddn I L Dendi (Benin) +ddo I L Dido +ddr I E Dhudhuroa +dds I L Donno So Dogon +ddw I L Dawera-Daweloor +dec I L Dagik +ded I L Dedua +dee I L Dewoin +def I L Dezfuli +deg I L Degema +deh I L Dehwari +dei I L Demisa +dek I L Dek +del del del M L Delaware +dem I L Dem +den den den M L Slave (Athapascan) +dep I E Pidgin Delaware +deq I L Dendi (Central African Republic) +der I L Deori +des I L Desano +deu ger deu de I L German +dev I L Domung +dez I L Dengese +dga I L Southern Dagaare +dgb I L Bunoge Dogon +dgc I L Casiguran Dumagat Agta +dgd I L Dagaari Dioula +dge I L Degenan +dgg I L Doga +dgh I L Dghwede +dgi I L Northern Dagara +dgk I L Dagba +dgl I L Andaandi +dgn I E Dagoman +dgo I L Dogri (individual language) +dgr dgr dgr I L Dogrib +dgs I L Dogoso +dgt I E Ndra'ngith +dgu I L Degaru +dgw I E Daungwurrung +dgx I L Doghoro +dgz I L Daga +dhd I L Dhundari +dhg I L Djangu +dhi I L Dhimal +dhl I L Dhalandji +dhm I L Zemba +dhn I L Dhanki +dho I L Dhodia +dhr I L Dhargari +dhs I L Dhaiso +dhu I E Dhurga +dhv I L Dehu +dhw I L Dhanwar (Nepal) +dhx I L Dhungaloo +dia I L Dia +dib I L South Central Dinka +dic I L Lakota Dida +did I L Didinga +dif I E Dieri +dig I L Digo +dih I L Kumiai +dii I L Dimbong +dij I L Dai +dik I L Southwestern Dinka +dil I L Dilling +dim I L Dime +din din din M L Dinka +dio I L Dibo +dip I L Northeastern Dinka +diq I L Dimli (individual language) +dir I L Dirim +dis I L Dimasa +dit I E Dirari +diu I L Diriku +div div div dv I L Dhivehi +diw I L Northwestern Dinka +dix I L Dixon Reef +diy I L Diuwe +diz I L Ding +dja I E Djadjawurrung +djb I L Djinba +djc I L Dar Daju Daju +djd I L Djamindjung +dje I L Zarma +djf I E Djangun +dji I L Djinang +djj I L Djeebbana +djk I L Eastern Maroon Creole +djm I L Jamsay Dogon +djn I L Djauan +djo I L Jangkang +djr I L Djambarrpuyngu +dju I L Kapriman +djw I E Djawi +dka I L Dakpakha +dkk I L Dakka +dkr I L Kuijau +dks I L Southeastern Dinka +dkx I L Mazagway +dlg I L Dolgan +dlk I L Dahalik +dlm I E Dalmatian +dln I L Darlong +dma I L Duma +dmb I L Mombo Dogon +dmc I L Gavak +dmd I E Madhi Madhi +dme I L Dugwor +dmg I L Upper Kinabatangan +dmk I L Domaaki +dml I L Dameli +dmm I L Dama +dmo I L Kemedzung +dmr I L East Damar +dms I L Dampelas +dmu I L Dubu +dmv I L Dumpas +dmw I L Mudburra +dmx I L Dema +dmy I L Demta +dna I L Upper Grand Valley Dani +dnd I L Daonda +dne I L Ndendeule +dng I L Dungan +dni I L Lower Grand Valley Dani +dnj I L Dan +dnk I L Dengka +dnn I L Dzùùngoo +dnr I L Danaru +dnt I L Mid Grand Valley Dani +dnu I L Danau +dnv I L Danu +dnw I L Western Dani +dny I L Dení +doa I L Dom +dob I L Dobu +doc I L Northern Dong +doe I L Doe +dof I L Domu +doh I L Dong +doi doi doi M L Dogri (macrolanguage) +dok I L Dondo +dol I L Doso +don I L Toura (Papua New Guinea) +doo I L Dongo +dop I L Lukpa +doq I L Dominican Sign Language +dor I L Dori'o +dos I L Dogosé +dot I L Dass +dov I L Dombe +dow I L Doyayo +dox I L Bussa +doy I L Dompo +doz I L Dorze +dpp I L Papar +drb I L Dair +drc I L Minderico +drd I L Darmiya +dre I L Dolpo +drg I L Rungus +dri I L C'lela +drl I L Paakantyi +drn I L West Damar +dro I L Daro-Matu Melanau +drq I E Dura +drr I E Dororo +drs I L Gedeo +drt I L Drents +dru I L Rukai +dry I L Darai +dsb dsb dsb I L Lower Sorbian +dse I L Dutch Sign Language +dsh I L Daasanach +dsi I L Disa +dsl I L Danish Sign Language +dsn I L Dusner +dso I L Desiya +dsq I L Tadaksahak +dta I L Daur +dtb I L Labuk-Kinabatangan Kadazan +dtd I L Ditidaht +dth I E Adithinngithigh +dti I L Ana Tinga Dogon +dtk I L Tene Kan Dogon +dtm I L Tomo Kan Dogon +dto I L Tommo So Dogon +dtp I L Central Dusun +dtr I L Lotud +dts I L Toro So Dogon +dtt I L Toro Tegu Dogon +dtu I L Tebul Ure Dogon +dty I L Dotyali +dua dua dua I L Duala +dub I L Dubli +duc I L Duna +dud I L Hun-Saare +due I L Umiray Dumaget Agta +duf I L Dumbea +dug I L Duruma +duh I L Dungra Bhil +dui I L Dumun +duj I L Dhuwal +duk I L Uyajitaya +dul I L Alabat Island Agta +dum dum dum I H Middle Dutch (ca. 1050-1350) +dun I L Dusun Deyah +duo I L Dupaninan Agta +dup I L Duano +duq I L Dusun Malang +dur I L Dii +dus I L Dumi +duu I L Drung +duv I L Duvle +duw I L Dusun Witu +dux I L Duungooma +duy I E Dicamay Agta +duz I E Duli +dva I L Duau +dwa I L Diri +dwr I L Dawro +dws I C Dutton World Speedwords +dww I L Dawawa +dya I L Dyan +dyb I E Dyaberdyaber +dyd I E Dyugun +dyg I E Villa Viciosa Agta +dyi I L Djimini Senoufo +dym I L Yanda Dom Dogon +dyn I L Dyangadi +dyo I L Jola-Fonyi +dyu dyu dyu I L Dyula +dyy I L Dyaabugay +dza I L Tunzu +dzd I L Daza +dze I E Djiwarli +dzg I L Dazaga +dzl I L Dzalakha +dzn I L Dzando +dzo dzo dzo dz I L Dzongkha +eaa I E Karenggapa +ebg I L Ebughu +ebk I L Eastern Bontok +ebo I L Teke-Ebo +ebr I L Ebrié +ebu I L Embu +ecr I A Eteocretan +ecs I L Ecuadorian Sign Language +ecy I A Eteocypriot +eee I L E +efa I L Efai +efe I L Efe +efi efi efi I L Efik +ega I L Ega +egl I L Emilian +ego I L Eggon +egy egy egy I A Egyptian (Ancient) +ehu I L Ehueun +eip I L Eipomek +eit I L Eitiep +eiv I L Askopan +eja I L Ejamat +eka eka eka I L Ekajuk +ekc I E Eastern Karnic +eke I L Ekit +ekg I L Ekari +eki I L Eki +ekk I L Standard Estonian +ekl I L Kol (Bangladesh) +ekm I L Elip +eko I L Koti +ekp I L Ekpeye +ekr I L Yace +eky I L Eastern Kayah +ele I L Elepi +elh I L El Hugeirat +eli I E Nding +elk I L Elkei +ell gre ell el I L Modern Greek (1453-) +elm I L Eleme +elo I L El Molo +elu I L Elu +elx elx elx I A Elamite +ema I L Emai-Iuleha-Ora +emb I L Embaloh +eme I L Emerillon +emg I L Eastern Meohang +emi I L Mussau-Emira +emk I L Eastern Maninkakan +emm I E Mamulique +emn I L Eman +emo I E Emok +emp I L Northern Emberá +ems I L Pacific Gulf Yupik +emu I L Eastern Muria +emw I L Emplawas +emx I L Erromintxela +emy I E Epigraphic Mayan +ena I L Apali +enb I L Markweeta +enc I L En +end I L Ende +enf I L Forest Enets +eng eng eng en I L English +enh I L Tundra Enets +enm enm enm I H Middle English (1100-1500) +enn I L Engenni +eno I L Enggano +enq I L Enga +enr I L Emumu +enu I L Enu +env I L Enwan (Edu State) +enw I L Enwan (Akwa Ibom State) +eot I L Beti (Côte d'Ivoire) +epi I L Epie +epo epo epo eo I C Esperanto +era I L Eravallan +erg I L Sie +erh I L Eruwa +eri I L Ogea +erk I L South Efate +ero I L Horpa +err I E Erre +ers I L Ersu +ert I L Eritai +erw I L Erokwanas +ese I L Ese Ejja +esh I L Eshtehardi +esi I L North Alaskan Inupiatun +esk I L Northwest Alaska Inupiatun +esl I L Egypt Sign Language +esm I E Esuma +esn I L Salvadoran Sign Language +eso I L Estonian Sign Language +esq I E Esselen +ess I L Central Siberian Yupik +est est est et M L Estonian +esu I L Central Yupik +etb I L Etebi +etc I E Etchemin +eth I L Ethiopian Sign Language +etn I L Eton (Vanuatu) +eto I L Eton (Cameroon) +etr I L Edolo +ets I L Yekhee +ett I A Etruscan +etu I L Ejagham +etx I L Eten +etz I L Semimi +eus baq eus eu I L Basque +eve I L Even +evh I L Uvbie +evn I L Evenki +ewe ewe ewe ee I L Ewe +ewo ewo ewo I L Ewondo +ext I L Extremaduran +eya I E Eyak +eyo I L Keiyo +eza I L Ezaa +eze I L Uzekwe +faa I L Fasu +fab I L Fa d'Ambu +fad I L Wagi +faf I L Fagani +fag I L Finongan +fah I L Baissa Fali +fai I L Faiwol +faj I L Faita +fak I L Fang (Cameroon) +fal I L South Fali +fam I L Fam +fan fan fan I L Fang (Equatorial Guinea) +fao fao fao fo I L Faroese +fap I L Palor +far I L Fataleka +fas per fas fa M L Persian +fat fat fat I L Fanti +fau I L Fayu +fax I L Fala +fay I L Southwestern Fars +faz I L Northwestern Fars +fbl I L West Albay Bikol +fcs I L Quebec Sign Language +fer I L Feroge +ffi I L Foia Foia +ffm I L Maasina Fulfulde +fgr I L Fongoro +fia I L Nobiin +fie I L Fyer +fij fij fij fj I L Fijian +fil fil fil I L Filipino +fin fin fin fi I L Finnish +fip I L Fipa +fir I L Firan +fit I L Tornedalen Finnish +fiw I L Fiwaga +fkk I L Kirya-Konzəl +fkv I L Kven Finnish +fla I L Kalispel-Pend d'Oreille +flh I L Foau +fli I L Fali +fll I L North Fali +fln I E Flinders Island +flr I L Fuliiru +fly I L Tsotsitaal +fmp I L Fe'fe' +fmu I L Far Western Muria +fng I L Fanagalo +fni I L Fania +fod I L Foodo +foi I L Foi +fom I L Foma +fon fon fon I L Fon +for I L Fore +fos I E Siraya +fpe I L Fernando Po Creole English +fqs I L Fas +fra fre fra fr I L French +frc I L Cajun French +frd I L Fordata +frk I E Frankish +frm frm frm I H Middle French (ca. 1400-1600) +fro fro fro I H Old French (842-ca. 1400) +frp I L Arpitan +frq I L Forak +frr frr frr I L Northern Frisian +frs frs frs I L Eastern Frisian +frt I L Fortsenal +fry fry fry fy I L Western Frisian +fse I L Finnish Sign Language +fsl I L French Sign Language +fss I L Finland-Swedish Sign Language +fub I L Adamawa Fulfulde +fuc I L Pulaar +fud I L East Futuna +fue I L Borgu Fulfulde +fuf I L Pular +fuh I L Western Niger Fulfulde +fui I L Bagirmi Fulfulde +fuj I L Ko +ful ful ful ff M L Fulah +fum I L Fum +fun I L Fulniô +fuq I L Central-Eastern Niger Fulfulde +fur fur fur I L Friulian +fut I L Futuna-Aniwa +fuu I L Furu +fuv I L Nigerian Fulfulde +fuy I L Fuyug +fvr I L Fur +fwa I L Fwâi +fwe I L Fwe +gaa gaa gaa I L Ga +gab I L Gabri +gac I L Mixed Great Andamanese +gad I L Gaddang +gae I L Guarequena +gaf I L Gende +gag I L Gagauz +gah I L Alekano +gai I L Borei +gaj I L Gadsup +gak I L Gamkonora +gal I L Galolen +gam I L Kandawo +gan I L Gan Chinese +gao I L Gants +gap I L Gal +gaq I L Gata' +gar I L Galeya +gas I L Adiwasi Garasia +gat I L Kenati +gau I L Mudhili Gadaba +gaw I L Nobonob +gax I L Borana-Arsi-Guji Oromo +gay gay gay I L Gayo +gaz I L West Central Oromo +gba gba gba M L Gbaya (Central African Republic) +gbb I L Kaytetye +gbd I L Karadjeri +gbe I L Niksek +gbf I L Gaikundi +gbg I L Gbanziri +gbh I L Defi Gbe +gbi I L Galela +gbj I L Bodo Gadaba +gbk I L Gaddi +gbl I L Gamit +gbm I L Garhwali +gbn I L Mo'da +gbo I L Northern Grebo +gbp I L Gbaya-Bossangoa +gbq I L Gbaya-Bozoum +gbr I L Gbagyi +gbs I L Gbesi Gbe +gbu I L Gagadu +gbv I L Gbanu +gbw I L Gabi-Gabi +gbx I L Eastern Xwla Gbe +gby I L Gbari +gbz I L Zoroastrian Dari +gcc I L Mali +gcd I E Ganggalida +gce I E Galice +gcf I L Guadeloupean Creole French +gcl I L Grenadian Creole English +gcn I L Gaina +gcr I L Guianese Creole French +gct I L Colonia Tovar German +gda I L Gade Lohar +gdb I L Pottangi Ollar Gadaba +gdc I E Gugu Badhun +gdd I L Gedaged +gde I L Gude +gdf I L Guduf-Gava +gdg I L Ga'dang +gdh I L Gadjerawang +gdi I L Gundi +gdj I L Gurdjar +gdk I L Gadang +gdl I L Dirasha +gdm I L Laal +gdn I L Umanakaina +gdo I L Ghodoberi +gdq I L Mehri +gdr I L Wipi +gds I L Ghandruk Sign Language +gdt I E Kungardutyi +gdu I L Gudu +gdx I L Godwari +gea I L Geruma +geb I L Kire +gec I L Gboloo Grebo +ged I L Gade +geg I L Gengle +geh I L Hutterite German +gei I L Gebe +gej I L Gen +gek I L Yiwom +gel I L ut-Ma'in +geq I L Geme +ges I L Geser-Gorom +gew I L Gera +gex I L Garre +gey I L Enya +gez gez gez I A Geez +gfk I L Patpatar +gft I E Gafat +gfx I L Mangetti Dune !Xung +gga I L Gao +ggb I L Gbii +ggd I E Gugadj +gge I L Guragone +ggg I L Gurgula +ggk I E Kungarakany +ggl I L Ganglau +ggm I E Gugu Mini +ggn I L Eastern Gurung +ggo I L Southern Gondi +ggt I L Gitua +ggu I L Gagu +ggw I L Gogodala +gha I L Ghadamès +ghc I E Hiberno-Scottish Gaelic +ghe I L Southern Ghale +ghh I L Northern Ghale +ghk I L Geko Karen +ghl I L Ghulfan +ghn I L Ghanongga +gho I E Ghomara +ghr I L Ghera +ghs I L Guhu-Samane +ght I L Kuke +gia I L Kitja +gib I L Gibanawa +gic I L Gail +gid I L Gidar +gig I L Goaria +gih I L Githabul +gil gil gil I L Gilbertese +gim I L Gimi (Eastern Highlands) +gin I L Hinukh +gip I L Gimi (West New Britain) +giq I L Green Gelao +gir I L Red Gelao +gis I L North Giziga +git I L Gitxsan +giu I L Mulao +giw I L White Gelao +gix I L Gilima +giy I L Giyug +giz I L South Giziga +gji I L Geji +gjk I L Kachi Koli +gjm I E Gunditjmara +gjn I L Gonja +gju I L Gujari +gka I L Guya +gke I L Ndai +gkn I L Gokana +gko I E Kok-Nar +gkp I L Guinea Kpelle +gla gla gla gd I L Scottish Gaelic +glc I L Bon Gula +gld I L Nanai +gle gle gle ga I L Irish +glg glg glg gl I L Galician +glh I L Northwest Pashayi +gli I E Guliguli +glj I L Gula Iro +glk I L Gilaki +gll I E Garlali +glo I L Galambu +glr I L Glaro-Twabo +glu I L Gula (Chad) +glv glv glv gv I L Manx +glw I L Glavda +gly I E Gule +gma I E Gambera +gmb I L Gula'alaa +gmd I L Mághdì +gmh gmh gmh I H Middle High German (ca. 1050-1500) +gml I H Middle Low German +gmm I L Gbaya-Mbodomo +gmn I L Gimnime +gmu I L Gumalu +gmv I L Gamo +gmx I L Magoma +gmy I A Mycenaean Greek +gmz I L Mgbolizhia +gna I L Kaansa +gnb I L Gangte +gnc I E Guanche +gnd I L Zulgo-Gemzek +gne I L Ganang +gng I L Ngangam +gnh I L Lere +gni I L Gooniyandi +gnk I L //Gana +gnl I E Gangulu +gnm I L Ginuman +gnn I L Gumatj +gno I L Northern Gondi +gnq I L Gana +gnr I E Gureng Gureng +gnt I L Guntai +gnu I L Gnau +gnw I L Western Bolivian Guaraní +gnz I L Ganzi +goa I L Guro +gob I L Playero +goc I L Gorakor +god I L Godié +goe I L Gongduk +gof I L Gofa +gog I L Gogo +goh goh goh I H Old High German (ca. 750-1050) +goi I L Gobasi +goj I L Gowlan +gok I L Gowli +gol I L Gola +gom I L Goan Konkani +gon gon gon M L Gondi +goo I L Gone Dau +gop I L Yeretuar +goq I L Gorap +gor gor gor I L Gorontalo +gos I L Gronings +got got got I A Gothic +gou I L Gavar +gow I L Gorowa +gox I L Gobu +goy I L Goundo +goz I L Gozarkhani +gpa I L Gupa-Abawa +gpe I L Ghanaian Pidgin English +gpn I L Taiap +gqa I L Ga'anda +gqi I L Guiqiong +gqn I E Guana (Brazil) +gqr I L Gor +gqu I L Qau +gra I L Rajput Garasia +grb grb grb M L Grebo +grc grc grc I H Ancient Greek (to 1453) +grd I L Guruntum-Mbaaru +grg I L Madi +grh I L Gbiri-Niragu +gri I L Ghari +grj I L Southern Grebo +grm I L Kota Marudu Talantang +grn grn grn gn M L Guarani +gro I L Groma +grq I L Gorovu +grr I L Taznatit +grs I L Gresi +grt I L Garo +gru I L Kistane +grv I L Central Grebo +grw I L Gweda +grx I L Guriaso +gry I L Barclayville Grebo +grz I L Guramalum +gse I L Ghanaian Sign Language +gsg I L German Sign Language +gsl I L Gusilay +gsm I L Guatemalan Sign Language +gsn I L Gusan +gso I L Southwest Gbaya +gsp I L Wasembo +gss I L Greek Sign Language +gsw gsw gsw I L Swiss German +gta I L Guató +gti I L Gbati-ri +gtu I E Aghu-Tharnggala +gua I L Shiki +gub I L Guajajára +guc I L Wayuu +gud I L Yocoboué Dida +gue I L Gurinji +guf I L Gupapuyngu +gug I L Paraguayan Guaraní +guh I L Guahibo +gui I L Eastern Bolivian Guaraní +guj guj guj gu I L Gujarati +guk I L Gumuz +gul I L Sea Island Creole English +gum I L Guambiano +gun I L Mbyá Guaraní +guo I L Guayabero +gup I L Gunwinggu +guq I L Aché +gur I L Farefare +gus I L Guinean Sign Language +gut I L Maléku Jaíka +guu I L Yanomamö +guv I E Gey +guw I L Gun +gux I L Gourmanchéma +guz I L Gusii +gva I L Guana (Paraguay) +gvc I L Guanano +gve I L Duwet +gvf I L Golin +gvj I L Guajá +gvl I L Gulay +gvm I L Gurmana +gvn I L Kuku-Yalanji +gvo I L Gavião Do Jiparaná +gvp I L Pará Gavião +gvr I L Western Gurung +gvs I L Gumawana +gvy I E Guyani +gwa I L Mbato +gwb I L Gwa +gwc I L Kalami +gwd I L Gawwada +gwe I L Gweno +gwf I L Gowro +gwg I L Moo +gwi gwi gwi I L Gwichʼin +gwj I L /Gwi +gwm I E Awngthim +gwn I L Gwandara +gwr I L Gwere +gwt I L Gawar-Bati +gwu I E Guwamu +gww I L Kwini +gwx I L Gua +gxx I L Wè Southern +gya I L Northwest Gbaya +gyb I L Garus +gyd I L Kayardild +gye I L Gyem +gyf I E Gungabula +gyg I L Gbayi +gyi I L Gyele +gyl I L Gayil +gym I L Ngäbere +gyn I L Guyanese Creole English +gyr I L Guarayu +gyy I E Gunya +gza I L Ganza +gzi I L Gazi +gzn I L Gane +haa I L Han +hab I L Hanoi Sign Language +hac I L Gurani +had I L Hatam +hae I L Eastern Oromo +haf I L Haiphong Sign Language +hag I L Hanga +hah I L Hahon +hai hai hai M L Haida +haj I L Hajong +hak I L Hakka Chinese +hal I L Halang +ham I L Hewa +han I L Hangaza +hao I L Hakö +hap I L Hupla +haq I L Ha +har I L Harari +has I L Haisla +hat hat hat ht I L Haitian +hau hau hau ha I L Hausa +hav I L Havu +haw haw haw I L Hawaiian +hax I L Southern Haida +hay I L Haya +haz I L Hazaragi +hba I L Hamba +hbb I L Huba +hbn I L Heiban +hbo I H Ancient Hebrew +hbs sh M L Serbo-Croatian Code element for 639-1 has been deprecated +hbu I L Habu +hca I L Andaman Creole Hindi +hch I L Huichol +hdn I L Northern Haida +hds I L Honduras Sign Language +hdy I L Hadiyya +hea I L Northern Qiandong Miao +heb heb heb he I L Hebrew +hed I L Herdé +heg I L Helong +heh I L Hehe +hei I L Heiltsuk +hem I L Hemba +her her her hz I L Herero +hgm I L Hai//om +hgw I L Haigwai +hhi I L Hoia Hoia +hhr I L Kerak +hhy I L Hoyahoya +hia I L Lamang +hib I E Hibito +hid I L Hidatsa +hif I L Fiji Hindi +hig I L Kamwe +hih I L Pamosu +hii I L Hinduri +hij I L Hijuk +hik I L Seit-Kaitetu +hil hil hil I L Hiligaynon +hin hin hin hi I L Hindi +hio I L Tsoa +hir I L Himarimã +hit hit hit I A Hittite +hiw I L Hiw +hix I L Hixkaryána +hji I L Haji +hka I L Kahe +hke I L Hunde +hkk I L Hunjara-Kaina Ke +hks I L Hong Kong Sign Language +hla I L Halia +hlb I L Halbi +hld I L Halang Doan +hle I L Hlersu +hlt I L Matu Chin +hlu I A Hieroglyphic Luwian +hma I L Southern Mashan Hmong +hmb I L Humburi Senni Songhay +hmc I L Central Huishui Hmong +hmd I L Large Flowery Miao +hme I L Eastern Huishui Hmong +hmf I L Hmong Don +hmg I L Southwestern Guiyang Hmong +hmh I L Southwestern Huishui Hmong +hmi I L Northern Huishui Hmong +hmj I L Ge +hmk I E Maek +hml I L Luopohe Hmong +hmm I L Central Mashan Hmong +hmn hmn hmn M L Hmong +hmo hmo hmo ho I L Hiri Motu +hmp I L Northern Mashan Hmong +hmq I L Eastern Qiandong Miao +hmr I L Hmar +hms I L Southern Qiandong Miao +hmt I L Hamtai +hmu I L Hamap +hmv I L Hmong Dô +hmw I L Western Mashan Hmong +hmy I L Southern Guiyang Hmong +hmz I L Hmong Shua +hna I L Mina (Cameroon) +hnd I L Southern Hindko +hne I L Chhattisgarhi +hnh I L //Ani +hni I L Hani +hnj I L Hmong Njua +hnn I L Hanunoo +hno I L Northern Hindko +hns I L Caribbean Hindustani +hnu I L Hung +hoa I L Hoava +hob I L Mari (Madang Province) +hoc I L Ho +hod I E Holma +hoe I L Horom +hoh I L Hobyót +hoi I L Holikachuk +hoj I L Hadothi +hol I L Holu +hom I E Homa +hoo I L Holoholo +hop I L Hopi +hor I E Horo +hos I L Ho Chi Minh City Sign Language +hot I L Hote +hov I L Hovongan +how I L Honi +hoy I L Holiya +hoz I L Hozo +hpo I L Hpon +hps I L Hawai'i Pidgin Sign Language +hra I L Hrangkhol +hrc I L Niwer Mil +hre I L Hre +hrk I L Haruku +hrm I L Horned Miao +hro I L Haroi +hrp I E Nhirrpi +hrt I L Hértevin +hru I L Hruso +hrv hrv hrv hr I L Croatian +hrw I L Warwar Feni +hrx I L Hunsrik +hrz I L Harzani +hsb hsb hsb I L Upper Sorbian +hsh I L Hungarian Sign Language +hsl I L Hausa Sign Language +hsn I L Xiang Chinese +hss I L Harsusi +hti I L Hoti +hto I L Minica Huitoto +hts I L Hadza +htu I L Hitu +htx I A Middle Hittite +hub I L Huambisa +huc I L =/Hua +hud I L Huaulu +hue I L San Francisco Del Mar Huave +huf I L Humene +hug I L Huachipaeri +huh I L Huilliche +hui I L Huli +huj I L Northern Guiyang Hmong +huk I L Hulung +hul I L Hula +hum I L Hungana +hun hun hun hu I L Hungarian +huo I L Hu +hup hup hup I L Hupa +huq I L Tsat +hur I L Halkomelem +hus I L Huastec +hut I L Humla +huu I L Murui Huitoto +huv I L San Mateo Del Mar Huave +huw I E Hukumina +hux I L Nüpode Huitoto +huy I L Hulaulá +huz I L Hunzib +hvc I L Haitian Vodoun Culture Language +hve I L San Dionisio Del Mar Huave +hvk I L Haveke +hvn I L Sabu +hvv I L Santa María Del Mar Huave +hwa I L Wané +hwc I L Hawai'i Creole English +hwo I L Hwana +hya I L Hya +hye arm hye hy I L Armenian +iai I L Iaai +ian I L Iatmul +iap I L Iapama +iar I L Purari +iba iba iba I L Iban +ibb I L Ibibio +ibd I L Iwaidja +ibe I L Akpes +ibg I L Ibanag +ibl I L Ibaloi +ibm I L Agoi +ibn I L Ibino +ibo ibo ibo ig I L Igbo +ibr I L Ibuoro +ibu I L Ibu +iby I L Ibani +ica I L Ede Ica +ich I L Etkywan +icl I L Icelandic Sign Language +icr I L Islander Creole English +ida I L Idakho-Isukha-Tiriki +idb I L Indo-Portuguese +idc I L Idon +idd I L Ede Idaca +ide I L Idere +idi I L Idi +ido ido ido io I C Ido +idr I L Indri +ids I L Idesa +idt I L Idaté +idu I L Idoma +ifa I L Amganad Ifugao +ifb I L Batad Ifugao +ife I L Ifè +iff I E Ifo +ifk I L Tuwali Ifugao +ifm I L Teke-Fuumu +ifu I L Mayoyao Ifugao +ify I L Keley-I Kallahan +igb I L Ebira +ige I L Igede +igg I L Igana +igl I L Igala +igm I L Kanggape +ign I L Ignaciano +igo I L Isebe +igs I C Interglossa +igw I L Igwe +ihb I L Iha Based Pidgin +ihi I L Ihievbe +ihp I L Iha +ihw I E Bidhawal +iii iii iii ii I L Sichuan Yi +iin I E Thiin +ijc I L Izon +ije I L Biseni +ijj I L Ede Ije +ijn I L Kalabari +ijs I L Southeast Ijo +ike I L Eastern Canadian Inuktitut +iki I L Iko +ikk I L Ika +ikl I L Ikulu +iko I L Olulumo-Ikom +ikp I L Ikpeshi +ikr I E Ikaranggal +ikt I L Inuinnaqtun +iku iku iku iu M L Inuktitut +ikv I L Iku-Gora-Ankwa +ikw I L Ikwere +ikx I L Ik +ikz I L Ikizu +ila I L Ile Ape +ilb I L Ila +ile ile ile ie I C Interlingue +ilg I E Garig-Ilgar +ili I L Ili Turki +ilk I L Ilongot +ill I L Iranun +ilo ilo ilo I L Iloko +ils I L International Sign +ilu I L Ili'uun +ilv I L Ilue +ima I L Mala Malasar +ime I L Imeraguen +imi I L Anamgura +iml I E Miluk +imn I L Imonda +imo I L Imbongu +imr I L Imroing +ims I A Marsian +imy I A Milyan +ina ina ina ia I C Interlingua (International Auxiliary Language Association) +inb I L Inga +ind ind ind id I L Indonesian +ing I L Degexit'an +inh inh inh I L Ingush +inj I L Jungle Inga +inl I L Indonesian Sign Language +inm I A Minaean +inn I L Isinai +ino I L Inoke-Yate +inp I L Iñapari +ins I L Indian Sign Language +int I L Intha +inz I E Ineseño +ior I L Inor +iou I L Tuma-Irumu +iow I E Iowa-Oto +ipi I L Ipili +ipk ipk ipk ik M L Inupiaq +ipo I L Ipiko +iqu I L Iquito +iqw I L Ikwo +ire I L Iresim +irh I L Irarutu +iri I L Irigwe +irk I L Iraqw +irn I L Irántxe +irr I L Ir +iru I L Irula +irx I L Kamberau +iry I L Iraya +isa I L Isabi +isc I L Isconahua +isd I L Isnag +ise I L Italian Sign Language +isg I L Irish Sign Language +ish I L Esan +isi I L Nkem-Nkum +isk I L Ishkashimi +isl ice isl is I L Icelandic +ism I L Masimasi +isn I L Isanzu +iso I L Isoko +isr I L Israeli Sign Language +ist I L Istriot +isu I L Isu (Menchum Division) +ita ita ita it I L Italian +itb I L Binongan Itneg +ite I E Itene +iti I L Inlaod Itneg +itk I L Judeo-Italian +itl I L Itelmen +itm I L Itu Mbon Uzo +ito I L Itonama +itr I L Iteri +its I L Isekiri +itt I L Maeng Itneg +itv I L Itawit +itw I L Ito +itx I L Itik +ity I L Moyadan Itneg +itz I L Itzá +ium I L Iu Mien +ivb I L Ibatan +ivv I L Ivatan +iwk I L I-Wak +iwm I L Iwam +iwo I L Iwur +iws I L Sepik Iwam +ixc I L Ixcatec +ixl I L Ixil +iya I L Iyayu +iyo I L Mesaka +iyx I L Yaka (Congo) +izh I L Ingrian +izr I L Izere +izz I L Izii +jaa I L Jamamadí +jab I L Hyam +jac I L Popti' +jad I L Jahanka +jae I L Yabem +jaf I L Jara +jah I L Jah Hut +jaj I L Zazao +jak I L Jakun +jal I L Yalahatan +jam I L Jamaican Creole English +jan I E Jandai +jao I L Yanyuwa +jaq I L Yaqay +jas I L New Caledonian Javanese +jat I L Jakati +jau I L Yaur +jav jav jav jv I L Javanese +jax I L Jambi Malay +jay I L Yan-nhangu +jaz I L Jawe +jbe I L Judeo-Berber +jbi I E Badjiri +jbj I L Arandai +jbk I L Barikewa +jbn I L Nafusi +jbo jbo jbo I C Lojban +jbr I L Jofotek-Bromnya +jbt I L Jabutí +jbu I L Jukun Takum +jbw I E Yawijibaya +jcs I L Jamaican Country Sign Language +jct I L Krymchak +jda I L Jad +jdg I L Jadgali +jdt I L Judeo-Tat +jeb I L Jebero +jee I L Jerung +jeg I L Jeng +jeh I L Jeh +jei I L Yei +jek I L Jeri Kuo +jel I L Yelmek +jen I L Dza +jer I L Jere +jet I L Manem +jeu I L Jonkor Bourmataguil +jgb I E Ngbee +jge I L Judeo-Georgian +jgk I L Gwak +jgo I L Ngomba +jhi I L Jehai +jhs I L Jhankot Sign Language +jia I L Jina +jib I L Jibu +jic I L Tol +jid I L Bu +jie I L Jilbe +jig I L Djingili +jih I L sTodsde +jii I L Jiiddu +jil I L Jilim +jim I L Jimi (Cameroon) +jio I L Jiamao +jiq I L Guanyinqiao +jit I L Jita +jiu I L Youle Jinuo +jiv I L Shuar +jiy I L Buyuan Jinuo +jjr I L Bankal +jkm I L Mobwa Karen +jko I L Kubo +jkp I L Paku Karen +jkr I L Koro (India) +jku I L Labir +jle I L Ngile +jls I L Jamaican Sign Language +jma I L Dima +jmb I L Zumbun +jmc I L Machame +jmd I L Yamdena +jmi I L Jimi (Nigeria) +jml I L Jumli +jmn I L Makuri Naga +jmr I L Kamara +jms I L Mashi (Nigeria) +jmw I L Mouwase +jmx I L Western Juxtlahuaca Mixtec +jna I L Jangshung +jnd I L Jandavra +jng I E Yangman +jni I L Janji +jnj I L Yemsa +jnl I L Rawat +jns I L Jaunsari +job I L Joba +jod I L Wojenaka +jor I E Jorá +jos I L Jordanian Sign Language +jow I L Jowulu +jpa I H Jewish Palestinian Aramaic +jpn jpn jpn ja I L Japanese +jpr jpr jpr I L Judeo-Persian +jqr I L Jaqaru +jra I L Jarai +jrb jrb jrb M L Judeo-Arabic +jrr I L Jiru +jrt I L Jorto +jru I L Japrería +jsl I L Japanese Sign Language +jua I L Júma +jub I L Wannu +juc I E Jurchen +jud I L Worodougou +juh I L Hõne +jui I E Ngadjuri +juk I L Wapan +jul I L Jirel +jum I L Jumjum +jun I L Juang +juo I L Jiba +jup I L Hupdë +jur I L Jurúna +jus I L Jumla Sign Language +jut I L Jutish +juu I L Ju +juw I L Wãpha +juy I L Juray +jvd I E Javindo +jvn I L Caribbean Javanese +jwi I L Jwira-Pepesa +jya I L Jiarong +jye I L Judeo-Yemeni Arabic +jyy I L Jaya +kaa kaa kaa I L Kara-Kalpak +kab kab kab I L Kabyle +kac kac kac I L Kachin +kad I L Adara +kae I E Ketangalan +kaf I L Katso +kag I L Kajaman +kah I L Kara (Central African Republic) +kai I L Karekare +kaj I L Jju +kak I L Kayapa Kallahan +kal kal kal kl I L Kalaallisut +kam kam kam I L Kamba (Kenya) +kan kan kan kn I L Kannada +kao I L Xaasongaxango +kap I L Bezhta +kaq I L Capanahua +kas kas kas ks I L Kashmiri +kat geo kat ka I L Georgian +kau kau kau kr M L Kanuri +kav I L Katukína +kaw kaw kaw I A Kawi +kax I L Kao +kay I L Kamayurá +kaz kaz kaz kk I L Kazakh +kba I E Kalarko +kbb I E Kaxuiâna +kbc I L Kadiwéu +kbd kbd kbd I L Kabardian +kbe I L Kanju +kbf I E Kakauhua +kbg I L Khamba +kbh I L Camsá +kbi I L Kaptiau +kbj I L Kari +kbk I L Grass Koiari +kbl I L Kanembu +kbm I L Iwal +kbn I L Kare (Central African Republic) +kbo I L Keliko +kbp I L Kabiyè +kbq I L Kamano +kbr I L Kafa +kbs I L Kande +kbt I L Abadi +kbu I L Kabutra +kbv I L Dera (Indonesia) +kbw I L Kaiep +kbx I L Ap Ma +kby I L Manga Kanuri +kbz I L Duhwa +kca I L Khanty +kcb I L Kawacha +kcc I L Lubila +kcd I L Ngkâlmpw Kanum +kce I L Kaivi +kcf I L Ukaan +kcg I L Tyap +kch I L Vono +kci I L Kamantan +kcj I L Kobiana +kck I L Kalanga +kcl I L Kela (Papua New Guinea) +kcm I L Gula (Central African Republic) +kcn I L Nubi +kco I L Kinalakna +kcp I L Kanga +kcq I L Kamo +kcr I L Katla +kcs I L Koenoem +kct I L Kaian +kcu I L Kami (Tanzania) +kcv I L Kete +kcw I L Kabwari +kcx I L Kachama-Ganjule +kcy I L Korandje +kcz I L Konongo +kda I E Worimi +kdc I L Kutu +kdd I L Yankunytjatjara +kde I L Makonde +kdf I L Mamusi +kdg I L Seba +kdh I L Tem +kdi I L Kumam +kdj I L Karamojong +kdk I L Numèè +kdl I L Tsikimba +kdm I L Kagoma +kdn I L Kunda +kdp I L Kaningdon-Nindem +kdq I L Koch +kdr I L Karaim +kdt I L Kuy +kdu I L Kadaru +kdw I L Koneraw +kdx I L Kam +kdy I L Keder +kdz I L Kwaja +kea I L Kabuverdianu +keb I L Kélé +kec I L Keiga +ked I L Kerewe +kee I L Eastern Keres +kef I L Kpessi +keg I L Tese +keh I L Keak +kei I L Kei +kej I L Kadar +kek I L Kekchí +kel I L Kela (Democratic Republic of Congo) +kem I L Kemak +ken I L Kenyang +keo I L Kakwa +kep I L Kaikadi +keq I L Kamar +ker I L Kera +kes I L Kugbo +ket I L Ket +keu I L Akebu +kev I L Kanikkaran +kew I L West Kewa +kex I L Kukna +key I L Kupia +kez I L Kukele +kfa I L Kodava +kfb I L Northwestern Kolami +kfc I L Konda-Dora +kfd I L Korra Koraga +kfe I L Kota (India) +kff I L Koya +kfg I L Kudiya +kfh I L Kurichiya +kfi I L Kannada Kurumba +kfj I L Kemiehua +kfk I L Kinnauri +kfl I L Kung +kfm I L Khunsari +kfn I L Kuk +kfo I L Koro (Côte d'Ivoire) +kfp I L Korwa +kfq I L Korku +kfr I L Kachchi +kfs I L Bilaspuri +kft I L Kanjari +kfu I L Katkari +kfv I L Kurmukar +kfw I L Kharam Naga +kfx I L Kullu Pahari +kfy I L Kumaoni +kfz I L Koromfé +kga I L Koyaga +kgb I L Kawe +kgc I L Kasseng +kgd I L Kataang +kge I L Komering +kgf I L Kube +kgg I L Kusunda +kgi I L Selangor Sign Language +kgj I L Gamale Kham +kgk I L Kaiwá +kgl I E Kunggari +kgm I E Karipúna +kgn I L Karingani +kgo I L Krongo +kgp I L Kaingang +kgq I L Kamoro +kgr I L Abun +kgs I L Kumbainggar +kgt I L Somyev +kgu I L Kobol +kgv I L Karas +kgw I L Karon Dori +kgx I L Kamaru +kgy I L Kyerung +kha kha kha I L Khasi +khb I L Lü +khc I L Tukang Besi North +khd I L Bädi Kanum +khe I L Korowai +khf I L Khuen +khg I L Khams Tibetan +khh I L Kehu +khj I L Kuturmi +khk I L Halh Mongolian +khl I L Lusi +khm khm khm km I L Central Khmer +khn I L Khandesi +kho kho kho I A Khotanese +khp I L Kapori +khq I L Koyra Chiini Songhay +khr I L Kharia +khs I L Kasua +kht I L Khamti +khu I L Nkhumbi +khv I L Khvarshi +khw I L Khowar +khx I L Kanu +khy I L Kele (Democratic Republic of Congo) +khz I L Keapara +kia I L Kim +kib I L Koalib +kic I L Kickapoo +kid I L Koshin +kie I L Kibet +kif I L Eastern Parbate Kham +kig I L Kimaama +kih I L Kilmeri +kii I E Kitsai +kij I L Kilivila +kik kik kik ki I L Kikuyu +kil I L Kariya +kim I L Karagas +kin kin kin rw I L Kinyarwanda +kio I L Kiowa +kip I L Sheshi Kham +kiq I L Kosadle +kir kir kir ky I L Kirghiz +kis I L Kis +kit I L Agob +kiu I L Kirmanjki (individual language) +kiv I L Kimbu +kiw I L Northeast Kiwai +kix I L Khiamniungan Naga +kiy I L Kirikiri +kiz I L Kisi +kja I L Mlap +kjb I L Q'anjob'al +kjc I L Coastal Konjo +kjd I L Southern Kiwai +kje I L Kisar +kjf I L Khalaj +kjg I L Khmu +kjh I L Khakas +kji I L Zabana +kjj I L Khinalugh +kjk I L Highland Konjo +kjl I L Western Parbate Kham +kjm I L Kháng +kjn I L Kunjen +kjo I L Harijan Kinnauri +kjp I L Pwo Eastern Karen +kjq I L Western Keres +kjr I L Kurudu +kjs I L East Kewa +kjt I L Phrae Pwo Karen +kju I L Kashaya +kjx I L Ramopa +kjy I L Erave +kjz I L Bumthangkha +kka I L Kakanda +kkb I L Kwerisa +kkc I L Odoodee +kkd I L Kinuku +kke I L Kakabe +kkf I L Kalaktang Monpa +kkg I L Mabaka Valley Kalinga +kkh I L Khün +kki I L Kagulu +kkj I L Kako +kkk I L Kokota +kkl I L Kosarek Yale +kkm I L Kiong +kkn I L Kon Keu +kko I L Karko +kkp I L Gugubera +kkq I L Kaiku +kkr I L Kir-Balar +kks I L Giiwo +kkt I L Koi +kku I L Tumi +kkv I L Kangean +kkw I L Teke-Kukuya +kkx I L Kohin +kky I L Guguyimidjir +kkz I L Kaska +kla I E Klamath-Modoc +klb I L Kiliwa +klc I L Kolbila +kld I L Gamilaraay +kle I L Kulung (Nepal) +klf I L Kendeje +klg I L Tagakaulo +klh I L Weliki +kli I L Kalumpang +klj I L Turkic Khalaj +klk I L Kono (Nigeria) +kll I L Kagan Kalagan +klm I L Migum +kln M L Kalenjin +klo I L Kapya +klp I L Kamasa +klq I L Rumu +klr I L Khaling +kls I L Kalasha +klt I L Nukna +klu I L Klao +klv I L Maskelynes +klw I L Lindu +klx I L Koluwawa +kly I L Kalao +klz I L Kabola +kma I L Konni +kmb kmb kmb I L Kimbundu +kmc I L Southern Dong +kmd I L Majukayang Kalinga +kme I L Bakole +kmf I L Kare (Papua New Guinea) +kmg I L Kâte +kmh I L Kalam +kmi I L Kami (Nigeria) +kmj I L Kumarbhag Paharia +kmk I L Limos Kalinga +kml I L Tanudan Kalinga +kmm I L Kom (India) +kmn I L Awtuw +kmo I L Kwoma +kmp I L Gimme +kmq I L Kwama +kmr I L Northern Kurdish +kms I L Kamasau +kmt I L Kemtuik +kmu I L Kanite +kmv I L Karipúna Creole French +kmw I L Komo (Democratic Republic of Congo) +kmx I L Waboda +kmy I L Koma +kmz I L Khorasani Turkish +kna I L Dera (Nigeria) +knb I L Lubuagan Kalinga +knc I L Central Kanuri +knd I L Konda +kne I L Kankanaey +knf I L Mankanya +kng I L Koongo +kni I L Kanufi +knj I L Western Kanjobal +knk I L Kuranko +knl I L Keninjal +knm I L Kanamarí +knn I L Konkani (individual language) +kno I L Kono (Sierra Leone) +knp I L Kwanja +knq I L Kintaq +knr I L Kaningra +kns I L Kensiu +knt I L Panoan Katukína +knu I L Kono (Guinea) +knv I L Tabo +knw I L Kung-Ekoka +knx I L Kendayan +kny I L Kanyok +knz I L Kalamsé +koa I L Konomala +koc I E Kpati +kod I L Kodi +koe I L Kacipo-Balesi +kof I E Kubi +kog I L Cogui +koh I L Koyo +koi I L Komi-Permyak +koj I L Sara Dunjo +kok kok kok M L Konkani (macrolanguage) +kol I L Kol (Papua New Guinea) +kom kom kom kv M L Komi +kon kon kon kg M L Kongo +koo I L Konzo +kop I L Waube +koq I L Kota (Gabon) +kor kor kor ko I L Korean +kos kos kos I L Kosraean +kot I L Lagwan +kou I L Koke +kov I L Kudu-Camo +kow I L Kugama +kox I E Coxima +koy I L Koyukon +koz I L Korak +kpa I L Kutto +kpb I L Mullu Kurumba +kpc I L Curripaco +kpd I L Koba +kpe kpe kpe M L Kpelle +kpf I L Komba +kpg I L Kapingamarangi +kph I L Kplang +kpi I L Kofei +kpj I L Karajá +kpk I L Kpan +kpl I L Kpala +kpm I L Koho +kpn I E Kepkiriwát +kpo I L Ikposo +kpq I L Korupun-Sela +kpr I L Korafe-Yegha +kps I L Tehit +kpt I L Karata +kpu I L Kafoa +kpv I L Komi-Zyrian +kpw I L Kobon +kpx I L Mountain Koiali +kpy I L Koryak +kpz I L Kupsabiny +kqa I L Mum +kqb I L Kovai +kqc I L Doromu-Koki +kqd I L Koy Sanjaq Surat +kqe I L Kalagan +kqf I L Kakabai +kqg I L Khe +kqh I L Kisankasa +kqi I L Koitabu +kqj I L Koromira +kqk I L Kotafon Gbe +kql I L Kyenele +kqm I L Khisa +kqn I L Kaonde +kqo I L Eastern Krahn +kqp I L Kimré +kqq I L Krenak +kqr I L Kimaragang +kqs I L Northern Kissi +kqt I L Klias River Kadazan +kqu I E Seroa +kqv I L Okolod +kqw I L Kandas +kqx I L Mser +kqy I L Koorete +kqz I E Korana +kra I L Kumhali +krb I E Karkin +krc krc krc I L Karachay-Balkar +krd I L Kairui-Midiki +kre I L Panará +krf I L Koro (Vanuatu) +krh I L Kurama +kri I L Krio +krj I L Kinaray-A +krk I E Kerek +krl krl krl I L Karelian +krm I L Krim +krn I L Sapo +krp I L Korop +krr I L Kru'ng 2 +krs I L Gbaya (Sudan) +krt I L Tumari Kanuri +kru kru kru I L Kurukh +krv I L Kavet +krw I L Western Krahn +krx I L Karon +kry I L Kryts +krz I L Sota Kanum +ksa I L Shuwa-Zamani +ksb I L Shambala +ksc I L Southern Kalinga +ksd I L Kuanua +kse I L Kuni +ksf I L Bafia +ksg I L Kusaghe +ksh I L Kölsch +ksi I L Krisa +ksj I L Uare +ksk I L Kansa +ksl I L Kumalu +ksm I L Kumba +ksn I L Kasiguranin +kso I L Kofa +ksp I L Kaba +ksq I L Kwaami +ksr I L Borong +kss I L Southern Kisi +kst I L Winyé +ksu I L Khamyang +ksv I L Kusu +ksw I L S'gaw Karen +ksx I L Kedang +ksy I L Kharia Thar +ksz I L Kodaku +kta I L Katua +ktb I L Kambaata +ktc I L Kholok +ktd I L Kokata +kte I L Nubri +ktf I L Kwami +ktg I E Kalkutung +kth I L Karanga +kti I L North Muyu +ktj I L Plapo Krumen +ktk I E Kaniet +ktl I L Koroshi +ktm I L Kurti +ktn I L Karitiâna +kto I L Kuot +ktp I L Kaduo +ktq I E Katabaga +ktr I L Kota Marudu Tinagas +kts I L South Muyu +ktt I L Ketum +ktu I L Kituba (Democratic Republic of Congo) +ktv I L Eastern Katu +ktw I E Kato +ktx I L Kaxararí +kty I L Kango (Bas-Uélé District) +ktz I L Ju/'hoan +kua kua kua kj I L Kuanyama +kub I L Kutep +kuc I L Kwinsu +kud I L 'Auhelawa +kue I L Kuman +kuf I L Western Katu +kug I L Kupa +kuh I L Kushi +kui I L Kuikúro-Kalapálo +kuj I L Kuria +kuk I L Kepo' +kul I L Kulere +kum kum kum I L Kumyk +kun I L Kunama +kuo I L Kumukio +kup I L Kunimaipa +kuq I L Karipuna +kur kur kur ku M L Kurdish +kus I L Kusaal +kut kut kut I L Kutenai +kuu I L Upper Kuskokwim +kuv I L Kur +kuw I L Kpagua +kux I L Kukatja +kuy I L Kuuku-Ya'u +kuz I E Kunza +kva I L Bagvalal +kvb I L Kubu +kvc I L Kove +kvd I L Kui (Indonesia) +kve I L Kalabakan +kvf I L Kabalai +kvg I L Kuni-Boazi +kvh I L Komodo +kvi I L Kwang +kvj I L Psikye +kvk I L Korean Sign Language +kvl I L Kayaw +kvm I L Kendem +kvn I L Border Kuna +kvo I L Dobel +kvp I L Kompane +kvq I L Geba Karen +kvr I L Kerinci +kvs I L Kunggara +kvt I L Lahta Karen +kvu I L Yinbaw Karen +kvv I L Kola +kvw I L Wersing +kvx I L Parkari Koli +kvy I L Yintale Karen +kvz I L Tsakwambo +kwa I L Dâw +kwb I L Kwa +kwc I L Likwala +kwd I L Kwaio +kwe I L Kwerba +kwf I L Kwara'ae +kwg I L Sara Kaba Deme +kwh I L Kowiai +kwi I L Awa-Cuaiquer +kwj I L Kwanga +kwk I L Kwakiutl +kwl I L Kofyar +kwm I L Kwambi +kwn I L Kwangali +kwo I L Kwomtari +kwp I L Kodia +kwq I L Kwak +kwr I L Kwer +kws I L Kwese +kwt I L Kwesten +kwu I L Kwakum +kwv I L Sara Kaba Náà +kww I L Kwinti +kwx I L Khirwar +kwy I L San Salvador Kongo +kwz I E Kwadi +kxa I L Kairiru +kxb I L Krobu +kxc I L Konso +kxd I L Brunei +kxe I L Kakihum +kxf I L Manumanaw Karen +kxh I L Karo (Ethiopia) +kxi I L Keningau Murut +kxj I L Kulfa +kxk I L Zayein Karen +kxl I L Nepali Kurux +kxm I L Northern Khmer +kxn I L Kanowit-Tanjong Melanau +kxo I E Kanoé +kxp I L Wadiyara Koli +kxq I L Smärky Kanum +kxr I L Koro (Papua New Guinea) +kxs I L Kangjia +kxt I L Koiwat +kxu I L Kui (India) +kxv I L Kuvi +kxw I L Konai +kxx I L Likuba +kxy I L Kayong +kxz I L Kerewo +kya I L Kwaya +kyb I L Butbut Kalinga +kyc I L Kyaka +kyd I L Karey +kye I L Krache +kyf I L Kouya +kyg I L Keyagana +kyh I L Karok +kyi I L Kiput +kyj I L Karao +kyk I L Kamayo +kyl I L Kalapuya +kym I L Kpatili +kyn I L Northern Binukidnon +kyo I L Kelon +kyp I L Kang +kyq I L Kenga +kyr I L Kuruáya +kys I L Baram Kayan +kyt I L Kayagar +kyu I L Western Kayah +kyv I L Kayort +kyw I L Kudmali +kyx I L Rapoisi +kyy I L Kambaira +kyz I L Kayabí +kza I L Western Karaboro +kzb I L Kaibobo +kzc I L Bondoukou Kulango +kzd I L Kadai +kze I L Kosena +kzf I L Da'a Kaili +kzg I L Kikai +kzi I L Kelabit +kzj I L Coastal Kadazan +kzk I E Kazukuru +kzl I L Kayeli +kzm I L Kais +kzn I L Kokola +kzo I L Kaningi +kzp I L Kaidipang +kzq I L Kaike +kzr I L Karang +kzs I L Sugut Dusun +kzt I L Tambunan Dusun +kzu I L Kayupulau +kzv I L Komyandaret +kzw I E Karirí-Xocó +kzx I L Kamarian +kzy I L Kango (Tshopo District) +kzz I L Kalabra +laa I L Southern Subanen +lab I A Linear A +lac I L Lacandon +lad lad lad I L Ladino +lae I L Pattani +laf I L Lafofa +lag I L Langi +lah lah lah M L Lahnda +lai I L Lambya +laj I L Lango (Uganda) +lak I L Laka (Nigeria) +lal I L Lalia +lam lam lam I L Lamba +lan I L Laru +lao lao lao lo I L Lao +lap I L Laka (Chad) +laq I L Qabiao +lar I L Larteh +las I L Lama (Togo) +lat lat lat la I A Latin +lau I L Laba +lav lav lav lv M L Latvian +law I L Lauje +lax I L Tiwa +lay I L Lama (Myanmar) +laz I E Aribwatsa +lba I E Lui +lbb I L Label +lbc I L Lakkia +lbe I L Lak +lbf I L Tinani +lbg I L Laopang +lbi I L La'bi +lbj I L Ladakhi +lbk I L Central Bontok +lbl I L Libon Bikol +lbm I L Lodhi +lbn I L Lamet +lbo I L Laven +lbq I L Wampar +lbr I L Lohorung +lbs I L Libyan Sign Language +lbt I L Lachi +lbu I L Labu +lbv I L Lavatbura-Lamusong +lbw I L Tolaki +lbx I L Lawangan +lby I E Lamu-Lamu +lbz I L Lardil +lcc I L Legenyem +lcd I L Lola +lce I L Loncong +lcf I L Lubu +lch I L Luchazi +lcl I L Lisela +lcm I L Tungag +lcp I L Western Lawa +lcq I L Luhu +lcs I L Lisabata-Nuniali +lda I L Kla-Dan +ldb I L Dũya +ldd I L Luri +ldg I L Lenyima +ldh I L Lamja-Dengsa-Tola +ldi I L Laari +ldj I L Lemoro +ldk I L Leelau +ldl I L Kaan +ldm I L Landoma +ldn I C Láadan +ldo I L Loo +ldp I L Tso +ldq I L Lufu +lea I L Lega-Shabunda +leb I L Lala-Bisa +lec I L Leco +led I L Lendu +lee I L Lyélé +lef I L Lelemi +leg I L Lengua +leh I L Lenje +lei I L Lemio +lej I L Lengola +lek I L Leipon +lel I L Lele (Democratic Republic of Congo) +lem I L Nomaande +len I E Lenca +leo I L Leti (Cameroon) +lep I L Lepcha +leq I L Lembena +ler I L Lenkau +les I L Lese +let I L Lesing-Gelimi +leu I L Kara (Papua New Guinea) +lev I L Lamma +lew I L Ledo Kaili +lex I L Luang +ley I L Lemolang +lez lez lez I L Lezghian +lfa I L Lefa +lfn I C Lingua Franca Nova +lga I L Lungga +lgb I L Laghu +lgg I L Lugbara +lgh I L Laghuu +lgi I L Lengilu +lgk I L Lingarak +lgl I L Wala +lgm I L Lega-Mwenga +lgn I L Opuuo +lgq I L Logba +lgr I L Lengo +lgt I L Pahi +lgu I L Longgu +lgz I L Ligenza +lha I L Laha (Viet Nam) +lhh I L Laha (Indonesia) +lhi I L Lahu Shi +lhl I L Lahul Lohar +lhm I L Lhomi +lhn I L Lahanan +lhp I L Lhokpu +lhs I E Mlahsö +lht I L Lo-Toga +lhu I L Lahu +lia I L West-Central Limba +lib I L Likum +lic I L Hlai +lid I L Nyindrou +lie I L Likila +lif I L Limbu +lig I L Ligbi +lih I L Lihir +lii I L Lingkhim +lij I L Ligurian +lik I L Lika +lil I L Lillooet +lim lim lim li I L Limburgan +lin lin lin ln I L Lingala +lio I L Liki +lip I L Sekpele +liq I L Libido +lir I L Liberian English +lis I L Lisu +lit lit lit lt I L Lithuanian +liu I L Logorik +liv I L Liv +liw I L Col +lix I L Liabuku +liy I L Banda-Bambari +liz I L Libinza +lja I E Golpa +lje I L Rampi +lji I L Laiyolo +ljl I L Li'o +ljp I L Lampung Api +ljw I L Yirandali +ljx I E Yuru +lka I L Lakalei +lkb I L Kabras +lkc I L Kucong +lkd I L Lakondê +lke I L Kenyi +lkh I L Lakha +lki I L Laki +lkj I L Remun +lkl I L Laeko-Libuat +lkm I E Kalaamaya +lkn I L Lakon +lko I L Khayo +lkr I L Päri +lks I L Kisa +lkt I L Lakota +lku I E Kungkari +lky I L Lokoya +lla I L Lala-Roba +llb I L Lolo +llc I L Lele (Guinea) +lld I L Ladin +lle I L Lele (Papua New Guinea) +llf I E Hermit +llg I L Lole +llh I L Lamu +lli I L Teke-Laali +llj I E Ladji Ladji +llk I E Lelak +lll I L Lilau +llm I L Lasalimu +lln I L Lele (Chad) +llo I L Khlor +llp I L North Efate +llq I L Lolak +lls I L Lithuanian Sign Language +llu I L Lau +llx I L Lauan +lma I L East Limba +lmb I L Merei +lmc I E Limilngan +lmd I L Lumun +lme I L Pévé +lmf I L South Lembata +lmg I L Lamogai +lmh I L Lambichhong +lmi I L Lombi +lmj I L West Lembata +lmk I L Lamkang +lml I L Hano +lmm I L Lamam +lmn I L Lambadi +lmo I L Lombard +lmp I L Limbum +lmq I L Lamatuka +lmr I L Lamalera +lmu I L Lamenu +lmv I L Lomaiviti +lmw I L Lake Miwok +lmx I L Laimbue +lmy I L Lamboya +lmz I E Lumbee +lna I L Langbashe +lnb I L Mbalanhu +lnd I L Lundayeh +lng I A Langobardic +lnh I L Lanoh +lni I L Daantanai' +lnj I E Leningitij +lnl I L South Central Banda +lnm I L Langam +lnn I L Lorediakarkar +lno I L Lango (Sudan) +lns I L Lamnso' +lnu I L Longuda +lnw I E Lanima +lnz I L Lonzo +loa I L Loloda +lob I L Lobi +loc I L Inonhan +loe I L Saluan +lof I L Logol +log I L Logo +loh I L Narim +loi I L Loma (Côte d'Ivoire) +loj I L Lou +lok I L Loko +lol lol lol I L Mongo +lom I L Loma (Liberia) +lon I L Malawi Lomwe +loo I L Lombo +lop I L Lopa +loq I L Lobala +lor I L Téén +los I L Loniu +lot I L Otuho +lou I L Louisiana Creole French +lov I L Lopi +low I L Tampias Lobu +lox I L Loun +loy I L Loke +loz loz loz I L Lozi +lpa I L Lelepa +lpe I L Lepki +lpn I L Long Phuri Naga +lpo I L Lipo +lpx I L Lopit +lra I L Rara Bakati' +lrc I L Northern Luri +lre I E Laurentian +lrg I E Laragia +lri I L Marachi +lrk I L Loarki +lrl I L Lari +lrm I L Marama +lrn I L Lorang +lro I L Laro +lrr I L Southern Yamphu +lrt I L Larantuka Malay +lrv I L Larevat +lrz I L Lemerig +lsa I L Lasgerdi +lsd I L Lishana Deni +lse I L Lusengo +lsg I L Lyons Sign Language +lsh I L Lish +lsi I L Lashi +lsl I L Latvian Sign Language +lsm I L Saamia +lso I L Laos Sign Language +lsp I L Panamanian Sign Language +lsr I L Aruop +lss I L Lasi +lst I L Trinidad and Tobago Sign Language +lsy I L Mauritian Sign Language +ltc I H Late Middle Chinese +ltg I L Latgalian +lti I L Leti (Indonesia) +ltn I L Latundê +lto I L Tsotso +lts I L Tachoni +ltu I L Latu +ltz ltz ltz lb I L Luxembourgish +lua lua lua I L Luba-Lulua +lub lub lub lu I L Luba-Katanga +luc I L Aringa +lud I L Ludian +lue I L Luvale +luf I L Laua +lug lug lug lg I L Ganda +lui lui lui I L Luiseno +luj I L Luna +luk I L Lunanakha +lul I L Olu'bo +lum I L Luimbi +lun lun lun I L Lunda +luo luo luo I L Luo (Kenya and Tanzania) +lup I L Lumbu +luq I L Lucumi +lur I L Laura +lus lus lus I L Lushai +lut I L Lushootseed +luu I L Lumba-Yakkha +luv I L Luwati +luw I L Luo (Cameroon) +luy M L Luyia +luz I L Southern Luri +lva I L Maku'a +lvk I L Lavukaleve +lvs I L Standard Latvian +lvu I L Levuka +lwa I L Lwalu +lwe I L Lewo Eleng +lwg I L Wanga +lwh I L White Lachi +lwl I L Eastern Lawa +lwm I L Laomian +lwo I L Luwo +lwt I L Lewotobi +lwu I L Lawu +lww I L Lewo +lya I L Layakha +lyg I L Lyngngam +lyn I L Luyana +lzh I H Literary Chinese +lzl I L Litzlitz +lzn I L Leinong Naga +lzz I L Laz +maa I L San Jerónimo Tecóatl Mazatec +mab I L Yutanduchi Mixtec +mad mad mad I L Madurese +mae I L Bo-Rukul +maf I L Mafa +mag mag mag I L Magahi +mah mah mah mh I L Marshallese +mai mai mai I L Maithili +maj I L Jalapa De Díaz Mazatec +mak mak mak I L Makasar +mal mal mal ml I L Malayalam +mam I L Mam +man man man M L Mandingo +maq I L Chiquihuitlán Mazatec +mar mar mar mr I L Marathi +mas mas mas I L Masai +mat I L San Francisco Matlatzinca +mau I L Huautla Mazatec +mav I L Sateré-Mawé +maw I L Mampruli +max I L North Moluccan Malay +maz I L Central Mazahua +mba I L Higaonon +mbb I L Western Bukidnon Manobo +mbc I L Macushi +mbd I L Dibabawon Manobo +mbe I E Molale +mbf I L Baba Malay +mbh I L Mangseng +mbi I L Ilianen Manobo +mbj I L Nadëb +mbk I L Malol +mbl I L Maxakalí +mbm I L Ombamba +mbn I L Macaguán +mbo I L Mbo (Cameroon) +mbp I L Malayo +mbq I L Maisin +mbr I L Nukak Makú +mbs I L Sarangani Manobo +mbt I L Matigsalug Manobo +mbu I L Mbula-Bwazza +mbv I L Mbulungish +mbw I L Maring +mbx I L Mari (East Sepik Province) +mby I L Memoni +mbz I L Amoltepec Mixtec +mca I L Maca +mcb I L Machiguenga +mcc I L Bitur +mcd I L Sharanahua +mce I L Itundujia Mixtec +mcf I L Matsés +mcg I L Mapoyo +mch I L Maquiritari +mci I L Mese +mcj I L Mvanip +mck I L Mbunda +mcl I E Macaguaje +mcm I L Malaccan Creole Portuguese +mcn I L Masana +mco I L Coatlán Mixe +mcp I L Makaa +mcq I L Ese +mcr I L Menya +mcs I L Mambai +mct I L Mengisa +mcu I L Cameroon Mambila +mcv I L Minanibai +mcw I L Mawa (Chad) +mcx I L Mpiemo +mcy I L South Watut +mcz I L Mawan +mda I L Mada (Nigeria) +mdb I L Morigi +mdc I L Male (Papua New Guinea) +mdd I L Mbum +mde I L Maba (Chad) +mdf mdf mdf I L Moksha +mdg I L Massalat +mdh I L Maguindanaon +mdi I L Mamvu +mdj I L Mangbetu +mdk I L Mangbutu +mdl I L Maltese Sign Language +mdm I L Mayogo +mdn I L Mbati +mdp I L Mbala +mdq I L Mbole +mdr mdr mdr I L Mandar +mds I L Maria (Papua New Guinea) +mdt I L Mbere +mdu I L Mboko +mdv I L Santa Lucía Monteverde Mixtec +mdw I L Mbosi +mdx I L Dizin +mdy I L Male (Ethiopia) +mdz I L Suruí Do Pará +mea I L Menka +meb I L Ikobi +mec I L Mara +med I L Melpa +mee I L Mengen +mef I L Megam +meh I L Southwestern Tlaxiaco Mixtec +mei I L Midob +mej I L Meyah +mek I L Mekeo +mel I L Central Melanau +mem I E Mangala +men men men I L Mende (Sierra Leone) +meo I L Kedah Malay +mep I L Miriwung +meq I L Merey +mer I L Meru +mes I L Masmaje +met I L Mato +meu I L Motu +mev I L Mano +mew I L Maaka +mey I L Hassaniyya +mez I L Menominee +mfa I L Pattani Malay +mfb I L Bangka +mfc I L Mba +mfd I L Mendankwe-Nkwen +mfe I L Morisyen +mff I L Naki +mfg I L Mogofin +mfh I L Matal +mfi I L Wandala +mfj I L Mefele +mfk I L North Mofu +mfl I L Putai +mfm I L Marghi South +mfn I L Cross River Mbembe +mfo I L Mbe +mfp I L Makassar Malay +mfq I L Moba +mfr I L Marithiel +mfs I L Mexican Sign Language +mft I L Mokerang +mfu I L Mbwela +mfv I L Mandjak +mfw I E Mulaha +mfx I L Melo +mfy I L Mayo +mfz I L Mabaan +mga mga mga I H Middle Irish (900-1200) +mgb I L Mararit +mgc I L Morokodo +mgd I L Moru +mge I L Mango +mgf I L Maklew +mgg I L Mpumpong +mgh I L Makhuwa-Meetto +mgi I L Lijili +mgj I L Abureni +mgk I L Mawes +mgl I L Maleu-Kilenge +mgm I L Mambae +mgn I L Mbangi +mgo I L Meta' +mgp I L Eastern Magar +mgq I L Malila +mgr I L Mambwe-Lungu +mgs I L Manda (Tanzania) +mgt I L Mongol +mgu I L Mailu +mgv I L Matengo +mgw I L Matumbi +mgy I L Mbunga +mgz I L Mbugwe +mha I L Manda (India) +mhb I L Mahongwe +mhc I L Mocho +mhd I L Mbugu +mhe I L Besisi +mhf I L Mamaa +mhg I L Margu +mhh I L Maskoy Pidgin +mhi I L Ma'di +mhj I L Mogholi +mhk I L Mungaka +mhl I L Mauwake +mhm I L Makhuwa-Moniga +mhn I L Mócheno +mho I L Mashi (Zambia) +mhp I L Balinese Malay +mhq I L Mandan +mhr I L Eastern Mari +mhs I L Buru (Indonesia) +mht I L Mandahuaca +mhu I L Digaro-Mishmi +mhw I L Mbukushu +mhx I L Maru +mhy I L Ma'anyan +mhz I L Mor (Mor Islands) +mia I L Miami +mib I L Atatláhuca Mixtec +mic mic mic I L Mi'kmaq +mid I L Mandaic +mie I L Ocotepec Mixtec +mif I L Mofu-Gudur +mig I L San Miguel El Grande Mixtec +mih I L Chayuco Mixtec +mii I L Chigmecatitlán Mixtec +mij I L Abar +mik I L Mikasuki +mil I L Peñoles Mixtec +mim I L Alacatlatzala Mixtec +min min min I L Minangkabau +mio I L Pinotepa Nacional Mixtec +mip I L Apasco-Apoala Mixtec +miq I L Mískito +mir I L Isthmus Mixe +mis mis mis S S Uncoded languages +mit I L Southern Puebla Mixtec +miu I L Cacaloxtepec Mixtec +miw I L Akoye +mix I L Mixtepec Mixtec +miy I L Ayutla Mixtec +miz I L Coatzospan Mixtec +mjc I L San Juan Colorado Mixtec +mjd I L Northwest Maidu +mje I E Muskum +mjg I L Tu +mjh I L Mwera (Nyasa) +mji I L Kim Mun +mjj I L Mawak +mjk I L Matukar +mjl I L Mandeali +mjm I L Medebur +mjn I L Ma (Papua New Guinea) +mjo I L Malankuravan +mjp I L Malapandaram +mjq I E Malaryan +mjr I L Malavedan +mjs I L Miship +mjt I L Sauria Paharia +mju I L Manna-Dora +mjv I L Mannan +mjw I L Karbi +mjx I L Mahali +mjy I E Mahican +mjz I L Majhi +mka I L Mbre +mkb I L Mal Paharia +mkc I L Siliput +mkd mac mkd mk I L Macedonian +mke I L Mawchi +mkf I L Miya +mkg I L Mak (China) +mki I L Dhatki +mkj I L Mokilese +mkk I L Byep +mkl I L Mokole +mkm I L Moklen +mkn I L Kupang Malay +mko I L Mingang Doso +mkp I L Moikodi +mkq I E Bay Miwok +mkr I L Malas +mks I L Silacayoapan Mixtec +mkt I L Vamale +mku I L Konyanka Maninka +mkv I L Mafea +mkw I L Kituba (Congo) +mkx I L Kinamiging Manobo +mky I L East Makian +mkz I L Makasae +mla I L Malo +mlb I L Mbule +mlc I L Cao Lan +mle I L Manambu +mlf I L Mal +mlg mlg mlg mg M L Malagasy +mlh I L Mape +mli I L Malimpung +mlj I L Miltu +mlk I L Ilwana +mll I L Malua Bay +mlm I L Mulam +mln I L Malango +mlo I L Mlomp +mlp I L Bargam +mlq I L Western Maninkakan +mlr I L Vame +mls I L Masalit +mlt mlt mlt mt I L Maltese +mlu I L To'abaita +mlv I L Motlav +mlw I L Moloko +mlx I L Malfaxal +mlz I L Malaynon +mma I L Mama +mmb I L Momina +mmc I L Michoacán Mazahua +mmd I L Maonan +mme I L Mae +mmf I L Mundat +mmg I L North Ambrym +mmh I L Mehináku +mmi I L Musar +mmj I L Majhwar +mmk I L Mukha-Dora +mml I L Man Met +mmm I L Maii +mmn I L Mamanwa +mmo I L Mangga Buang +mmp I L Siawi +mmq I L Musak +mmr I L Western Xiangxi Miao +mmt I L Malalamai +mmu I L Mmaala +mmv I E Miriti +mmw I L Emae +mmx I L Madak +mmy I L Migaama +mmz I L Mabaale +mna I L Mbula +mnb I L Muna +mnc mnc mnc I L Manchu +mnd I L Mondé +mne I L Naba +mnf I L Mundani +mng I L Eastern Mnong +mnh I L Mono (Democratic Republic of Congo) +mni mni mni I L Manipuri +mnj I L Munji +mnk I L Mandinka +mnl I L Tiale +mnm I L Mapena +mnn I L Southern Mnong +mnp I L Min Bei Chinese +mnq I L Minriq +mnr I L Mono (USA) +mns I L Mansi +mnu I L Mer +mnv I L Rennell-Bellona +mnw I L Mon +mnx I L Manikion +mny I L Manyawa +mnz I L Moni +moa I L Mwan +moc I L Mocoví +mod I E Mobilian +moe I L Montagnais +mog I L Mongondow +moh moh moh I L Mohawk +moi I L Mboi +moj I L Monzombo +mok I L Morori +mom I E Mangue +mon mon mon mn M L Mongolian +moo I L Monom +mop I L Mopán Maya +moq I L Mor (Bomberai Peninsula) +mor I L Moro +mos mos mos I L Mossi +mot I L Barí +mou I L Mogum +mov I L Mohave +mow I L Moi (Congo) +mox I L Molima +moy I L Shekkacho +moz I L Mukulu +mpa I L Mpoto +mpb I L Mullukmulluk +mpc I L Mangarayi +mpd I L Machinere +mpe I L Majang +mpg I L Marba +mph I L Maung +mpi I L Mpade +mpj I L Martu Wangka +mpk I L Mbara (Chad) +mpl I L Middle Watut +mpm I L Yosondúa Mixtec +mpn I L Mindiri +mpo I L Miu +mpp I L Migabac +mpq I L Matís +mpr I L Vangunu +mps I L Dadibi +mpt I L Mian +mpu I L Makuráp +mpv I L Mungkip +mpw I L Mapidian +mpx I L Misima-Panaeati +mpy I L Mapia +mpz I L Mpi +mqa I L Maba (Indonesia) +mqb I L Mbuko +mqc I L Mangole +mqe I L Matepi +mqf I L Momuna +mqg I L Kota Bangun Kutai Malay +mqh I L Tlazoyaltepec Mixtec +mqi I L Mariri +mqj I L Mamasa +mqk I L Rajah Kabunsuwan Manobo +mql I L Mbelime +mqm I L South Marquesan +mqn I L Moronene +mqo I L Modole +mqp I L Manipa +mqq I L Minokok +mqr I L Mander +mqs I L West Makian +mqt I L Mok +mqu I L Mandari +mqv I L Mosimo +mqw I L Murupi +mqx I L Mamuju +mqy I L Manggarai +mqz I L Pano +mra I L Mlabri +mrb I L Marino +mrc I L Maricopa +mrd I L Western Magar +mre I E Martha's Vineyard Sign Language +mrf I L Elseng +mrg I L Mising +mrh I L Mara Chin +mri mao mri mi I L Maori +mrj I L Western Mari +mrk I L Hmwaveke +mrl I L Mortlockese +mrm I L Merlav +mrn I L Cheke Holo +mro I L Mru +mrp I L Morouas +mrq I L North Marquesan +mrr I L Maria (India) +mrs I L Maragus +mrt I L Marghi Central +mru I L Mono (Cameroon) +mrv I L Mangareva +mrw I L Maranao +mrx I L Maremgi +mry I L Mandaya +mrz I L Marind +msa may msa ms M L Malay (macrolanguage) +msb I L Masbatenyo +msc I L Sankaran Maninka +msd I L Yucatec Maya Sign Language +mse I L Musey +msf I L Mekwei +msg I L Moraid +msh I L Masikoro Malagasy +msi I L Sabah Malay +msj I L Ma (Democratic Republic of Congo) +msk I L Mansaka +msl I L Molof +msm I L Agusan Manobo +msn I L Vurës +mso I L Mombum +msp I E Maritsauá +msq I L Caac +msr I L Mongolian Sign Language +mss I L West Masela +msu I L Musom +msv I L Maslam +msw I L Mansoanka +msx I L Moresada +msy I L Aruamu +msz I L Momare +mta I L Cotabato Manobo +mtb I L Anyin Morofo +mtc I L Munit +mtd I L Mualang +mte I L Mono (Solomon Islands) +mtf I L Murik (Papua New Guinea) +mtg I L Una +mth I L Munggui +mti I L Maiwa (Papua New Guinea) +mtj I L Moskona +mtk I L Mbe' +mtl I L Montol +mtm I E Mator +mtn I E Matagalpa +mto I L Totontepec Mixe +mtp I L Wichí Lhamtés Nocten +mtq I L Muong +mtr I L Mewari +mts I L Yora +mtt I L Mota +mtu I L Tututepec Mixtec +mtv I L Asaro'o +mtw I L Southern Binukidnon +mtx I L Tidaá Mixtec +mty I L Nabi +mua I L Mundang +mub I L Mubi +muc I L Ajumbu +mud I L Mednyj Aleut +mue I L Media Lengua +mug I L Musgu +muh I L Mündü +mui I L Musi +muj I L Mabire +muk I L Mugom +mul mul mul S S Multiple languages +mum I L Maiwala +muo I L Nyong +mup I L Malvi +muq I L Eastern Xiangxi Miao +mur I L Murle +mus mus mus I L Creek +mut I L Western Muria +muu I L Yaaku +muv I L Muthuvan +mux I L Bo-Ung +muy I L Muyang +muz I L Mursi +mva I L Manam +mvb I E Mattole +mvd I L Mamboru +mve I L Marwari (Pakistan) +mvf I L Peripheral Mongolian +mvg I L Yucuañe Mixtec +mvh I L Mulgi +mvi I L Miyako +mvk I L Mekmek +mvl I E Mbara (Australia) +mvm I L Muya +mvn I L Minaveha +mvo I L Marovo +mvp I L Duri +mvq I L Moere +mvr I L Marau +mvs I L Massep +mvt I L Mpotovoro +mvu I L Marfa +mvv I L Tagal Murut +mvw I L Machinga +mvx I L Meoswar +mvy I L Indus Kohistani +mvz I L Mesqan +mwa I L Mwatebu +mwb I L Juwal +mwc I L Are +mwe I L Mwera (Chimwera) +mwf I L Murrinh-Patha +mwg I L Aiklep +mwh I L Mouk-Aria +mwi I L Labo +mwj I L Maligo +mwk I L Kita Maninkakan +mwl mwl mwl I L Mirandese +mwm I L Sar +mwn I L Nyamwanga +mwo I L Central Maewo +mwp I L Kala Lagaw Ya +mwq I L Mün Chin +mwr mwr mwr M L Marwari +mws I L Mwimbi-Muthambi +mwt I L Moken +mwu I E Mittu +mwv I L Mentawai +mww I L Hmong Daw +mwx I L Mediak +mwy I L Mosiro +mwz I L Moingi +mxa I L Northwest Oaxaca Mixtec +mxb I L Tezoatlán Mixtec +mxc I L Manyika +mxd I L Modang +mxe I L Mele-Fila +mxf I L Malgbe +mxg I L Mbangala +mxh I L Mvuba +mxi I E Mozarabic +mxj I L Miju-Mishmi +mxk I L Monumbo +mxl I L Maxi Gbe +mxm I L Meramera +mxn I L Moi (Indonesia) +mxo I L Mbowe +mxp I L Tlahuitoltepec Mixe +mxq I L Juquila Mixe +mxr I L Murik (Malaysia) +mxs I L Huitepec Mixtec +mxt I L Jamiltepec Mixtec +mxu I L Mada (Cameroon) +mxv I L Metlatónoc Mixtec +mxw I L Namo +mxx I L Mahou +mxy I L Southeastern Nochixtlán Mixtec +mxz I L Central Masela +mya bur mya my I L Burmese +myb I L Mbay +myc I L Mayeka +myd I L Maramba +mye I L Myene +myf I L Bambassi +myg I L Manta +myh I L Makah +myi I L Mina (India) +myj I L Mangayat +myk I L Mamara Senoufo +myl I L Moma +mym I L Me'en +myo I L Anfillo +myp I L Pirahã +myr I L Muniche +mys I E Mesmes +myu I L Mundurukú +myv myv myv I L Erzya +myw I L Muyuw +myx I L Masaaba +myy I L Macuna +myz I H Classical Mandaic +mza I L Santa María Zacatepec Mixtec +mzb I L Tumzabt +mzc I L Madagascar Sign Language +mzd I L Malimba +mze I L Morawa +mzg I L Monastic Sign Language +mzh I L Wichí Lhamtés Güisnay +mzi I L Ixcatlán Mazatec +mzj I L Manya +mzk I L Nigeria Mambila +mzl I L Mazatlán Mixe +mzm I L Mumuye +mzn I L Mazanderani +mzo I E Matipuhy +mzp I L Movima +mzq I L Mori Atas +mzr I L Marúbo +mzs I L Macanese +mzt I L Mintil +mzu I L Inapang +mzv I L Manza +mzw I L Deg +mzx I L Mawayana +mzy I L Mozambican Sign Language +mzz I L Maiadomu +naa I L Namla +nab I L Southern Nambikuára +nac I L Narak +nad I L Nijadali +nae I L Naka'ela +naf I L Nabak +nag I L Naga Pidgin +naj I L Nalu +nak I L Nakanai +nal I L Nalik +nam I L Ngan'gityemerri +nan I L Min Nan Chinese +nao I L Naaba +nap nap nap I L Neapolitan +naq I L Nama (Namibia) +nar I L Iguta +nas I L Naasioi +nat I L Hungworo +nau nau nau na I L Nauru +nav nav nav nv I L Navajo +naw I L Nawuri +nax I L Nakwi +nay I E Narrinyeri +naz I L Coatepec Nahuatl +nba I L Nyemba +nbb I L Ndoe +nbc I L Chang Naga +nbd I L Ngbinda +nbe I L Konyak Naga +nbg I L Nagarchal +nbh I L Ngamo +nbi I L Mao Naga +nbj I L Ngarinman +nbk I L Nake +nbl nbl nbl nr I L South Ndebele +nbm I L Ngbaka Ma'bo +nbn I L Kuri +nbo I L Nkukoli +nbp I L Nnam +nbq I L Nggem +nbr I L Numana-Nunku-Gbantu-Numbu +nbs I L Namibian Sign Language +nbt I L Na +nbu I L Rongmei Naga +nbv I L Ngamambo +nbw I L Southern Ngbandi +nby I L Ningera +nca I L Iyo +ncb I L Central Nicobarese +ncc I L Ponam +ncd I L Nachering +nce I L Yale +ncf I L Notsi +ncg I L Nisga'a +nch I L Central Huasteca Nahuatl +nci I H Classical Nahuatl +ncj I L Northern Puebla Nahuatl +nck I L Nakara +ncl I L Michoacán Nahuatl +ncm I L Nambo +ncn I L Nauna +nco I L Sibe +ncp I L Ndaktup +ncr I L Ncane +ncs I L Nicaraguan Sign Language +nct I L Chothe Naga +ncu I L Chumburung +ncx I L Central Puebla Nahuatl +ncz I E Natchez +nda I L Ndasa +ndb I L Kenswei Nsei +ndc I L Ndau +ndd I L Nde-Nsele-Nta +nde nde nde nd I L North Ndebele +ndf I E Nadruvian +ndg I L Ndengereko +ndh I L Ndali +ndi I L Samba Leko +ndj I L Ndamba +ndk I L Ndaka +ndl I L Ndolo +ndm I L Ndam +ndn I L Ngundi +ndo ndo ndo ng I L Ndonga +ndp I L Ndo +ndq I L Ndombe +ndr I L Ndoola +nds nds nds I L Low German +ndt I L Ndunga +ndu I L Dugun +ndv I L Ndut +ndw I L Ndobo +ndx I L Nduga +ndy I L Lutos +ndz I L Ndogo +nea I L Eastern Ngad'a +neb I L Toura (Côte d'Ivoire) +nec I L Nedebang +ned I L Nde-Gbite +nee I L Nêlêmwa-Nixumwak +nef I L Nefamese +neg I L Negidal +neh I L Nyenkha +nei I A Neo-Hittite +nej I L Neko +nek I L Neku +nem I L Nemi +nen I L Nengone +neo I L Ná-Meo +nep nep nep ne M L Nepali (macrolanguage) +neq I L North Central Mixe +ner I L Yahadian +nes I L Bhoti Kinnauri +net I L Nete +neu I C Neo +nev I L Nyaheun +new new new I L Newari +nex I L Neme +ney I L Neyo +nez I L Nez Perce +nfa I L Dhao +nfd I L Ahwai +nfl I L Ayiwo +nfr I L Nafaanra +nfu I L Mfumte +nga I L Ngbaka +ngb I L Northern Ngbandi +ngc I L Ngombe (Democratic Republic of Congo) +ngd I L Ngando (Central African Republic) +nge I L Ngemba +ngg I L Ngbaka Manza +ngh I L N/u +ngi I L Ngizim +ngj I L Ngie +ngk I L Dalabon +ngl I L Lomwe +ngm I L Ngatik Men's Creole +ngn I L Ngwo +ngo I L Ngoni +ngp I L Ngulu +ngq I L Ngurimi +ngr I L Engdewu +ngs I L Gvoko +ngt I L Ngeq +ngu I L Guerrero Nahuatl +ngv I E Nagumi +ngw I L Ngwaba +ngx I L Nggwahyi +ngy I L Tibea +ngz I L Ngungwel +nha I L Nhanda +nhb I L Beng +nhc I E Tabasco Nahuatl +nhd I L Chiripá +nhe I L Eastern Huasteca Nahuatl +nhf I L Nhuwala +nhg I L Tetelcingo Nahuatl +nhh I L Nahari +nhi I L Zacatlán-Ahuacatlán-Tepetzintla Nahuatl +nhk I L Isthmus-Cosoleacaque Nahuatl +nhm I L Morelos Nahuatl +nhn I L Central Nahuatl +nho I L Takuu +nhp I L Isthmus-Pajapan Nahuatl +nhq I L Huaxcaleca Nahuatl +nhr I L Naro +nht I L Ometepec Nahuatl +nhu I L Noone +nhv I L Temascaltepec Nahuatl +nhw I L Western Huasteca Nahuatl +nhx I L Isthmus-Mecayapan Nahuatl +nhy I L Northern Oaxaca Nahuatl +nhz I L Santa María La Alta Nahuatl +nia nia nia I L Nias +nib I L Nakame +nid I E Ngandi +nie I L Niellim +nif I L Nek +nig I E Ngalakan +nih I L Nyiha (Tanzania) +nii I L Nii +nij I L Ngaju +nik I L Southern Nicobarese +nil I L Nila +nim I L Nilamba +nin I L Ninzo +nio I L Nganasan +niq I L Nandi +nir I L Nimboran +nis I L Nimi +nit I L Southeastern Kolami +niu niu niu I L Niuean +niv I L Gilyak +niw I L Nimo +nix I L Hema +niy I L Ngiti +niz I L Ningil +nja I L Nzanyi +njb I L Nocte Naga +njd I L Ndonde Hamba +njh I L Lotha Naga +nji I L Gudanji +njj I L Njen +njl I L Njalgulgule +njm I L Angami Naga +njn I L Liangmai Naga +njo I L Ao Naga +njr I L Njerep +njs I L Nisa +njt I L Ndyuka-Trio Pidgin +nju I L Ngadjunmaya +njx I L Kunyi +njy I L Njyem +njz I L Nyishi +nka I L Nkoya +nkb I L Khoibu Naga +nkc I L Nkongho +nkd I L Koireng +nke I L Duke +nkf I L Inpui Naga +nkg I L Nekgini +nkh I L Khezha Naga +nki I L Thangal Naga +nkj I L Nakai +nkk I L Nokuku +nkm I L Namat +nkn I L Nkangala +nko I L Nkonya +nkp I E Niuatoputapu +nkq I L Nkami +nkr I L Nukuoro +nks I L North Asmat +nkt I L Nyika (Tanzania) +nku I L Bouna Kulango +nkv I L Nyika (Malawi and Zambia) +nkw I L Nkutu +nkx I L Nkoroo +nkz I L Nkari +nla I L Ngombale +nlc I L Nalca +nld dut nld nl I L Dutch +nle I L East Nyala +nlg I L Gela +nli I L Grangali +nlj I L Nyali +nlk I L Ninia Yali +nll I L Nihali +nlo I L Ngul +nlq I L Lao Naga +nlu I L Nchumbulu +nlv I L Orizaba Nahuatl +nlw I E Walangama +nlx I L Nahali +nly I L Nyamal +nlz I L Nalögo +nma I L Maram Naga +nmb I L Big Nambas +nmc I L Ngam +nmd I L Ndumu +nme I L Mzieme Naga +nmf I L Tangkhul Naga (India) +nmg I L Kwasio +nmh I L Monsang Naga +nmi I L Nyam +nmj I L Ngombe (Central African Republic) +nmk I L Namakura +nml I L Ndemli +nmm I L Manangba +nmn I L !Xóõ +nmo I L Moyon Naga +nmp I E Nimanbur +nmq I L Nambya +nmr I E Nimbari +nms I L Letemboi +nmt I L Namonuito +nmu I L Northeast Maidu +nmv I E Ngamini +nmw I L Nimoa +nmx I L Nama (Papua New Guinea) +nmy I L Namuyi +nmz I L Nawdm +nna I L Nyangumarta +nnb I L Nande +nnc I L Nancere +nnd I L West Ambae +nne I L Ngandyera +nnf I L Ngaing +nng I L Maring Naga +nnh I L Ngiemboon +nni I L North Nuaulu +nnj I L Nyangatom +nnk I L Nankina +nnl I L Northern Rengma Naga +nnm I L Namia +nnn I L Ngete +nno nno nno nn I L Norwegian Nynorsk +nnp I L Wancho Naga +nnq I L Ngindo +nnr I E Narungga +nns I L Ningye +nnt I E Nanticoke +nnu I L Dwang +nnv I E Nugunu (Australia) +nnw I L Southern Nuni +nnx I L Ngong +nny I E Nyangga +nnz I L Nda'nda' +noa I L Woun Meu +nob nob nob nb I L Norwegian Bokmål +noc I L Nuk +nod I L Northern Thai +noe I L Nimadi +nof I L Nomane +nog nog nog I L Nogai +noh I L Nomu +noi I L Noiri +noj I L Nonuya +nok I E Nooksack +nol I E Nomlaki +nom I E Nocamán +non non non I H Old Norse +nop I L Numanggang +noq I L Ngongo +nor nor nor no M L Norwegian +nos I L Eastern Nisu +not I L Nomatsiguenga +nou I L Ewage-Notu +nov I C Novial +now I L Nyambo +noy I L Noy +noz I L Nayi +npa I L Nar Phu +npb I L Nupbikha +npg I L Ponyo-Gongwang Naga +nph I L Phom Naga +npi I L Nepali (individual language) +npl I L Southeastern Puebla Nahuatl +npn I L Mondropolon +npo I L Pochuri Naga +nps I L Nipsan +npu I L Puimei Naga +npy I L Napu +nqg I L Southern Nago +nqk I L Kura Ede Nago +nqm I L Ndom +nqn I L Nen +nqo nqo nqo I L N'Ko +nqq I L Kyan-Karyaw Naga +nqy I L Akyaung Ari Naga +nra I L Ngom +nrb I L Nara +nrc I A Noric +nre I L Southern Rengma Naga +nrg I L Narango +nri I L Chokri Naga +nrk I L Ngarla +nrl I L Ngarluma +nrm I L Narom +nrn I E Norn +nrp I A North Picene +nrr I E Norra +nrt I E Northern Kalapuya +nru I L Narua +nrx I E Ngurmbur +nrz I L Lala +nsa I L Sangtam Naga +nsc I L Nshi +nsd I L Southern Nisu +nse I L Nsenga +nsf I L Northwestern Nisu +nsg I L Ngasa +nsh I L Ngoshie +nsi I L Nigerian Sign Language +nsk I L Naskapi +nsl I L Norwegian Sign Language +nsm I L Sumi Naga +nsn I L Nehan +nso nso nso I L Pedi +nsp I L Nepalese Sign Language +nsq I L Northern Sierra Miwok +nsr I L Maritime Sign Language +nss I L Nali +nst I L Tase Naga +nsu I L Sierra Negra Nahuatl +nsv I L Southwestern Nisu +nsw I L Navut +nsx I L Nsongo +nsy I L Nasal +nsz I L Nisenan +nte I L Nathembo +ntg I E Ngantangarra +nti I L Natioro +ntj I L Ngaanyatjarra +ntk I L Ikoma-Nata-Isenye +ntm I L Nateni +nto I L Ntomba +ntp I L Northern Tepehuan +ntr I L Delo +nts I E Natagaimas +ntu I L Natügu +ntw I E Nottoway +ntx I L Tangkhul Naga (Myanmar) +nty I L Mantsi +ntz I L Natanzi +nua I L Yuanga +nuc I E Nukuini +nud I L Ngala +nue I L Ngundu +nuf I L Nusu +nug I E Nungali +nuh I L Ndunda +nui I L Ngumbi +nuj I L Nyole +nuk I L Nuu-chah-nulth +nul I L Nusa Laut +num I L Niuafo'ou +nun I L Anong +nuo I L Nguôn +nup I L Nupe-Nupe-Tako +nuq I L Nukumanu +nur I L Nukuria +nus I L Nuer +nut I L Nung (Viet Nam) +nuu I L Ngbundu +nuv I L Northern Nuni +nuw I L Nguluwan +nux I L Mehek +nuy I L Nunggubuyu +nuz I L Tlamacazapa Nahuatl +nvh I L Nasarian +nvm I L Namiae +nvo I L Nyokon +nwa I E Nawathinehena +nwb I L Nyabwa +nwc nwc nwc I H Classical Newari +nwe I L Ngwe +nwg I E Ngayawung +nwi I L Southwest Tanna +nwm I L Nyamusa-Molo +nwo I E Nauo +nwr I L Nawaru +nwx I H Middle Newar +nwy I E Nottoway-Meherrin +nxa I L Nauete +nxd I L Ngando (Democratic Republic of Congo) +nxe I L Nage +nxg I L Ngad'a +nxi I L Nindi +nxk I L Koki Naga +nxl I L South Nuaulu +nxm I A Numidian +nxn I E Ngawun +nxq I L Naxi +nxr I L Ninggerum +nxu I E Narau +nxx I L Nafri +nya nya nya ny I L Nyanja +nyb I L Nyangbo +nyc I L Nyanga-li +nyd I L Nyore +nye I L Nyengo +nyf I L Giryama +nyg I L Nyindu +nyh I L Nyigina +nyi I L Ama (Sudan) +nyj I L Nyanga +nyk I L Nyaneka +nyl I L Nyeu +nym nym nym I L Nyamwezi +nyn nyn nyn I L Nyankole +nyo nyo nyo I L Nyoro +nyp I E Nyang'i +nyq I L Nayini +nyr I L Nyiha (Malawi) +nys I L Nyunga +nyt I E Nyawaygi +nyu I L Nyungwe +nyv I E Nyulnyul +nyw I L Nyaw +nyx I E Nganyaywana +nyy I L Nyakyusa-Ngonde +nza I L Tigon Mbembe +nzb I L Njebi +nzi nzi nzi I L Nzima +nzk I L Nzakara +nzm I L Zeme Naga +nzs I L New Zealand Sign Language +nzu I L Teke-Nzikou +nzy I L Nzakambay +nzz I L Nanga Dama Dogon +oaa I L Orok +oac I L Oroch +oar I A Old Aramaic (up to 700 BCE) +oav I H Old Avar +obi I E Obispeño +obk I L Southern Bontok +obl I L Oblo +obm I A Moabite +obo I L Obo Manobo +obr I H Old Burmese +obt I H Old Breton +obu I L Obulom +oca I L Ocaina +och I A Old Chinese +oci oci oci oc I L Occitan (post 1500) +oco I H Old Cornish +ocu I L Atzingo Matlatzinca +oda I L Odut +odk I L Od +odt I H Old Dutch +odu I L Odual +ofo I E Ofo +ofs I H Old Frisian +ofu I L Efutop +ogb I L Ogbia +ogc I L Ogbah +oge I H Old Georgian +ogg I L Ogbogolo +ogo I L Khana +ogu I L Ogbronuagum +oht I A Old Hittite +ohu I H Old Hungarian +oia I L Oirata +oin I L Inebu One +ojb I L Northwestern Ojibwa +ojc I L Central Ojibwa +ojg I L Eastern Ojibwa +oji oji oji oj M L Ojibwa +ojp I H Old Japanese +ojs I L Severn Ojibwa +ojv I L Ontong Java +ojw I L Western Ojibwa +oka I L Okanagan +okb I L Okobo +okd I L Okodia +oke I L Okpe (Southwestern Edo) +okg I E Koko Babangk +okh I L Koresh-e Rostam +oki I L Okiek +okj I E Oko-Juwoi +okk I L Kwamtim One +okl I E Old Kentish Sign Language +okm I H Middle Korean (10th-16th cent.) +okn I L Oki-No-Erabu +oko I H Old Korean (3rd-9th cent.) +okr I L Kirike +oks I L Oko-Eni-Osayen +oku I L Oku +okv I L Orokaiva +okx I L Okpe (Northwestern Edo) +ola I L Walungge +old I L Mochi +ole I L Olekha +olk I E Olkol +olm I L Oloma +olo I L Livvi +olr I L Olrat +oma I L Omaha-Ponca +omb I L East Ambae +omc I E Mochica +ome I E Omejes +omg I L Omagua +omi I L Omi +omk I E Omok +oml I L Ombo +omn I A Minoan +omo I L Utarmbung +omp I H Old Manipuri +omr I H Old Marathi +omt I L Omotik +omu I E Omurano +omw I L South Tairora +omx I H Old Mon +ona I L Ona +onb I L Lingao +one I L Oneida +ong I L Olo +oni I L Onin +onj I L Onjob +onk I L Kabore One +onn I L Onobasulu +ono I L Onondaga +onp I L Sartang +onr I L Northern One +ons I L Ono +ont I L Ontenu +onu I L Unua +onw I H Old Nubian +onx I L Onin Based Pidgin +ood I L Tohono O'odham +oog I L Ong +oon I L Önge +oor I L Oorlams +oos I A Old Ossetic +opa I L Okpamheri +opk I L Kopkaka +opm I L Oksapmin +opo I L Opao +opt I E Opata +opy I L Ofayé +ora I L Oroha +orc I L Orma +ore I L Orejón +org I L Oring +orh I L Oroqen +ori ori ori or M L Oriya (macrolanguage) +orm orm orm om M L Oromo +orn I L Orang Kanaq +oro I L Orokolo +orr I L Oruma +ors I L Orang Seletar +ort I L Adivasi Oriya +oru I L Ormuri +orv I H Old Russian +orw I L Oro Win +orx I L Oro +ory I L Oriya (individual language) +orz I L Ormu +osa osa osa I L Osage +osc I A Oscan +osi I L Osing +oso I L Ososo +osp I H Old Spanish +oss oss oss os I L Ossetian +ost I L Osatu +osu I L Southern One +osx I H Old Saxon +ota ota ota I H Ottoman Turkish (1500-1928) +otb I H Old Tibetan +otd I L Ot Danum +ote I L Mezquital Otomi +oti I E Oti +otk I H Old Turkish +otl I L Tilapa Otomi +otm I L Eastern Highland Otomi +otn I L Tenango Otomi +otq I L Querétaro Otomi +otr I L Otoro +ots I L Estado de México Otomi +ott I L Temoaya Otomi +otu I E Otuke +otw I L Ottawa +otx I L Texcatepec Otomi +oty I A Old Tamil +otz I L Ixtenco Otomi +oua I L Tagargrent +oub I L Glio-Oubi +oue I L Oune +oui I H Old Uighur +oum I E Ouma +oun I L !O!ung +owi I L Owiniga +owl I H Old Welsh +oyb I L Oy +oyd I L Oyda +oym I L Wayampi +oyy I L Oya'oya +ozm I L Koonzime +pab I L Parecís +pac I L Pacoh +pad I L Paumarí +pae I L Pagibete +paf I E Paranawát +pag pag pag I L Pangasinan +pah I L Tenharim +pai I L Pe +pak I L Parakanã +pal pal pal I A Pahlavi +pam pam pam I L Pampanga +pan pan pan pa I L Panjabi +pao I L Northern Paiute +pap pap pap I L Papiamento +paq I L Parya +par I L Panamint +pas I L Papasena +pat I L Papitalai +pau pau pau I L Palauan +pav I L Pakaásnovos +paw I L Pawnee +pax I E Pankararé +pay I L Pech +paz I E Pankararú +pbb I L Páez +pbc I L Patamona +pbe I L Mezontla Popoloca +pbf I L Coyotepec Popoloca +pbg I E Paraujano +pbh I L E'ñapa Woromaipu +pbi I L Parkwa +pbl I L Mak (Nigeria) +pbn I L Kpasam +pbo I L Papel +pbp I L Badyara +pbr I L Pangwa +pbs I L Central Pame +pbt I L Southern Pashto +pbu I L Northern Pashto +pbv I L Pnar +pby I L Pyu +pca I L Santa Inés Ahuatempan Popoloca +pcb I L Pear +pcc I L Bouyei +pcd I L Picard +pce I L Ruching Palaung +pcf I L Paliyan +pcg I L Paniya +pch I L Pardhan +pci I L Duruwa +pcj I L Parenga +pck I L Paite Chin +pcl I L Pardhi +pcm I L Nigerian Pidgin +pcn I L Piti +pcp I L Pacahuara +pcw I L Pyapun +pda I L Anam +pdc I L Pennsylvania German +pdi I L Pa Di +pdn I L Podena +pdo I L Padoe +pdt I L Plautdietsch +pdu I L Kayan +pea I L Peranakan Indonesian +peb I E Eastern Pomo +ped I L Mala (Papua New Guinea) +pee I L Taje +pef I E Northeastern Pomo +peg I L Pengo +peh I L Bonan +pei I L Chichimeca-Jonaz +pej I E Northern Pomo +pek I L Penchal +pel I L Pekal +pem I L Phende +peo peo peo I H Old Persian (ca. 600-400 B.C.) +pep I L Kunja +peq I L Southern Pomo +pes I L Iranian Persian +pev I L Pémono +pex I L Petats +pey I L Petjo +pez I L Eastern Penan +pfa I L Pááfang +pfe I L Peere +pfl I L Pfaelzisch +pga I L Sudanese Creole Arabic +pgg I L Pangwali +pgi I L Pagi +pgk I L Rerep +pgl I A Primitive Irish +pgn I A Paelignian +pgs I L Pangseng +pgu I L Pagu +pha I L Pa-Hng +phd I L Phudagi +phg I L Phuong +phh I L Phukha +phk I L Phake +phl I L Phalura +phm I L Phimbi +phn phn phn I A Phoenician +pho I L Phunoi +phq I L Phana' +phr I L Pahari-Potwari +pht I L Phu Thai +phu I L Phuan +phv I L Pahlavani +phw I L Phangduwali +pia I L Pima Bajo +pib I L Yine +pic I L Pinji +pid I L Piaroa +pie I E Piro +pif I L Pingelapese +pig I L Pisabo +pih I L Pitcairn-Norfolk +pii I L Pini +pij I E Pijao +pil I L Yom +pim I E Powhatan +pin I L Piame +pio I L Piapoco +pip I L Pero +pir I L Piratapuyo +pis I L Pijin +pit I E Pitta Pitta +piu I L Pintupi-Luritja +piv I L Pileni +piw I L Pimbwe +pix I L Piu +piy I L Piya-Kwonci +piz I L Pije +pjt I L Pitjantjatjara +pka I H Ardhamāgadhī Prākrit +pkb I L Pokomo +pkc I E Paekche +pkg I L Pak-Tong +pkh I L Pankhu +pkn I L Pakanha +pko I L Pökoot +pkp I L Pukapuka +pkr I L Attapady Kurumba +pks I L Pakistan Sign Language +pkt I L Maleng +pku I L Paku +pla I L Miani +plb I L Polonombauk +plc I L Central Palawano +pld I L Polari +ple I L Palu'e +plg I L Pilagá +plh I L Paulohi +pli pli pli pi I A Pali +plj I L Polci +plk I L Kohistani Shina +pll I L Shwe Palaung +pln I L Palenquero +plo I L Oluta Popoluca +plp I L Palpa +plq I A Palaic +plr I L Palaka Senoufo +pls I L San Marcos Tlalcoyalco Popoloca +plt I L Plateau Malagasy +plu I L Palikúr +plv I L Southwest Palawano +plw I L Brooke's Point Palawano +ply I L Bolyu +plz I L Paluan +pma I L Paama +pmb I L Pambia +pmc I E Palumata +pmd I E Pallanganmiddang +pme I L Pwaamei +pmf I L Pamona +pmh I H Māhārāṣṭri Prākrit +pmi I L Northern Pumi +pmj I L Southern Pumi +pmk I E Pamlico +pml I E Lingua Franca +pmm I L Pomo +pmn I L Pam +pmo I L Pom +pmq I L Northern Pame +pmr I L Paynamar +pms I L Piemontese +pmt I L Tuamotuan +pmu I L Mirpur Panjabi +pmw I L Plains Miwok +pmx I L Poumei Naga +pmy I L Papuan Malay +pmz I E Southern Pame +pna I L Punan Bah-Biau +pnb I L Western Panjabi +pnc I L Pannei +pne I L Western Penan +png I L Pongu +pnh I L Penrhyn +pni I L Aoheng +pnj I E Pinjarup +pnk I L Paunaka +pnl I L Paleni +pnm I L Punan Batu 1 +pnn I L Pinai-Hagahai +pno I E Panobo +pnp I L Pancana +pnq I L Pana (Burkina Faso) +pnr I L Panim +pns I L Ponosakan +pnt I L Pontic +pnu I L Jiongnai Bunu +pnv I L Pinigura +pnw I L Panytyima +pnx I L Phong-Kniang +pny I L Pinyin +pnz I L Pana (Central African Republic) +poc I L Poqomam +pod I E Ponares +poe I L San Juan Atzingo Popoloca +pof I L Poke +pog I E Potiguára +poh I L Poqomchi' +poi I L Highland Popoluca +pok I L Pokangá +pol pol pol pl I L Polish +pom I L Southeastern Pomo +pon pon pon I L Pohnpeian +poo I L Central Pomo +pop I L Pwapwâ +poq I L Texistepec Popoluca +por por por pt I L Portuguese +pos I L Sayula Popoluca +pot I L Potawatomi +pov I L Upper Guinea Crioulo +pow I L San Felipe Otlaltepec Popoloca +pox I E Polabian +poy I L Pogolo +ppa I L Pao +ppe I L Papi +ppi I L Paipai +ppk I L Uma +ppl I L Pipil +ppm I L Papuma +ppn I L Papapana +ppo I L Folopa +ppp I L Pelende +ppq I L Pei +pps I L San Luís Temalacayuca Popoloca +ppt I L Pare +ppu I E Papora +pqa I L Pa'a +pqm I L Malecite-Passamaquoddy +prb I L Lua' +prc I L Parachi +prd I L Parsi-Dari +pre I L Principense +prf I L Paranan +prg I L Prussian +prh I L Porohanon +pri I L Paicî +prk I L Parauk +prl I L Peruvian Sign Language +prm I L Kibiri +prn I L Prasuni +pro pro pro I H Old Provençal (to 1500) +prp I L Parsi +prq I L Ashéninka Perené +prr I E Puri +prs I L Dari +prt I L Phai +pru I L Puragi +prw I L Parawen +prx I L Purik +pry I L Pray 3 +prz I L Providencia Sign Language +psa I L Asue Awyu +psc I L Persian Sign Language +psd I L Plains Indian Sign Language +pse I L Central Malay +psg I L Penang Sign Language +psh I L Southwest Pashayi +psi I L Southeast Pashayi +psl I L Puerto Rican Sign Language +psm I E Pauserna +psn I L Panasuan +pso I L Polish Sign Language +psp I L Philippine Sign Language +psq I L Pasi +psr I L Portuguese Sign Language +pss I L Kaulong +pst I L Central Pashto +psu I H Sauraseni Prākrit +psw I L Port Sandwich +psy I E Piscataway +pta I L Pai Tavytera +pth I E Pataxó Hã-Ha-Hãe +pti I L Pintiini +ptn I L Patani +pto I L Zo'é +ptp I L Patep +ptr I L Piamatsina +ptt I L Enrekang +ptu I L Bambam +ptv I L Port Vato +ptw I E Pentlatch +pty I L Pathiya +pua I L Western Highland Purepecha +pub I L Purum +puc I L Punan Merap +pud I L Punan Aput +pue I L Puelche +puf I L Punan Merah +pug I L Phuie +pui I L Puinave +puj I L Punan Tubu +puk I L Pu Ko +pum I L Puma +puo I L Puoc +pup I L Pulabu +puq I E Puquina +pur I L Puruborá +pus pus pus ps M L Pushto +put I L Putoh +puu I L Punu +puw I L Puluwatese +pux I L Puare +puy I E Purisimeño +puz I L Purum Naga +pwa I L Pawaia +pwb I L Panawa +pwg I L Gapapaiwa +pwi I E Patwin +pwm I L Molbog +pwn I L Paiwan +pwo I L Pwo Western Karen +pwr I L Powari +pww I L Pwo Northern Karen +pxm I L Quetzaltepec Mixe +pye I L Pye Krumen +pym I L Fyam +pyn I L Poyanáwa +pys I L Paraguayan Sign Language +pyu I L Puyuma +pyx I A Pyu (Myanmar) +pyy I L Pyen +pzn I L Para Naga +qua I L Quapaw +qub I L Huallaga Huánuco Quechua +quc I L K'iche' +qud I L Calderón Highland Quichua +que que que qu M L Quechua +quf I L Lambayeque Quechua +qug I L Chimborazo Highland Quichua +quh I L South Bolivian Quechua +qui I L Quileute +quk I L Chachapoyas Quechua +qul I L North Bolivian Quechua +qum I L Sipacapense +qun I E Quinault +qup I L Southern Pastaza Quechua +quq I L Quinqui +qur I L Yanahuanca Pasco Quechua +qus I L Santiago del Estero Quichua +quv I L Sacapulteco +quw I L Tena Lowland Quichua +qux I L Yauyos Quechua +quy I L Ayacucho Quechua +quz I L Cusco Quechua +qva I L Ambo-Pasco Quechua +qvc I L Cajamarca Quechua +qve I L Eastern Apurímac Quechua +qvh I L Huamalíes-Dos de Mayo Huánuco Quechua +qvi I L Imbabura Highland Quichua +qvj I L Loja Highland Quichua +qvl I L Cajatambo North Lima Quechua +qvm I L Margos-Yarowilca-Lauricocha Quechua +qvn I L North Junín Quechua +qvo I L Napo Lowland Quechua +qvp I L Pacaraos Quechua +qvs I L San Martín Quechua +qvw I L Huaylla Wanca Quechua +qvy I L Queyu +qvz I L Northern Pastaza Quichua +qwa I L Corongo Ancash Quechua +qwc I H Classical Quechua +qwh I L Huaylas Ancash Quechua +qwm I E Kuman (Russia) +qws I L Sihuas Ancash Quechua +qwt I E Kwalhioqua-Tlatskanai +qxa I L Chiquián Ancash Quechua +qxc I L Chincha Quechua +qxh I L Panao Huánuco Quechua +qxl I L Salasaca Highland Quichua +qxn I L Northern Conchucos Ancash Quechua +qxo I L Southern Conchucos Ancash Quechua +qxp I L Puno Quechua +qxq I L Qashqa'i +qxr I L Cañar Highland Quichua +qxs I L Southern Qiang +qxt I L Santa Ana de Tusi Pasco Quechua +qxu I L Arequipa-La Unión Quechua +qxw I L Jauja Wanca Quechua +qya I C Quenya +qyp I E Quiripi +raa I L Dungmali +rab I L Camling +rac I L Rasawa +rad I L Rade +raf I L Western Meohang +rag I L Logooli +rah I L Rabha +rai I L Ramoaaina +raj raj raj M L Rajasthani +rak I L Tulu-Bohuai +ral I L Ralte +ram I L Canela +ran I L Riantana +rao I L Rao +rap rap rap I L Rapanui +raq I L Saam +rar rar rar I L Rarotongan +ras I L Tegali +rat I L Razajerdi +rau I L Raute +rav I L Sampang +raw I L Rawang +rax I L Rang +ray I L Rapa +raz I L Rahambuu +rbb I L Rumai Palaung +rbk I L Northern Bontok +rbl I L Miraya Bikol +rbp I E Barababaraba +rcf I L Réunion Creole French +rdb I L Rudbari +rea I L Rerau +reb I L Rembong +ree I L Rejang Kayan +reg I L Kara (Tanzania) +rei I L Reli +rej I L Rejang +rel I L Rendille +rem I E Remo +ren I L Rengao +rer I E Rer Bare +res I L Reshe +ret I L Retta +rey I L Reyesano +rga I L Roria +rge I L Romano-Greek +rgk I E Rangkas +rgn I L Romagnol +rgr I L Resígaro +rgs I L Southern Roglai +rgu I L Ringgou +rhg I L Rohingya +rhp I L Yahang +ria I L Riang (India) +rie I L Rien +rif I L Tarifit +ril I L Riang (Myanmar) +rim I L Nyaturu +rin I L Nungu +rir I L Ribun +rit I L Ritarungo +riu I L Riung +rjg I L Rajong +rji I L Raji +rjs I L Rajbanshi +rka I L Kraol +rkb I L Rikbaktsa +rkh I L Rakahanga-Manihiki +rki I L Rakhine +rkm I L Marka +rkt I L Rangpuri +rkw I E Arakwal +rma I L Rama +rmb I L Rembarunga +rmc I L Carpathian Romani +rmd I E Traveller Danish +rme I L Angloromani +rmf I L Kalo Finnish Romani +rmg I L Traveller Norwegian +rmh I L Murkim +rmi I L Lomavren +rmk I L Romkun +rml I L Baltic Romani +rmm I L Roma +rmn I L Balkan Romani +rmo I L Sinte Romani +rmp I L Rempi +rmq I L Caló +rms I L Romanian Sign Language +rmt I L Domari +rmu I L Tavringer Romani +rmv I C Romanova +rmw I L Welsh Romani +rmx I L Romam +rmy I L Vlax Romani +rmz I L Marma +rna I E Runa +rnd I L Ruund +rng I L Ronga +rnl I L Ranglong +rnn I L Roon +rnp I L Rongpo +rnr I E Nari Nari +rnw I L Rungwa +rob I L Tae' +roc I L Cacgia Roglai +rod I L Rogo +roe I L Ronji +rof I L Rombo +rog I L Northern Roglai +roh roh roh rm I L Romansh +rol I L Romblomanon +rom rom rom M L Romany +ron rum ron ro I L Romanian +roo I L Rotokas +rop I L Kriol +ror I L Rongga +rou I L Runga +row I L Dela-Oenale +rpn I L Repanbitip +rpt I L Rapting +rri I L Ririo +rro I L Waima +rrt I E Arritinngithigh +rsb I L Romano-Serbian +rsi I L Rennellese Sign Language +rsl I L Russian Sign Language +rtc I L Rungtu Chin +rth I L Ratahan +rtm I L Rotuman +rtw I L Rathawi +rub I L Gungu +ruc I L Ruuli +rue I L Rusyn +ruf I L Luguru +rug I L Roviana +ruh I L Ruga +rui I L Rufiji +ruk I L Che +run run run rn I L Rundi +ruo I L Istro Romanian +rup rup rup I L Macedo-Romanian +ruq I L Megleno Romanian +rus rus rus ru I L Russian +rut I L Rutul +ruu I L Lanas Lobu +ruy I L Mala (Nigeria) +ruz I L Ruma +rwa I L Rawo +rwk I L Rwa +rwm I L Amba (Uganda) +rwo I L Rawa +rwr I L Marwari (India) +rxd I L Ngardi +rxw I E Karuwali +ryn I L Northern Amami-Oshima +rys I L Yaeyama +ryu I L Central Okinawan +saa I L Saba +sab I L Buglere +sac I L Meskwaki +sad sad sad I L Sandawe +sae I L Sabanê +saf I L Safaliba +sag sag sag sg I L Sango +sah sah sah I L Yakut +saj I L Sahu +sak I L Sake +sam sam sam I E Samaritan Aramaic +san san san sa I A Sanskrit +sao I L Sause +sap I L Sanapaná +saq I L Samburu +sar I E Saraveca +sas sas sas I L Sasak +sat sat sat I L Santali +sau I L Saleman +sav I L Saafi-Saafi +saw I L Sawi +sax I L Sa +say I L Saya +saz I L Saurashtra +sba I L Ngambay +sbb I L Simbo +sbc I L Kele (Papua New Guinea) +sbd I L Southern Samo +sbe I L Saliba +sbf I L Shabo +sbg I L Seget +sbh I L Sori-Harengan +sbi I L Seti +sbj I L Surbakhal +sbk I L Safwa +sbl I L Botolan Sambal +sbm I L Sagala +sbn I L Sindhi Bhil +sbo I L Sabüm +sbp I L Sangu (Tanzania) +sbq I L Sileibi +sbr I L Sembakung Murut +sbs I L Subiya +sbt I L Kimki +sbu I L Stod Bhoti +sbv I A Sabine +sbw I L Simba +sbx I L Seberuang +sby I L Soli +sbz I L Sara Kaba +scb I L Chut +sce I L Dongxiang +scf I L San Miguel Creole French +scg I L Sanggau +sch I L Sakachep +sci I L Sri Lankan Creole Malay +sck I L Sadri +scl I L Shina +scn scn scn I L Sicilian +sco sco sco I L Scots +scp I L Helambu Sherpa +scq I L Sa'och +scs I L North Slavey +scu I L Shumcho +scv I L Sheni +scw I L Sha +scx I A Sicel +sda I L Toraja-Sa'dan +sdb I L Shabak +sdc I L Sassarese Sardinian +sde I L Surubu +sdf I L Sarli +sdg I L Savi +sdh I L Southern Kurdish +sdj I L Suundi +sdk I L Sos Kundi +sdl I L Saudi Arabian Sign Language +sdm I L Semandang +sdn I L Gallurese Sardinian +sdo I L Bukar-Sadung Bidayuh +sdp I L Sherdukpen +sdr I L Oraon Sadri +sds I E Sened +sdt I E Shuadit +sdu I L Sarudu +sdx I L Sibu Melanau +sdz I L Sallands +sea I L Semai +seb I L Shempire Senoufo +sec I L Sechelt +sed I L Sedang +see I L Seneca +sef I L Cebaara Senoufo +seg I L Segeju +seh I L Sena +sei I L Seri +sej I L Sene +sek I L Sekani +sel sel sel I L Selkup +sen I L Nanerigé Sénoufo +seo I L Suarmin +sep I L Sìcìté Sénoufo +seq I L Senara Sénoufo +ser I L Serrano +ses I L Koyraboro Senni Songhai +set I L Sentani +seu I L Serui-Laut +sev I L Nyarafolo Senoufo +sew I L Sewa Bay +sey I L Secoya +sez I L Senthang Chin +sfb I L Langue des signes de Belgique Francophone +sfe I L Eastern Subanen +sfm I L Small Flowery Miao +sfs I L South African Sign Language +sfw I L Sehwi +sga sga sga I H Old Irish (to 900) +sgb I L Mag-antsi Ayta +sgc I L Kipsigis +sgd I L Surigaonon +sge I L Segai +sgg I L Swiss-German Sign Language +sgh I L Shughni +sgi I L Suga +sgj I L Surgujia +sgk I L Sangkong +sgm I E Singa +sgo I L Songa +sgp I L Singpho +sgr I L Sangisari +sgs I L Samogitian +sgt I L Brokpake +sgu I L Salas +sgw I L Sebat Bet Gurage +sgx I L Sierra Leone Sign Language +sgy I L Sanglechi +sgz I L Sursurunga +sha I L Shall-Zwall +shb I L Ninam +shc I L Sonde +shd I L Kundal Shahi +she I L Sheko +shg I L Shua +shh I L Shoshoni +shi I L Tachelhit +shj I L Shatt +shk I L Shilluk +shl I L Shendu +shm I L Shahrudi +shn shn shn I L Shan +sho I L Shanga +shp I L Shipibo-Conibo +shq I L Sala +shr I L Shi +shs I L Shuswap +sht I E Shasta +shu I L Chadian Arabic +shv I L Shehri +shw I L Shwai +shx I L She +shy I L Tachawit +shz I L Syenara Senoufo +sia I E Akkala Sami +sib I L Sebop +sid sid sid I L Sidamo +sie I L Simaa +sif I L Siamou +sig I L Paasaal +sih I L Zire +sii I L Shom Peng +sij I L Numbami +sik I L Sikiana +sil I L Tumulung Sisaala +sim I L Mende (Papua New Guinea) +sin sin sin si I L Sinhala +sip I L Sikkimese +siq I L Sonia +sir I L Siri +sis I E Siuslaw +siu I L Sinagen +siv I L Sumariup +siw I L Siwai +six I L Sumau +siy I L Sivandi +siz I L Siwi +sja I L Epena +sjb I L Sajau Basap +sjd I L Kildin Sami +sje I L Pite Sami +sjg I L Assangori +sjk I E Kemi Sami +sjl I L Sajalong +sjm I L Mapun +sjn I C Sindarin +sjo I L Xibe +sjp I L Surjapuri +sjr I L Siar-Lak +sjs I E Senhaja De Srair +sjt I L Ter Sami +sju I L Ume Sami +sjw I L Shawnee +ska I L Skagit +skb I L Saek +skc I L Ma Manda +skd I L Southern Sierra Miwok +ske I L Seke (Vanuatu) +skf I L Sakirabiá +skg I L Sakalava Malagasy +skh I L Sikule +ski I L Sika +skj I L Seke (Nepal) +skk I L Sok +skm I L Kutong +skn I L Kolibugan Subanon +sko I L Seko Tengah +skp I L Sekapan +skq I L Sininkere +skr I L Seraiki +sks I L Maia +skt I L Sakata +sku I L Sakao +skv I L Skou +skw I E Skepi Creole Dutch +skx I L Seko Padang +sky I L Sikaiana +skz I L Sekar +slc I L Sáliba +sld I L Sissala +sle I L Sholaga +slf I L Swiss-Italian Sign Language +slg I L Selungai Murut +slh I L Southern Puget Sound Salish +sli I L Lower Silesian +slj I L Salumá +slk slo slk sk I L Slovak +sll I L Salt-Yui +slm I L Pangutaran Sama +sln I E Salinan +slp I L Lamaholot +slq I L Salchuq +slr I L Salar +sls I L Singapore Sign Language +slt I L Sila +slu I L Selaru +slv slv slv sl I L Slovenian +slw I L Sialum +slx I L Salampasu +sly I L Selayar +slz I L Ma'ya +sma sma sma I L Southern Sami +smb I L Simbari +smc I E Som +smd I L Sama +sme sme sme se I L Northern Sami +smf I L Auwe +smg I L Simbali +smh I L Samei +smj smj smj I L Lule Sami +smk I L Bolinao +sml I L Central Sama +smm I L Musasa +smn smn smn I L Inari Sami +smo smo smo sm I L Samoan +smp I E Samaritan +smq I L Samo +smr I L Simeulue +sms sms sms I L Skolt Sami +smt I L Simte +smu I E Somray +smv I L Samvedi +smw I L Sumbawa +smx I L Samba +smy I L Semnani +smz I L Simeku +sna sna sna sn I L Shona +snb I L Sebuyau +snc I L Sinaugoro +snd snd snd sd I L Sindhi +sne I L Bau Bidayuh +snf I L Noon +sng I L Sanga (Democratic Republic of Congo) +snh I E Shinabo +sni I E Sensi +snj I L Riverain Sango +snk snk snk I L Soninke +snl I L Sangil +snm I L Southern Ma'di +snn I L Siona +sno I L Snohomish +snp I L Siane +snq I L Sangu (Gabon) +snr I L Sihan +sns I L South West Bay +snu I L Senggi +snv I L Sa'ban +snw I L Selee +snx I L Sam +sny I L Saniyo-Hiyewe +snz I L Sinsauru +soa I L Thai Song +sob I L Sobei +soc I L So (Democratic Republic of Congo) +sod I L Songoora +soe I L Songomeno +sog sog sog I A Sogdian +soh I L Aka +soi I L Sonha +soj I L Soi +sok I L Sokoro +sol I L Solos +som som som so I L Somali +soo I L Songo +sop I L Songe +soq I L Kanasi +sor I L Somrai +sos I L Seeku +sot sot sot st I L Southern Sotho +sou I L Southern Thai +sov I L Sonsorol +sow I L Sowanda +sox I L Swo +soy I L Miyobe +soz I L Temi +spa spa spa es I L Spanish +spb I L Sepa (Indonesia) +spc I L Sapé +spd I L Saep +spe I L Sepa (Papua New Guinea) +spg I L Sian +spi I L Saponi +spk I L Sengo +spl I L Selepet +spm I L Akukem +spo I L Spokane +spp I L Supyire Senoufo +spq I L Loreto-Ucayali Spanish +spr I L Saparua +sps I L Saposa +spt I L Spiti Bhoti +spu I L Sapuan +spv I L Sambalpuri +spx I A South Picene +spy I L Sabaot +sqa I L Shama-Sambuga +sqh I L Shau +sqi alb sqi sq M L Albanian +sqk I L Albanian Sign Language +sqm I L Suma +sqn I E Susquehannock +sqo I L Sorkhei +sqq I L Sou +sqr I H Siculo Arabic +sqs I L Sri Lankan Sign Language +sqt I L Soqotri +squ I L Squamish +sra I L Saruga +srb I L Sora +src I L Logudorese Sardinian +srd srd srd sc M L Sardinian +sre I L Sara +srf I L Nafi +srg I L Sulod +srh I L Sarikoli +sri I L Siriano +srk I L Serudung Murut +srl I L Isirawa +srm I L Saramaccan +srn srn srn I L Sranan Tongo +sro I L Campidanese Sardinian +srp srp srp sr I L Serbian +srq I L Sirionó +srr srr srr I L Serer +srs I L Sarsi +srt I L Sauri +sru I L Suruí +srv I L Southern Sorsoganon +srw I L Serua +srx I L Sirmauri +sry I L Sera +srz I L Shahmirzadi +ssb I L Southern Sama +ssc I L Suba-Simbiti +ssd I L Siroi +sse I L Balangingi +ssf I L Thao +ssg I L Seimat +ssh I L Shihhi Arabic +ssi I L Sansi +ssj I L Sausi +ssk I L Sunam +ssl I L Western Sisaala +ssm I L Semnam +ssn I L Waata +sso I L Sissano +ssp I L Spanish Sign Language +ssq I L So'a +ssr I L Swiss-French Sign Language +sss I L Sô +sst I L Sinasina +ssu I L Susuami +ssv I L Shark Bay +ssw ssw ssw ss I L Swati +ssx I L Samberigi +ssy I L Saho +ssz I L Sengseng +sta I L Settla +stb I L Northern Subanen +std I L Sentinel +ste I L Liana-Seti +stf I L Seta +stg I L Trieng +sth I L Shelta +sti I L Bulo Stieng +stj I L Matya Samo +stk I L Arammba +stl I L Stellingwerfs +stm I L Setaman +stn I L Owa +sto I L Stoney +stp I L Southeastern Tepehuan +stq I L Saterfriesisch +str I L Straits Salish +sts I L Shumashti +stt I L Budeh Stieng +stu I L Samtao +stv I L Silt'e +stw I L Satawalese +sty I L Siberian Tatar +sua I L Sulka +sub I L Suku +suc I L Western Subanon +sue I L Suena +sug I L Suganga +sui I L Suki +suj I L Shubi +suk suk suk I L Sukuma +sun sun sun su I L Sundanese +suq I L Suri +sur I L Mwaghavul +sus sus sus I L Susu +sut I E Subtiaba +suv I L Puroik +suw I L Sumbwa +sux sux sux I A Sumerian +suy I L Suyá +suz I L Sunwar +sva I L Svan +svb I L Ulau-Suain +svc I L Vincentian Creole English +sve I L Serili +svk I L Slovakian Sign Language +svm I L Slavomolisano +svr I L Savara +svs I L Savosavo +svx I E Skalvian +swa swa swa sw M L Swahili (macrolanguage) +swb I L Maore Comorian +swc I L Congo Swahili +swe swe swe sv I L Swedish +swf I L Sere +swg I L Swabian +swh I L Swahili (individual language) +swi I L Sui +swj I L Sira +swk I L Malawi Sena +swl I L Swedish Sign Language +swm I L Samosa +swn I L Sawknah +swo I L Shanenawa +swp I L Suau +swq I L Sharwa +swr I L Saweru +sws I L Seluwasan +swt I L Sawila +swu I L Suwawa +swv I L Shekhawati +sww I E Sowa +swx I L Suruahá +swy I L Sarua +sxb I L Suba +sxc I A Sicanian +sxe I L Sighu +sxg I L Shixing +sxk I E Southern Kalapuya +sxl I E Selian +sxm I L Samre +sxn I L Sangir +sxo I A Sorothaptic +sxr I L Saaroa +sxs I L Sasaru +sxu I L Upper Saxon +sxw I L Saxwe Gbe +sya I L Siang +syb I L Central Subanen +syc syc syc I H Classical Syriac +syi I L Seki +syk I L Sukur +syl I L Sylheti +sym I L Maya Samo +syn I L Senaya +syo I L Suoy +syr syr syr M L Syriac +sys I L Sinyar +syw I L Kagate +syy I L Al-Sayyid Bedouin Sign Language +sza I L Semelai +szb I L Ngalum +szc I L Semaq Beri +szd I E Seru +sze I L Seze +szg I L Sengele +szl I L Silesian +szn I L Sula +szp I L Suabo +szv I L Isu (Fako Division) +szw I L Sawai +taa I L Lower Tanana +tab I L Tabassaran +tac I L Lowland Tarahumara +tad I L Tause +tae I L Tariana +taf I L Tapirapé +tag I L Tagoi +tah tah tah ty I L Tahitian +taj I L Eastern Tamang +tak I L Tala +tal I L Tal +tam tam tam ta I L Tamil +tan I L Tangale +tao I L Yami +tap I L Taabwa +taq I L Tamasheq +tar I L Central Tarahumara +tas I E Tay Boi +tat tat tat tt I L Tatar +tau I L Upper Tanana +tav I L Tatuyo +taw I L Tai +tax I L Tamki +tay I L Atayal +taz I L Tocho +tba I L Aikanã +tbb I E Tapeba +tbc I L Takia +tbd I L Kaki Ae +tbe I L Tanimbili +tbf I L Mandara +tbg I L North Tairora +tbh I E Thurawal +tbi I L Gaam +tbj I L Tiang +tbk I L Calamian Tagbanwa +tbl I L Tboli +tbm I L Tagbu +tbn I L Barro Negro Tunebo +tbo I L Tawala +tbp I L Taworta +tbr I L Tumtum +tbs I L Tanguat +tbt I L Tembo (Kitembo) +tbu I E Tubar +tbv I L Tobo +tbw I L Tagbanwa +tbx I L Kapin +tby I L Tabaru +tbz I L Ditammari +tca I L Ticuna +tcb I L Tanacross +tcc I L Datooga +tcd I L Tafi +tce I L Southern Tutchone +tcf I L Malinaltepec Me'phaa +tcg I L Tamagario +tch I L Turks And Caicos Creole English +tci I L Wára +tck I L Tchitchege +tcl I E Taman (Myanmar) +tcm I L Tanahmerah +tcn I L Tichurong +tco I L Taungyo +tcp I L Tawr Chin +tcq I L Kaiy +tcs I L Torres Strait Creole +tct I L T'en +tcu I L Southeastern Tarahumara +tcw I L Tecpatlán Totonac +tcx I L Toda +tcy I L Tulu +tcz I L Thado Chin +tda I L Tagdal +tdb I L Panchpargania +tdc I L Emberá-Tadó +tdd I L Tai Nüa +tde I L Tiranige Diga Dogon +tdf I L Talieng +tdg I L Western Tamang +tdh I L Thulung +tdi I L Tomadino +tdj I L Tajio +tdk I L Tambas +tdl I L Sur +tdn I L Tondano +tdo I L Teme +tdq I L Tita +tdr I L Todrah +tds I L Doutai +tdt I L Tetun Dili +tdu I L Tempasuk Dusun +tdv I L Toro +tdx I L Tandroy-Mahafaly Malagasy +tdy I L Tadyawan +tea I L Temiar +teb I E Tetete +tec I L Terik +ted I L Tepo Krumen +tee I L Huehuetla Tepehua +tef I L Teressa +teg I L Teke-Tege +teh I L Tehuelche +tei I L Torricelli +tek I L Ibali Teke +tel tel tel te I L Telugu +tem tem tem I L Timne +ten I E Tama (Colombia) +teo I L Teso +tep I E Tepecano +teq I L Temein +ter ter ter I L Tereno +tes I L Tengger +tet tet tet I L Tetum +teu I L Soo +tev I L Teor +tew I L Tewa (USA) +tex I L Tennet +tey I L Tulishi +tfi I L Tofin Gbe +tfn I L Tanaina +tfo I L Tefaro +tfr I L Teribe +tft I L Ternate +tga I L Sagalla +tgb I L Tobilung +tgc I L Tigak +tgd I L Ciwogai +tge I L Eastern Gorkha Tamang +tgf I L Chalikha +tgh I L Tobagonian Creole English +tgi I L Lawunuia +tgj I L Tagin +tgk tgk tgk tg I L Tajik +tgl tgl tgl tl I L Tagalog +tgn I L Tandaganon +tgo I L Sudest +tgp I L Tangoa +tgq I L Tring +tgr I L Tareng +tgs I L Nume +tgt I L Central Tagbanwa +tgu I L Tanggu +tgv I E Tingui-Boto +tgw I L Tagwana Senoufo +tgx I L Tagish +tgy I E Togoyo +tgz I E Tagalaka +tha tha tha th I L Thai +thc I L Tai Hang Tong +thd I L Thayore +the I L Chitwania Tharu +thf I L Thangmi +thh I L Northern Tarahumara +thi I L Tai Long +thk I L Tharaka +thl I L Dangaura Tharu +thm I L Aheu +thn I L Thachanadan +thp I L Thompson +thq I L Kochila Tharu +thr I L Rana Tharu +ths I L Thakali +tht I L Tahltan +thu I L Thuri +thv I L Tahaggart Tamahaq +thw I L Thudam +thx I L The +thy I L Tha +thz I L Tayart Tamajeq +tia I L Tidikelt Tamazight +tic I L Tira +tid I L Tidong +tif I L Tifal +tig tig tig I L Tigre +tih I L Timugon Murut +tii I L Tiene +tij I L Tilung +tik I L Tikar +til I E Tillamook +tim I L Timbe +tin I L Tindi +tio I L Teop +tip I L Trimuris +tiq I L Tiéfo +tir tir tir ti I L Tigrinya +tis I L Masadiit Itneg +tit I L Tinigua +tiu I L Adasen +tiv tiv tiv I L Tiv +tiw I L Tiwi +tix I L Southern Tiwa +tiy I L Tiruray +tiz I L Tai Hongjin +tja I L Tajuasohn +tjg I L Tunjung +tji I L Northern Tujia +tjl I L Tai Laing +tjm I E Timucua +tjn I E Tonjon +tjo I L Temacine Tamazight +tjs I L Southern Tujia +tju I E Tjurruru +tjw I L Djabwurrung +tka I E Truká +tkb I L Buksa +tkd I L Tukudede +tke I L Takwane +tkf I E Tukumanféd +tkg I L Tesaka Malagasy +tkl tkl tkl I L Tokelau +tkm I E Takelma +tkn I L Toku-No-Shima +tkp I L Tikopia +tkq I L Tee +tkr I L Tsakhur +tks I L Takestani +tkt I L Kathoriya Tharu +tku I L Upper Necaxa Totonac +tkw I L Teanu +tkx I L Tangko +tkz I L Takua +tla I L Southwestern Tepehuan +tlb I L Tobelo +tlc I L Yecuatla Totonac +tld I L Talaud +tlf I L Telefol +tlg I L Tofanma +tlh tlh tlh I C Klingon +tli tli tli I L Tlingit +tlj I L Talinga-Bwisi +tlk I L Taloki +tll I L Tetela +tlm I L Tolomako +tln I L Talondo' +tlo I L Talodi +tlp I L Filomena Mata-Coahuitlán Totonac +tlq I L Tai Loi +tlr I L Talise +tls I L Tambotalo +tlt I L Teluti +tlu I L Tulehu +tlv I L Taliabu +tlx I L Khehek +tly I L Talysh +tma I L Tama (Chad) +tmb I L Katbol +tmc I L Tumak +tmd I L Haruai +tme I E Tremembé +tmf I L Toba-Maskoy +tmg I E Ternateño +tmh tmh tmh M L Tamashek +tmi I L Tutuba +tmj I L Samarokena +tmk I L Northwestern Tamang +tml I L Tamnim Citak +tmm I L Tai Thanh +tmn I L Taman (Indonesia) +tmo I L Temoq +tmp I L Tai Mène +tmq I L Tumleo +tmr I E Jewish Babylonian Aramaic (ca. 200-1200 CE) +tms I L Tima +tmt I L Tasmate +tmu I L Iau +tmv I L Tembo (Motembo) +tmw I L Temuan +tmy I L Tami +tmz I E Tamanaku +tna I L Tacana +tnb I L Western Tunebo +tnc I L Tanimuca-Retuarã +tnd I L Angosturas Tunebo +tne I L Tinoc Kallahan +tng I L Tobanga +tnh I L Maiani +tni I L Tandia +tnk I L Kwamera +tnl I L Lenakel +tnm I L Tabla +tnn I L North Tanna +tno I L Toromono +tnp I L Whitesands +tnq I E Taino +tnr I L Ménik +tns I L Tenis +tnt I L Tontemboan +tnu I L Tay Khang +tnv I L Tangchangya +tnw I L Tonsawang +tnx I L Tanema +tny I L Tongwe +tnz I L Tonga (Thailand) +tob I L Toba +toc I L Coyutla Totonac +tod I L Toma +toe I E Tomedes +tof I L Gizrra +tog tog tog I L Tonga (Nyasa) +toh I L Gitonga +toi I L Tonga (Zambia) +toj I L Tojolabal +tol I L Tolowa +tom I L Tombulu +ton ton ton to I L Tonga (Tonga Islands) +too I L Xicotepec De Juárez Totonac +top I L Papantla Totonac +toq I L Toposa +tor I L Togbo-Vara Banda +tos I L Highland Totonac +tou I L Tho +tov I L Upper Taromi +tow I L Jemez +tox I L Tobian +toy I L Topoiyo +toz I L To +tpa I L Taupota +tpc I L Azoyú Me'phaa +tpe I L Tippera +tpf I L Tarpia +tpg I L Kula +tpi tpi tpi I L Tok Pisin +tpj I L Tapieté +tpk I E Tupinikin +tpl I L Tlacoapa Me'phaa +tpm I L Tampulma +tpn I E Tupinambá +tpo I L Tai Pao +tpp I L Pisaflores Tepehua +tpq I L Tukpa +tpr I L Tuparí +tpt I L Tlachichilco Tepehua +tpu I L Tampuan +tpv I L Tanapag +tpw I E Tupí +tpx I L Acatepec Me'phaa +tpy I L Trumai +tpz I L Tinputz +tqb I L Tembé +tql I L Lehali +tqm I L Turumsa +tqn I L Tenino +tqo I L Toaripi +tqp I L Tomoip +tqq I L Tunni +tqr I E Torona +tqt I L Western Totonac +tqu I L Touo +tqw I E Tonkawa +tra I L Tirahi +trb I L Terebu +trc I L Copala Triqui +trd I L Turi +tre I L East Tarangan +trf I L Trinidadian Creole English +trg I L Lishán Didán +trh I L Turaka +tri I L Trió +trj I L Toram +trl I L Traveller Scottish +trm I L Tregami +trn I L Trinitario +tro I L Tarao Naga +trp I L Kok Borok +trq I L San Martín Itunyoso Triqui +trr I L Taushiro +trs I L Chicahuaxtla Triqui +trt I L Tunggare +tru I L Turoyo +trv I L Taroko +trw I L Torwali +trx I L Tringgus-Sembaan Bidayuh +try I E Turung +trz I E Torá +tsa I L Tsaangi +tsb I L Tsamai +tsc I L Tswa +tsd I L Tsakonian +tse I L Tunisian Sign Language +tsf I L Southwestern Tamang +tsg I L Tausug +tsh I L Tsuvan +tsi tsi tsi I L Tsimshian +tsj I L Tshangla +tsk I L Tseku +tsl I L Ts'ün-Lao +tsm I L Turkish Sign Language +tsn tsn tsn tn I L Tswana +tso tso tso ts I L Tsonga +tsp I L Northern Toussian +tsq I L Thai Sign Language +tsr I L Akei +tss I L Taiwan Sign Language +tst I L Tondi Songway Kiini +tsu I L Tsou +tsv I L Tsogo +tsw I L Tsishingini +tsx I L Mubami +tsy I L Tebul Sign Language +tsz I L Purepecha +tta I E Tutelo +ttb I L Gaa +ttc I L Tektiteko +ttd I L Tauade +tte I L Bwanabwana +ttf I L Tuotomb +ttg I L Tutong +tth I L Upper Ta'oih +tti I L Tobati +ttj I L Tooro +ttk I L Totoro +ttl I L Totela +ttm I L Northern Tutchone +ttn I L Towei +tto I L Lower Ta'oih +ttp I L Tombelala +ttq I L Tawallammat Tamajaq +ttr I L Tera +tts I L Northeastern Thai +ttt I L Muslim Tat +ttu I L Torau +ttv I L Titan +ttw I L Long Wat +tty I L Sikaritai +ttz I L Tsum +tua I L Wiarumus +tub I L Tübatulabal +tuc I L Mutu +tud I E Tuxá +tue I L Tuyuca +tuf I L Central Tunebo +tug I L Tunia +tuh I L Taulil +tui I L Tupuri +tuj I L Tugutil +tuk tuk tuk tk I L Turkmen +tul I L Tula +tum tum tum I L Tumbuka +tun I E Tunica +tuo I L Tucano +tuq I L Tedaga +tur tur tur tr I L Turkish +tus I L Tuscarora +tuu I L Tututni +tuv I L Turkana +tux I E Tuxináwa +tuy I L Tugen +tuz I L Turka +tva I L Vaghua +tvd I L Tsuvadi +tve I L Te'un +tvk I L Southeast Ambrym +tvl tvl tvl I L Tuvalu +tvm I L Tela-Masbuar +tvn I L Tavoyan +tvo I L Tidore +tvs I L Taveta +tvt I L Tutsa Naga +tvu I L Tunen +tvw I L Sedoa +tvy I E Timor Pidgin +twa I E Twana +twb I L Western Tawbuid +twc I E Teshenawa +twd I L Twents +twe I L Tewa (Indonesia) +twf I L Northern Tiwa +twg I L Tereweng +twh I L Tai Dón +twi twi twi tw I L Twi +twl I L Tawara +twm I L Tawang Monpa +twn I L Twendi +two I L Tswapong +twp I L Ere +twq I L Tasawaq +twr I L Southwestern Tarahumara +twt I E Turiwára +twu I L Termanu +tww I L Tuwari +twx I L Tewe +twy I L Tawoyan +txa I L Tombonuo +txb I A Tokharian B +txc I E Tsetsaut +txe I L Totoli +txg I A Tangut +txh I A Thracian +txi I L Ikpeng +txm I L Tomini +txn I L West Tarangan +txo I L Toto +txq I L Tii +txr I A Tartessian +txs I L Tonsea +txt I L Citak +txu I L Kayapó +txx I L Tatana +txy I L Tanosy Malagasy +tya I L Tauya +tye I L Kyanga +tyh I L O'du +tyi I L Teke-Tsaayi +tyj I L Tai Do +tyl I L Thu Lao +tyn I L Kombai +typ I E Thaypan +tyr I L Tai Daeng +tys I L Tày Sa Pa +tyt I L Tày Tac +tyu I L Kua +tyv tyv tyv I L Tuvinian +tyx I L Teke-Tyee +tyz I L Tày +tza I L Tanzanian Sign Language +tzh I L Tzeltal +tzj I L Tz'utujil +tzl I C Talossan +tzm I L Central Atlas Tamazight +tzn I L Tugun +tzo I L Tzotzil +tzx I L Tabriak +uam I E Uamué +uan I L Kuan +uar I L Tairuma +uba I L Ubang +ubi I L Ubi +ubl I L Buhi'non Bikol +ubr I L Ubir +ubu I L Umbu-Ungu +uby I E Ubykh +uda I L Uda +ude I L Udihe +udg I L Muduga +udi I L Udi +udj I L Ujir +udl I L Wuzlam +udm udm udm I L Udmurt +udu I L Uduk +ues I L Kioko +ufi I L Ufim +uga uga uga I A Ugaritic +ugb I E Kuku-Ugbanh +uge I L Ughele +ugn I L Ugandan Sign Language +ugo I L Ugong +ugy I L Uruguayan Sign Language +uha I L Uhami +uhn I L Damal +uig uig uig ug I L Uighur +uis I L Uisai +uiv I L Iyive +uji I L Tanjijili +uka I L Kaburi +ukg I L Ukuriguma +ukh I L Ukhwejo +ukl I L Ukrainian Sign Language +ukp I L Ukpe-Bayobiri +ukq I L Ukwa +ukr ukr ukr uk I L Ukrainian +uks I L Urubú-Kaapor Sign Language +uku I L Ukue +ukw I L Ukwuani-Aboh-Ndoni +uky I E Kuuk-Yak +ula I L Fungwa +ulb I L Ulukwumi +ulc I L Ulch +ule I E Lule +ulf I L Usku +uli I L Ulithian +ulk I L Meriam +ull I L Ullatan +ulm I L Ulumanda' +uln I L Unserdeutsch +ulu I L Uma' Lung +ulw I L Ulwa +uma I L Umatilla +umb umb umb I L Umbundu +umc I A Marrucinian +umd I E Umbindhamu +umg I E Umbuygamu +umi I L Ukit +umm I L Umon +umn I L Makyan Naga +umo I E Umotína +ump I L Umpila +umr I E Umbugarla +ums I L Pendau +umu I L Munsee +una I L North Watut +und und und S S Undetermined +une I L Uneme +ung I L Ngarinyin +unk I L Enawené-Nawé +unm I E Unami +unn I L Kurnai +unr I L Mundari +unu I L Unubahe +unx I L Munda +unz I L Unde Kaili +uok I L Uokha +upi I L Umeda +upv I L Uripiv-Wala-Rano-Atchin +ura I L Urarina +urb I L Urubú-Kaapor +urc I E Urningangg +urd urd urd ur I L Urdu +ure I L Uru +urf I E Uradhi +urg I L Urigina +urh I L Urhobo +uri I L Urim +urk I L Urak Lawoi' +url I L Urali +urm I L Urapmin +urn I L Uruangnirin +uro I L Ura (Papua New Guinea) +urp I L Uru-Pa-In +urr I L Lehalurup +urt I L Urat +uru I E Urumi +urv I E Uruava +urw I L Sop +urx I L Urimo +ury I L Orya +urz I L Uru-Eu-Wau-Wau +usa I L Usarufa +ush I L Ushojo +usi I L Usui +usk I L Usaghade +usp I L Uspanteco +usu I L Uya +uta I L Otank +ute I L Ute-Southern Paiute +utp I L Amba (Solomon Islands) +utr I L Etulo +utu I L Utu +uum I L Urum +uun I L Kulon-Pazeh +uur I L Ura (Vanuatu) +uuu I L U +uve I L West Uvean +uvh I L Uri +uvl I L Lote +uwa I L Kuku-Uwanh +uya I L Doko-Uyanga +uzb uzb uzb uz M L Uzbek +uzn I L Northern Uzbek +uzs I L Southern Uzbek +vaa I L Vaagri Booli +vae I L Vale +vaf I L Vafsi +vag I L Vagla +vah I L Varhadi-Nagpuri +vai vai vai I L Vai +vaj I L Vasekela Bushman +val I L Vehes +vam I L Vanimo +van I L Valman +vao I L Vao +vap I L Vaiphei +var I L Huarijio +vas I L Vasavi +vau I L Vanuma +vav I L Varli +vay I L Wayu +vbb I L Southeast Babar +vbk I L Southwestern Bontok +vec I L Venetian +ved I L Veddah +vel I L Veluws +vem I L Vemgo-Mabas +ven ven ven ve I L Venda +veo I E Ventureño +vep I L Veps +ver I L Mom Jango +vgr I L Vaghri +vgt I L Vlaamse Gebarentaal +vic I L Virgin Islands Creole English +vid I L Vidunda +vie vie vie vi I L Vietnamese +vif I L Vili +vig I L Viemo +vil I L Vilela +vin I L Vinza +vis I L Vishavan +vit I L Viti +viv I L Iduna +vka I E Kariyarra +vki I L Ija-Zuba +vkj I L Kujarge +vkk I L Kaur +vkl I L Kulisusu +vkm I E Kamakan +vko I L Kodeoha +vkp I L Korlai Creole Portuguese +vkt I L Tenggarong Kutai Malay +vku I L Kurrama +vlp I L Valpei +vls I L Vlaams +vma I L Martuyhunira +vmb I E Barbaram +vmc I L Juxtlahuaca Mixtec +vmd I L Mudu Koraga +vme I L East Masela +vmf I L Mainfränkisch +vmg I L Lungalunga +vmh I L Maraghei +vmi I E Miwa +vmj I L Ixtayutla Mixtec +vmk I L Makhuwa-Shirima +vml I E Malgana +vmm I L Mitlatongo Mixtec +vmp I L Soyaltepec Mazatec +vmq I L Soyaltepec Mixtec +vmr I L Marenje +vms I E Moksela +vmu I E Muluridyi +vmv I E Valley Maidu +vmw I L Makhuwa +vmx I L Tamazola Mixtec +vmy I L Ayautla Mazatec +vmz I L Mazatlán Mazatec +vnk I L Vano +vnm I L Vinmavis +vnp I L Vunapu +vol vol vol vo I C Volapük +vor I L Voro +vot vot vot I L Votic +vra I L Vera'a +vro I L Võro +vrs I L Varisi +vrt I L Burmbar +vsi I L Moldova Sign Language +vsl I L Venezuelan Sign Language +vsv I L Valencian Sign Language +vto I L Vitou +vum I L Vumbu +vun I L Vunjo +vut I L Vute +vwa I L Awa (China) +waa I L Walla Walla +wab I L Wab +wac I L Wasco-Wishram +wad I L Wandamen +wae I L Walser +waf I E Wakoná +wag I L Wa'ema +wah I L Watubela +wai I L Wares +waj I L Waffa +wal wal wal I L Wolaytta +wam I E Wampanoag +wan I L Wan +wao I E Wappo +wap I L Wapishana +waq I L Wageman +war war war I L Waray (Philippines) +was was was I L Washo +wat I L Kaninuwa +wau I L Waurá +wav I L Waka +waw I L Waiwai +wax I L Watam +way I L Wayana +waz I L Wampur +wba I L Warao +wbb I L Wabo +wbe I L Waritai +wbf I L Wara +wbh I L Wanda +wbi I L Vwanji +wbj I L Alagwa +wbk I L Waigali +wbl I L Wakhi +wbm I L Wa +wbp I L Warlpiri +wbq I L Waddar +wbr I L Wagdi +wbt I L Wanman +wbv I L Wajarri +wbw I L Woi +wca I L Yanomámi +wci I L Waci Gbe +wdd I L Wandji +wdg I L Wadaginam +wdj I L Wadjiginy +wdk I E Wadikali +wdu I E Wadjigu +wdy I E Wadjabangayi +wea I E Wewaw +wec I L Wè Western +wed I L Wedau +weg I L Wergaia +weh I L Weh +wei I L Kiunum +wem I L Weme Gbe +weo I L Wemale +wep I L Westphalien +wer I L Weri +wes I L Cameroon Pidgin +wet I L Perai +weu I L Rawngtu Chin +wew I L Wejewa +wfg I L Yafi +wga I E Wagaya +wgb I L Wagawaga +wgg I E Wangganguru +wgi I L Wahgi +wgo I L Waigeo +wgu I E Wirangu +wgy I L Warrgamay +wha I L Manusela +whg I L North Wahgi +whk I L Wahau Kenyah +whu I L Wahau Kayan +wib I L Southern Toussian +wic I L Wichita +wie I E Wik-Epa +wif I E Wik-Keyangan +wig I L Wik-Ngathana +wih I L Wik-Me'anha +wii I L Minidien +wij I L Wik-Iiyanh +wik I L Wikalkan +wil I E Wilawila +wim I L Wik-Mungkan +win I L Ho-Chunk +wir I E Wiraféd +wiu I L Wiru +wiv I L Vitu +wiy I E Wiyot +wja I L Waja +wji I L Warji +wka I E Kw'adza +wkb I L Kumbaran +wkd I L Wakde +wkl I L Kalanadi +wku I L Kunduvadi +wkw I E Wakawaka +wky I E Wangkayutyuru +wla I L Walio +wlc I L Mwali Comorian +wle I L Wolane +wlg I L Kunbarlang +wli I L Waioli +wlk I E Wailaki +wll I L Wali (Sudan) +wlm I H Middle Welsh +wln wln wln wa I L Walloon +wlo I L Wolio +wlr I L Wailapa +wls I L Wallisian +wlu I E Wuliwuli +wlv I L Wichí Lhamtés Vejoz +wlw I L Walak +wlx I L Wali (Ghana) +wly I E Waling +wma I E Mawa (Nigeria) +wmb I L Wambaya +wmc I L Wamas +wmd I L Mamaindé +wme I L Wambule +wmh I L Waima'a +wmi I E Wamin +wmm I L Maiwa (Indonesia) +wmn I E Waamwang +wmo I L Wom (Papua New Guinea) +wms I L Wambon +wmt I L Walmajarri +wmw I L Mwani +wmx I L Womo +wnb I L Wanambre +wnc I L Wantoat +wnd I E Wandarang +wne I L Waneci +wng I L Wanggom +wni I L Ndzwani Comorian +wnk I L Wanukaka +wnm I E Wanggamala +wnn I E Wunumara +wno I L Wano +wnp I L Wanap +wnu I L Usan +wnw I L Wintu +wny I L Wanyi +woa I L Tyaraity +wob I L Wè Northern +woc I L Wogeo +wod I L Wolani +woe I L Woleaian +wof I L Gambian Wolof +wog I L Wogamusin +woi I L Kamang +wok I L Longto +wol wol wol wo I L Wolof +wom I L Wom (Nigeria) +won I L Wongo +woo I L Manombai +wor I L Woria +wos I L Hanga Hundi +wow I L Wawonii +woy I E Weyto +wpc I L Maco +wra I L Warapu +wrb I E Warluwara +wrd I L Warduji +wrg I E Warungu +wrh I E Wiradhuri +wri I E Wariyangga +wrk I L Garrwa +wrl I L Warlmanpa +wrm I L Warumungu +wrn I L Warnang +wro I E Worrorra +wrp I L Waropen +wrr I L Wardaman +wrs I L Waris +wru I L Waru +wrv I L Waruna +wrw I E Gugu Warra +wrx I L Wae Rana +wry I L Merwari +wrz I E Waray (Australia) +wsa I L Warembori +wsi I L Wusi +wsk I L Waskia +wsr I L Owenia +wss I L Wasa +wsu I E Wasu +wsv I E Wotapuri-Katarqalai +wtf I L Watiwa +wth I E Wathawurrung +wti I L Berta +wtk I L Watakataui +wtm I L Mewati +wtw I L Wotu +wua I L Wikngenchera +wub I L Wunambal +wud I L Wudu +wuh I L Wutunhua +wul I L Silimo +wum I L Wumbvu +wun I L Bungu +wur I E Wurrugu +wut I L Wutung +wuu I L Wu Chinese +wuv I L Wuvulu-Aua +wux I L Wulna +wuy I L Wauyai +wwa I L Waama +wwb I E Wakabunga +wwo I L Wetamut +wwr I E Warrwa +www I L Wawa +wxa I L Waxianghua +wxw I E Wardandi +wya I L Wyandot +wyb I L Wangaaybuwan-Ngiyambaa +wyi I E Woiwurrung +wym I L Wymysorys +wyr I L Wayoró +wyy I L Western Fijian +xaa I H Andalusian Arabic +xab I L Sambe +xac I L Kachari +xad I E Adai +xae I A Aequian +xag I E Aghwan +xai I E Kaimbé +xal xal xal I L Kalmyk +xam I E /Xam +xan I L Xamtanga +xao I L Khao +xap I E Apalachee +xaq I A Aquitanian +xar I E Karami +xas I E Kamas +xat I L Katawixi +xau I L Kauwera +xav I L Xavánte +xaw I L Kawaiisu +xay I L Kayan Mahakam +xba I E Kamba (Brazil) +xbb I E Lower Burdekin +xbc I A Bactrian +xbd I E Bindal +xbe I E Bigambal +xbg I E Bunganditj +xbi I L Kombio +xbj I E Birrpayi +xbm I H Middle Breton +xbn I E Kenaboi +xbo I E Bolgarian +xbp I E Bibbulman +xbr I L Kambera +xbw I E Kambiwá +xbx I E Kabixí +xby I L Batyala +xcb I E Cumbric +xcc I A Camunic +xce I A Celtiberian +xcg I A Cisalpine Gaulish +xch I E Chemakum +xcl I H Classical Armenian +xcm I E Comecrudo +xcn I E Cotoname +xco I A Chorasmian +xcr I A Carian +xct I H Classical Tibetan +xcu I E Curonian +xcv I E Chuvantsy +xcw I E Coahuilteco +xcy I E Cayuse +xda I L Darkinyung +xdc I A Dacian +xdk I E Dharuk +xdm I A Edomite +xdy I L Malayic Dayak +xeb I A Eblan +xed I L Hdi +xeg I E //Xegwi +xel I L Kelo +xem I L Kembayan +xep I A Epi-Olmec +xer I L Xerénte +xes I L Kesawai +xet I L Xetá +xeu I L Keoru-Ahia +xfa I A Faliscan +xga I A Galatian +xgb I E Gbin +xgd I E Gudang +xgf I E Gabrielino-Fernandeño +xgg I E Goreng +xgi I E Garingbal +xgl I E Galindan +xgm I E Guwinmal +xgr I E Garza +xgu I L Unggumi +xgw I E Guwa +xha I A Harami +xhc I E Hunnic +xhd I A Hadrami +xhe I L Khetrani +xho xho xho xh I L Xhosa +xhr I A Hernican +xht I A Hattic +xhu I A Hurrian +xhv I L Khua +xib I A Iberian +xii I L Xiri +xil I A Illyrian +xin I E Xinca +xip I E Xipináwa +xir I E Xiriâna +xiv I A Indus Valley Language +xiy I L Xipaya +xjb I E Minjungbal +xjt I E Jaitmatang +xka I L Kalkoti +xkb I L Northern Nago +xkc I L Kho'ini +xkd I L Mendalam Kayan +xke I L Kereho +xkf I L Khengkha +xkg I L Kagoro +xkh I L Karahawyana +xki I L Kenyan Sign Language +xkj I L Kajali +xkk I L Kaco' +xkl I L Mainstream Kenyah +xkn I L Kayan River Kayan +xko I L Kiorr +xkp I L Kabatei +xkq I L Koroni +xkr I E Xakriabá +xks I L Kumbewaha +xkt I L Kantosi +xku I L Kaamba +xkv I L Kgalagadi +xkw I L Kembra +xkx I L Karore +xky I L Uma' Lasan +xkz I L Kurtokha +xla I L Kamula +xlb I E Loup B +xlc I A Lycian +xld I A Lydian +xle I A Lemnian +xlg I A Ligurian (Ancient) +xli I A Liburnian +xln I A Alanic +xlo I E Loup A +xlp I A Lepontic +xls I A Lusitanian +xlu I A Cuneiform Luwian +xly I A Elymian +xma I L Mushungulu +xmb I L Mbonga +xmc I L Makhuwa-Marrevone +xmd I L Mbudum +xme I A Median +xmf I L Mingrelian +xmg I L Mengaka +xmh I L Kuku-Muminh +xmj I L Majera +xmk I A Ancient Macedonian +xml I L Malaysian Sign Language +xmm I L Manado Malay +xmn I H Manichaean Middle Persian +xmo I L Morerebi +xmp I E Kuku-Mu'inh +xmq I E Kuku-Mangk +xmr I A Meroitic +xms I L Moroccan Sign Language +xmt I L Matbat +xmu I E Kamu +xmv I L Antankarana Malagasy +xmw I L Tsimihety Malagasy +xmx I L Maden +xmy I L Mayaguduna +xmz I L Mori Bawah +xna I A Ancient North Arabian +xnb I L Kanakanabu +xng I H Middle Mongolian +xnh I L Kuanhua +xni I E Ngarigu +xnk I E Nganakarti +xnn I L Northern Kankanay +xno I H Anglo-Norman +xnr I L Kangri +xns I L Kanashi +xnt I E Narragansett +xnu I E Nukunul +xny I L Nyiyaparli +xnz I L Kenzi +xoc I E O'chi'chi' +xod I L Kokoda +xog I L Soga +xoi I L Kominimung +xok I L Xokleng +xom I L Komo (Sudan) +xon I L Konkomba +xoo I E Xukurú +xop I L Kopar +xor I L Korubo +xow I L Kowaki +xpa I E Pirriya +xpc I E Pecheneg +xpe I L Liberia Kpelle +xpg I A Phrygian +xpi I E Pictish +xpj I E Mpalitjanh +xpk I L Kulina Pano +xpm I E Pumpokol +xpn I E Kapinawá +xpo I E Pochutec +xpp I E Puyo-Paekche +xpq I E Mohegan-Pequot +xpr I A Parthian +xps I E Pisidian +xpt I E Punthamara +xpu I A Punic +xpy I E Puyo +xqa I H Karakhanid +xqt I A Qatabanian +xra I L Krahô +xrb I L Eastern Karaboro +xrd I E Gundungurra +xre I L Kreye +xrg I E Minang +xri I L Krikati-Timbira +xrm I E Armazic +xrn I E Arin +xrq I E Karranga +xrr I A Raetic +xrt I E Aranama-Tamique +xru I L Marriammu +xrw I L Karawa +xsa I A Sabaean +xsb I L Sambal +xsc I A Scythian +xsd I A Sidetic +xse I L Sempan +xsh I L Shamang +xsi I L Sio +xsj I L Subi +xsl I L South Slavey +xsm I L Kasem +xsn I L Sanga (Nigeria) +xso I E Solano +xsp I L Silopi +xsq I L Makhuwa-Saka +xsr I L Sherpa +xss I E Assan +xsu I L Sanumá +xsv I E Sudovian +xsy I L Saisiyat +xta I L Alcozauca Mixtec +xtb I L Chazumba Mixtec +xtc I L Katcha-Kadugli-Miri +xtd I L Diuxi-Tilantongo Mixtec +xte I L Ketengban +xtg I A Transalpine Gaulish +xth I E Yitha Yitha +xti I L Sinicahua Mixtec +xtj I L San Juan Teita Mixtec +xtl I L Tijaltepec Mixtec +xtm I L Magdalena Peñasco Mixtec +xtn I L Northern Tlaxiaco Mixtec +xto I A Tokharian A +xtp I L San Miguel Piedras Mixtec +xtq I H Tumshuqese +xtr I A Early Tripuri +xts I L Sindihui Mixtec +xtt I L Tacahua Mixtec +xtu I L Cuyamecalco Mixtec +xtv I E Thawa +xtw I L Tawandê +xty I L Yoloxochitl Mixtec +xtz I E Tasmanian +xua I L Alu Kurumba +xub I L Betta Kurumba +xud I E Umiida +xug I L Kunigami +xuj I L Jennu Kurumba +xul I E Ngunawal +xum I A Umbrian +xun I E Unggaranggu +xuo I L Kuo +xup I E Upper Umpqua +xur I A Urartian +xut I E Kuthant +xuu I L Kxoe +xve I A Venetic +xvi I L Kamviri +xvn I A Vandalic +xvo I A Volscian +xvs I A Vestinian +xwa I L Kwaza +xwc I E Woccon +xwd I E Wadi Wadi +xwe I L Xwela Gbe +xwg I L Kwegu +xwj I E Wajuk +xwk I E Wangkumara +xwl I L Western Xwla Gbe +xwo I E Written Oirat +xwr I L Kwerba Mamberamo +xwt I E Wotjobaluk +xww I E Wemba Wemba +xxb I E Boro (Ghana) +xxk I L Ke'o +xxm I E Minkin +xxr I E Koropó +xxt I E Tambora +xya I E Yaygir +xyb I E Yandjibara +xyj I E Mayi-Yapi +xyk I E Mayi-Kulan +xyl I E Yalakalore +xyt I E Mayi-Thakurti +xyy I L Yorta Yorta +xzh I A Zhang-Zhung +xzm I E Zemgalian +xzp I H Ancient Zapotec +yaa I L Yaminahua +yab I L Yuhup +yac I L Pass Valley Yali +yad I L Yagua +yae I L Pumé +yaf I L Yaka (Democratic Republic of Congo) +yag I L Yámana +yah I L Yazgulyam +yai I L Yagnobi +yaj I L Banda-Yangere +yak I L Yakama +yal I L Yalunka +yam I L Yamba +yan I L Mayangna +yao yao yao I L Yao +yap yap yap I L Yapese +yaq I L Yaqui +yar I L Yabarana +yas I L Nugunu (Cameroon) +yat I L Yambeta +yau I L Yuwana +yav I L Yangben +yaw I L Yawalapití +yax I L Yauma +yay I L Agwagwune +yaz I L Lokaa +yba I L Yala +ybb I L Yemba +ybe I L West Yugur +ybh I L Yakha +ybi I L Yamphu +ybj I L Hasha +ybk I L Bokha +ybl I L Yukuben +ybm I L Yaben +ybn I E Yabaâna +ybo I L Yabong +ybx I L Yawiyo +yby I L Yaweyuha +ych I L Chesu +ycl I L Lolopo +ycn I L Yucuna +ycp I L Chepya +yda I E Yanda +ydd I L Eastern Yiddish +yde I L Yangum Dey +ydg I L Yidgha +ydk I L Yoidik +yds I L Yiddish Sign Language +yea I L Ravula +yec I L Yeniche +yee I L Yimas +yei I E Yeni +yej I L Yevanic +yel I L Yela +yer I L Tarok +yes I L Nyankpa +yet I L Yetfa +yeu I L Yerukula +yev I L Yapunda +yey I L Yeyi +yga I E Malyangapa +ygi I E Yiningayi +ygl I L Yangum Gel +ygm I L Yagomi +ygp I L Gepo +ygr I L Yagaria +ygu I L Yugul +ygw I L Yagwoia +yha I L Baha Buyang +yhd I L Judeo-Iraqi Arabic +yhl I L Hlepho Phowa +yia I L Yinggarda +yid yid yid yi M L Yiddish +yif I L Ache +yig I L Wusa Nasu +yih I L Western Yiddish +yii I L Yidiny +yij I L Yindjibarndi +yik I L Dongshanba Lalo +yil I E Yindjilandji +yim I L Yimchungru Naga +yin I L Yinchia +yip I L Pholo +yiq I L Miqie +yir I L North Awyu +yis I L Yis +yit I L Eastern Lalu +yiu I L Awu +yiv I L Northern Nisu +yix I L Axi Yi +yiz I L Azhe +yka I L Yakan +ykg I L Northern Yukaghir +yki I L Yoke +ykk I L Yakaikeke +ykl I L Khlula +ykm I L Kap +ykn I L Kua-nsi +yko I L Yasa +ykr I L Yekora +ykt I L Kathu +yku I L Kuamasi +yky I L Yakoma +yla I L Yaul +ylb I L Yaleba +yle I L Yele +ylg I L Yelogu +yli I L Angguruk Yali +yll I L Yil +ylm I L Limi +yln I L Langnian Buyang +ylo I L Naluo Yi +ylr I E Yalarnnga +ylu I L Aribwaung +yly I L Nyâlayu +ymb I L Yambes +ymc I L Southern Muji +ymd I L Muda +yme I E Yameo +ymg I L Yamongeri +ymh I L Mili +ymi I L Moji +ymk I L Makwe +yml I L Iamalele +ymm I L Maay +ymn I L Yamna +ymo I L Yangum Mon +ymp I L Yamap +ymq I L Qila Muji +ymr I L Malasar +yms I A Mysian +ymt I E Mator-Taygi-Karagas +ymx I L Northern Muji +ymz I L Muzi +yna I L Aluo +ynd I E Yandruwandha +yne I L Lang'e +yng I L Yango +ynh I L Yangho +ynk I L Naukan Yupik +ynl I L Yangulam +ynn I E Yana +yno I L Yong +ynq I L Yendang +yns I L Yansi +ynu I E Yahuna +yob I E Yoba +yog I L Yogad +yoi I L Yonaguni +yok I L Yokuts +yol I E Yola +yom I L Yombe +yon I L Yongkom +yor yor yor yo I L Yoruba +yot I L Yotti +yox I L Yoron +yoy I L Yoy +ypa I L Phala +ypb I L Labo Phowa +ypg I L Phola +yph I L Phupha +ypm I L Phuma +ypn I L Ani Phowa +ypo I L Alo Phola +ypp I L Phupa +ypz I L Phuza +yra I L Yerakai +yrb I L Yareba +yre I L Yaouré +yri I L Yarí +yrk I L Nenets +yrl I L Nhengatu +yrm I L Yirrk-Mel +yrn I L Yerong +yrs I L Yarsun +yrw I L Yarawata +yry I L Yarluyandi +ysc I E Yassic +ysd I L Samatao +ysg I L Sonaga +ysl I L Yugoslavian Sign Language +ysn I L Sani +yso I L Nisi (China) +ysp I L Southern Lolopo +ysr I E Sirenik Yupik +yss I L Yessan-Mayo +ysy I L Sanie +yta I L Talu +ytl I L Tanglang +ytp I L Thopho +ytw I L Yout Wam +yty I E Yatay +yua I L Yucateco +yub I E Yugambal +yuc I L Yuchi +yud I L Judeo-Tripolitanian Arabic +yue I L Yue Chinese +yuf I L Havasupai-Walapai-Yavapai +yug I E Yug +yui I L Yurutí +yuj I L Karkar-Yuri +yuk I E Yuki +yul I L Yulu +yum I L Quechan +yun I L Bena (Nigeria) +yup I L Yukpa +yuq I L Yuqui +yur I L Yurok +yut I L Yopno +yuu I L Yugh +yuw I L Yau (Morobe Province) +yux I L Southern Yukaghir +yuy I L East Yugur +yuz I L Yuracare +yva I L Yawa +yvt I E Yavitero +ywa I L Kalou +ywg I L Yinhawangka +ywl I L Western Lalu +ywn I L Yawanawa +ywq I L Wuding-Luquan Yi +ywr I L Yawuru +ywt I L Xishanba Lalo +ywu I L Wumeng Nasu +yww I E Yawarawarga +yxa I E Mayawali +yxg I E Yagara +yxl I E Yardliyawarra +yxm I E Yinwum +yxu I E Yuyu +yxy I E Yabula Yabula +yyr I E Yir Yoront +yyu I L Yau (Sandaun Province) +yyz I L Ayizi +yzg I L E'ma Buyang +yzk I L Zokhuo +zaa I L Sierra de Juárez Zapotec +zab I L San Juan Guelavía Zapotec +zac I L Ocotlán Zapotec +zad I L Cajonos Zapotec +zae I L Yareni Zapotec +zaf I L Ayoquesco Zapotec +zag I L Zaghawa +zah I L Zangwal +zai I L Isthmus Zapotec +zaj I L Zaramo +zak I L Zanaki +zal I L Zauzou +zam I L Miahuatlán Zapotec +zao I L Ozolotepec Zapotec +zap zap zap M L Zapotec +zaq I L Aloápam Zapotec +zar I L Rincón Zapotec +zas I L Santo Domingo Albarradas Zapotec +zat I L Tabaa Zapotec +zau I L Zangskari +zav I L Yatzachi Zapotec +zaw I L Mitla Zapotec +zax I L Xadani Zapotec +zay I L Zayse-Zergulla +zaz I L Zari +zbc I L Central Berawan +zbe I L East Berawan +zbl zbl zbl I C Blissymbols +zbt I L Batui +zbw I L West Berawan +zca I L Coatecas Altas Zapotec +zch I L Central Hongshuihe Zhuang +zdj I L Ngazidja Comorian +zea I L Zeeuws +zeg I L Zenag +zeh I L Eastern Hongshuihe Zhuang +zen zen zen I L Zenaga +zga I L Kinga +zgb I L Guibei Zhuang +zgh I L Standard Moroccan Tamazight +zgm I L Minz Zhuang +zgn I L Guibian Zhuang +zgr I L Magori +zha zha zha za M L Zhuang +zhb I L Zhaba +zhd I L Dai Zhuang +zhi I L Zhire +zhn I L Nong Zhuang +zho chi zho zh M L Chinese +zhw I L Zhoa +zia I L Zia +zib I L Zimbabwe Sign Language +zik I L Zimakani +zil I L Zialo +zim I L Mesme +zin I L Zinza +zir I E Ziriya +ziw I L Zigula +ziz I L Zizilivakan +zka I L Kaimbulawa +zkb I E Koibal +zkd I L Kadu +zkg I E Koguryo +zkh I E Khorezmian +zkk I E Karankawa +zkn I L Kanan +zko I E Kott +zkp I E São Paulo Kaingáng +zkr I L Zakhring +zkt I E Kitan +zku I E Kaurna +zkv I E Krevinian +zkz I E Khazar +zlj I L Liujiang Zhuang +zlm I L Malay (individual language) +zln I L Lianshan Zhuang +zlq I L Liuqian Zhuang +zma I L Manda (Australia) +zmb I L Zimba +zmc I E Margany +zmd I L Maridan +zme I E Mangerr +zmf I L Mfinu +zmg I L Marti Ke +zmh I E Makolkol +zmi I L Negeri Sembilan Malay +zmj I L Maridjabin +zmk I E Mandandanyi +zml I L Madngele +zmm I L Marimanindji +zmn I L Mbangwe +zmo I L Molo +zmp I L Mpuono +zmq I L Mituku +zmr I L Maranunggu +zms I L Mbesa +zmt I L Maringarr +zmu I E Muruwari +zmv I E Mbariman-Gudhinma +zmw I L Mbo (Democratic Republic of Congo) +zmx I L Bomitaba +zmy I L Mariyedi +zmz I L Mbandja +zna I L Zan Gula +zne I L Zande (individual language) +zng I L Mang +znk I E Manangkari +zns I L Mangas +zoc I L Copainalá Zoque +zoh I L Chimalapa Zoque +zom I L Zou +zoo I L Asunción Mixtepec Zapotec +zoq I L Tabasco Zoque +zor I L Rayón Zoque +zos I L Francisco León Zoque +zpa I L Lachiguiri Zapotec +zpb I L Yautepec Zapotec +zpc I L Choapan Zapotec +zpd I L Southeastern Ixtlán Zapotec +zpe I L Petapa Zapotec +zpf I L San Pedro Quiatoni Zapotec +zpg I L Guevea De Humboldt Zapotec +zph I L Totomachapan Zapotec +zpi I L Santa María Quiegolani Zapotec +zpj I L Quiavicuzas Zapotec +zpk I L Tlacolulita Zapotec +zpl I L Lachixío Zapotec +zpm I L Mixtepec Zapotec +zpn I L Santa Inés Yatzechi Zapotec +zpo I L Amatlán Zapotec +zpp I L El Alto Zapotec +zpq I L Zoogocho Zapotec +zpr I L Santiago Xanica Zapotec +zps I L Coatlán Zapotec +zpt I L San Vicente Coatlán Zapotec +zpu I L Yalálag Zapotec +zpv I L Chichicapan Zapotec +zpw I L Zaniza Zapotec +zpx I L San Baltazar Loxicha Zapotec +zpy I L Mazaltepec Zapotec +zpz I L Texmelucan Zapotec +zqe I L Qiubei Zhuang +zra I E Kara (Korea) +zrg I L Mirgan +zrn I L Zerenkel +zro I L Záparo +zrp I E Zarphatic +zrs I L Mairasi +zsa I L Sarasira +zsk I A Kaskean +zsl I L Zambian Sign Language +zsm I L Standard Malay +zsr I L Southern Rincon Zapotec +zsu I L Sukurum +zte I L Elotepec Zapotec +ztg I L Xanaguía Zapotec +ztl I L Lapaguía-Guivini Zapotec +ztm I L San Agustín Mixtepec Zapotec +ztn I L Santa Catarina Albarradas Zapotec +ztp I L Loxicha Zapotec +ztq I L Quioquitani-Quierí Zapotec +zts I L Tilquiapan Zapotec +ztt I L Tejalapan Zapotec +ztu I L Güilá Zapotec +ztx I L Zaachila Zapotec +zty I L Yatee Zapotec +zua I L Zeem +zuh I L Tokano +zul zul zul zu I L Zulu +zum I L Kumzari +zun zun zun I L Zuni +zuy I L Zumaya +zwa I L Zay +zxx zxx zxx S S No linguistic content +zyb I L Yongbei Zhuang +zyg I L Yang Zhuang +zyj I L Youjiang Zhuang +zyn I L Yongnan Zhuang +zyp I L Zyphe Chin +zza zza zza M L Zaza +zzj I L Zuojiang Zhuang \ No newline at end of file diff --git a/lib/babelfish/data/iso15924-utf8-20131012.txt b/lib/babelfish/data/iso15924-utf8-20131012.txt new file mode 100644 index 00000000..4b6ff471 --- /dev/null +++ b/lib/babelfish/data/iso15924-utf8-20131012.txt @@ -0,0 +1,176 @@ +# +# ISO 15924 - Codes for the representation of names of scripts +# Codes pour la représentation des noms d’écritures +# Format: +# Code;N°;English Name;Nom français;PVA;Date +# + +Afak;439;Afaka;afaka;;2010-12-21 +Aghb;239;Caucasian Albanian;aghbanien;;2012-10-16 +Ahom;338;Ahom, Tai Ahom;âhom;;2012-11-01 +Arab;160;Arabic;arabe;Arabic;2004-05-01 +Armi;124;Imperial Aramaic;araméen impérial;Imperial_Aramaic;2009-06-01 +Armn;230;Armenian;arménien;Armenian;2004-05-01 +Avst;134;Avestan;avestique;Avestan;2009-06-01 +Bali;360;Balinese;balinais;Balinese;2006-10-10 +Bamu;435;Bamum;bamoum;Bamum;2009-06-01 +Bass;259;Bassa Vah;bassa;;2010-03-26 +Batk;365;Batak;batik;Batak;2010-07-23 +Beng;325;Bengali;bengalî;Bengali;2004-05-01 +Blis;550;Blissymbols;symboles Bliss;;2004-05-01 +Bopo;285;Bopomofo;bopomofo;Bopomofo;2004-05-01 +Brah;300;Brahmi;brahma;Brahmi;2010-07-23 +Brai;570;Braille;braille;Braille;2004-05-01 +Bugi;367;Buginese;bouguis;Buginese;2006-06-21 +Buhd;372;Buhid;bouhide;Buhid;2004-05-01 +Cakm;349;Chakma;chakma;Chakma;2012-02-06 +Cans;440;Unified Canadian Aboriginal Syllabics;syllabaire autochtone canadien unifié;Canadian_Aboriginal;2004-05-29 +Cari;201;Carian;carien;Carian;2007-07-02 +Cham;358;Cham;cham (čam, tcham);Cham;2009-11-11 +Cher;445;Cherokee;tchérokî;Cherokee;2004-05-01 +Cirt;291;Cirth;cirth;;2004-05-01 +Copt;204;Coptic;copte;Coptic;2006-06-21 +Cprt;403;Cypriot;syllabaire chypriote;Cypriot;2004-05-01 +Cyrl;220;Cyrillic;cyrillique;Cyrillic;2004-05-01 +Cyrs;221;Cyrillic (Old Church Slavonic variant);cyrillique (variante slavonne);;2004-05-01 +Deva;315;Devanagari (Nagari);dévanâgarî;Devanagari;2004-05-01 +Dsrt;250;Deseret (Mormon);déseret (mormon);Deseret;2004-05-01 +Dupl;755;Duployan shorthand, Duployan stenography;sténographie Duployé;;2010-07-18 +Egyd;070;Egyptian demotic;démotique égyptien;;2004-05-01 +Egyh;060;Egyptian hieratic;hiératique égyptien;;2004-05-01 +Egyp;050;Egyptian hieroglyphs;hiéroglyphes égyptiens;Egyptian_Hieroglyphs;2009-06-01 +Elba;226;Elbasan;elbasan;;2010-07-18 +Ethi;430;Ethiopic (Geʻez);éthiopien (geʻez, guèze);Ethiopic;2004-10-25 +Geor;240;Georgian (Mkhedruli);géorgien (mkhédrouli);Georgian;2004-05-29 +Geok;241;Khutsuri (Asomtavruli and Nuskhuri);khoutsouri (assomtavrouli et nouskhouri);Georgian;2012-10-16 +Glag;225;Glagolitic;glagolitique;Glagolitic;2006-06-21 +Goth;206;Gothic;gotique;Gothic;2004-05-01 +Gran;343;Grantha;grantha;;2009-11-11 +Grek;200;Greek;grec;Greek;2004-05-01 +Gujr;320;Gujarati;goudjarâtî (gujrâtî);Gujarati;2004-05-01 +Guru;310;Gurmukhi;gourmoukhî;Gurmukhi;2004-05-01 +Hang;286;Hangul (Hangŭl, Hangeul);hangûl (hangŭl, hangeul);Hangul;2004-05-29 +Hani;500;Han (Hanzi, Kanji, Hanja);idéogrammes han (sinogrammes);Han;2009-02-23 +Hano;371;Hanunoo (Hanunóo);hanounóo;Hanunoo;2004-05-29 +Hans;501;Han (Simplified variant);idéogrammes han (variante simplifiée);;2004-05-29 +Hant;502;Han (Traditional variant);idéogrammes han (variante traditionnelle);;2004-05-29 +Hatr;127;Hatran;hatrénien;;2012-11-01 +Hebr;125;Hebrew;hébreu;Hebrew;2004-05-01 +Hira;410;Hiragana;hiragana;Hiragana;2004-05-01 +Hluw;080;Anatolian Hieroglyphs (Luwian Hieroglyphs, Hittite Hieroglyphs);hiéroglyphes anatoliens (hiéroglyphes louvites, hiéroglyphes hittites);;2011-12-09 +Hmng;450;Pahawh Hmong;pahawh hmong;;2004-05-01 +Hrkt;412;Japanese syllabaries (alias for Hiragana + Katakana);syllabaires japonais (alias pour hiragana + katakana);Katakana_Or_Hiragana;2011-06-21 +Hung;176;Old Hungarian (Hungarian Runic);runes hongroises (ancien hongrois);;2012-10-16 +Inds;610;Indus (Harappan);indus;;2004-05-01 +Ital;210;Old Italic (Etruscan, Oscan, etc.);ancien italique (étrusque, osque, etc.);Old_Italic;2004-05-29 +Java;361;Javanese;javanais;Javanese;2009-06-01 +Jpan;413;Japanese (alias for Han + Hiragana + Katakana);japonais (alias pour han + hiragana + katakana);;2006-06-21 +Jurc;510;Jurchen;jurchen;;2010-12-21 +Kali;357;Kayah Li;kayah li;Kayah_Li;2007-07-02 +Kana;411;Katakana;katakana;Katakana;2004-05-01 +Khar;305;Kharoshthi;kharochthî;Kharoshthi;2006-06-21 +Khmr;355;Khmer;khmer;Khmer;2004-05-29 +Khoj;322;Khojki;khojkî;;2011-06-21 +Knda;345;Kannada;kannara (canara);Kannada;2004-05-29 +Kore;287;Korean (alias for Hangul + Han);coréen (alias pour hangûl + han);;2007-06-13 +Kpel;436;Kpelle;kpèllé;;2010-03-26 +Kthi;317;Kaithi;kaithî;Kaithi;2009-06-01 +Lana;351;Tai Tham (Lanna);taï tham (lanna);Tai_Tham;2009-06-01 +Laoo;356;Lao;laotien;Lao;2004-05-01 +Latf;217;Latin (Fraktur variant);latin (variante brisée);;2004-05-01 +Latg;216;Latin (Gaelic variant);latin (variante gaélique);;2004-05-01 +Latn;215;Latin;latin;Latin;2004-05-01 +Lepc;335;Lepcha (Róng);lepcha (róng);Lepcha;2007-07-02 +Limb;336;Limbu;limbou;Limbu;2004-05-29 +Lina;400;Linear A;linéaire A;;2004-05-01 +Linb;401;Linear B;linéaire B;Linear_B;2004-05-29 +Lisu;399;Lisu (Fraser);lisu (Fraser);Lisu;2009-06-01 +Loma;437;Loma;loma;;2010-03-26 +Lyci;202;Lycian;lycien;Lycian;2007-07-02 +Lydi;116;Lydian;lydien;Lydian;2007-07-02 +Mahj;314;Mahajani;mahâjanî;;2012-10-16 +Mand;140;Mandaic, Mandaean;mandéen;Mandaic;2010-07-23 +Mani;139;Manichaean;manichéen;;2007-07-15 +Maya;090;Mayan hieroglyphs;hiéroglyphes mayas;;2004-05-01 +Mend;438;Mende Kikakui;mendé kikakui;;2013-10-12 +Merc;101;Meroitic Cursive;cursif méroïtique;Meroitic_Cursive;2012-02-06 +Mero;100;Meroitic Hieroglyphs;hiéroglyphes méroïtiques;Meroitic_Hieroglyphs;2012-02-06 +Mlym;347;Malayalam;malayâlam;Malayalam;2004-05-01 +Modi;323;Modi, Moḍī;modî;;2013-10-12 +Moon;218;Moon (Moon code, Moon script, Moon type);écriture Moon;;2006-12-11 +Mong;145;Mongolian;mongol;Mongolian;2004-05-01 +Mroo;199;Mro, Mru;mro;;2010-12-21 +Mtei;337;Meitei Mayek (Meithei, Meetei);meitei mayek;Meetei_Mayek;2009-06-01 +Mult;323; Multani;multanî;;2012-11-01 +Mymr;350;Myanmar (Burmese);birman;Myanmar;2004-05-01 +Narb;106;Old North Arabian (Ancient North Arabian);nord-arabique;;2010-03-26 +Nbat;159;Nabataean;nabatéen;;2010-03-26 +Nkgb;420;Nakhi Geba ('Na-'Khi ²Ggŏ-¹baw, Naxi Geba);nakhi géba;;2009-02-23 +Nkoo;165;N’Ko;n’ko;Nko;2006-10-10 +Nshu;499;Nüshu;nüshu;;2010-12-21 +Ogam;212;Ogham;ogam;Ogham;2004-05-01 +Olck;261;Ol Chiki (Ol Cemet’, Ol, Santali);ol tchiki;Ol_Chiki;2007-07-02 +Orkh;175;Old Turkic, Orkhon Runic;orkhon;Old_Turkic;2009-06-01 +Orya;327;Oriya;oriyâ;Oriya;2004-05-01 +Osma;260;Osmanya;osmanais;Osmanya;2004-05-01 +Palm;126;Palmyrene;palmyrénien;;2010-03-26 +Pauc;263;Pau Cin Hau;paou chin haou;;2013-10-12 +Perm;227;Old Permic;ancien permien;;2004-05-01 +Phag;331;Phags-pa;’phags pa;Phags_Pa;2006-10-10 +Phli;131;Inscriptional Pahlavi;pehlevi des inscriptions;Inscriptional_Pahlavi;2009-06-01 +Phlp;132;Psalter Pahlavi;pehlevi des psautiers;;2007-11-26 +Phlv;133;Book Pahlavi;pehlevi des livres;;2007-07-15 +Phnx;115;Phoenician;phénicien;Phoenician;2006-10-10 +Plrd;282;Miao (Pollard);miao (Pollard);Miao;2012-02-06 +Prti;130;Inscriptional Parthian;parthe des inscriptions;Inscriptional_Parthian;2009-06-01 +Qaaa;900;Reserved for private use (start);réservé à l’usage privé (début);;2004-05-29 +Qabx;949;Reserved for private use (end);réservé à l’usage privé (fin);;2004-05-29 +Rjng;363;Rejang (Redjang, Kaganga);redjang (kaganga);Rejang;2009-02-23 +Roro;620;Rongorongo;rongorongo;;2004-05-01 +Runr;211;Runic;runique;Runic;2004-05-01 +Samr;123;Samaritan;samaritain;Samaritan;2009-06-01 +Sara;292;Sarati;sarati;;2004-05-29 +Sarb;105;Old South Arabian;sud-arabique, himyarite;Old_South_Arabian;2009-06-01 +Saur;344;Saurashtra;saurachtra;Saurashtra;2007-07-02 +Sgnw;095;SignWriting;SignÉcriture, SignWriting;;2006-10-10 +Shaw;281;Shavian (Shaw);shavien (Shaw);Shavian;2004-05-01 +Shrd;319;Sharada, Śāradā;charada, shard;Sharada;2012-02-06 +Sidd;302;Siddham, Siddhaṃ, Siddhamātṛkā;siddham;;2013-10-12 +Sind;318;Khudawadi, Sindhi;khoudawadî, sindhî;;2010-12-21 +Sinh;348;Sinhala;singhalais;Sinhala;2004-05-01 +Sora;398;Sora Sompeng;sora sompeng;Sora_Sompeng;2012-02-06 +Sund;362;Sundanese;sundanais;Sundanese;2007-07-02 +Sylo;316;Syloti Nagri;sylotî nâgrî;Syloti_Nagri;2006-06-21 +Syrc;135;Syriac;syriaque;Syriac;2004-05-01 +Syre;138;Syriac (Estrangelo variant);syriaque (variante estranghélo);;2004-05-01 +Syrj;137;Syriac (Western variant);syriaque (variante occidentale);;2004-05-01 +Syrn;136;Syriac (Eastern variant);syriaque (variante orientale);;2004-05-01 +Tagb;373;Tagbanwa;tagbanoua;Tagbanwa;2004-05-01 +Takr;321;Takri, Ṭākrī, Ṭāṅkrī;tâkrî;Takri;2012-02-06 +Tale;353;Tai Le;taï-le;Tai_Le;2004-10-25 +Talu;354;New Tai Lue;nouveau taï-lue;New_Tai_Lue;2006-06-21 +Taml;346;Tamil;tamoul;Tamil;2004-05-01 +Tang;520;Tangut;tangoute;;2010-12-21 +Tavt;359;Tai Viet;taï viêt;Tai_Viet;2009-06-01 +Telu;340;Telugu;télougou;Telugu;2004-05-01 +Teng;290;Tengwar;tengwar;;2004-05-01 +Tfng;120;Tifinagh (Berber);tifinagh (berbère);Tifinagh;2006-06-21 +Tglg;370;Tagalog (Baybayin, Alibata);tagal (baybayin, alibata);Tagalog;2009-02-23 +Thaa;170;Thaana;thâna;Thaana;2004-05-01 +Thai;352;Thai;thaï;Thai;2004-05-01 +Tibt;330;Tibetan;tibétain;Tibetan;2004-05-01 +Tirh;326;Tirhuta;tirhouta;;2011-12-09 +Ugar;040;Ugaritic;ougaritique;Ugaritic;2004-05-01 +Vaii;470;Vai;vaï;Vai;2007-07-02 +Visp;280;Visible Speech;parole visible;;2004-05-01 +Wara;262;Warang Citi (Varang Kshiti);warang citi;;2009-11-11 +Wole;480;Woleai;woléaï;;2010-12-21 +Xpeo;030;Old Persian;cunéiforme persépolitain;Old_Persian;2006-06-21 +Xsux;020;Cuneiform, Sumero-Akkadian;cunéiforme suméro-akkadien;Cuneiform;2006-10-10 +Yiii;460;Yi;yi;Yi;2004-05-01 +Zinh;994;Code for inherited script;codet pour écriture héritée;Inherited;2009-02-23 +Zmth;995;Mathematical notation;notation mathématique;;2007-11-26 +Zsym;996;Symbols;symboles;;2007-11-26 +Zxxx;997;Code for unwritten documents;codet pour les documents non écrits;;2011-06-21 +Zyyy;998;Code for undetermined script;codet pour écriture indéterminée;Common;2004-05-29 +Zzzz;999;Code for uncoded script;codet pour écriture non codée;Unknown;2006-10-10 diff --git a/lib/babelfish/data/opensubtitles_languages.txt b/lib/babelfish/data/opensubtitles_languages.txt new file mode 100644 index 00000000..1bd35063 --- /dev/null +++ b/lib/babelfish/data/opensubtitles_languages.txt @@ -0,0 +1,474 @@ +IdSubLanguage ISO639 LanguageName UploadEnabled WebEnabled +aar aa Afar, afar 0 0 +abk ab Abkhazian 0 0 +ace Achinese 0 0 +ach Acoli 0 0 +ada Adangme 0 0 +ady adyghé 0 0 +afa Afro-Asiatic (Other) 0 0 +afh Afrihili 0 0 +afr af Afrikaans 1 0 +ain Ainu 0 0 +aka ak Akan 0 0 +akk Akkadian 0 0 +alb sq Albanian 1 1 +ale Aleut 0 0 +alg Algonquian languages 0 0 +alt Southern Altai 0 0 +amh am Amharic 0 0 +ang English, Old (ca.450-1100) 0 0 +apa Apache languages 0 0 +ara ar Arabic 1 1 +arc Aramaic 0 0 +arg an Aragonese 0 0 +arm hy Armenian 1 0 +arn Araucanian 0 0 +arp Arapaho 0 0 +art Artificial (Other) 0 0 +arw Arawak 0 0 +asm as Assamese 0 0 +ast Asturian, Bable 0 0 +ath Athapascan languages 0 0 +aus Australian languages 0 0 +ava av Avaric 0 0 +ave ae Avestan 0 0 +awa Awadhi 0 0 +aym ay Aymara 0 0 +aze az Azerbaijani 0 0 +bad Banda 0 0 +bai Bamileke languages 0 0 +bak ba Bashkir 0 0 +bal Baluchi 0 0 +bam bm Bambara 0 0 +ban Balinese 0 0 +baq eu Basque 1 1 +bas Basa 0 0 +bat Baltic (Other) 0 0 +bej Beja 0 0 +bel be Belarusian 0 0 +bem Bemba 0 0 +ben bn Bengali 1 0 +ber Berber (Other) 0 0 +bho Bhojpuri 0 0 +bih bh Bihari 0 0 +bik Bikol 0 0 +bin Bini 0 0 +bis bi Bislama 0 0 +bla Siksika 0 0 +bnt Bantu (Other) 0 0 +bos bs Bosnian 1 0 +bra Braj 0 0 +bre br Breton 1 0 +btk Batak (Indonesia) 0 0 +bua Buriat 0 0 +bug Buginese 0 0 +bul bg Bulgarian 1 1 +bur my Burmese 1 0 +byn Blin 0 0 +cad Caddo 0 0 +cai Central American Indian (Other) 0 0 +car Carib 0 0 +cat ca Catalan 1 1 +cau Caucasian (Other) 0 0 +ceb Cebuano 0 0 +cel Celtic (Other) 0 0 +cha ch Chamorro 0 0 +chb Chibcha 0 0 +che ce Chechen 0 0 +chg Chagatai 0 0 +chi zh Chinese 1 1 +chk Chuukese 0 0 +chm Mari 0 0 +chn Chinook jargon 0 0 +cho Choctaw 0 0 +chp Chipewyan 0 0 +chr Cherokee 0 0 +chu cu Church Slavic 0 0 +chv cv Chuvash 0 0 +chy Cheyenne 0 0 +cmc Chamic languages 0 0 +cop Coptic 0 0 +cor kw Cornish 0 0 +cos co Corsican 0 0 +cpe Creoles and pidgins, English based (Other) 0 0 +cpf Creoles and pidgins, French-based (Other) 0 0 +cpp Creoles and pidgins, Portuguese-based (Other) 0 0 +cre cr Cree 0 0 +crh Crimean Tatar 0 0 +crp Creoles and pidgins (Other) 0 0 +csb Kashubian 0 0 +cus Cushitic (Other)' couchitiques, autres langues 0 0 +cze cs Czech 1 1 +dak Dakota 0 0 +dan da Danish 1 1 +dar Dargwa 0 0 +day Dayak 0 0 +del Delaware 0 0 +den Slave (Athapascan) 0 0 +dgr Dogrib 0 0 +din Dinka 0 0 +div dv Divehi 0 0 +doi Dogri 0 0 +dra Dravidian (Other) 0 0 +dua Duala 0 0 +dum Dutch, Middle (ca.1050-1350) 0 0 +dut nl Dutch 1 1 +dyu Dyula 0 0 +dzo dz Dzongkha 0 0 +efi Efik 0 0 +egy Egyptian (Ancient) 0 0 +eka Ekajuk 0 0 +elx Elamite 0 0 +eng en English 1 1 +enm English, Middle (1100-1500) 0 0 +epo eo Esperanto 1 0 +est et Estonian 1 1 +ewe ee Ewe 0 0 +ewo Ewondo 0 0 +fan Fang 0 0 +fao fo Faroese 0 0 +fat Fanti 0 0 +fij fj Fijian 0 0 +fil Filipino 0 0 +fin fi Finnish 1 1 +fiu Finno-Ugrian (Other) 0 0 +fon Fon 0 0 +fre fr French 1 1 +frm French, Middle (ca.1400-1600) 0 0 +fro French, Old (842-ca.1400) 0 0 +fry fy Frisian 0 0 +ful ff Fulah 0 0 +fur Friulian 0 0 +gaa Ga 0 0 +gay Gayo 0 0 +gba Gbaya 0 0 +gem Germanic (Other) 0 0 +geo ka Georgian 1 1 +ger de German 1 1 +gez Geez 0 0 +gil Gilbertese 0 0 +gla gd Gaelic 0 0 +gle ga Irish 0 0 +glg gl Galician 1 1 +glv gv Manx 0 0 +gmh German, Middle High (ca.1050-1500) 0 0 +goh German, Old High (ca.750-1050) 0 0 +gon Gondi 0 0 +gor Gorontalo 0 0 +got Gothic 0 0 +grb Grebo 0 0 +grc Greek, Ancient (to 1453) 0 0 +ell el Greek 1 1 +grn gn Guarani 0 0 +guj gu Gujarati 0 0 +gwi Gwich´in 0 0 +hai Haida 0 0 +hat ht Haitian 0 0 +hau ha Hausa 0 0 +haw Hawaiian 0 0 +heb he Hebrew 1 1 +her hz Herero 0 0 +hil Hiligaynon 0 0 +him Himachali 0 0 +hin hi Hindi 1 1 +hit Hittite 0 0 +hmn Hmong 0 0 +hmo ho Hiri Motu 0 0 +hrv hr Croatian 1 1 +hun hu Hungarian 1 1 +hup Hupa 0 0 +iba Iban 0 0 +ibo ig Igbo 0 0 +ice is Icelandic 1 1 +ido io Ido 0 0 +iii ii Sichuan Yi 0 0 +ijo Ijo 0 0 +iku iu Inuktitut 0 0 +ile ie Interlingue 0 0 +ilo Iloko 0 0 +ina ia Interlingua (International Auxiliary Language Asso 0 0 +inc Indic (Other) 0 0 +ind id Indonesian 1 1 +ine Indo-European (Other) 0 0 +inh Ingush 0 0 +ipk ik Inupiaq 0 0 +ira Iranian (Other) 0 0 +iro Iroquoian languages 0 0 +ita it Italian 1 1 +jav jv Javanese 0 0 +jpn ja Japanese 1 1 +jpr Judeo-Persian 0 0 +jrb Judeo-Arabic 0 0 +kaa Kara-Kalpak 0 0 +kab Kabyle 0 0 +kac Kachin 0 0 +kal kl Kalaallisut 0 0 +kam Kamba 0 0 +kan kn Kannada 0 0 +kar Karen 0 0 +kas ks Kashmiri 0 0 +kau kr Kanuri 0 0 +kaw Kawi 0 0 +kaz kk Kazakh 1 0 +kbd Kabardian 0 0 +kha Khasi 0 0 +khi Khoisan (Other) 0 0 +khm km Khmer 1 1 +kho Khotanese 0 0 +kik ki Kikuyu 0 0 +kin rw Kinyarwanda 0 0 +kir ky Kirghiz 0 0 +kmb Kimbundu 0 0 +kok Konkani 0 0 +kom kv Komi 0 0 +kon kg Kongo 0 0 +kor ko Korean 1 1 +kos Kosraean 0 0 +kpe Kpelle 0 0 +krc Karachay-Balkar 0 0 +kro Kru 0 0 +kru Kurukh 0 0 +kua kj Kuanyama 0 0 +kum Kumyk 0 0 +kur ku Kurdish 0 0 +kut Kutenai 0 0 +lad Ladino 0 0 +lah Lahnda 0 0 +lam Lamba 0 0 +lao lo Lao 0 0 +lat la Latin 0 0 +lav lv Latvian 1 0 +lez Lezghian 0 0 +lim li Limburgan 0 0 +lin ln Lingala 0 0 +lit lt Lithuanian 1 0 +lol Mongo 0 0 +loz Lozi 0 0 +ltz lb Luxembourgish 1 0 +lua Luba-Lulua 0 0 +lub lu Luba-Katanga 0 0 +lug lg Ganda 0 0 +lui Luiseno 0 0 +lun Lunda 0 0 +luo Luo (Kenya and Tanzania) 0 0 +lus lushai 0 0 +mac mk Macedonian 1 1 +mad Madurese 0 0 +mag Magahi 0 0 +mah mh Marshallese 0 0 +mai Maithili 0 0 +mak Makasar 0 0 +mal ml Malayalam 1 0 +man Mandingo 0 0 +mao mi Maori 0 0 +map Austronesian (Other) 0 0 +mar mr Marathi 0 0 +mas Masai 0 0 +may ms Malay 1 1 +mdf Moksha 0 0 +mdr Mandar 0 0 +men Mende 0 0 +mga Irish, Middle (900-1200) 0 0 +mic Mi'kmaq 0 0 +min Minangkabau 0 0 +mis Miscellaneous languages 0 0 +mkh Mon-Khmer (Other) 0 0 +mlg mg Malagasy 0 0 +mlt mt Maltese 0 0 +mnc Manchu 0 0 +mni Manipuri 0 0 +mno Manobo languages 0 0 +moh Mohawk 0 0 +mol mo Moldavian 0 0 +mon mn Mongolian 1 0 +mos Mossi 0 0 +mwl Mirandese 0 0 +mul Multiple languages 0 0 +mun Munda languages 0 0 +mus Creek 0 0 +mwr Marwari 0 0 +myn Mayan languages 0 0 +myv Erzya 0 0 +nah Nahuatl 0 0 +nai North American Indian 0 0 +nap Neapolitan 0 0 +nau na Nauru 0 0 +nav nv Navajo 0 0 +nbl nr Ndebele, South 0 0 +nde nd Ndebele, North 0 0 +ndo ng Ndonga 0 0 +nds Low German 0 0 +nep ne Nepali 0 0 +new Nepal Bhasa 0 0 +nia Nias 0 0 +nic Niger-Kordofanian (Other) 0 0 +niu Niuean 0 0 +nno nn Norwegian Nynorsk 0 0 +nob nb Norwegian Bokmal 0 0 +nog Nogai 0 0 +non Norse, Old 0 0 +nor no Norwegian 1 1 +nso Northern Sotho 0 0 +nub Nubian languages 0 0 +nwc Classical Newari 0 0 +nya ny Chichewa 0 0 +nym Nyamwezi 0 0 +nyn Nyankole 0 0 +nyo Nyoro 0 0 +nzi Nzima 0 0 +oci oc Occitan 1 1 +oji oj Ojibwa 0 0 +ori or Oriya 0 0 +orm om Oromo 0 0 +osa Osage 0 0 +oss os Ossetian 0 0 +ota Turkish, Ottoman (1500-1928) 0 0 +oto Otomian languages 0 0 +paa Papuan (Other) 0 0 +pag Pangasinan 0 0 +pal Pahlavi 0 0 +pam Pampanga 0 0 +pan pa Panjabi 0 0 +pap Papiamento 0 0 +pau Palauan 0 0 +peo Persian, Old (ca.600-400 B.C.) 0 0 +per fa Persian 1 1 +phi Philippine (Other) 0 0 +phn Phoenician 0 0 +pli pi Pali 0 0 +pol pl Polish 1 1 +pon Pohnpeian 0 0 +por pt Portuguese 1 1 +pra Prakrit languages 0 0 +pro Provençal, Old (to 1500) 0 0 +pus ps Pushto 0 0 +que qu Quechua 0 0 +raj Rajasthani 0 0 +rap Rapanui 0 0 +rar Rarotongan 0 0 +roa Romance (Other) 0 0 +roh rm Raeto-Romance 0 0 +rom Romany 0 0 +run rn Rundi 0 0 +rup Aromanian 0 0 +rus ru Russian 1 1 +sad Sandawe 0 0 +sag sg Sango 0 0 +sah Yakut 0 0 +sai South American Indian (Other) 0 0 +sal Salishan languages 0 0 +sam Samaritan Aramaic 0 0 +san sa Sanskrit 0 0 +sas Sasak 0 0 +sat Santali 0 0 +scc sr Serbian 1 1 +scn Sicilian 0 0 +sco Scots 0 0 +sel Selkup 0 0 +sem Semitic (Other) 0 0 +sga Irish, Old (to 900) 0 0 +sgn Sign Languages 0 0 +shn Shan 0 0 +sid Sidamo 0 0 +sin si Sinhalese 1 1 +sio Siouan languages 0 0 +sit Sino-Tibetan (Other) 0 0 +sla Slavic (Other) 0 0 +slo sk Slovak 1 1 +slv sl Slovenian 1 1 +sma Southern Sami 0 0 +sme se Northern Sami 0 0 +smi Sami languages (Other) 0 0 +smj Lule Sami 0 0 +smn Inari Sami 0 0 +smo sm Samoan 0 0 +sms Skolt Sami 0 0 +sna sn Shona 0 0 +snd sd Sindhi 0 0 +snk Soninke 0 0 +sog Sogdian 0 0 +som so Somali 0 0 +son Songhai 0 0 +sot st Sotho, Southern 0 0 +spa es Spanish 1 1 +srd sc Sardinian 0 0 +srr Serer 0 0 +ssa Nilo-Saharan (Other) 0 0 +ssw ss Swati 0 0 +suk Sukuma 0 0 +sun su Sundanese 0 0 +sus Susu 0 0 +sux Sumerian 0 0 +swa sw Swahili 1 0 +swe sv Swedish 1 1 +syr Syriac 1 0 +tah ty Tahitian 0 0 +tai Tai (Other) 0 0 +tam ta Tamil 1 0 +tat tt Tatar 0 0 +tel te Telugu 1 0 +tem Timne 0 0 +ter Tereno 0 0 +tet Tetum 0 0 +tgk tg Tajik 0 0 +tgl tl Tagalog 1 1 +tha th Thai 1 1 +tib bo Tibetan 0 0 +tig Tigre 0 0 +tir ti Tigrinya 0 0 +tiv Tiv 0 0 +tkl Tokelau 0 0 +tlh Klingon 0 0 +tli Tlingit 0 0 +tmh Tamashek 0 0 +tog Tonga (Nyasa) 0 0 +ton to Tonga (Tonga Islands) 0 0 +tpi Tok Pisin 0 0 +tsi Tsimshian 0 0 +tsn tn Tswana 0 0 +tso ts Tsonga 0 0 +tuk tk Turkmen 0 0 +tum Tumbuka 0 0 +tup Tupi languages 0 0 +tur tr Turkish 1 1 +tut Altaic (Other) 0 0 +tvl Tuvalu 0 0 +twi tw Twi 0 0 +tyv Tuvinian 0 0 +udm Udmurt 0 0 +uga Ugaritic 0 0 +uig ug Uighur 0 0 +ukr uk Ukrainian 1 1 +umb Umbundu 0 0 +und Undetermined 0 0 +urd ur Urdu 1 0 +uzb uz Uzbek 0 0 +vai Vai 0 0 +ven ve Venda 0 0 +vie vi Vietnamese 1 1 +vol vo Volapük 0 0 +vot Votic 0 0 +wak Wakashan languages 0 0 +wal Walamo 0 0 +war Waray 0 0 +was Washo 0 0 +wel cy Welsh 0 0 +wen Sorbian languages 0 0 +wln wa Walloon 0 0 +wol wo Wolof 0 0 +xal Kalmyk 0 0 +xho xh Xhosa 0 0 +yao Yao 0 0 +yap Yapese 0 0 +yid yi Yiddish 0 0 +yor yo Yoruba 0 0 +ypk Yupik languages 0 0 +zap Zapotec 0 0 +zen Zenaga 0 0 +zha za Zhuang 0 0 +znd Zande 0 0 +zul zu Zulu 0 0 +zun Zuni 0 0 +rum ro Romanian 1 1 +pob pb Brazilian 1 1 +mne Montenegrin 1 0 diff --git a/lib/babelfish/exceptions.py b/lib/babelfish/exceptions.py new file mode 100644 index 00000000..bbc6efe3 --- /dev/null +++ b/lib/babelfish/exceptions.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2013 the BabelFish authors. All rights reserved. +# Use of this source code is governed by the 3-clause BSD license +# that can be found in the LICENSE file. +# +from __future__ import unicode_literals + + +class Error(Exception): + """Base class for all exceptions in babelfish""" + pass + + +class LanguageError(Error, AttributeError): + """Base class for all language exceptions in babelfish""" + pass + + +class LanguageConvertError(LanguageError): + """Exception raised by converters when :meth:`~babelfish.converters.LanguageConverter.convert` fails + + :param string alpha3: alpha3 code that failed conversion + :param country: country code that failed conversion, if any + :type country: string or None + :param script: script code that failed conversion, if any + :type script: string or None + + """ + def __init__(self, alpha3, country=None, script=None): + self.alpha3 = alpha3 + self.country = country + self.script = script + + def __str__(self): + s = self.alpha3 + if self.country is not None: + s += '-' + self.country + if self.script is not None: + s += '-' + self.script + return s + + +class LanguageReverseError(LanguageError): + """Exception raised by converters when :meth:`~babelfish.converters.LanguageReverseConverter.reverse` fails + + :param string code: code that failed reverse conversion + + """ + def __init__(self, code): + self.code = code + + def __str__(self): + return repr(self.code) + + +class CountryError(Error, AttributeError): + """Base class for all country exceptions in babelfish""" + pass + + +class CountryConvertError(CountryError): + """Exception raised by converters when :meth:`~babelfish.converters.CountryConverter.convert` fails + + :param string alpha2: alpha2 code that failed conversion + + """ + def __init__(self, alpha2): + self.alpha2 = alpha2 + + def __str__(self): + return self.alpha2 + + +class CountryReverseError(CountryError): + """Exception raised by converters when :meth:`~babelfish.converters.CountryReverseConverter.reverse` fails + + :param string code: code that failed reverse conversion + + """ + def __init__(self, code): + self.code = code + + def __str__(self): + return repr(self.code) diff --git a/lib/babelfish/language.py b/lib/babelfish/language.py new file mode 100644 index 00000000..b4b25193 --- /dev/null +++ b/lib/babelfish/language.py @@ -0,0 +1,185 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2013 the BabelFish authors. All rights reserved. +# Use of this source code is governed by the 3-clause BSD license +# that can be found in the LICENSE file. +# +from __future__ import unicode_literals +from collections import namedtuple +from functools import partial +from pkg_resources import resource_stream # @UnresolvedImport +from .converters import ConverterManager +from .country import Country +from .exceptions import LanguageConvertError +from .script import Script +from . import basestr + + +LANGUAGES = set() +LANGUAGE_MATRIX = [] + +#: The namedtuple used in the :data:`LANGUAGE_MATRIX` +IsoLanguage = namedtuple('IsoLanguage', ['alpha3', 'alpha3b', 'alpha3t', 'alpha2', 'scope', 'type', 'name', 'comment']) + +f = resource_stream('babelfish', 'data/iso-639-3.tab') +f.readline() +for l in f: + iso_language = IsoLanguage(*l.decode('utf-8').split('\t')) + LANGUAGES.add(iso_language.alpha3) + LANGUAGE_MATRIX.append(iso_language) +f.close() + + +class LanguageConverterManager(ConverterManager): + """:class:`~babelfish.converters.ConverterManager` for language converters""" + entry_point = 'babelfish.language_converters' + internal_converters = ['alpha2 = babelfish.converters.alpha2:Alpha2Converter', + 'alpha3b = babelfish.converters.alpha3b:Alpha3BConverter', + 'alpha3t = babelfish.converters.alpha3t:Alpha3TConverter', + 'name = babelfish.converters.name:NameConverter', + 'scope = babelfish.converters.scope:ScopeConverter', + 'type = babelfish.converters.type:LanguageTypeConverter', + 'opensubtitles = babelfish.converters.opensubtitles:OpenSubtitlesConverter'] + +language_converters = LanguageConverterManager() + + +class LanguageMeta(type): + """The :class:`Language` metaclass + + Dynamically redirect :meth:`Language.frommycode` to :meth:`Language.fromcode` with the ``mycode`` `converter` + + """ + def __getattr__(cls, name): + if name.startswith('from'): + return partial(cls.fromcode, converter=name[4:]) + return type.__getattribute__(cls, name) + + +class Language(LanguageMeta(str('LanguageBase'), (object,), {})): + """A human language + + A human language is composed of a language part following the ISO-639 + standard and can be country-specific when a :class:`~babelfish.country.Country` + is specified. + + The :class:`Language` is extensible with custom converters (see :ref:`custom_converters`) + + :param string language: the language as a 3-letter ISO-639-3 code + :param country: the country (if any) as a 2-letter ISO-3166 code or :class:`~babelfish.country.Country` instance + :type country: string or :class:`~babelfish.country.Country` or None + :param script: the script (if any) as a 4-letter ISO-15924 code or :class:`~babelfish.script.Script` instance + :type script: string or :class:`~babelfish.script.Script` or None + :param unknown: the unknown language as a three-letters ISO-639-3 code to use as fallback + :type unknown: string or None + :raise: ValueError if the language could not be recognized and `unknown` is ``None`` + + """ + def __init__(self, language, country=None, script=None, unknown=None): + if unknown is not None and language not in LANGUAGES: + language = unknown + if language not in LANGUAGES: + raise ValueError('%r is not a valid language' % language) + self.alpha3 = language + self.country = None + if isinstance(country, Country): + self.country = country + elif country is None: + self.country = None + else: + self.country = Country(country) + self.script = None + if isinstance(script, Script): + self.script = script + elif script is None: + self.script = None + else: + self.script = Script(script) + + @classmethod + def fromcode(cls, code, converter): + """Create a :class:`Language` by its `code` using `converter` to + :meth:`~babelfish.converters.LanguageReverseConverter.reverse` it + + :param string code: the code to reverse + :param string converter: name of the :class:`~babelfish.converters.LanguageReverseConverter` to use + :return: the corresponding :class:`Language` instance + :rtype: :class:`Language` + + """ + return cls(*language_converters[converter].reverse(code)) + + @classmethod + def fromietf(cls, ietf): + """Create a :class:`Language` by from an IETF language code + + :param string ietf: the ietf code + :return: the corresponding :class:`Language` instance + :rtype: :class:`Language` + + """ + subtags = ietf.split('-') + language_subtag = subtags.pop(0).lower() + if len(language_subtag) == 2: + language = cls.fromalpha2(language_subtag) + else: + language = cls(language_subtag) + while subtags: + subtag = subtags.pop(0) + if len(subtag) == 2: + language.country = Country(subtag.upper()) + else: + language.script = Script(subtag.capitalize()) + if language.script is not None: + if subtags: + raise ValueError('Wrong IETF format. Unmatched subtags: %r' % subtags) + break + return language + + def __getstate__(self): + return self.alpha3, self.country, self.script + + def __setstate__(self, state): + self.alpha3, self.country, self.script = state + + def __getattr__(self, name): + alpha3 = self.alpha3 + country = self.country.alpha2 if self.country is not None else None + script = self.script.code if self.script is not None else None + try: + return language_converters[name].convert(alpha3, country, script) + except KeyError: + raise AttributeError(name) + + def __hash__(self): + return hash(str(self)) + + def __eq__(self, other): + if isinstance(other, basestr): + return str(self) == other + if not isinstance(other, Language): + return False + return (self.alpha3 == other.alpha3 and + self.country == other.country and + self.script == other.script) + + def __ne__(self, other): + return not self == other + + def __bool__(self): + return self.alpha3 != 'und' + __nonzero__ = __bool__ + + def __repr__(self): + return '<Language [%s]>' % self + + def __str__(self): + try: + s = self.alpha2 + except LanguageConvertError: + s = self.alpha3 + if self.country is not None: + s += '-' + str(self.country) + if self.script is not None: + s += '-' + str(self.script) + return s diff --git a/lib/babelfish/script.py b/lib/babelfish/script.py new file mode 100644 index 00000000..4b59ce01 --- /dev/null +++ b/lib/babelfish/script.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2013 the BabelFish authors. All rights reserved. +# Use of this source code is governed by the 3-clause BSD license +# that can be found in the LICENSE file. +# +from __future__ import unicode_literals +from collections import namedtuple +from pkg_resources import resource_stream # @UnresolvedImport +from . import basestr + +#: Script code to script name mapping +SCRIPTS = {} + +#: List of countries in the ISO-15924 as namedtuple of code, number, name, french_name, pva and date +SCRIPT_MATRIX = [] + +#: The namedtuple used in the :data:`SCRIPT_MATRIX` +IsoScript = namedtuple('IsoScript', ['code', 'number', 'name', 'french_name', 'pva', 'date']) + +f = resource_stream('babelfish', 'data/iso15924-utf8-20131012.txt') +f.readline() +for l in f: + l = l.decode('utf-8').strip() + if not l or l.startswith('#'): + continue + script = IsoScript._make(l.split(';')) + SCRIPT_MATRIX.append(script) + SCRIPTS[script.code] = script.name +f.close() + + +class Script(object): + """A human writing system + + A script is represented by a 4-letter code from the ISO-15924 standard + + :param string script: 4-letter ISO-15924 script code + + """ + def __init__(self, script): + if script not in SCRIPTS: + raise ValueError('%r is not a valid script' % script) + + #: ISO-15924 4-letter script code + self.code = script + + @property + def name(self): + """English name of the script""" + return SCRIPTS[self.code] + + def __getstate__(self): + return self.code + + def __setstate__(self, state): + self.code = state + + def __hash__(self): + return hash(self.code) + + def __eq__(self, other): + if isinstance(other, basestr): + return self.code == other + if not isinstance(other, Script): + return False + return self.code == other.code + + def __ne__(self, other): + return not self == other + + def __repr__(self): + return '<Script [%s]>' % self + + def __str__(self): + return self.code diff --git a/lib/babelfish/tests.py b/lib/babelfish/tests.py new file mode 100644 index 00000000..b72ec284 --- /dev/null +++ b/lib/babelfish/tests.py @@ -0,0 +1,377 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2013 the BabelFish authors. All rights reserved. +# Use of this source code is governed by the 3-clause BSD license +# that can be found in the LICENSE file. +# +from __future__ import unicode_literals +import re +import sys +import pickle +from unittest import TestCase, TestSuite, TestLoader, TextTestRunner +from pkg_resources import resource_stream # @UnresolvedImport +from babelfish import (LANGUAGES, Language, Country, Script, language_converters, country_converters, + LanguageReverseConverter, LanguageConvertError, LanguageReverseError, CountryReverseError) + + +if sys.version_info[:2] <= (2, 6): + _MAX_LENGTH = 80 + + def safe_repr(obj, short=False): + try: + result = repr(obj) + except Exception: + result = object.__repr__(obj) + if not short or len(result) < _MAX_LENGTH: + return result + return result[:_MAX_LENGTH] + ' [truncated]...' + + class _AssertRaisesContext(object): + """A context manager used to implement TestCase.assertRaises* methods.""" + + def __init__(self, expected, test_case, expected_regexp=None): + self.expected = expected + self.failureException = test_case.failureException + self.expected_regexp = expected_regexp + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, tb): + if exc_type is None: + try: + exc_name = self.expected.__name__ + except AttributeError: + exc_name = str(self.expected) + raise self.failureException( + "{0} not raised".format(exc_name)) + if not issubclass(exc_type, self.expected): + # let unexpected exceptions pass through + return False + self.exception = exc_value # store for later retrieval + if self.expected_regexp is None: + return True + + expected_regexp = self.expected_regexp + if isinstance(expected_regexp, basestring): + expected_regexp = re.compile(expected_regexp) + if not expected_regexp.search(str(exc_value)): + raise self.failureException('"%s" does not match "%s"' % + (expected_regexp.pattern, str(exc_value))) + return True + + class _Py26FixTestCase(object): + def assertIsNone(self, obj, msg=None): + """Same as self.assertTrue(obj is None), with a nicer default message.""" + if obj is not None: + standardMsg = '%s is not None' % (safe_repr(obj),) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertIsNotNone(self, obj, msg=None): + """Included for symmetry with assertIsNone.""" + if obj is None: + standardMsg = 'unexpectedly None' + self.fail(self._formatMessage(msg, standardMsg)) + + def assertIn(self, member, container, msg=None): + """Just like self.assertTrue(a in b), but with a nicer default message.""" + if member not in container: + standardMsg = '%s not found in %s' % (safe_repr(member), + safe_repr(container)) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertNotIn(self, member, container, msg=None): + """Just like self.assertTrue(a not in b), but with a nicer default message.""" + if member in container: + standardMsg = '%s unexpectedly found in %s' % (safe_repr(member), + safe_repr(container)) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertIs(self, expr1, expr2, msg=None): + """Just like self.assertTrue(a is b), but with a nicer default message.""" + if expr1 is not expr2: + standardMsg = '%s is not %s' % (safe_repr(expr1), + safe_repr(expr2)) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertIsNot(self, expr1, expr2, msg=None): + """Just like self.assertTrue(a is not b), but with a nicer default message.""" + if expr1 is expr2: + standardMsg = 'unexpectedly identical: %s' % (safe_repr(expr1),) + self.fail(self._formatMessage(msg, standardMsg)) + +else: + class _Py26FixTestCase(object): + pass + + +class TestScript(TestCase, _Py26FixTestCase): + def test_wrong_script(self): + self.assertRaises(ValueError, lambda: Script('Azer')) + + def test_eq(self): + self.assertEqual(Script('Latn'), Script('Latn')) + + def test_ne(self): + self.assertNotEqual(Script('Cyrl'), Script('Latn')) + + def test_hash(self): + self.assertEqual(hash(Script('Hira')), hash('Hira')) + + def test_pickle(self): + self.assertEqual(pickle.loads(pickle.dumps(Script('Latn'))), Script('Latn')) + + +class TestCountry(TestCase, _Py26FixTestCase): + def test_wrong_country(self): + self.assertRaises(ValueError, lambda: Country('ZZ')) + + def test_eq(self): + self.assertEqual(Country('US'), Country('US')) + + def test_ne(self): + self.assertNotEqual(Country('GB'), Country('US')) + self.assertIsNotNone(Country('US')) + + def test_hash(self): + self.assertEqual(hash(Country('US')), hash('US')) + + def test_pickle(self): + for country in [Country('GB'), Country('US')]: + self.assertEqual(pickle.loads(pickle.dumps(country)), country) + + def test_converter_name(self): + self.assertEqual(Country('US').name, 'UNITED STATES') + self.assertEqual(Country.fromname('UNITED STATES'), Country('US')) + self.assertEqual(Country.fromcode('UNITED STATES', 'name'), Country('US')) + self.assertRaises(CountryReverseError, lambda: Country.fromname('ZZZZZ')) + self.assertEqual(len(country_converters['name'].codes), 249) + + +class TestLanguage(TestCase, _Py26FixTestCase): + def test_languages(self): + self.assertEqual(len(LANGUAGES), 7874) + + def test_wrong_language(self): + self.assertRaises(ValueError, lambda: Language('zzz')) + + def test_unknown_language(self): + self.assertEqual(Language('zzzz', unknown='und'), Language('und')) + + def test_converter_alpha2(self): + self.assertEqual(Language('eng').alpha2, 'en') + self.assertEqual(Language.fromalpha2('en'), Language('eng')) + self.assertEqual(Language.fromcode('en', 'alpha2'), Language('eng')) + self.assertRaises(LanguageReverseError, lambda: Language.fromalpha2('zz')) + self.assertRaises(LanguageConvertError, lambda: Language('aaa').alpha2) + self.assertEqual(len(language_converters['alpha2'].codes), 184) + + def test_converter_alpha3b(self): + self.assertEqual(Language('fra').alpha3b, 'fre') + self.assertEqual(Language.fromalpha3b('fre'), Language('fra')) + self.assertEqual(Language.fromcode('fre', 'alpha3b'), Language('fra')) + self.assertRaises(LanguageReverseError, lambda: Language.fromalpha3b('zzz')) + self.assertRaises(LanguageConvertError, lambda: Language('aaa').alpha3b) + self.assertEqual(len(language_converters['alpha3b'].codes), 418) + + def test_converter_alpha3t(self): + self.assertEqual(Language('fra').alpha3t, 'fra') + self.assertEqual(Language.fromalpha3t('fra'), Language('fra')) + self.assertEqual(Language.fromcode('fra', 'alpha3t'), Language('fra')) + self.assertRaises(LanguageReverseError, lambda: Language.fromalpha3t('zzz')) + self.assertRaises(LanguageConvertError, lambda: Language('aaa').alpha3t) + self.assertEqual(len(language_converters['alpha3t'].codes), 418) + + def test_converter_name(self): + self.assertEqual(Language('eng').name, 'English') + self.assertEqual(Language.fromname('English'), Language('eng')) + self.assertEqual(Language.fromcode('English', 'name'), Language('eng')) + self.assertRaises(LanguageReverseError, lambda: Language.fromname('Zzzzzzzzz')) + self.assertEqual(len(language_converters['name'].codes), 7874) + + def test_converter_scope(self): + self.assertEqual(language_converters['scope'].codes, set(['I', 'S', 'M'])) + self.assertEqual(Language('eng').scope, 'individual') + self.assertEqual(Language('und').scope, 'special') + + def test_converter_type(self): + self.assertEqual(language_converters['type'].codes, set(['A', 'C', 'E', 'H', 'L', 'S'])) + self.assertEqual(Language('eng').type, 'living') + self.assertEqual(Language('und').type, 'special') + + def test_converter_opensubtitles(self): + self.assertEqual(Language('fra').opensubtitles, Language('fra').alpha3b) + self.assertEqual(Language('por', 'BR').opensubtitles, 'pob') + self.assertEqual(Language.fromopensubtitles('fre'), Language('fra')) + self.assertEqual(Language.fromopensubtitles('pob'), Language('por', 'BR')) + self.assertEqual(Language.fromopensubtitles('pb'), Language('por', 'BR')) + # Montenegrin is not recognized as an ISO language (yet?) but for now it is + # unofficially accepted as Serbian from Montenegro + self.assertEqual(Language.fromopensubtitles('mne'), Language('srp', 'ME')) + self.assertEqual(Language.fromcode('pob', 'opensubtitles'), Language('por', 'BR')) + self.assertRaises(LanguageReverseError, lambda: Language.fromopensubtitles('zzz')) + self.assertRaises(LanguageConvertError, lambda: Language('aaa').opensubtitles) + self.assertEqual(len(language_converters['opensubtitles'].codes), 607) + + # test with all the LANGUAGES from the opensubtitles api + # downloaded from: http://www.opensubtitles.org/addons/export_languages.php + f = resource_stream('babelfish', 'data/opensubtitles_languages.txt') + f.readline() + for l in f: + idlang, alpha2, _, upload_enabled, web_enabled = l.decode('utf-8').strip().split('\t') + if not int(upload_enabled) and not int(web_enabled): + # do not test LANGUAGES that are too esoteric / not widely available + continue + self.assertEqual(Language.fromopensubtitles(idlang).opensubtitles, idlang) + if alpha2: + self.assertEqual(Language.fromopensubtitles(idlang), Language.fromopensubtitles(alpha2)) + f.close() + + def test_converter_opensubtitles_codes(self): + for code in language_converters['opensubtitles'].from_opensubtitles.keys(): + self.assertIn(code, language_converters['opensubtitles'].codes) + + def test_fromietf_country_script(self): + language = Language.fromietf('fra-FR-Latn') + self.assertEqual(language.alpha3, 'fra') + self.assertEqual(language.country, Country('FR')) + self.assertEqual(language.script, Script('Latn')) + + def test_fromietf_country_no_script(self): + language = Language.fromietf('fra-FR') + self.assertEqual(language.alpha3, 'fra') + self.assertEqual(language.country, Country('FR')) + self.assertIsNone(language.script) + + def test_fromietf_no_country_no_script(self): + language = Language.fromietf('fra-FR') + self.assertEqual(language.alpha3, 'fra') + self.assertEqual(language.country, Country('FR')) + self.assertIsNone(language.script) + + def test_fromietf_no_country_script(self): + language = Language.fromietf('fra-Latn') + self.assertEqual(language.alpha3, 'fra') + self.assertIsNone(language.country) + self.assertEqual(language.script, Script('Latn')) + + def test_fromietf_alpha2_language(self): + language = Language.fromietf('fr-Latn') + self.assertEqual(language.alpha3, 'fra') + self.assertIsNone(language.country) + self.assertEqual(language.script, Script('Latn')) + + def test_fromietf_wrong_language(self): + self.assertRaises(ValueError, lambda: Language.fromietf('xyz-FR')) + + def test_fromietf_wrong_country(self): + self.assertRaises(ValueError, lambda: Language.fromietf('fra-YZ')) + + def test_fromietf_wrong_script(self): + self.assertRaises(ValueError, lambda: Language.fromietf('fra-FR-Wxyz')) + + def test_eq(self): + self.assertEqual(Language('eng'), Language('eng')) + + def test_ne(self): + self.assertNotEqual(Language('fra'), Language('eng')) + self.assertIsNotNone(Language('fra')) + + def test_nonzero(self): + self.assertFalse(bool(Language('und'))) + self.assertTrue(bool(Language('eng'))) + + def test_language_hasattr(self): + self.assertTrue(hasattr(Language('fra'), 'alpha3')) + self.assertTrue(hasattr(Language('fra'), 'alpha2')) + self.assertFalse(hasattr(Language('bej'), 'alpha2')) + + def test_country_hasattr(self): + self.assertTrue(hasattr(Country('US'), 'name')) + self.assertTrue(hasattr(Country('FR'), 'alpha2')) + self.assertFalse(hasattr(Country('BE'), 'none')) + + def test_country(self): + self.assertEqual(Language('por', 'BR').country, Country('BR')) + self.assertEqual(Language('eng', Country('US')).country, Country('US')) + + def test_eq_with_country(self): + self.assertEqual(Language('eng', 'US'), Language('eng', Country('US'))) + + def test_ne_with_country(self): + self.assertNotEqual(Language('eng', 'US'), Language('eng', Country('GB'))) + + def test_script(self): + self.assertEqual(Language('srp', script='Latn').script, Script('Latn')) + self.assertEqual(Language('srp', script=Script('Cyrl')).script, Script('Cyrl')) + + def test_eq_with_script(self): + self.assertEqual(Language('srp', script='Latn'), Language('srp', script=Script('Latn'))) + + def test_ne_with_script(self): + self.assertNotEqual(Language('srp', script='Latn'), Language('srp', script=Script('Cyrl'))) + + def test_eq_with_country_and_script(self): + self.assertEqual(Language('srp', 'SR', 'Latn'), Language('srp', Country('SR'), Script('Latn'))) + + def test_ne_with_country_and_script(self): + self.assertNotEqual(Language('srp', 'SR', 'Latn'), Language('srp', Country('SR'), Script('Cyrl'))) + + def test_hash(self): + self.assertEqual(hash(Language('fra')), hash('fr')) + self.assertEqual(hash(Language('ace')), hash('ace')) + self.assertEqual(hash(Language('por', 'BR')), hash('pt-BR')) + self.assertEqual(hash(Language('srp', script='Cyrl')), hash('sr-Cyrl')) + self.assertEqual(hash(Language('eng', 'US', 'Latn')), hash('en-US-Latn')) + + def test_pickle(self): + for lang in [Language('fra'), + Language('eng', 'US'), + Language('srp', script='Latn'), + Language('eng', 'US', 'Latn')]: + self.assertEqual(pickle.loads(pickle.dumps(lang)), lang) + + def test_str(self): + self.assertEqual(Language.fromietf(str(Language('eng', 'US', 'Latn'))), Language('eng', 'US', 'Latn')) + self.assertEqual(Language.fromietf(str(Language('fra', 'FR'))), Language('fra', 'FR')) + self.assertEqual(Language.fromietf(str(Language('bel'))), Language('bel')) + + def test_register_converter(self): + class TestConverter(LanguageReverseConverter): + def __init__(self): + self.to_test = {'fra': 'test1', 'eng': 'test2'} + self.from_test = {'test1': 'fra', 'test2': 'eng'} + + def convert(self, alpha3, country=None, script=None): + if alpha3 not in self.to_test: + raise LanguageConvertError(alpha3, country, script) + return self.to_test[alpha3] + + def reverse(self, test): + if test not in self.from_test: + raise LanguageReverseError(test) + return (self.from_test[test], None) + language = Language('fra') + self.assertFalse(hasattr(language, 'test')) + language_converters['test'] = TestConverter() + self.assertTrue(hasattr(language, 'test')) + self.assertIn('test', language_converters) + self.assertEqual(Language('fra').test, 'test1') + self.assertEqual(Language.fromtest('test2').alpha3, 'eng') + del language_converters['test'] + self.assertNotIn('test', language_converters) + self.assertRaises(KeyError, lambda: Language.fromtest('test1')) + self.assertRaises(AttributeError, lambda: Language('fra').test) + + +def suite(): + suite = TestSuite() + suite.addTest(TestLoader().loadTestsFromTestCase(TestScript)) + suite.addTest(TestLoader().loadTestsFromTestCase(TestCountry)) + suite.addTest(TestLoader().loadTestsFromTestCase(TestLanguage)) + return suite + + +if __name__ == '__main__': + TextTestRunner().run(suite()) diff --git a/lib/guessit/__init__.py b/lib/guessit/__init__.py new file mode 100644 index 00000000..03f8d208 --- /dev/null +++ b/lib/guessit/__init__.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Extracts as much information as possible from a video file. +""" +from . import monkeypatch as _monkeypatch + +from .api import guessit, GuessItApi +from .options import ConfigurationException +from .rules.common.quantity import Size + +from .__version__ import __version__ + +_monkeypatch.monkeypatch_rebulk() diff --git a/lib/guessit/__main__.py b/lib/guessit/__main__.py new file mode 100644 index 00000000..fad196d6 --- /dev/null +++ b/lib/guessit/__main__.py @@ -0,0 +1,180 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Entry point module +""" +# pragma: no cover +from __future__ import print_function + +import json +import logging +import os +import sys + +import six +from rebulk.__version__ import __version__ as __rebulk_version__ + +from guessit import api +from guessit.__version__ import __version__ +from guessit.jsonutils import GuessitEncoder +from guessit.options import argument_parser, parse_options, load_config, merge_options + + +try: + from collections import OrderedDict +except ImportError: # pragma: no-cover + from ordereddict import OrderedDict # pylint:disable=import-error + + +def guess_filename(filename, options): + """ + Guess a single filename using given options + :param filename: filename to parse + :type filename: str + :param options: + :type options: dict + :return: + :rtype: + """ + if not options.get('yaml') and not options.get('json') and not options.get('show_property'): + print('For:', filename) + + guess = api.guessit(filename, options) + + if options.get('show_property'): + print(guess.get(options.get('show_property'), '')) + return + + if options.get('json'): + print(json.dumps(guess, cls=GuessitEncoder, ensure_ascii=False)) + elif options.get('yaml'): + import yaml + from guessit import yamlutils + + ystr = yaml.dump({filename: OrderedDict(guess)}, Dumper=yamlutils.CustomDumper, default_flow_style=False, + allow_unicode=True) + i = 0 + for yline in ystr.splitlines(): + if i == 0: + print("? " + yline[:-1]) + elif i == 1: + print(":" + yline[1:]) + else: + print(yline) + i += 1 + else: + print('GuessIt found:', json.dumps(guess, cls=GuessitEncoder, indent=4, ensure_ascii=False)) + + +def display_properties(options): + """ + Display properties + """ + properties = api.properties(options) + + if options.get('json'): + if options.get('values'): + print(json.dumps(properties, cls=GuessitEncoder, ensure_ascii=False)) + else: + print(json.dumps(list(properties.keys()), cls=GuessitEncoder, ensure_ascii=False)) + elif options.get('yaml'): + import yaml + from guessit import yamlutils + if options.get('values'): + print(yaml.dump(properties, Dumper=yamlutils.CustomDumper, default_flow_style=False, allow_unicode=True)) + else: + print(yaml.dump(list(properties.keys()), Dumper=yamlutils.CustomDumper, default_flow_style=False, + allow_unicode=True)) + else: + print('GuessIt properties:') + + properties_list = list(sorted(properties.keys())) + for property_name in properties_list: + property_values = properties.get(property_name) + print(2 * ' ' + '[+] %s' % (property_name,)) + if property_values and options.get('values'): + for property_value in property_values: + print(4 * ' ' + '[!] %s' % (property_value,)) + + +def fix_argv_encoding(): + """ + Fix encoding of sys.argv on windows Python 2 + """ + if six.PY2 and os.name == 'nt': # pragma: no cover + # see http://bugs.python.org/issue2128 + import locale + + for i, j in enumerate(sys.argv): + sys.argv[i] = j.decode(locale.getpreferredencoding()) + + +def main(args=None): # pylint:disable=too-many-branches + """ + Main function for entry point + """ + fix_argv_encoding() + + if args is None: # pragma: no cover + options = parse_options() + else: + options = parse_options(args) + + config = load_config(options) + options = merge_options(config, options) + + if options.get('verbose'): + logging.basicConfig(stream=sys.stdout, format='%(message)s') + logging.getLogger().setLevel(logging.DEBUG) + + help_required = True + + if options.get('version'): + print('+-------------------------------------------------------+') + print('+ GuessIt ' + __version__ + (28 - len(__version__)) * ' ' + '+') + print('+-------------------------------------------------------+') + print('+ Rebulk ' + __rebulk_version__ + (29 - len(__rebulk_version__)) * ' ' + '+') + print('+-------------------------------------------------------+') + print('| Please report any bug or feature request at |') + print('| https://github.com/guessit-io/guessit/issues. |') + print('+-------------------------------------------------------+') + help_required = False + + if options.get('yaml'): + try: + import yaml # pylint:disable=unused-variable,unused-import + except ImportError: # pragma: no cover + del options['yaml'] + print('PyYAML is not installed. \'--yaml\' option will be ignored ...', file=sys.stderr) + + if options.get('properties') or options.get('values'): + display_properties(options) + help_required = False + + filenames = [] + if options.get('filename'): + for filename in options.get('filename'): + filenames.append(filename) + if options.get('input_file'): + if six.PY2: + input_file = open(options.get('input_file'), 'r') + else: + input_file = open(options.get('input_file'), 'r', encoding='utf-8') + try: + filenames.extend([line.strip() for line in input_file.readlines()]) + finally: + input_file.close() + + filenames = list(filter(lambda f: f, filenames)) + + if filenames: + for filename in filenames: + help_required = False + guess_filename(filename, options) + + if help_required: # pragma: no cover + argument_parser.print_help() + + +if __name__ == '__main__': # pragma: no cover + main() diff --git a/lib/guessit/__version__.py b/lib/guessit/__version__.py new file mode 100644 index 00000000..ba2ebdbe --- /dev/null +++ b/lib/guessit/__version__.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Version module +""" +# pragma: no cover +__version__ = '3.1.1.dev0' diff --git a/lib/guessit/api.py b/lib/guessit/api.py new file mode 100644 index 00000000..8e306340 --- /dev/null +++ b/lib/guessit/api.py @@ -0,0 +1,263 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +API functions that can be used by external software +""" + +try: + from collections import OrderedDict +except ImportError: # pragma: no-cover + from ordereddict import OrderedDict # pylint:disable=import-error + +import os +import traceback + +import six +from rebulk.introspector import introspect + +from .__version__ import __version__ +from .options import parse_options, load_config, merge_options +from .rules import rebulk_builder + + +class GuessitException(Exception): + """ + Exception raised when guessit fails to perform a guess because of an internal error. + """ + + def __init__(self, string, options): + super(GuessitException, self).__init__("An internal error has occured in guessit.\n" + "===================== Guessit Exception Report =====================\n" + "version=%s\n" + "string=%s\n" + "options=%s\n" + "--------------------------------------------------------------------\n" + "%s" + "--------------------------------------------------------------------\n" + "Please report at " + "https://github.com/guessit-io/guessit/issues.\n" + "====================================================================" % + (__version__, str(string), str(options), traceback.format_exc())) + + self.string = string + self.options = options + + +def configure(options=None, rules_builder=rebulk_builder, force=False): + """ + Load configuration files and initialize rebulk rules if required. + + :param options: + :type options: dict + :param rules_builder: + :type rules_builder: + :param force: + :type force: bool + :return: + """ + default_api.configure(options, rules_builder=rules_builder, force=force) + + +def guessit(string, options=None): + """ + Retrieves all matches from string as a dict + :param string: the filename or release name + :type string: str + :param options: + :type options: str|dict + :return: + :rtype: + """ + return default_api.guessit(string, options) + + +def properties(options=None): + """ + Retrieves all properties with possible values that can be guessed + :param options: + :type options: str|dict + :return: + :rtype: + """ + return default_api.properties(options) + + +def suggested_expected(titles, options=None): + """ + Return a list of suggested titles to be used as `expected_title` based on the list of titles + :param titles: the filename or release name + :type titles: list|set|dict + :param options: + :type options: str|dict + :return: + :rtype: list of str + """ + return default_api.suggested_expected(titles, options) + + +class GuessItApi(object): + """ + An api class that can be configured with custom Rebulk configuration. + """ + + def __init__(self): + """Default constructor.""" + self.rebulk = None + self.config = None + self.load_config_options = None + self.advanced_config = None + + @classmethod + def _fix_encoding(cls, value): + if isinstance(value, list): + return [cls._fix_encoding(item) for item in value] + if isinstance(value, dict): + return {cls._fix_encoding(k): cls._fix_encoding(v) for k, v in value.items()} + if six.PY2 and isinstance(value, six.text_type): + return value.encode('utf-8') + if six.PY3 and isinstance(value, six.binary_type): + return value.decode('ascii') + return value + + @classmethod + def _has_same_properties(cls, dic1, dic2, values): + for value in values: + if dic1.get(value) != dic2.get(value): + return False + return True + + def configure(self, options=None, rules_builder=rebulk_builder, force=False, sanitize_options=True): + """ + Load configuration files and initialize rebulk rules if required. + + :param options: + :type options: str|dict + :param rules_builder: + :type rules_builder: + :param force: + :type force: bool + :return: + :rtype: dict + """ + if sanitize_options: + options = parse_options(options, True) + options = self._fix_encoding(options) + + if self.config is None or self.load_config_options is None or force or \ + not self._has_same_properties(self.load_config_options, + options, + ['config', 'no_user_config', 'no_default_config']): + config = load_config(options) + config = self._fix_encoding(config) + self.load_config_options = options + else: + config = self.config + + advanced_config = merge_options(config.get('advanced_config'), options.get('advanced_config')) + + should_build_rebulk = force or not self.rebulk or not self.advanced_config or \ + self.advanced_config != advanced_config + + if should_build_rebulk: + self.advanced_config = advanced_config + self.rebulk = rules_builder(advanced_config) + + self.config = config + return self.config + + def guessit(self, string, options=None): # pylint: disable=too-many-branches + """ + Retrieves all matches from string as a dict + :param string: the filename or release name + :type string: str|Path + :param options: + :type options: str|dict + :return: + :rtype: + """ + try: + from pathlib import Path + if isinstance(string, Path): + try: + # Handle path-like object + string = os.fspath(string) + except AttributeError: + string = str(string) + except ImportError: + pass + + try: + options = parse_options(options, True) + options = self._fix_encoding(options) + config = self.configure(options, sanitize_options=False) + options = merge_options(config, options) + result_decode = False + result_encode = False + + if six.PY2: + if isinstance(string, six.text_type): + string = string.encode("utf-8") + result_decode = True + elif isinstance(string, six.binary_type): + string = six.binary_type(string) + if six.PY3: + if isinstance(string, six.binary_type): + string = string.decode('ascii') + result_encode = True + elif isinstance(string, six.text_type): + string = six.text_type(string) + + matches = self.rebulk.matches(string, options) + if result_decode: + for match in matches: + if isinstance(match.value, six.binary_type): + match.value = match.value.decode("utf-8") + if result_encode: + for match in matches: + if isinstance(match.value, six.text_type): + match.value = match.value.encode("ascii") + return matches.to_dict(options.get('advanced', False), options.get('single_value', False), + options.get('enforce_list', False)) + except: + raise GuessitException(string, options) + + def properties(self, options=None): + """ + Grab properties and values that can be generated. + :param options: + :type options: + :return: + :rtype: + """ + options = parse_options(options, True) + options = self._fix_encoding(options) + config = self.configure(options, sanitize_options=False) + options = merge_options(config, options) + unordered = introspect(self.rebulk, options).properties + ordered = OrderedDict() + for k in sorted(unordered.keys(), key=six.text_type): + ordered[k] = list(sorted(unordered[k], key=six.text_type)) + if hasattr(self.rebulk, 'customize_properties'): + ordered = self.rebulk.customize_properties(ordered) + return ordered + + def suggested_expected(self, titles, options=None): + """ + Return a list of suggested titles to be used as `expected_title` based on the list of titles + :param titles: the filename or release name + :type titles: list|set|dict + :param options: + :type options: str|dict + :return: + :rtype: list of str + """ + suggested = [] + for title in titles: + guess = self.guessit(title, options) + if len(guess) != 2 or 'title' not in guess: + suggested.append(title) + + return suggested + + +default_api = GuessItApi() diff --git a/lib/guessit/backports.py b/lib/guessit/backports.py new file mode 100644 index 00000000..3e94e27a --- /dev/null +++ b/lib/guessit/backports.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Backports +""" +# pragma: no-cover +# pylint: disabled + +def cmp_to_key(mycmp): + """functools.cmp_to_key backport""" + class KeyClass(object): + """Key class""" + def __init__(self, obj, *args): # pylint: disable=unused-argument + self.obj = obj + def __lt__(self, other): + return mycmp(self.obj, other.obj) < 0 + def __gt__(self, other): + return mycmp(self.obj, other.obj) > 0 + def __eq__(self, other): + return mycmp(self.obj, other.obj) == 0 + def __le__(self, other): + return mycmp(self.obj, other.obj) <= 0 + def __ge__(self, other): + return mycmp(self.obj, other.obj) >= 0 + def __ne__(self, other): + return mycmp(self.obj, other.obj) != 0 + return KeyClass diff --git a/lib/guessit/config/options.json b/lib/guessit/config/options.json new file mode 100644 index 00000000..da7c7030 --- /dev/null +++ b/lib/guessit/config/options.json @@ -0,0 +1,586 @@ +{ + "expected_title": [ + "OSS 117", + "This is Us" + ], + "allowed_countries": [ + "au", + "gb", + "us" + ], + "allowed_languages": [ + "ca", + "cs", + "de", + "en", + "es", + "fr", + "he", + "hi", + "hu", + "it", + "ja", + "ko", + "mul", + "nl", + "no", + "pl", + "pt", + "ro", + "ru", + "sv", + "te", + "uk", + "und" + ], + "advanced_config": { + "common_words": [ + "ca", + "cat", + "de", + "he", + "it", + "no", + "por", + "rum", + "se", + "st", + "sub" + ], + "groups": { + "starting": "([{", + "ending": ")]}" + }, + "audio_codec": { + "audio_channels": { + "1.0": [ + "1ch", + "mono" + ], + "2.0": [ + "2ch", + "stereo", + "re:(2[\\W_]0(?:ch)?)(?=[^\\d]|$)" + ], + "5.1": [ + "5ch", + "6ch", + "re:(5[\\W_][01](?:ch)?)(?=[^\\d]|$)", + "re:(6[\\W_]0(?:ch)?)(?=[^\\d]|$)" + ], + "7.1": [ + "7ch", + "8ch", + "re:(7[\\W_][01](?:ch)?)(?=[^\\d]|$)" + ] + } + }, + "container": { + "subtitles": [ + "srt", + "idx", + "sub", + "ssa", + "ass" + ], + "info": [ + "nfo" + ], + "videos": [ + "3g2", + "3gp", + "3gp2", + "asf", + "avi", + "divx", + "flv", + "iso", + "m4v", + "mk2", + "mk3d", + "mka", + "mkv", + "mov", + "mp4", + "mp4a", + "mpeg", + "mpg", + "ogg", + "ogm", + "ogv", + "qt", + "ra", + "ram", + "rm", + "ts", + "vob", + "wav", + "webm", + "wma", + "wmv" + ], + "torrent": [ + "torrent" + ], + "nzb": [ + "nzb" + ] + }, + "country": { + "synonyms": { + "ES": [ + "españa" + ], + "GB": [ + "UK" + ], + "BR": [ + "brazilian", + "bra" + ], + "CA": [ + "québec", + "quebec", + "qc" + ], + "MX": [ + "Latinoamérica", + "latin america" + ] + } + }, + "episodes": { + "season_max_range": 100, + "episode_max_range": 100, + "max_range_gap": 1, + "season_markers": [ + "s" + ], + "season_ep_markers": [ + "x" + ], + "disc_markers": [ + "d" + ], + "episode_markers": [ + "xe", + "ex", + "ep", + "e", + "x" + ], + "range_separators": [ + "-", + "~", + "to", + "a" + ], + "discrete_separators": [ + "+", + "&", + "and", + "et" + ], + "season_words": [ + "season", + "saison", + "seizoen", + "seasons", + "saisons", + "tem", + "temp", + "temporada", + "temporadas", + "stagione" + ], + "episode_words": [ + "episode", + "episodes", + "eps", + "ep", + "episodio", + "episodios", + "capitulo", + "capitulos" + ], + "of_words": [ + "of", + "sur" + ], + "all_words": [ + "All" + ] + }, + "language": { + "synonyms": { + "ell": [ + "gr", + "greek" + ], + "spa": [ + "esp", + "español", + "espanol" + ], + "fra": [ + "français", + "vf", + "vff", + "vfi", + "vfq" + ], + "swe": [ + "se" + ], + "por_BR": [ + "po", + "pb", + "pob", + "ptbr", + "br", + "brazilian" + ], + "deu_CH": [ + "swissgerman", + "swiss german" + ], + "nld_BE": [ + "flemish" + ], + "cat": [ + "català", + "castellano", + "espanol castellano", + "español castellano" + ], + "ces": [ + "cz" + ], + "ukr": [ + "ua" + ], + "zho": [ + "cn" + ], + "jpn": [ + "jp" + ], + "hrv": [ + "scr" + ], + "mul": [ + "multi", + "dl" + ] + }, + "subtitle_affixes": [ + "sub", + "subs", + "esub", + "esubs", + "subbed", + "custom subbed", + "custom subs", + "custom sub", + "customsubbed", + "customsubs", + "customsub", + "soft subtitles", + "soft subs" + ], + "subtitle_prefixes": [ + "st", + "vost", + "subforced", + "fansub", + "hardsub", + "legenda", + "legendas", + "legendado", + "subtitulado", + "soft", + "subtitles" + ], + "subtitle_suffixes": [ + "subforced", + "fansub", + "hardsub" + ], + "language_affixes": [ + "dublado", + "dubbed", + "dub" + ], + "language_prefixes": [ + "true" + ], + "language_suffixes": [ + "audio" + ], + "weak_affixes": [ + "v", + "audio", + "true" + ] + }, + "part": { + "prefixes": [ + "pt", + "part" + ] + }, + "release_group": { + "forbidden_names": [ + "bonus", + "by", + "for", + "par", + "pour", + "rip" + ], + "ignored_seps": "[]{}()" + }, + "screen_size": { + "frame_rates": [ + "23.976", + "24", + "25", + "29.970", + "30", + "48", + "50", + "60", + "120" + ], + "min_ar": 1.333, + "max_ar": 1.898, + "interlaced": [ + "360", + "480", + "576", + "900", + "1080" + ], + "progressive": [ + "360", + "480", + "540", + "576", + "900", + "1080", + "368", + "720", + "1440", + "2160", + "4320" + ] + }, + "website": { + "safe_tlds": [ + "com", + "net", + "org" + ], + "safe_subdomains": [ + "www" + ], + "safe_prefixes": [ + "co", + "com", + "net", + "org" + ], + "prefixes": [ + "from" + ] + }, + "streaming_service": { + "A&E": [ + "AE", + "A&E" + ], + "ABC": "AMBC", + "ABC Australia": "AUBC", + "Al Jazeera English": "AJAZ", + "AMC": "AMC", + "Amazon Prime": [ + "AMZN", + "Amazon", + "re:Amazon-?Prime" + ], + "Adult Swim": [ + "AS", + "re:Adult-?Swim" + ], + "America's Test Kitchen": "ATK", + "Animal Planet": "ANPL", + "AnimeLab": "ANLB", + "AOL": "AOL", + "ARD": "ARD", + "BBC iPlayer": [ + "iP", + "re:BBC-?iPlayer" + ], + "BravoTV": "BRAV", + "Canal+": "CNLP", + "Cartoon Network": "CN", + "CBC": "CBC", + "CBS": "CBS", + "CNBC": "CNBC", + "Comedy Central": [ + "CC", + "re:Comedy-?Central" + ], + "Channel 4": "4OD", + "CHRGD": "CHGD", + "Cinemax": "CMAX", + "Country Music Television": "CMT", + "Comedians in Cars Getting Coffee": "CCGC", + "Crunchy Roll": [ + "CR", + "re:Crunchy-?Roll" + ], + "Crackle": "CRKL", + "CSpan": "CSPN", + "CTV": "CTV", + "CuriosityStream": "CUR", + "CWSeed": "CWS", + "Daisuki": "DSKI", + "DC Universe": "DCU", + "Deadhouse Films": "DHF", + "DramaFever": [ + "DF", + "DramaFever" + ], + "Digiturk Diledigin Yerde": "DDY", + "Discovery": [ + "DISC", + "Discovery" + ], + "Disney": [ + "DSNY", + "Disney" + ], + "DIY Network": "DIY", + "Doc Club": "DOCC", + "DPlay": "DPLY", + "E!": "ETV", + "ePix": "EPIX", + "El Trece": "ETTV", + "ESPN": "ESPN", + "Esquire": "ESQ", + "Family": "FAM", + "Family Jr": "FJR", + "Food Network": "FOOD", + "Fox": "FOX", + "Freeform": "FREE", + "FYI Network": "FYI", + "Global": "GLBL", + "GloboSat Play": "GLOB", + "Hallmark": "HLMK", + "HBO Go": [ + "HBO", + "re:HBO-?Go" + ], + "HGTV": "HGTV", + "History": [ + "HIST", + "History" + ], + "Hulu": "HULU", + "Investigation Discovery": "ID", + "IFC": "IFC", + "iTunes": "iTunes", + "ITV": "ITV", + "Knowledge Network": "KNOW", + "Lifetime": "LIFE", + "Motor Trend OnDemand": "MTOD", + "MBC": [ + "MBC", + "MBCVOD" + ], + "MSNBC": "MNBC", + "MTV": "MTV", + "National Geographic": [ + "NATG", + "re:National-?Geographic" + ], + "NBA TV": [ + "NBA", + "re:NBA-?TV" + ], + "NBC": "NBC", + "Netflix": [ + "NF", + "Netflix" + ], + "NFL": "NFL", + "NFL Now": "NFLN", + "NHL GameCenter": "GC", + "Nickelodeon": [ + "NICK", + "Nickelodeon" + ], + "Norsk Rikskringkasting": "NRK", + "OnDemandKorea": [ + "ODK", + "OnDemandKorea" + ], + "PBS": "PBS", + "PBS Kids": "PBSK", + "Playstation Network": "PSN", + "Pluzz": "PLUZ", + "RTE One": "RTE", + "SBS (AU)": "SBS", + "SeeSo": [ + "SESO", + "SeeSo" + ], + "Shomi": "SHMI", + "Spike": "SPIK", + "Spike TV": [ + "SPKE", + "re:Spike-?TV" + ], + "Sportsnet": "SNET", + "Sprout": "SPRT", + "Stan": "STAN", + "Starz": "STZ", + "Sveriges Television": "SVT", + "SwearNet": "SWER", + "Syfy": "SYFY", + "TBS": "TBS", + "TFou": "TFOU", + "The CW": [ + "CW", + "re:The-?CW" + ], + "TLC": "TLC", + "TubiTV": "TUBI", + "TV3 Ireland": "TV3", + "TV4 Sweeden": "TV4", + "TVING": "TVING", + "TV Land": [ + "TVL", + "re:TV-?Land" + ], + "UFC": "UFC", + "UKTV": "UKTV", + "Univision": "UNIV", + "USA Network": "USAN", + "Velocity": "VLCT", + "VH1": "VH1", + "Viceland": "VICE", + "Viki": "VIKI", + "Vimeo": "VMEO", + "VRV": "VRV", + "W Network": "WNET", + "WatchMe": "WME", + "WWE Network": "WWEN", + "Xbox Video": "XBOX", + "Yahoo": "YHOO", + "YouTube Red": "RED", + "ZDF": "ZDF" + } + } +} diff --git a/lib/guessit/jsonutils.py b/lib/guessit/jsonutils.py new file mode 100644 index 00000000..0a0ac3a6 --- /dev/null +++ b/lib/guessit/jsonutils.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +JSON Utils +""" +import json + +from six import text_type +from rebulk.match import Match + +class GuessitEncoder(json.JSONEncoder): + """ + JSON Encoder for guessit response + """ + + def default(self, o): # pylint:disable=method-hidden + if isinstance(o, Match): + return o.advanced + if hasattr(o, 'name'): # Babelfish languages/countries long name + return text_type(o.name) + # pragma: no cover + return text_type(o) diff --git a/lib/guessit/monkeypatch.py b/lib/guessit/monkeypatch.py new file mode 100644 index 00000000..33e7c46e --- /dev/null +++ b/lib/guessit/monkeypatch.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Monkeypatch initialisation functions +""" + +try: + from collections import OrderedDict +except ImportError: # pragma: no-cover + from ordereddict import OrderedDict # pylint:disable=import-error + +from rebulk.match import Match + + +def monkeypatch_rebulk(): + """Monkeypatch rebulk classes""" + + @property + def match_advanced(self): + """ + Build advanced dict from match + :param self: + :return: + """ + + ret = OrderedDict() + ret['value'] = self.value + if self.raw: + ret['raw'] = self.raw + ret['start'] = self.start + ret['end'] = self.end + return ret + + Match.advanced = match_advanced diff --git a/lib/guessit/options.py b/lib/guessit/options.py new file mode 100644 index 00000000..14e4d069 --- /dev/null +++ b/lib/guessit/options.py @@ -0,0 +1,295 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Options +""" +import copy +import json +import os +import pkgutil +import shlex + +from argparse import ArgumentParser + +import six + + +def build_argument_parser(): + """ + Builds the argument parser + :return: the argument parser + :rtype: ArgumentParser + """ + opts = ArgumentParser() + opts.add_argument(dest='filename', help='Filename or release name to guess', nargs='*') + + naming_opts = opts.add_argument_group("Naming") + naming_opts.add_argument('-t', '--type', dest='type', default=None, + help='The suggested file type: movie, episode. If undefined, type will be guessed.') + naming_opts.add_argument('-n', '--name-only', dest='name_only', action='store_true', default=None, + help='Parse files as name only, considering "/" and "\\" like other separators.') + naming_opts.add_argument('-Y', '--date-year-first', action='store_true', dest='date_year_first', default=None, + help='If short date is found, consider the first digits as the year.') + naming_opts.add_argument('-D', '--date-day-first', action='store_true', dest='date_day_first', default=None, + help='If short date is found, consider the second digits as the day.') + naming_opts.add_argument('-L', '--allowed-languages', action='append', dest='allowed_languages', default=None, + help='Allowed language (can be used multiple times)') + naming_opts.add_argument('-C', '--allowed-countries', action='append', dest='allowed_countries', default=None, + help='Allowed country (can be used multiple times)') + naming_opts.add_argument('-E', '--episode-prefer-number', action='store_true', dest='episode_prefer_number', + default=None, + help='Guess "serie.213.avi" as the episode 213. Without this option, ' + 'it will be guessed as season 2, episode 13') + naming_opts.add_argument('-T', '--expected-title', action='append', dest='expected_title', default=None, + help='Expected title to parse (can be used multiple times)') + naming_opts.add_argument('-G', '--expected-group', action='append', dest='expected_group', default=None, + help='Expected release group (can be used multiple times)') + naming_opts.add_argument('--includes', action='append', dest='includes', default=None, + help='List of properties to be detected') + naming_opts.add_argument('--excludes', action='append', dest='excludes', default=None, + help='List of properties to be ignored') + + input_opts = opts.add_argument_group("Input") + input_opts.add_argument('-f', '--input-file', dest='input_file', default=None, + help='Read filenames from an input text file. File should use UTF-8 charset.') + + output_opts = opts.add_argument_group("Output") + output_opts.add_argument('-v', '--verbose', action='store_true', dest='verbose', default=None, + help='Display debug output') + output_opts.add_argument('-P', '--show-property', dest='show_property', default=None, + help='Display the value of a single property (title, series, video_codec, year, ...)') + output_opts.add_argument('-a', '--advanced', dest='advanced', action='store_true', default=None, + help='Display advanced information for filename guesses, as json output') + output_opts.add_argument('-s', '--single-value', dest='single_value', action='store_true', default=None, + help='Keep only first value found for each property') + output_opts.add_argument('-l', '--enforce-list', dest='enforce_list', action='store_true', default=None, + help='Wrap each found value in a list even when property has a single value') + output_opts.add_argument('-j', '--json', dest='json', action='store_true', default=None, + help='Display information for filename guesses as json output') + output_opts.add_argument('-y', '--yaml', dest='yaml', action='store_true', default=None, + help='Display information for filename guesses as yaml output') + + conf_opts = opts.add_argument_group("Configuration") + conf_opts.add_argument('-c', '--config', dest='config', action='append', default=None, + help='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.') + conf_opts.add_argument('--no-user-config', dest='no_user_config', action='store_true', + default=None, + help='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)') + conf_opts.add_argument('--no-default-config', dest='no_default_config', action='store_true', + default=None, + help='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_opts = opts.add_argument_group("Information") + information_opts.add_argument('-p', '--properties', dest='properties', action='store_true', default=None, + help='Display properties that can be guessed.') + information_opts.add_argument('-V', '--values', dest='values', action='store_true', default=None, + help='Display property values that can be guessed.') + information_opts.add_argument('--version', dest='version', action='store_true', default=None, + help='Display the guessit version.') + + return opts + + +def parse_options(options=None, api=False): + """ + Parse given option string + + :param options: + :type options: + :param api + :type api: boolean + :return: + :rtype: + """ + if isinstance(options, six.string_types): + args = shlex.split(options) + options = vars(argument_parser.parse_args(args)) + elif options is None: + if api: + options = {} + else: + options = vars(argument_parser.parse_args()) + elif not isinstance(options, dict): + options = vars(argument_parser.parse_args(options)) + return options + + +argument_parser = build_argument_parser() + + +class ConfigurationException(Exception): + """ + Exception related to configuration file. + """ + pass # pylint:disable=unnecessary-pass + + +def load_config(options): + """ + Load options from configuration files, if defined and present. + :param options: + :type options: + :return: + :rtype: + """ + configurations = [] + + if not options.get('no_default_config'): + default_options_data = pkgutil.get_data('guessit', 'config/options.json').decode('utf-8') + default_options = json.loads(default_options_data) + configurations.append(default_options) + + config_files = [] + + if not options.get('no_user_config'): + home_directory = os.path.expanduser("~") + cwd = os.getcwd() + yaml_supported = False + try: + import yaml # pylint:disable=unused-variable,unused-import + yaml_supported = True + except ImportError: + pass + + config_file_locations = get_options_file_locations(home_directory, cwd, yaml_supported) + config_files = [f for f in config_file_locations if os.path.exists(f)] + + custom_config_files = options.get('config') + if custom_config_files: + config_files = config_files + custom_config_files + + for config_file in config_files: + config_file_options = load_config_file(config_file) + if config_file_options: + configurations.append(config_file_options) + + config = {} + if configurations: + config = merge_options(*configurations) + + if 'advanced_config' not in config: + # Guessit doesn't work without advanced_config, so we use default if no configuration files provides it. + default_options_data = pkgutil.get_data('guessit', 'config/options.json').decode('utf-8') + default_options = json.loads(default_options_data) + config['advanced_config'] = default_options['advanced_config'] + + return config + + +def merge_options(*options): + """ + Merge options into a single options dict. + :param options: + :type options: + :return: + :rtype: + """ + + merged = {} + if options: + if options[0]: + merged.update(copy.deepcopy(options[0])) + + for options in options[1:]: + if options: + pristine = options.get('pristine') + + if pristine is True: + merged = {} + elif pristine: + for to_reset in pristine: + if to_reset in merged: + del merged[to_reset] + + for (option, value) in options.items(): + merge_option_value(option, value, merged) + + return merged + + +def merge_option_value(option, value, merged): + """ + Merge option value + :param option: + :param value: + :param merged: + :return: + """ + if value is not None and option != 'pristine': + if option in merged.keys() and isinstance(merged[option], list): + for val in value: + if val not in merged[option]: + merged[option].append(val) + elif option in merged.keys() and isinstance(merged[option], dict): + merged[option] = merge_options(merged[option], value) + elif isinstance(value, list): + merged[option] = list(value) + else: + merged[option] = value + + +def load_config_file(filepath): + """ + Load a configuration as an options dict. + + Format of the file is given with filepath extension. + :param filepath: + :type filepath: + :return: + :rtype: + """ + if filepath.endswith('.json'): + with open(filepath) as config_file_data: + return json.load(config_file_data) + if filepath.endswith('.yaml') or filepath.endswith('.yml'): + try: + import yaml + with open(filepath) as config_file_data: + return yaml.load(config_file_data) + except ImportError: # pragma: no cover + raise ConfigurationException('Configuration file extension is not supported. ' + 'PyYAML should be installed to support "%s" file' % ( + filepath,)) + + try: + # Try to load input as JSON + return json.loads(filepath) + except: # pylint: disable=bare-except + pass + + raise ConfigurationException('Configuration file extension is not supported for "%s" file.' % (filepath,)) + + +def get_options_file_locations(homedir, cwd, yaml_supported=False): + """ + Get all possible locations for options file. + :param homedir: user home directory + :type homedir: basestring + :param cwd: current working directory + :type homedir: basestring + :return: + :rtype: list + """ + locations = [] + + configdirs = [(os.path.join(homedir, '.guessit'), 'options'), + (os.path.join(homedir, '.config', 'guessit'), 'options'), + (cwd, 'guessit.options')] + configexts = ['json'] + + if yaml_supported: + configexts.append('yaml') + configexts.append('yml') + + for configdir in configdirs: + for configext in configexts: + locations.append(os.path.join(configdir[0], configdir[1] + '.' + configext)) + + return locations diff --git a/lib/guessit/reutils.py b/lib/guessit/reutils.py new file mode 100644 index 00000000..0b654d27 --- /dev/null +++ b/lib/guessit/reutils.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Utils for re module +""" + +from rebulk.remodule import re + + +def build_or_pattern(patterns, name=None, escape=False): + """ + Build a or pattern string from a list of possible patterns + + :param patterns: + :type patterns: + :param name: + :type name: + :param escape: + :type escape: + :return: + :rtype: + """ + or_pattern = [] + for pattern in patterns: + if not or_pattern: + or_pattern.append('(?') + if name: + or_pattern.append('P<' + name + '>') + else: + or_pattern.append(':') + else: + or_pattern.append('|') + or_pattern.append('(?:%s)' % re.escape(pattern) if escape else pattern) + or_pattern.append(')') + return ''.join(or_pattern) diff --git a/lib/guessit/rules/__init__.py b/lib/guessit/rules/__init__.py new file mode 100644 index 00000000..f16bc4e0 --- /dev/null +++ b/lib/guessit/rules/__init__.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Rebulk object default builder +""" +from rebulk import Rebulk + +from .markers.path import path +from .markers.groups import groups + +from .properties.episodes import episodes +from .properties.container import container +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 +from .properties.website import website +from .properties.date import date +from .properties.title import title +from .properties.episode_title import episode_title +from .properties.language import language +from .properties.country import country +from .properties.release_group import release_group +from .properties.streaming_service import streaming_service +from .properties.other import other +from .properties.size import size +from .properties.bit_rate import bit_rate +from .properties.edition import edition +from .properties.cds import cds +from .properties.bonus import bonus +from .properties.film import film +from .properties.part import part +from .properties.crc import crc +from .properties.mimetype import mimetype +from .properties.type import type_ + +from .processors import processors + + +def rebulk_builder(config): + """ + Default builder for main Rebulk object used by api. + :return: Main Rebulk object + :rtype: Rebulk + """ + def _config(name): + return config.get(name, {}) + + rebulk = Rebulk() + + common_words = frozenset(_config('common_words')) + + rebulk.rebulk(path(_config('path'))) + rebulk.rebulk(groups(_config('groups'))) + + rebulk.rebulk(episodes(_config('episodes'))) + rebulk.rebulk(container(_config('container'))) + rebulk.rebulk(source(_config('source'))) + rebulk.rebulk(video_codec(_config('video_codec'))) + rebulk.rebulk(audio_codec(_config('audio_codec'))) + rebulk.rebulk(screen_size(_config('screen_size'))) + rebulk.rebulk(website(_config('website'))) + rebulk.rebulk(date(_config('date'))) + rebulk.rebulk(title(_config('title'))) + rebulk.rebulk(episode_title(_config('episode_title'))) + rebulk.rebulk(language(_config('language'), common_words)) + rebulk.rebulk(country(_config('country'), common_words)) + rebulk.rebulk(release_group(_config('release_group'))) + rebulk.rebulk(streaming_service(_config('streaming_service'))) + rebulk.rebulk(other(_config('other'))) + rebulk.rebulk(size(_config('size'))) + rebulk.rebulk(bit_rate(_config('bit_rate'))) + rebulk.rebulk(edition(_config('edition'))) + rebulk.rebulk(cds(_config('cds'))) + rebulk.rebulk(bonus(_config('bonus'))) + rebulk.rebulk(film(_config('film'))) + rebulk.rebulk(part(_config('part'))) + rebulk.rebulk(crc(_config('crc'))) + + rebulk.rebulk(processors(_config('processors'))) + + rebulk.rebulk(mimetype(_config('mimetype'))) + rebulk.rebulk(type_(_config('type'))) + + def customize_properties(properties): + """ + Customize default rebulk properties + """ + count = properties['count'] + del properties['count'] + + properties['season_count'] = count + properties['episode_count'] = count + + return properties + + rebulk.customize_properties = customize_properties + + return rebulk diff --git a/lib/guessit/rules/common/__init__.py b/lib/guessit/rules/common/__init__.py new file mode 100644 index 00000000..444dc72a --- /dev/null +++ b/lib/guessit/rules/common/__init__.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Common module +""" +import re + +seps = r' [](){}+*|=-_~#/\\.,;:' # list of tags/words separators +seps_no_groups = seps.replace('[](){}', '') +seps_no_fs = seps.replace('/', '').replace('\\', '') + +title_seps = r'-+/\|' # separators for title + +dash = (r'-', r'['+re.escape(seps_no_fs)+']') # abbreviation used by many rebulk objects. +alt_dash = (r'@', r'['+re.escape(seps_no_fs)+']') # abbreviation used by many rebulk objects. diff --git a/lib/guessit/rules/common/comparators.py b/lib/guessit/rules/common/comparators.py new file mode 100644 index 00000000..f46f0c11 --- /dev/null +++ b/lib/guessit/rules/common/comparators.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Comparators +""" +try: + from functools import cmp_to_key +except ImportError: + from ...backports import cmp_to_key + + +def marker_comparator_predicate(match): + """ + Match predicate used in comparator + """ + return ( + not match.private + and match.name not in ('proper_count', 'title') + and not (match.name == 'container' and 'extension' in match.tags) + and not (match.name == 'other' and match.value == 'Rip') + ) + + +def marker_weight(matches, marker, predicate): + """ + Compute the comparator weight of a marker + :param matches: + :param marker: + :param predicate: + :return: + """ + return len(set(match.name for match in matches.range(*marker.span, predicate=predicate))) + + +def marker_comparator(matches, markers, predicate): + """ + Builds a comparator that returns markers sorted from the most valuable to the less. + + Take the parts where matches count is higher, then when length is higher, then when position is at left. + + :param matches: + :type matches: + :param markers: + :param predicate: + :return: + :rtype: + """ + + def comparator(marker1, marker2): + """ + The actual comparator function. + """ + matches_count = marker_weight(matches, marker2, predicate) - marker_weight(matches, marker1, predicate) + if matches_count: + return matches_count + + # give preference to rightmost path + return markers.index(marker2) - markers.index(marker1) + + return comparator + + +def marker_sorted(markers, matches, predicate=marker_comparator_predicate): + """ + Sort markers from matches, from the most valuable to the less. + + :param markers: + :type markers: + :param matches: + :type matches: + :param predicate: + :return: + :rtype: + """ + return sorted(markers, key=cmp_to_key(marker_comparator(matches, markers, predicate=predicate))) diff --git a/lib/guessit/rules/common/date.py b/lib/guessit/rules/common/date.py new file mode 100644 index 00000000..e513af9f --- /dev/null +++ b/lib/guessit/rules/common/date.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Date +""" +from dateutil import parser + +from rebulk.remodule import re + +_dsep = r'[-/ \.]' +_dsep_bis = r'[-/ \.x]' + +date_regexps = [ + re.compile(r'%s((\d{8}))%s' % (_dsep, _dsep), re.IGNORECASE), + re.compile(r'%s((\d{6}))%s' % (_dsep, _dsep), re.IGNORECASE), + re.compile(r'(?:^|[^\d])((\d{2})%s(\d{1,2})%s(\d{1,2}))(?:$|[^\d])' % (_dsep, _dsep), re.IGNORECASE), + re.compile(r'(?:^|[^\d])((\d{1,2})%s(\d{1,2})%s(\d{2}))(?:$|[^\d])' % (_dsep, _dsep), re.IGNORECASE), + re.compile(r'(?:^|[^\d])((\d{4})%s(\d{1,2})%s(\d{1,2}))(?:$|[^\d])' % (_dsep_bis, _dsep), re.IGNORECASE), + re.compile(r'(?:^|[^\d])((\d{1,2})%s(\d{1,2})%s(\d{4}))(?:$|[^\d])' % (_dsep, _dsep_bis), re.IGNORECASE), + re.compile(r'(?:^|[^\d])((\d{1,2}(?:st|nd|rd|th)?%s(?:[a-z]{3,10})%s\d{4}))(?:$|[^\d])' % (_dsep, _dsep), + re.IGNORECASE)] + + +def valid_year(year): + """Check if number is a valid year""" + return 1920 <= year < 2030 + + +def _is_int(string): + """ + Check if the input string is an integer + + :param string: + :type string: + :return: + :rtype: + """ + try: + int(string) + return True + except ValueError: + return False + + +def _guess_day_first_parameter(groups): # pylint:disable=inconsistent-return-statements + """ + If day_first is not defined, use some heuristic to fix it. + It helps to solve issues with python dateutils 2.5.3 parser changes. + + :param groups: match groups found for the date + :type groups: list of match objects + :return: day_first option guessed value + :rtype: bool + """ + + # If match starts with a long year, then day_first is force to false. + if _is_int(groups[0]) and valid_year(int(groups[0][:4])): + return False + # If match ends with a long year, the day_first is forced to true. + if _is_int(groups[-1]) and valid_year(int(groups[-1][-4:])): + return True + # If match starts with a short year, then day_first is force to false. + if _is_int(groups[0]) and int(groups[0][:2]) > 31: + return False + # If match ends with a short year, then day_first is force to true. + if _is_int(groups[-1]) and int(groups[-1][-2:]) > 31: + return True + + +def search_date(string, year_first=None, day_first=None): # pylint:disable=inconsistent-return-statements + """Looks for date patterns, and if found return the date and group span. + + Assumes there are sentinels at the beginning and end of the string that + always allow matching a non-digit delimiting the date. + + Year can be defined on two digit only. It will return the nearest possible + date from today. + + >>> search_date(' This happened on 2002-04-22. ') + (18, 28, datetime.date(2002, 4, 22)) + + >>> search_date(' And this on 17-06-1998. ') + (13, 23, datetime.date(1998, 6, 17)) + + >>> search_date(' no date in here ') + """ + for date_re in date_regexps: + search_match = date_re.search(string) + if not search_match: + continue + + start, end = search_match.start(1), search_match.end(1) + groups = search_match.groups()[1:] + match = '-'.join(groups) + + if match is None: + continue + + if year_first and day_first is None: + day_first = False + + if day_first is None: + day_first = _guess_day_first_parameter(groups) + + # If day_first/year_first is undefined, parse is made using both possible values. + yearfirst_opts = [False, True] + if year_first is not None: + yearfirst_opts = [year_first] + + dayfirst_opts = [True, False] + if day_first is not None: + dayfirst_opts = [day_first] + + kwargs_list = ({'dayfirst': d, 'yearfirst': y} + for d in dayfirst_opts for y in yearfirst_opts) + for kwargs in kwargs_list: + try: + date = parser.parse(match, **kwargs) + except (ValueError, TypeError): # pragma: no cover + # see https://bugs.launchpad.net/dateutil/+bug/1247643 + date = None + + # check date plausibility + if date and valid_year(date.year): # pylint:disable=no-member + return start, end, date.date() # pylint:disable=no-member diff --git a/lib/guessit/rules/common/expected.py b/lib/guessit/rules/common/expected.py new file mode 100644 index 00000000..eae562a2 --- /dev/null +++ b/lib/guessit/rules/common/expected.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Expected property factory +""" +import re + +from rebulk import Rebulk +from rebulk.utils import find_all + +from . import dash, seps + + +def build_expected_function(context_key): + """ + Creates a expected property function + :param context_key: + :type context_key: + :param cleanup: + :type cleanup: + :return: + :rtype: + """ + + def expected(input_string, context): + """ + Expected property functional pattern. + :param input_string: + :type input_string: + :param context: + :type context: + :return: + :rtype: + """ + ret = [] + for search in context.get(context_key): + if search.startswith('re:'): + search = search[3:] + search = search.replace(' ', '-') + matches = Rebulk().regex(search, abbreviations=[dash], flags=re.IGNORECASE) \ + .matches(input_string, context) + for match in matches: + ret.append(match.span) + else: + value = search + for sep in seps: + input_string = input_string.replace(sep, ' ') + search = search.replace(sep, ' ') + for start in find_all(input_string, search, ignore_case=True): + ret.append({'start': start, 'end': start + len(search), 'value': value}) + return ret + + return expected diff --git a/lib/guessit/rules/common/formatters.py b/lib/guessit/rules/common/formatters.py new file mode 100644 index 00000000..2a64dee9 --- /dev/null +++ b/lib/guessit/rules/common/formatters.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Formatters +""" +from rebulk.formatters import formatters +from rebulk.remodule import re +from . import seps + +_excluded_clean_chars = ',:;-/\\' +clean_chars = "" +for sep in seps: + if sep not in _excluded_clean_chars: + clean_chars += sep + + +def _potential_before(i, input_string): + """ + Check if the character at position i can be a potential single char separator considering what's before it. + + :param i: + :type i: int + :param input_string: + :type input_string: str + :return: + :rtype: bool + """ + return i - 1 >= 0 and input_string[i] in seps and input_string[i - 2] in seps and input_string[i - 1] not in seps + + +def _potential_after(i, input_string): + """ + Check if the character at position i can be a potential single char separator considering what's after it. + + :param i: + :type i: int + :param input_string: + :type input_string: str + :return: + :rtype: bool + """ + return i + 2 >= len(input_string) or \ + input_string[i + 2] == input_string[i] and input_string[i + 1] not in seps + + +def cleanup(input_string): + """ + Removes and strip separators from input_string (but keep ',;' characters) + + It also keep separators for single characters (Mavels Agents of S.H.I.E.L.D.) + + :param input_string: + :type input_string: str + :return: + :rtype: + """ + clean_string = input_string + for char in clean_chars: + clean_string = clean_string.replace(char, ' ') + + # Restore input separator if they separate single characters. + # Useful for Mavels Agents of S.H.I.E.L.D. + # https://github.com/guessit-io/guessit/issues/278 + + indices = [i for i, letter in enumerate(clean_string) if letter in seps] + + dots = set() + if indices: + clean_list = list(clean_string) + + potential_indices = [] + + for i in indices: + if _potential_before(i, input_string) and _potential_after(i, input_string): + potential_indices.append(i) + + replace_indices = [] + + for potential_index in potential_indices: + if potential_index - 2 in potential_indices or potential_index + 2 in potential_indices: + replace_indices.append(potential_index) + + if replace_indices: + for replace_index in replace_indices: + dots.add(input_string[replace_index]) + clean_list[replace_index] = input_string[replace_index] + clean_string = ''.join(clean_list) + + clean_string = strip(clean_string, ''.join([c for c in seps if c not in dots])) + + clean_string = re.sub(' +', ' ', clean_string) + return clean_string + + +def strip(input_string, chars=seps): + """ + Strip separators from input_string + :param input_string: + :param chars: + :type input_string: + :return: + :rtype: + """ + return input_string.strip(chars) + + +def raw_cleanup(raw): + """ + Cleanup a raw value to perform raw comparison + :param raw: + :type raw: + :return: + :rtype: + """ + return formatters(cleanup, strip)(raw.lower()) + + +def reorder_title(title, articles=('the',), separators=(',', ', ')): + """ + Reorder the title + :param title: + :type title: + :param articles: + :type articles: + :param separators: + :type separators: + :return: + :rtype: + """ + ltitle = title.lower() + for article in articles: + for separator in separators: + suffix = separator + article + if ltitle[-len(suffix):] == suffix: + return title[-len(suffix) + len(separator):] + ' ' + title[:-len(suffix)] + return title diff --git a/lib/guessit/rules/common/numeral.py b/lib/guessit/rules/common/numeral.py new file mode 100644 index 00000000..7c064fdb --- /dev/null +++ b/lib/guessit/rules/common/numeral.py @@ -0,0 +1,165 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +parse numeral from various formats +""" +from rebulk.remodule import re + +digital_numeral = r'\d{1,4}' + +roman_numeral = r'(?=[MCDLXVI]+)M{0,4}(?:CM|CD|D?C{0,3})(?:XC|XL|L?X{0,3})(?:IX|IV|V?I{0,3})' + +english_word_numeral_list = [ + 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', + 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty' +] + +french_word_numeral_list = [ + 'zéro', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', + 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix-sept', 'dix-huit', 'dix-neuf', 'vingt' +] + +french_alt_word_numeral_list = [ + 'zero', 'une', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', + 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dixsept', 'dixhuit', 'dixneuf', 'vingt' +] + + +def __build_word_numeral(*args): + """ + Build word numeral regexp from list. + + :param args: + :type args: + :param kwargs: + :type kwargs: + :return: + :rtype: + """ + re_ = None + for word_list in args: + for word in word_list: + if not re_: + re_ = r'(?:(?=\w+)' + else: + re_ += '|' + re_ += word + re_ += ')' + return re_ + + +word_numeral = __build_word_numeral(english_word_numeral_list, french_word_numeral_list, french_alt_word_numeral_list) + +numeral = '(?:' + digital_numeral + '|' + roman_numeral + '|' + word_numeral + ')' + +__romanNumeralMap = ( + ('M', 1000), + ('CM', 900), + ('D', 500), + ('CD', 400), + ('C', 100), + ('XC', 90), + ('L', 50), + ('XL', 40), + ('X', 10), + ('IX', 9), + ('V', 5), + ('IV', 4), + ('I', 1) +) + +__romanNumeralPattern = re.compile('^' + roman_numeral + '$') + + +def __parse_roman(value): + """ + convert Roman numeral to integer + + :param value: Value to parse + :type value: string + :return: + :rtype: + """ + if not __romanNumeralPattern.search(value): + raise ValueError('Invalid Roman numeral: %s' % value) + + result = 0 + index = 0 + for num, integer in __romanNumeralMap: + while value[index:index + len(num)] == num: + result += integer + index += len(num) + return result + + +def __parse_word(value): + """ + Convert Word numeral to integer + + :param value: Value to parse + :type value: string + :return: + :rtype: + """ + for word_list in [english_word_numeral_list, french_word_numeral_list, french_alt_word_numeral_list]: + try: + return word_list.index(value.lower()) + except ValueError: + pass + raise ValueError # pragma: no cover + + +_clean_re = re.compile(r'[^\d]*(\d+)[^\d]*') + + +def parse_numeral(value, int_enabled=True, roman_enabled=True, word_enabled=True, clean=True): + """ + Parse a numeric value into integer. + + :param value: Value to parse. Can be an integer, roman numeral or word. + :type value: string + :param int_enabled: + :type int_enabled: + :param roman_enabled: + :type roman_enabled: + :param word_enabled: + :type word_enabled: + :param clean: + :type clean: + :return: Numeric value, or None if value can't be parsed + :rtype: int + """ + # pylint: disable=too-many-branches + if int_enabled: + try: + if clean: + match = _clean_re.match(value) + if match: + clean_value = match.group(1) + return int(clean_value) + return int(value) + except ValueError: + pass + if roman_enabled: + try: + if clean: + for word in value.split(): + try: + return __parse_roman(word.upper()) + except ValueError: + pass + return __parse_roman(value) + except ValueError: + pass + if word_enabled: + try: + if clean: + for word in value.split(): + try: + return __parse_word(word) + except ValueError: # pragma: no cover + pass + return __parse_word(value) # pragma: no cover + except ValueError: # pragma: no cover + pass + raise ValueError('Invalid numeral: ' + value) # pragma: no cover diff --git a/lib/guessit/rules/common/pattern.py b/lib/guessit/rules/common/pattern.py new file mode 100644 index 00000000..5f560f2c --- /dev/null +++ b/lib/guessit/rules/common/pattern.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Pattern utility functions +""" + + +def is_disabled(context, name): + """Whether a specific pattern is disabled. + + The context object might define an inclusion list (includes) or an exclusion list (excludes) + A pattern is considered disabled if it's found in the exclusion list or + it's not found in the inclusion list and the inclusion list is not empty or not defined. + + :param context: + :param name: + :return: + """ + if not context: + return False + + excludes = context.get('excludes') + if excludes and name in excludes: + return True + + includes = context.get('includes') + return includes and name not in includes diff --git a/lib/guessit/rules/common/quantity.py b/lib/guessit/rules/common/quantity.py new file mode 100644 index 00000000..bbd41fbb --- /dev/null +++ b/lib/guessit/rules/common/quantity.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Quantities: Size +""" +import re +from abc import abstractmethod + +import six + +from ..common import seps + + +class Quantity(object): + """ + Represent a quantity object with magnitude and units. + """ + + parser_re = re.compile(r'(?P<magnitude>\d+(?:[.]\d+)?)(?P<units>[^\d]+)?') + + def __init__(self, magnitude, units): + self.magnitude = magnitude + self.units = units + + @classmethod + @abstractmethod + def parse_units(cls, value): + """ + Parse a string to a proper unit notation. + """ + raise NotImplementedError + + @classmethod + def fromstring(cls, string): + """ + Parse the string into a quantity object. + :param string: + :return: + """ + values = cls.parser_re.match(string).groupdict() + try: + magnitude = int(values['magnitude']) + except ValueError: + magnitude = float(values['magnitude']) + units = cls.parse_units(values['units']) + + return cls(magnitude, units) + + def __hash__(self): + return hash(str(self)) + + def __eq__(self, other): + if isinstance(other, six.string_types): + return str(self) == other + if not isinstance(other, self.__class__): + return NotImplemented + return self.magnitude == other.magnitude and self.units == other.units + + def __ne__(self, other): + return not self == other + + def __repr__(self): + return '<{0} [{1}]>'.format(self.__class__.__name__, self) + + def __str__(self): + return '{0}{1}'.format(self.magnitude, self.units) + + +class Size(Quantity): + """ + Represent size. + + e.g.: 1.1GB, 300MB + """ + + @classmethod + def parse_units(cls, value): + return value.strip(seps).upper() + + +class BitRate(Quantity): + """ + Represent bit rate. + + e.g.: 320Kbps, 1.5Mbps + """ + + @classmethod + def parse_units(cls, value): + value = value.strip(seps).capitalize() + for token in ('bits', 'bit'): + value = value.replace(token, 'bps') + + return value + + +class FrameRate(Quantity): + """ + Represent frame rate. + + e.g.: 24fps, 60fps + """ + + @classmethod + def parse_units(cls, value): + return 'fps' diff --git a/lib/guessit/rules/common/validators.py b/lib/guessit/rules/common/validators.py new file mode 100644 index 00000000..0d0eb3eb --- /dev/null +++ b/lib/guessit/rules/common/validators.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Validators +""" +from functools import partial + +from rebulk.validators import chars_before, chars_after, chars_surround +from . import seps + +seps_before = partial(chars_before, seps) +seps_after = partial(chars_after, seps) +seps_surround = partial(chars_surround, seps) + + +def int_coercable(string): + """ + Check if string can be coerced to int + :param string: + :type string: + :return: + :rtype: + """ + try: + int(string) + return True + except ValueError: + return False + + +def and_(*validators): + """ + Compose validators functions + :param validators: + :type validators: + :return: + :rtype: + """ + def composed(string): + """ + Composed validators function + :param string: + :type string: + :return: + :rtype: + """ + for validator in validators: + if not validator(string): + return False + return True + return composed + + +def or_(*validators): + """ + Compose validators functions + :param validators: + :type validators: + :return: + :rtype: + """ + def composed(string): + """ + Composed validators function + :param string: + :type string: + :return: + :rtype: + """ + for validator in validators: + if validator(string): + return True + return False + return composed diff --git a/lib/guessit/rules/common/words.py b/lib/guessit/rules/common/words.py new file mode 100644 index 00000000..cccbc7d2 --- /dev/null +++ b/lib/guessit/rules/common/words.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Words utils +""" +from collections import namedtuple + +from . import seps + +_Word = namedtuple('_Word', ['span', 'value']) + + +def iter_words(string): + """ + Iterate on all words in a string + :param string: + :type string: + :return: + :rtype: iterable[str] + """ + i = 0 + last_sep_index = -1 + inside_word = False + for char in string: + if ord(char) < 128 and char in seps: # Make sure we don't exclude unicode characters. + if inside_word: + yield _Word(span=(last_sep_index+1, i), value=string[last_sep_index+1:i]) + inside_word = False + last_sep_index = i + else: + inside_word = True + i += 1 + if inside_word: + yield _Word(span=(last_sep_index+1, i), value=string[last_sep_index+1:i]) diff --git a/lib/guessit/rules/markers/__init__.py b/lib/guessit/rules/markers/__init__.py new file mode 100644 index 00000000..6a48a13b --- /dev/null +++ b/lib/guessit/rules/markers/__init__.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Markers +""" diff --git a/lib/guessit/rules/markers/groups.py b/lib/guessit/rules/markers/groups.py new file mode 100644 index 00000000..4716d15d --- /dev/null +++ b/lib/guessit/rules/markers/groups.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Groups markers (...), [...] and {...} +""" +from rebulk import Rebulk + + +def groups(config): + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk() + rebulk.defaults(name="group", marker=True) + + starting = config['starting'] + ending = config['ending'] + + def mark_groups(input_string): + """ + Functional pattern to mark groups (...), [...] and {...}. + + :param input_string: + :return: + """ + openings = ([], [], []) + i = 0 + + ret = [] + for char in input_string: + start_type = starting.find(char) + if start_type > -1: + openings[start_type].append(i) + + i += 1 + + end_type = ending.find(char) + if end_type > -1: + try: + start_index = openings[end_type].pop() + ret.append((start_index, i)) + except IndexError: + pass + return ret + + rebulk.functional(mark_groups) + return rebulk diff --git a/lib/guessit/rules/markers/path.py b/lib/guessit/rules/markers/path.py new file mode 100644 index 00000000..6d993b75 --- /dev/null +++ b/lib/guessit/rules/markers/path.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Path markers +""" +from rebulk import Rebulk + +from rebulk.utils import find_all + + +def path(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk() + rebulk.defaults(name="path", marker=True) + + def mark_path(input_string, context): + """ + Functional pattern to mark path elements. + + :param input_string: + :param context: + :return: + """ + ret = [] + if context.get('name_only', False): + ret.append((0, len(input_string))) + else: + indices = list(find_all(input_string, '/')) + indices += list(find_all(input_string, '\\')) + indices += [-1, len(input_string)] + + indices.sort() + + for i in range(0, len(indices) - 1): + ret.append((indices[i] + 1, indices[i + 1])) + + return ret + + rebulk.functional(mark_path) + return rebulk diff --git a/lib/guessit/rules/match_processors.py b/lib/guessit/rules/match_processors.py new file mode 100644 index 00000000..0b49372f --- /dev/null +++ b/lib/guessit/rules/match_processors.py @@ -0,0 +1,20 @@ +""" +Match processors +""" +from guessit.rules.common import seps + + +def strip(match, chars=seps): + """ + Strip given characters from match. + + :param chars: + :param match: + :return: + """ + while match.input_string[match.start] in chars: + match.start += 1 + while match.input_string[match.end - 1] in chars: + match.end -= 1 + if not match: + return False diff --git a/lib/guessit/rules/processors.py b/lib/guessit/rules/processors.py new file mode 100644 index 00000000..5b018140 --- /dev/null +++ b/lib/guessit/rules/processors.py @@ -0,0 +1,259 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Processors +""" +from collections import defaultdict +import copy + +import six + +from rebulk import Rebulk, Rule, CustomRule, POST_PROCESS, PRE_PROCESS, AppendMatch, RemoveMatch + +from .common import seps_no_groups +from .common.formatters import cleanup +from .common.comparators import marker_sorted +from .common.date import valid_year +from .common.words import iter_words + + +class EnlargeGroupMatches(CustomRule): + """ + Enlarge matches that are starting and/or ending group to include brackets in their span. + """ + priority = PRE_PROCESS + + def when(self, matches, context): + starting = [] + ending = [] + + for group in matches.markers.named('group'): + for match in matches.starting(group.start + 1): + starting.append(match) + + for match in matches.ending(group.end - 1): + ending.append(match) + + if starting or ending: + return starting, ending + return False + + def then(self, matches, when_response, context): + starting, ending = when_response + for match in starting: + matches.remove(match) + match.start -= 1 + match.raw_start += 1 + matches.append(match) + + for match in ending: + matches.remove(match) + match.end += 1 + match.raw_end -= 1 + matches.append(match) + + +class EquivalentHoles(Rule): + """ + Creates equivalent matches for holes that have same values than existing (case insensitive) + """ + priority = POST_PROCESS + consequence = AppendMatch + + def when(self, matches, context): + new_matches = [] + + for filepath in marker_sorted(matches.markers.named('path'), matches): + holes = matches.holes(start=filepath.start, end=filepath.end, formatter=cleanup) + for name in matches.names: + for hole in list(holes): + for current_match in matches.named(name): + if isinstance(current_match.value, six.string_types) and \ + hole.value.lower() == current_match.value.lower(): + if 'equivalent-ignore' in current_match.tags: + continue + new_value = _preferred_string(hole.value, current_match.value) + if hole.value != new_value: + hole.value = new_value + if current_match.value != new_value: + current_match.value = new_value + hole.name = name + hole.tags = ['equivalent'] + new_matches.append(hole) + if hole in holes: + holes.remove(hole) + + return new_matches + + +class RemoveAmbiguous(Rule): + """ + If multiple matches are found with same name and different values, keep the one in the most valuable filepart. + Also keep others match with same name and values than those kept ones. + """ + + priority = POST_PROCESS + consequence = RemoveMatch + + def __init__(self, sort_function=marker_sorted, predicate=None): + super(RemoveAmbiguous, self).__init__() + self.sort_function = sort_function + self.predicate = predicate + + def when(self, matches, context): + fileparts = self.sort_function(matches.markers.named('path'), matches) + + previous_fileparts_names = set() + values = defaultdict(list) + + to_remove = [] + for filepart in fileparts: + filepart_matches = matches.range(filepart.start, filepart.end, predicate=self.predicate) + + filepart_names = set() + for match in filepart_matches: + filepart_names.add(match.name) + if match.name in previous_fileparts_names: + if match.value not in values[match.name]: + to_remove.append(match) + else: + if match.value not in values[match.name]: + values[match.name].append(match.value) + + previous_fileparts_names.update(filepart_names) + + return to_remove + + +class RemoveLessSpecificSeasonEpisode(RemoveAmbiguous): + """ + If multiple season/episodes matches are found with different values, + keep the one tagged as 'SxxExx' or in the rightmost filepart. + """ + def __init__(self, name): + super(RemoveLessSpecificSeasonEpisode, self).__init__( + sort_function=(lambda markers, matches: + marker_sorted(list(reversed(markers)), matches, + lambda match: match.name == name and 'SxxExx' in match.tags)), + predicate=lambda match: match.name == name) + + +def _preferred_string(value1, value2): # pylint:disable=too-many-return-statements + """ + Retrieves preferred title from both values. + :param value1: + :type value1: str + :param value2: + :type value2: str + :return: The preferred title + :rtype: str + """ + if value1 == value2: + return value1 + if value1.istitle() and not value2.istitle(): + return value1 + if not value1.isupper() and value2.isupper(): + return value1 + if not value1.isupper() and value1[0].isupper() and not value2[0].isupper(): + return value1 + if _count_title_words(value1) > _count_title_words(value2): + return value1 + return value2 + + +def _count_title_words(value): + """ + Count only many words are titles in value. + :param value: + :type value: + :return: + :rtype: + """ + ret = 0 + for word in iter_words(value): + if word.value.istitle(): + ret += 1 + return ret + + +class SeasonYear(Rule): + """ + If a season is a valid year and no year was found, create an match with year. + """ + priority = POST_PROCESS + consequence = AppendMatch + + def when(self, matches, context): + ret = [] + if not matches.named('year'): + for season in matches.named('season'): + if valid_year(season.value): + year = copy.copy(season) + year.name = 'year' + ret.append(year) + return ret + + +class YearSeason(Rule): + """ + If a year is found, no season found, and episode is found, create an match with season. + """ + priority = POST_PROCESS + consequence = AppendMatch + + def when(self, matches, context): + ret = [] + if not matches.named('season') and matches.named('episode'): + for year in matches.named('year'): + season = copy.copy(year) + season.name = 'season' + ret.append(season) + return ret + + +class Processors(CustomRule): + """ + Empty rule for ordering post_processing properly. + """ + priority = POST_PROCESS + + def when(self, matches, context): + pass + + def then(self, matches, when_response, context): # pragma: no cover + pass + + +class StripSeparators(CustomRule): + """ + Strip separators from matches. Keep separators if they are from acronyms, like in ".S.H.I.E.L.D." + """ + priority = POST_PROCESS + + def when(self, matches, context): + return matches + + def then(self, matches, when_response, context): # pragma: no cover + for match in matches: + for _ in range(0, len(match.span)): + if match.raw[0] in seps_no_groups and (len(match.raw) < 3 or match.raw[2] not in seps_no_groups): + match.raw_start += 1 + + for _ in reversed(range(0, len(match.span))): + if match.raw[-1] in seps_no_groups and (len(match.raw) < 3 or match.raw[-3] not in seps_no_groups): + match.raw_end -= 1 + + +def processors(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + return Rebulk().rules(EnlargeGroupMatches, EquivalentHoles, + RemoveLessSpecificSeasonEpisode('season'), + RemoveLessSpecificSeasonEpisode('episode'), + RemoveAmbiguous, SeasonYear, YearSeason, Processors, StripSeparators) diff --git a/lib/guessit/rules/properties/__init__.py b/lib/guessit/rules/properties/__init__.py new file mode 100644 index 00000000..e0a24eaf --- /dev/null +++ b/lib/guessit/rules/properties/__init__.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Properties +""" diff --git a/lib/guessit/rules/properties/audio_codec.py b/lib/guessit/rules/properties/audio_codec.py new file mode 100644 index 00000000..815caff9 --- /dev/null +++ b/lib/guessit/rules/properties/audio_codec.py @@ -0,0 +1,235 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +audio_codec, audio_profile and audio_channels property +""" +from rebulk import Rebulk, Rule, RemoveMatch +from rebulk.remodule import re + +from ..common import dash +from ..common.pattern import is_disabled +from ..common.validators import seps_before, seps_after + +audio_properties = ['audio_codec', 'audio_profile', 'audio_channels'] + + +def audio_codec(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk()\ + .regex_defaults(flags=re.IGNORECASE, abbreviations=[dash])\ + .string_defaults(ignore_case=True) + + def audio_codec_priority(match1, match2): + """ + Gives priority to audio_codec + :param match1: + :type match1: + :param match2: + :type match2: + :return: + :rtype: + """ + if match1.name == 'audio_codec' and match2.name in ['audio_profile', 'audio_channels']: + return match2 + if match1.name in ['audio_profile', 'audio_channels'] and match2.name == 'audio_codec': + return match1 + return '__default__' + + rebulk.defaults(name='audio_codec', + conflict_solver=audio_codec_priority, + disabled=lambda context: is_disabled(context, 'audio_codec')) + + rebulk.regex("MP3", "LAME", r"LAME(?:\d)+-?(?:\d)+", value="MP3") + rebulk.string("MP2", value="MP2") + rebulk.regex('Dolby', 'DolbyDigital', 'Dolby-Digital', 'DD', 'AC3D?', value='Dolby Digital') + rebulk.regex('Dolby-?Atmos', 'Atmos', value='Dolby Atmos') + rebulk.string("AAC", value="AAC") + rebulk.string('EAC3', 'DDP', 'DD+', value='Dolby Digital Plus') + rebulk.string("Flac", value="FLAC") + rebulk.string("DTS", value="DTS") + rebulk.regex('DTS-?HD', 'DTS(?=-?MA)', value='DTS-HD', + conflict_solver=lambda match, other: other if other.name == 'audio_codec' else '__default__') + rebulk.regex('True-?HD', value='Dolby TrueHD') + rebulk.string('Opus', value='Opus') + rebulk.string('Vorbis', value='Vorbis') + rebulk.string('PCM', value='PCM') + rebulk.string('LPCM', value='LPCM') + + rebulk.defaults(clear=True, + name='audio_profile', + disabled=lambda context: is_disabled(context, 'audio_profile')) + rebulk.string('MA', value='Master Audio', tags=['audio_profile.rule', 'DTS-HD']) + rebulk.string('HR', 'HRA', value='High Resolution Audio', tags=['audio_profile.rule', 'DTS-HD']) + rebulk.string('ES', value='Extended Surround', tags=['audio_profile.rule', 'DTS']) + rebulk.string('HE', value='High Efficiency', tags=['audio_profile.rule', 'AAC']) + rebulk.string('LC', value='Low Complexity', tags=['audio_profile.rule', 'AAC']) + rebulk.string('HQ', value='High Quality', tags=['audio_profile.rule', 'Dolby Digital']) + rebulk.string('EX', value='EX', tags=['audio_profile.rule', 'Dolby Digital']) + + rebulk.defaults(clear=True, + name="audio_channels", + disabled=lambda context: is_disabled(context, 'audio_channels')) + rebulk.regex('7[01]', value='7.1', validator=seps_after, tags='weak-audio_channels') + rebulk.regex('5[01]', value='5.1', validator=seps_after, tags='weak-audio_channels') + rebulk.string('20', value='2.0', validator=seps_after, tags='weak-audio_channels') + + for value, items in config.get('audio_channels').items(): + for item in items: + if item.startswith('re:'): + rebulk.regex(item[3:], value=value, children=True) + else: + rebulk.string(item, value=value) + + rebulk.rules(DtsHDRule, DtsRule, AacRule, DolbyDigitalRule, AudioValidatorRule, HqConflictRule, + AudioChannelsValidatorRule) + + return rebulk + + +class AudioValidatorRule(Rule): + """ + Remove audio properties if not surrounded by separators and not next each others + """ + priority = 64 + consequence = RemoveMatch + + def when(self, matches, context): + ret = [] + + audio_list = matches.range(predicate=lambda match: match.name in audio_properties) + for audio in audio_list: + if not seps_before(audio): + valid_before = matches.range(audio.start - 1, audio.start, + lambda match: match.name in audio_properties) + if not valid_before: + ret.append(audio) + continue + if not seps_after(audio): + valid_after = matches.range(audio.end, audio.end + 1, + lambda match: match.name in audio_properties) + if not valid_after: + ret.append(audio) + continue + + return ret + + +class AudioProfileRule(Rule): + """ + Abstract rule to validate audio profiles + """ + priority = 64 + dependency = AudioValidatorRule + consequence = RemoveMatch + + def __init__(self, codec): + super(AudioProfileRule, self).__init__() + self.codec = codec + + def enabled(self, context): + return not is_disabled(context, 'audio_profile') + + def when(self, matches, context): + profile_list = matches.named('audio_profile', + lambda match: 'audio_profile.rule' in match.tags and + self.codec in match.tags) + ret = [] + for profile in profile_list: + codec = matches.at_span(profile.span, + lambda match: match.name == 'audio_codec' and + match.value == self.codec, 0) + if not codec: + codec = matches.previous(profile, + lambda match: match.name == 'audio_codec' and + match.value == self.codec) + if not codec: + codec = matches.next(profile, + lambda match: match.name == 'audio_codec' and + match.value == self.codec) + if not codec: + ret.append(profile) + if codec: + ret.extend(matches.conflicting(profile)) + return ret + + +class DtsHDRule(AudioProfileRule): + """ + Rule to validate DTS-HD profile + """ + + def __init__(self): + super(DtsHDRule, self).__init__('DTS-HD') + + +class DtsRule(AudioProfileRule): + """ + Rule to validate DTS profile + """ + + def __init__(self): + super(DtsRule, self).__init__('DTS') + + +class AacRule(AudioProfileRule): + """ + Rule to validate AAC profile + """ + + def __init__(self): + super(AacRule, self).__init__('AAC') + + +class DolbyDigitalRule(AudioProfileRule): + """ + Rule to validate Dolby Digital profile + """ + + def __init__(self): + super(DolbyDigitalRule, self).__init__('Dolby Digital') + + +class HqConflictRule(Rule): + """ + Solve conflict between HQ from other property and from audio_profile. + """ + + dependency = [DtsHDRule, DtsRule, AacRule, DolbyDigitalRule] + consequence = RemoveMatch + + def enabled(self, context): + return not is_disabled(context, 'audio_profile') + + def when(self, matches, context): + hq_audio = matches.named('audio_profile', lambda m: m.value == 'High Quality') + hq_audio_spans = [match.span for match in hq_audio] + return matches.named('other', lambda m: m.span in hq_audio_spans) + + +class AudioChannelsValidatorRule(Rule): + """ + Remove audio_channel if no audio codec as previous match. + """ + priority = 128 + consequence = RemoveMatch + + def enabled(self, context): + return not is_disabled(context, 'audio_channels') + + def when(self, matches, context): + ret = [] + + for audio_channel in matches.tagged('weak-audio_channels'): + valid_before = matches.range(audio_channel.start - 1, audio_channel.start, + lambda match: match.name == 'audio_codec') + if not valid_before: + ret.append(audio_channel) + + return ret diff --git a/lib/guessit/rules/properties/bit_rate.py b/lib/guessit/rules/properties/bit_rate.py new file mode 100644 index 00000000..d279c9f1 --- /dev/null +++ b/lib/guessit/rules/properties/bit_rate.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +video_bit_rate and audio_bit_rate properties +""" +import re + +from rebulk import Rebulk +from rebulk.rules import Rule, RemoveMatch, RenameMatch + +from ..common import dash, seps +from ..common.pattern import is_disabled +from ..common.quantity import BitRate +from ..common.validators import seps_surround + + +def bit_rate(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk(disabled=lambda context: (is_disabled(context, 'audio_bit_rate') + and is_disabled(context, 'video_bit_rate'))) + rebulk = rebulk.regex_defaults(flags=re.IGNORECASE, abbreviations=[dash]) + rebulk.defaults(name='audio_bit_rate', validator=seps_surround) + rebulk.regex(r'\d+-?[kmg]b(ps|its?)', r'\d+\.\d+-?[kmg]b(ps|its?)', + conflict_solver=( + lambda match, other: match + if other.name == 'audio_channels' and 'weak-audio_channels' not in other.tags + else other + ), + formatter=BitRate.fromstring, tags=['release-group-prefix']) + + rebulk.rules(BitRateTypeRule) + + return rebulk + + +class BitRateTypeRule(Rule): + """ + Convert audio bit rate guess into video bit rate. + """ + consequence = [RenameMatch('video_bit_rate'), RemoveMatch] + + def when(self, matches, context): + to_rename = [] + to_remove = [] + + if is_disabled(context, 'audio_bit_rate'): + to_remove.extend(matches.named('audio_bit_rate')) + else: + video_bit_rate_disabled = is_disabled(context, 'video_bit_rate') + for match in matches.named('audio_bit_rate'): + previous = matches.previous(match, index=0, + predicate=lambda m: m.name in ('source', 'screen_size', 'video_codec')) + if previous and not matches.holes(previous.end, match.start, predicate=lambda m: m.value.strip(seps)): + after = matches.next(match, index=0, predicate=lambda m: m.name == 'audio_codec') + if after and not matches.holes(match.end, after.start, predicate=lambda m: m.value.strip(seps)): + bitrate = match.value + if bitrate.units == 'Kbps' or (bitrate.units == 'Mbps' and bitrate.magnitude < 10): + continue + + if video_bit_rate_disabled: + to_remove.append(match) + else: + to_rename.append(match) + + if to_rename or to_remove: + return to_rename, to_remove + return False diff --git a/lib/guessit/rules/properties/bonus.py b/lib/guessit/rules/properties/bonus.py new file mode 100644 index 00000000..54087aa3 --- /dev/null +++ b/lib/guessit/rules/properties/bonus.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +bonus property +""" +from rebulk.remodule import re + +from rebulk import Rebulk, AppendMatch, Rule + +from .title import TitleFromPosition +from ..common.formatters import cleanup +from ..common.pattern import is_disabled +from ..common.validators import seps_surround + + +def bonus(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'bonus')) + rebulk = rebulk.regex_defaults(flags=re.IGNORECASE) + + rebulk.regex(r'x(\d+)', name='bonus', private_parent=True, children=True, formatter=int, + validator={'__parent__': seps_surround}, + validate_all=True, + conflict_solver=lambda match, conflicting: match + if conflicting.name in ('video_codec', 'episode') and 'weak-episode' not in conflicting.tags + else '__default__') + + rebulk.rules(BonusTitleRule) + + return rebulk + + +class BonusTitleRule(Rule): + """ + Find bonus title after bonus. + """ + dependency = TitleFromPosition + consequence = AppendMatch + + properties = {'bonus_title': [None]} + + def when(self, matches, context): # pylint:disable=inconsistent-return-statements + bonus_number = matches.named('bonus', lambda match: not match.private, index=0) + if bonus_number: + filepath = matches.markers.at_match(bonus_number, lambda marker: marker.name == 'path', 0) + hole = matches.holes(bonus_number.end, filepath.end + 1, formatter=cleanup, index=0) + if hole and hole.value: + hole.name = 'bonus_title' + return hole diff --git a/lib/guessit/rules/properties/cds.py b/lib/guessit/rules/properties/cds.py new file mode 100644 index 00000000..873df6fe --- /dev/null +++ b/lib/guessit/rules/properties/cds.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +cd and cd_count properties +""" +from rebulk.remodule import re + +from rebulk import Rebulk + +from ..common import dash +from ..common.pattern import is_disabled + + +def cds(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'cd')) + rebulk = rebulk.regex_defaults(flags=re.IGNORECASE, abbreviations=[dash]) + + rebulk.regex(r'cd-?(?P<cd>\d+)(?:-?of-?(?P<cd_count>\d+))?', + validator={'cd': lambda match: 0 < match.value < 100, + 'cd_count': lambda match: 0 < match.value < 100}, + formatter={'cd': int, 'cd_count': int}, + children=True, + private_parent=True, + properties={'cd': [None], 'cd_count': [None]}) + rebulk.regex(r'(?P<cd_count>\d+)-?cds?', + validator={'cd': lambda match: 0 < match.value < 100, + 'cd_count': lambda match: 0 < match.value < 100}, + formatter={'cd_count': int}, + children=True, + private_parent=True, + properties={'cd': [None], 'cd_count': [None]}) + + return rebulk diff --git a/lib/guessit/rules/properties/container.py b/lib/guessit/rules/properties/container.py new file mode 100644 index 00000000..0f1860af --- /dev/null +++ b/lib/guessit/rules/properties/container.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +container property +""" +from rebulk.remodule import re + +from rebulk import Rebulk + +from ..common import seps +from ..common.pattern import is_disabled +from ..common.validators import seps_surround +from ...reutils import build_or_pattern + + +def container(config): + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'container')) + rebulk = rebulk.regex_defaults(flags=re.IGNORECASE).string_defaults(ignore_case=True) + rebulk.defaults(name='container', + formatter=lambda value: value.strip(seps), + tags=['extension'], + conflict_solver=lambda match, other: other + if other.name in ('source', 'video_codec') or + other.name == 'container' and 'extension' not in other.tags + else '__default__') + + subtitles = config['subtitles'] + info = config['info'] + videos = config['videos'] + torrent = config['torrent'] + nzb = config['nzb'] + + rebulk.regex(r'\.'+build_or_pattern(subtitles)+'$', exts=subtitles, tags=['extension', 'subtitle']) + rebulk.regex(r'\.'+build_or_pattern(info)+'$', exts=info, tags=['extension', 'info']) + rebulk.regex(r'\.'+build_or_pattern(videos)+'$', exts=videos, tags=['extension', 'video']) + rebulk.regex(r'\.'+build_or_pattern(torrent)+'$', exts=torrent, tags=['extension', 'torrent']) + rebulk.regex(r'\.'+build_or_pattern(nzb)+'$', exts=nzb, tags=['extension', 'nzb']) + + rebulk.defaults(clear=True, + name='container', + validator=seps_surround, + formatter=lambda s: s.lower(), + conflict_solver=lambda match, other: match + 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', 'ass')], tags=['subtitle']) + rebulk.string(*videos, tags=['video']) + rebulk.string(*torrent, tags=['torrent']) + rebulk.string(*nzb, tags=['nzb']) + + return rebulk diff --git a/lib/guessit/rules/properties/country.py b/lib/guessit/rules/properties/country.py new file mode 100644 index 00000000..172c2990 --- /dev/null +++ b/lib/guessit/rules/properties/country.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +country property +""" +# pylint: disable=no-member +import babelfish + +from rebulk import Rebulk +from ..common.pattern import is_disabled +from ..common.words import iter_words + + +def country(config, common_words): + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :param common_words: common words + :type common_words: set + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'country')) + rebulk = rebulk.defaults(name='country') + + def find_countries(string, context=None): + """ + Find countries in given string. + """ + allowed_countries = context.get('allowed_countries') if context else None + return CountryFinder(allowed_countries, common_words).find(string) + + rebulk.functional(find_countries, + #  Prefer language and any other property over country if not US or GB. + conflict_solver=lambda match, other: match + if other.name != 'language' or match.value not in (babelfish.Country('US'), + babelfish.Country('GB')) + else other, + properties={'country': [None]}, + disabled=lambda context: not context.get('allowed_countries')) + + babelfish.country_converters['guessit'] = GuessitCountryConverter(config['synonyms']) + + return rebulk + + +class GuessitCountryConverter(babelfish.CountryReverseConverter): # pylint: disable=missing-docstring + def __init__(self, synonyms): + self.guessit_exceptions = {} + + for alpha2, synlist in synonyms.items(): + for syn in synlist: + self.guessit_exceptions[syn.lower()] = alpha2 + + @property + def codes(self): # pylint: disable=missing-docstring + return (babelfish.country_converters['name'].codes | + frozenset(babelfish.COUNTRIES.values()) | + frozenset(self.guessit_exceptions.keys())) + + def convert(self, alpha2): + if alpha2 == 'GB': + return 'UK' + return str(babelfish.Country(alpha2)) + + def reverse(self, name): # pylint:disable=arguments-differ + # exceptions come first, as they need to override a potential match + # with any of the other guessers + try: + return self.guessit_exceptions[name.lower()] + except KeyError: + pass + + try: + return babelfish.Country(name.upper()).alpha2 + except ValueError: + pass + + for conv in [babelfish.Country.fromname]: + try: + return conv(name).alpha2 + except babelfish.CountryReverseError: + pass + + raise babelfish.CountryReverseError(name) + + +class CountryFinder(object): + """Helper class to search and return country matches.""" + + def __init__(self, allowed_countries, common_words): + self.allowed_countries = {l.lower() for l in allowed_countries or []} + self.common_words = common_words + + def find(self, string): + """Return all matches for country.""" + for word_match in iter_words(string.strip().lower()): + word = word_match.value + if word.lower() in self.common_words: + continue + + try: + country_object = babelfish.Country.fromguessit(word) + if (country_object.name.lower() in self.allowed_countries or + country_object.alpha2.lower() in self.allowed_countries): + yield self._to_rebulk_match(word_match, country_object) + except babelfish.Error: + continue + + @classmethod + def _to_rebulk_match(cls, word, value): + return word.span[0], word.span[1], {'value': value} diff --git a/lib/guessit/rules/properties/crc.py b/lib/guessit/rules/properties/crc.py new file mode 100644 index 00000000..eedee93d --- /dev/null +++ b/lib/guessit/rules/properties/crc.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +crc and uuid properties +""" +from rebulk.remodule import re + +from rebulk import Rebulk +from ..common.pattern import is_disabled +from ..common.validators import seps_surround + + +def crc(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'crc32')) + rebulk = rebulk.regex_defaults(flags=re.IGNORECASE) + rebulk.defaults(validator=seps_surround) + + rebulk.regex('(?:[a-fA-F]|[0-9]){8}', name='crc32', + conflict_solver=lambda match, other: other + if other.name in ['episode', 'season'] + else '__default__') + + rebulk.functional(guess_idnumber, name='uuid', + conflict_solver=lambda match, other: match + if other.name in ['episode', 'season'] + else '__default__') + return rebulk + + +_DIGIT = 0 +_LETTER = 1 +_OTHER = 2 + +_idnum = re.compile(r'(?P<uuid>[a-zA-Z0-9-]{20,})') # 1.0, (0, 0)) + + +def guess_idnumber(string): + """ + Guess id number function + :param string: + :type string: + :return: + :rtype: + """ + # pylint:disable=invalid-name + ret = [] + + matches = list(_idnum.finditer(string)) + for match in matches: + result = match.groupdict() + switch_count = 0 + switch_letter_count = 0 + letter_count = 0 + last_letter = None + + last = _LETTER + for c in result['uuid']: + if c in '0123456789': + ci = _DIGIT + elif c in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ': + ci = _LETTER + if c != last_letter: + switch_letter_count += 1 + last_letter = c + letter_count += 1 + else: + ci = _OTHER + + if ci != last: + switch_count += 1 + + last = ci + + # only return the result as probable if we alternate often between + # char type (more likely for hash values than for common words) + switch_ratio = float(switch_count) / len(result['uuid']) + letters_ratio = (float(switch_letter_count) / letter_count) if letter_count > 0 else 1 + + if switch_ratio > 0.4 and letters_ratio > 0.4: + ret.append(match.span()) + + return ret diff --git a/lib/guessit/rules/properties/date.py b/lib/guessit/rules/properties/date.py new file mode 100644 index 00000000..e50cdfa3 --- /dev/null +++ b/lib/guessit/rules/properties/date.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +date and year properties +""" +from rebulk import Rebulk, RemoveMatch, Rule + +from ..common.date import search_date, valid_year +from ..common.pattern import is_disabled +from ..common.validators import seps_surround + + +def date(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk().defaults(validator=seps_surround) + + rebulk.regex(r"\d{4}", name="year", formatter=int, + disabled=lambda context: is_disabled(context, 'year'), + conflict_solver=lambda match, other: other + if other.name in ('episode', 'season') and len(other.raw) < len(match.raw) + else '__default__', + validator=lambda match: seps_surround(match) and valid_year(match.value)) + + def date_functional(string, context): # pylint:disable=inconsistent-return-statements + """ + Search for date in the string and retrieves match + + :param string: + :return: + """ + + ret = search_date(string, context.get('date_year_first'), context.get('date_day_first')) + if ret: + return ret[0], ret[1], {'value': ret[2]} + + rebulk.functional(date_functional, name="date", properties={'date': [None]}, + disabled=lambda context: is_disabled(context, 'date'), + conflict_solver=lambda match, other: other + if other.name in ('episode', 'season', 'crc32') + else '__default__') + + rebulk.rules(KeepMarkedYearInFilepart) + + return rebulk + + +class KeepMarkedYearInFilepart(Rule): + """ + Keep first years marked with [](){} in filepart, or if no year is marked, ensure it won't override titles. + """ + priority = 64 + consequence = RemoveMatch + + def enabled(self, context): + return not is_disabled(context, 'year') + + def when(self, matches, context): + ret = [] + if len(matches.named('year')) > 1: + for filepart in matches.markers.named('path'): + years = matches.range(filepart.start, filepart.end, lambda match: match.name == 'year') + if len(years) > 1: + group_years = [] + ungroup_years = [] + for year in years: + if matches.markers.at_match(year, lambda marker: marker.name == 'group'): + group_years.append(year) + else: + ungroup_years.append(year) + if group_years and ungroup_years: + ret.extend(ungroup_years) + ret.extend(group_years[1:]) # Keep the first year in marker. + elif not group_years: + ret.append(ungroup_years[0]) # Keep first year for title. + if len(ungroup_years) > 2: + ret.extend(ungroup_years[2:]) + return ret diff --git a/lib/guessit/rules/properties/edition.py b/lib/guessit/rules/properties/edition.py new file mode 100644 index 00000000..822aa4ee --- /dev/null +++ b/lib/guessit/rules/properties/edition.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +edition property +""" +from rebulk.remodule import re + +from rebulk import Rebulk +from ..common import dash +from ..common.pattern import is_disabled +from ..common.validators import seps_surround + + +def edition(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'edition')) + rebulk = rebulk.regex_defaults(flags=re.IGNORECASE, abbreviations=[dash]).string_defaults(ignore_case=True) + rebulk.defaults(name='edition', validator=seps_surround) + + rebulk.regex('collector', "collector'?s?-edition", 'edition-collector', value='Collector') + rebulk.regex('special-edition', 'edition-special', value='Special', + conflict_solver=lambda match, other: other + if other.name == 'episode_details' and other.value == 'Special' + else '__default__') + rebulk.string('se', value='Special', tags='has-neighbor') + rebulk.string('ddc', value="Director's Definitive Cut") + rebulk.regex('criterion-edition', 'edition-criterion', 'CC', value='Criterion') + rebulk.regex('deluxe', 'deluxe-edition', 'edition-deluxe', value='Deluxe') + rebulk.regex('limited', 'limited-edition', value='Limited', tags=['has-neighbor', 'release-group-prefix']) + rebulk.regex(r'theatrical-cut', r'theatrical-edition', r'theatrical', value='Theatrical') + rebulk.regex(r"director'?s?-cut", r"director'?s?-cut-edition", r"edition-director'?s?-cut", 'DC', + value="Director's Cut") + rebulk.regex('extended', 'extended-?cut', 'extended-?version', + value='Extended', tags=['has-neighbor', 'release-group-prefix']) + rebulk.regex('alternat(e|ive)(?:-?Cut)?', value='Alternative Cut', tags=['has-neighbor', 'release-group-prefix']) + for value in ('Remastered', 'Uncensored', 'Uncut', 'Unrated'): + rebulk.string(value, value=value, tags=['has-neighbor', 'release-group-prefix']) + rebulk.string('Festival', value='Festival', tags=['has-neighbor-before', 'has-neighbor-after']) + rebulk.regex('imax', 'imax-edition', value='IMAX') + rebulk.regex('fan-edit(?:ion)?', 'fan-collection', value='Fan') + rebulk.regex('ultimate-edition', value='Ultimate') + rebulk.regex("ultimate-collector'?s?-edition", value=['Ultimate', 'Collector']) + rebulk.regex('ultimate-fan-edit(?:ion)?', 'ultimate-fan-collection', value=['Ultimate', 'Fan']) + + return rebulk diff --git a/lib/guessit/rules/properties/episode_title.py b/lib/guessit/rules/properties/episode_title.py new file mode 100644 index 00000000..ece8921d --- /dev/null +++ b/lib/guessit/rules/properties/episode_title.py @@ -0,0 +1,300 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Episode title +""" +from collections import defaultdict + +from rebulk import Rebulk, Rule, AppendMatch, RemoveMatch, RenameMatch, POST_PROCESS + +from ..common import seps, title_seps +from ..common.formatters import cleanup +from ..common.pattern import is_disabled +from ..common.validators import or_ +from ..properties.title import TitleFromPosition, TitleBaseRule +from ..properties.type import TypeProcessor + + +def episode_title(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + previous_names = ('episode', 'episode_count', + 'season', 'season_count', 'date', 'title', 'year') + + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'episode_title')) + rebulk = rebulk.rules(RemoveConflictsWithEpisodeTitle(previous_names), + EpisodeTitleFromPosition(previous_names), + AlternativeTitleReplace(previous_names), + TitleToEpisodeTitle, + Filepart3EpisodeTitle, + Filepart2EpisodeTitle, + RenameEpisodeTitleWhenMovieType) + return rebulk + + +class RemoveConflictsWithEpisodeTitle(Rule): + """ + Remove conflicting matches that might lead to wrong episode_title parsing. + """ + + priority = 64 + consequence = RemoveMatch + + def __init__(self, previous_names): + super(RemoveConflictsWithEpisodeTitle, self).__init__() + self.previous_names = previous_names + 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') + + def when(self, matches, context): + to_remove = [] + for filepart in matches.markers.named('path'): + for match in matches.range(filepart.start, filepart.end, + predicate=lambda m: m.name in self.affected_names): + before = matches.range(filepart.start, match.start, predicate=lambda m: not m.private, index=-1) + if not before or before.name not in self.previous_names: + continue + + after = matches.range(match.end, filepart.end, predicate=lambda m: not m.private, index=0) + if not after or after.name not in self.next_names: + continue + + group = matches.markers.at_match(match, predicate=lambda m: m.name == 'group', index=0) + + def has_value_in_same_group(current_match, current_group=group): + """Return true if current match has value and belongs to the current group.""" + return current_match.value.strip(seps) and ( + current_group == matches.markers.at_match(current_match, + predicate=lambda mm: mm.name == 'group', index=0) + ) + + holes_before = matches.holes(before.end, match.start, predicate=has_value_in_same_group) + holes_after = matches.holes(match.end, after.start, predicate=has_value_in_same_group) + + if not holes_before and not holes_after: + continue + + if match.name in self.affected_if_holes_after and not holes_after: + continue + + to_remove.append(match) + if match.parent: + to_remove.append(match.parent) + + return to_remove + + +class TitleToEpisodeTitle(Rule): + """ + If multiple different title are found, convert the one following episode number to episode_title. + """ + dependency = TitleFromPosition + + def when(self, matches, context): + titles = matches.named('title') + title_groups = defaultdict(list) + for title in titles: + title_groups[title.value].append(title) + + episode_titles = [] + if len(title_groups) < 2: + return episode_titles + + for title in titles: + if matches.previous(title, lambda match: match.name == 'episode'): + episode_titles.append(title) + + return episode_titles + + def then(self, matches, when_response, context): + for title in when_response: + matches.remove(title) + title.name = 'episode_title' + matches.append(title) + + +class EpisodeTitleFromPosition(TitleBaseRule): + """ + Add episode title match in existing matches + Must run after TitleFromPosition rule. + """ + dependency = TitleToEpisodeTitle + + def __init__(self, previous_names): + super(EpisodeTitleFromPosition, self).__init__('episode_title', ['title']) + self.previous_names = previous_names + + def hole_filter(self, hole, matches): + episode = matches.previous(hole, + lambda previous: previous.named(*self.previous_names), + 0) + + crc32 = matches.named('crc32') + + return episode or crc32 + + def filepart_filter(self, filepart, matches): + # Filepart where title was found. + if matches.range(filepart.start, filepart.end, lambda match: match.name == 'title'): + return True + return False + + def should_remove(self, match, matches, filepart, hole, context): + if match.name == 'episode_details': + return False + return super(EpisodeTitleFromPosition, self).should_remove(match, matches, filepart, hole, context) + + def when(self, matches, context): # pylint:disable=inconsistent-return-statements + if matches.named('episode_title'): + return + return super(EpisodeTitleFromPosition, self).when(matches, context) + + +class AlternativeTitleReplace(Rule): + """ + If alternateTitle was found and title is next to episode, season or date, replace it with episode_title. + """ + dependency = EpisodeTitleFromPosition + consequence = RenameMatch + + def __init__(self, previous_names): + super(AlternativeTitleReplace, self).__init__() + self.previous_names = previous_names + + def when(self, matches, context): # pylint:disable=inconsistent-return-statements + if matches.named('episode_title'): + return + + alternative_title = matches.range(predicate=lambda match: match.name == 'alternative_title', index=0) + if alternative_title: + main_title = matches.chain_before(alternative_title.start, seps=seps, + predicate=lambda match: 'title' in match.tags, index=0) + if main_title: + episode = matches.previous(main_title, + lambda previous: previous.named(*self.previous_names), + 0) + + crc32 = matches.named('crc32') + + if episode or crc32: + return alternative_title + + def then(self, matches, when_response, context): + matches.remove(when_response) + when_response.name = 'episode_title' + when_response.tags.append('alternative-replaced') + matches.append(when_response) + + +class RenameEpisodeTitleWhenMovieType(Rule): + """ + Rename episode_title by alternative_title when type is movie. + """ + priority = POST_PROCESS + + dependency = TypeProcessor + consequence = RenameMatch + + def when(self, matches, context): # pylint:disable=inconsistent-return-statements + if matches.named('episode_title', lambda m: 'alternative-replaced' not in m.tags) \ + and not matches.named('type', lambda m: m.value == 'episode'): + return matches.named('episode_title') + + def then(self, matches, when_response, context): + for match in when_response: + matches.remove(match) + match.name = 'alternative_title' + matches.append(match) + + +class Filepart3EpisodeTitle(Rule): + """ + If we have at least 3 filepart structured like this: + + Serie name/SO1/E01-episode_title.mkv + AAAAAAAAAA/BBB/CCCCCCCCCCCCCCCCCCCC + + Serie name/SO1/episode_title-E01.mkv + AAAAAAAAAA/BBB/CCCCCCCCCCCCCCCCCCCC + + If CCCC contains episode and BBB contains seasonNumber + Then title is to be found in AAAA. + """ + consequence = AppendMatch('title') + + def when(self, matches, context): # pylint:disable=inconsistent-return-statements + if matches.tagged('filepart-title'): + return + + fileparts = matches.markers.named('path') + if len(fileparts) < 3: + return + + filename = fileparts[-1] + directory = fileparts[-2] + subdirectory = fileparts[-3] + + episode_number = matches.range(filename.start, filename.end, lambda match: match.name == 'episode', 0) + if episode_number: + season = matches.range(directory.start, directory.end, lambda match: match.name == 'season', 0) + + if season: + hole = matches.holes(subdirectory.start, subdirectory.end, + ignore=or_(lambda match: 'weak-episode' in match.tags, TitleBaseRule.is_ignored), + formatter=cleanup, seps=title_seps, predicate=lambda match: match.value, + index=0) + if hole: + return hole + + +class Filepart2EpisodeTitle(Rule): + """ + If we have at least 2 filepart structured like this: + + Serie name SO1/E01-episode_title.mkv + AAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBB + + If BBBB contains episode and AAA contains a hole followed by seasonNumber + then title is to be found in AAAA. + + or + + Serie name/SO1E01-episode_title.mkv + AAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBB + + If BBBB contains season and episode and AAA contains a hole + then title is to be found in AAAA. + """ + consequence = AppendMatch('title') + + def when(self, matches, context): # pylint:disable=inconsistent-return-statements + if matches.tagged('filepart-title'): + return + + fileparts = matches.markers.named('path') + if len(fileparts) < 2: + return + + filename = fileparts[-1] + directory = fileparts[-2] + + episode_number = matches.range(filename.start, filename.end, lambda match: match.name == 'episode', 0) + if episode_number: + season = (matches.range(directory.start, directory.end, lambda match: match.name == 'season', 0) or + matches.range(filename.start, filename.end, lambda match: match.name == 'season', 0)) + if season: + hole = matches.holes(directory.start, directory.end, + ignore=or_(lambda match: 'weak-episode' in match.tags, TitleBaseRule.is_ignored), + formatter=cleanup, seps=title_seps, + predicate=lambda match: match.value, index=0) + if hole: + hole.tags.append('filepart-title') + return hole diff --git a/lib/guessit/rules/properties/episodes.py b/lib/guessit/rules/properties/episodes.py new file mode 100644 index 00000000..345c785d --- /dev/null +++ b/lib/guessit/rules/properties/episodes.py @@ -0,0 +1,912 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +episode, season, disc, episode_count, season_count and episode_details properties +""" +import copy +from collections import defaultdict + +from rebulk import Rebulk, RemoveMatch, Rule, AppendMatch, RenameMatch +from rebulk.match import Match +from rebulk.remodule import re +from rebulk.utils import is_iterable + +from guessit.rules import match_processors +from guessit.rules.common.numeral import parse_numeral, numeral +from .title import TitleFromPosition +from ..common import dash, alt_dash, seps, seps_no_fs +from ..common.formatters import strip +from ..common.pattern import is_disabled +from ..common.validators import seps_surround, int_coercable, and_ +from ...reutils import build_or_pattern + + +def episodes(config): + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + + # pylint: disable=too-many-branches,too-many-statements,too-many-locals + def is_season_episode_disabled(context): + """Whether season and episode rules should be enabled.""" + return is_disabled(context, 'episode') or is_disabled(context, 'season') + + def episodes_season_chain_breaker(matches): + """ + Break chains if there's more than 100 offset between two neighbor values. + :param matches: + :type matches: + :return: + :rtype: + """ + eps = matches.named('episode') + if len(eps) > 1 and abs(eps[-1].value - eps[-2].value) > episode_max_range: + return True + + seasons = matches.named('season') + if len(seasons) > 1 and abs(seasons[-1].value - seasons[-2].value) > season_max_range: + return True + return False + + def season_episode_conflict_solver(match, other): + """ + Conflict solver for episode/season patterns + + :param match: + :param other: + :return: + """ + if match.name != other.name: + if match.name == 'episode' and other.name == 'year': + return match + if match.name in ('season', 'episode'): + if other.name in ('video_codec', 'audio_codec', 'container', 'date'): + return match + if (other.name == 'audio_channels' and 'weak-audio_channels' not in other.tags + and not match.initiator.children.named(match.name + 'Marker')) or ( + other.name == 'screen_size' and not int_coercable(other.raw)): + return match + if other.name in ('season', 'episode') and match.initiator != other.initiator: + if (match.initiator.name in ('weak_episode', 'weak_duplicate') + and other.initiator.name in ('weak_episode', 'weak_duplicate')): + return '__default__' + for current in (match, other): + if 'weak-episode' in current.tags or 'x' in current.initiator.raw.lower(): + return current + return '__default__' + + def ordering_validator(match): + """ + Validator for season list. They should be in natural order to be validated. + + episode/season separated by a weak discrete separator should be consecutive, unless a strong discrete separator + or a range separator is present in the chain (1.3&5 is valid, but 1.3-5 is not valid and 1.3.5 is not valid) + """ + values = match.children.to_dict() + if 'season' in values and is_iterable(values['season']): + # Season numbers must be in natural order to be validated. + if not list(sorted(values['season'])) == values['season']: + return False + if 'episode' in values and is_iterable(values['episode']): + # Season numbers must be in natural order to be validated. + if not list(sorted(values['episode'])) == values['episode']: + return False + + def is_consecutive(property_name): + """ + Check if the property season or episode has valid consecutive values. + :param property_name: + :type property_name: + :return: + :rtype: + """ + previous_match = None + valid = True + for current_match in match.children.named(property_name): + if previous_match: + match.children.previous(current_match, + lambda m: m.name == property_name + 'Separator') + separator = match.children.previous(current_match, + lambda m: m.name == property_name + 'Separator', 0) + if separator: + if separator.raw not in range_separators and separator.raw in weak_discrete_separators: + if not 0 < current_match.value - previous_match.value <= max_range_gap + 1: + valid = False + if separator.raw in strong_discrete_separators: + valid = True + break + previous_match = current_match + return valid + + return is_consecutive('episode') and is_consecutive('season') + + def validate_roman(match): + """ + Validate a roman match if surrounded by separators + :param match: + :type match: + :return: + :rtype: + """ + if int_coercable(match.raw): + return True + return seps_surround(match) + + season_words = config['season_words'] + episode_words = config['episode_words'] + of_words = config['of_words'] + all_words = config['all_words'] + season_markers = config['season_markers'] + season_ep_markers = config['season_ep_markers'] + disc_markers = config['disc_markers'] + episode_markers = config['episode_markers'] + range_separators = config['range_separators'] + weak_discrete_separators = list(sep for sep in seps_no_fs if sep not in range_separators) + strong_discrete_separators = config['discrete_separators'] + discrete_separators = strong_discrete_separators + weak_discrete_separators + episode_max_range = config['episode_max_range'] + season_max_range = config['season_max_range'] + max_range_gap = config['max_range_gap'] + + rebulk = Rebulk() \ + .regex_defaults(flags=re.IGNORECASE) \ + .string_defaults(ignore_case=True) \ + .chain_defaults(chain_breaker=episodes_season_chain_breaker) \ + .defaults(private_names=['episodeSeparator', 'seasonSeparator', 'episodeMarker', 'seasonMarker'], + formatter={'season': int, 'episode': int, 'version': int, 'count': int}, + children=True, + private_parent=True, + conflict_solver=season_episode_conflict_solver, + abbreviations=[alt_dash]) + + # S01E02, 01x02, S01S02S03 + rebulk.chain( + tags=['SxxExx'], + validate_all=True, + validator={'__parent__': and_(seps_surround, ordering_validator)}, + disabled=is_season_episode_disabled) \ + .defaults(tags=['SxxExx']) \ + .regex(build_or_pattern(season_markers, name='seasonMarker') + r'(?P<season>\d+)@?' + + build_or_pattern(episode_markers + disc_markers, name='episodeMarker') + r'@?(?P<episode>\d+)')\ + .repeater('+') \ + .regex(build_or_pattern(episode_markers + disc_markers + discrete_separators + range_separators, + name='episodeSeparator', + escape=True) + + r'(?P<episode>\d+)').repeater('*') + + rebulk.chain(tags=['SxxExx'], + validate_all=True, + validator={'__parent__': and_(seps_surround, ordering_validator)}, + disabled=is_season_episode_disabled) \ + .defaults(tags=['SxxExx']) \ + .regex(r'(?P<season>\d+)@?' + + build_or_pattern(season_ep_markers, name='episodeMarker') + + r'@?(?P<episode>\d+)').repeater('+') \ + + rebulk.chain(tags=['SxxExx'], + validate_all=True, + validator={'__parent__': and_(seps_surround, ordering_validator)}, + disabled=is_season_episode_disabled) \ + .defaults(tags=['SxxExx']) \ + .regex(r'(?P<season>\d+)@?' + + build_or_pattern(season_ep_markers, name='episodeMarker') + + r'@?(?P<episode>\d+)') \ + .regex(build_or_pattern(season_ep_markers + discrete_separators + range_separators, + name='episodeSeparator', + escape=True) + + r'(?P<episode>\d+)').repeater('*') + + rebulk.chain(tags=['SxxExx'], + validate_all=True, + validator={'__parent__': and_(seps_surround, ordering_validator)}, + disabled=is_season_episode_disabled) \ + .defaults(tags=['SxxExx']) \ + .regex(build_or_pattern(season_markers, name='seasonMarker') + r'(?P<season>\d+)') \ + .regex('(?P<other>Extras)', name='other', value='Extras', tags=['no-release-group-prefix']).repeater('?') \ + .regex(build_or_pattern(season_markers + discrete_separators + range_separators, + name='seasonSeparator', + escape=True) + + r'(?P<season>\d+)').repeater('*') + + # episode_details property + for episode_detail in ('Special', 'Pilot', 'Unaired', 'Final'): + rebulk.string(episode_detail, + private_parent=False, + children=False, + value=episode_detail, + name='episode_details', + disabled=lambda context: is_disabled(context, 'episode_details')) + + rebulk.defaults(private_names=['episodeSeparator', 'seasonSeparator', 'episodeMarker', 'seasonMarker'], + validate_all=True, + validator={'__parent__': and_(seps_surround, ordering_validator)}, + children=True, + private_parent=True, + conflict_solver=season_episode_conflict_solver) + + rebulk.chain(validate_all=True, + conflict_solver=season_episode_conflict_solver, + formatter={'season': parse_numeral, 'count': parse_numeral}, + validator={'__parent__': and_(seps_surround, ordering_validator), + 'season': validate_roman, + 'count': validate_roman}, + disabled=lambda context: context.get('type') == 'movie' or is_disabled(context, 'season')) \ + .defaults(formatter={'season': parse_numeral, 'count': parse_numeral}, + validator={'season': validate_roman, 'count': validate_roman}, + conflict_solver=season_episode_conflict_solver) \ + .regex(build_or_pattern(season_words, name='seasonMarker') + '@?(?P<season>' + numeral + ')') \ + .regex(r'' + build_or_pattern(of_words) + '@?(?P<count>' + numeral + ')').repeater('?') \ + .regex(r'@?' + build_or_pattern(range_separators + discrete_separators + ['@'], + name='seasonSeparator', escape=True) + + r'@?(?P<season>\d+)').repeater('*') + + rebulk.defaults(abbreviations=[dash]) + + rebulk.regex(build_or_pattern(episode_words, name='episodeMarker') + r'-?(?P<episode>\d+)' + + r'(?:v(?P<version>\d+))?' + + r'(?:-?' + build_or_pattern(of_words) + r'-?(?P<count>\d+))?', # Episode 4 + disabled=lambda context: context.get('type') == 'episode' or is_disabled(context, 'episode')) + + rebulk.regex(build_or_pattern(episode_words, name='episodeMarker') + r'-?(?P<episode>' + numeral + ')' + + r'(?:v(?P<version>\d+))?' + + r'(?:-?' + build_or_pattern(of_words) + r'-?(?P<count>\d+))?', # Episode 4 + validator={'episode': validate_roman}, + formatter={'episode': parse_numeral}, + disabled=lambda context: context.get('type') != 'episode' or is_disabled(context, 'episode')) + + rebulk.regex(r'S?(?P<season>\d+)-?(?:xE|Ex|E|x)-?(?P<other>' + build_or_pattern(all_words) + ')', + tags=['SxxExx'], + formatter={'other': lambda match: 'Complete'}, + disabled=lambda context: is_disabled(context, 'season')) + + # 12, 13 + rebulk.chain(tags=['weak-episode'], + disabled=lambda context: context.get('type') == 'movie' or is_disabled(context, 'episode')) \ + .defaults(validator=None, tags=['weak-episode']) \ + .regex(r'(?P<episode>\d{2})') \ + .regex(r'v(?P<version>\d+)').repeater('?') \ + .regex(r'(?P<episodeSeparator>[x-])(?P<episode>\d{2})', abbreviations=None).repeater('*') + + # 012, 013 + rebulk.chain(tags=['weak-episode'], + disabled=lambda context: context.get('type') == 'movie' or is_disabled(context, 'episode')) \ + .defaults(validator=None, tags=['weak-episode']) \ + .regex(r'0(?P<episode>\d{1,2})') \ + .regex(r'v(?P<version>\d+)').repeater('?') \ + .regex(r'(?P<episodeSeparator>[x-])0(?P<episode>\d{1,2})', abbreviations=None).repeater('*') + + # 112, 113 + rebulk.chain(tags=['weak-episode'], + name='weak_episode', + disabled=lambda context: context.get('type') == 'movie' or is_disabled(context, 'episode')) \ + .defaults(validator=None, tags=['weak-episode'], name='weak_episode') \ + .regex(r'(?P<episode>\d{3,4})') \ + .regex(r'v(?P<version>\d+)').repeater('?') \ + .regex(r'(?P<episodeSeparator>[x-])(?P<episode>\d{3,4})', abbreviations=None).repeater('*') + + # 1, 2, 3 + rebulk.chain(tags=['weak-episode'], + disabled=lambda context: context.get('type') != 'episode' or is_disabled(context, 'episode')) \ + .defaults(validator=None, tags=['weak-episode']) \ + .regex(r'(?P<episode>\d)') \ + .regex(r'v(?P<version>\d+)').repeater('?') \ + .regex(r'(?P<episodeSeparator>[x-])(?P<episode>\d{1,2})', abbreviations=None).repeater('*') + + # e112, e113, 1e18, 3e19 + rebulk.chain(disabled=lambda context: is_disabled(context, 'episode')) \ + .defaults(validator=None) \ + .regex(r'(?P<season>\d{1,2})?(?P<episodeMarker>e)(?P<episode>\d{1,4})') \ + .regex(r'v(?P<version>\d+)').repeater('?') \ + .regex(r'(?P<episodeSeparator>e|x|-)(?P<episode>\d{1,4})', abbreviations=None).repeater('*') + + # ep 112, ep113, ep112, ep113 + rebulk.chain(disabled=lambda context: is_disabled(context, 'episode')) \ + .defaults(validator=None) \ + .regex(r'ep-?(?P<episode>\d{1,4})') \ + .regex(r'v(?P<version>\d+)').repeater('?') \ + .regex(r'(?P<episodeSeparator>ep|e|x|-)(?P<episode>\d{1,4})', abbreviations=None).repeater('*') + + # cap 112, cap 112_114 + rebulk.chain(tags=['see-pattern'], + disabled=is_season_episode_disabled) \ + .defaults(validator=None, tags=['see-pattern']) \ + .regex(r'(?P<seasonMarker>cap)-?(?P<season>\d{1,2})(?P<episode>\d{2})') \ + .regex(r'(?P<episodeSeparator>-)(?P<season>\d{1,2})(?P<episode>\d{2})').repeater('?') + + # 102, 0102 + rebulk.chain(tags=['weak-episode', 'weak-duplicate'], + name='weak_duplicate', + conflict_solver=season_episode_conflict_solver, + disabled=lambda context: (context.get('episode_prefer_number', False) or + context.get('type') == 'movie') or is_season_episode_disabled(context)) \ + .defaults(tags=['weak-episode', 'weak-duplicate'], + name='weak_duplicate', + validator=None, + conflict_solver=season_episode_conflict_solver) \ + .regex(r'(?P<season>\d{1,2})(?P<episode>\d{2})') \ + .regex(r'v(?P<version>\d+)').repeater('?') \ + .regex(r'(?P<episodeSeparator>x|-)(?P<episode>\d{2})', abbreviations=None).repeater('*') + + rebulk.regex(r'v(?P<version>\d+)', + formatter=int, + disabled=lambda context: is_disabled(context, 'version')) + + rebulk.defaults(private_names=['episodeSeparator', 'seasonSeparator']) + + # TODO: List of words + # detached of X count (season/episode) + rebulk.regex(r'(?P<episode>\d+)-?' + build_or_pattern(of_words) + + r'-?(?P<count>\d+)-?' + build_or_pattern(episode_words) + '?', + formatter=int, + pre_match_processor=match_processors.strip, + disabled=lambda context: is_disabled(context, 'episode')) + + rebulk.regex(r'Minisodes?', + children=False, + private_parent=False, + name='episode_format', + value="Minisode", + disabled=lambda context: is_disabled(context, 'episode_format')) + + rebulk.rules(WeakConflictSolver, RemoveInvalidSeason, RemoveInvalidEpisode, + SeePatternRange(range_separators + ['_']), + EpisodeNumberSeparatorRange(range_separators), + SeasonSeparatorRange(range_separators), RemoveWeakIfMovie, RemoveWeakIfSxxExx, RemoveWeakDuplicate, + EpisodeDetailValidator, RemoveDetachedEpisodeNumber, VersionValidator, RemoveWeak(episode_words), + RenameToAbsoluteEpisode, CountValidator, EpisodeSingleDigitValidator, RenameToDiscMatch) + + return rebulk + + +class WeakConflictSolver(Rule): + """ + Rule to decide whether weak-episode or weak-duplicate matches should be kept. + + If an anime is detected: + - weak-duplicate matches should be removed + - weak-episode matches should be tagged as anime + Otherwise: + - weak-episode matches are removed unless they're part of an episode range match. + """ + priority = 128 + consequence = [RemoveMatch, AppendMatch] + + def enabled(self, context): + return context.get('type') != 'movie' + + @classmethod + def is_anime(cls, matches): + """Return True if it seems to be an anime. + + Anime characteristics: + - version, crc32 matches + - screen_size inside brackets + - release_group at start and inside brackets + """ + if matches.named('version') or matches.named('crc32'): + return True + + for group in matches.markers.named('group'): + if matches.range(group.start, group.end, predicate=lambda m: m.name == 'screen_size'): + return True + if matches.markers.starting(group.start, predicate=lambda m: m.name == 'path'): + hole = matches.holes(group.start, group.end, index=0) + if hole and hole.raw == group.raw: + return True + + return False + + def when(self, matches, context): + to_remove = [] + to_append = [] + anime_detected = self.is_anime(matches) + for filepart in matches.markers.named('path'): + weak_matches = matches.range(filepart.start, filepart.end, predicate=( + lambda m: m.initiator.name == 'weak_episode')) + weak_dup_matches = matches.range(filepart.start, filepart.end, predicate=( + lambda m: m.initiator.name == 'weak_duplicate')) + if anime_detected: + if weak_matches: + to_remove.extend(weak_dup_matches) + for match in matches.range(filepart.start, filepart.end, predicate=( + lambda m: m.name == 'episode' and m.initiator.name != 'weak_duplicate')): + episode = copy.copy(match) + episode.tags = episode.tags + ['anime'] + to_append.append(episode) + to_remove.append(match) + elif weak_dup_matches: + episodes_in_range = matches.range(filepart.start, filepart.end, predicate=( + lambda m: + m.name == 'episode' and m.initiator.name == 'weak_episode' + and m.initiator.children.named('episodeSeparator') + )) + if not episodes_in_range and not matches.range(filepart.start, filepart.end, + predicate=lambda m: 'SxxExx' in m.tags): + to_remove.extend(weak_matches) + else: + for match in episodes_in_range: + episode = copy.copy(match) + episode.tags = [] + to_append.append(episode) + to_remove.append(match) + + if to_append: + to_remove.extend(weak_dup_matches) + + if to_remove or to_append: + return to_remove, to_append + return False + + +class CountValidator(Rule): + """ + Validate count property and rename it + """ + priority = 64 + consequence = [RemoveMatch, RenameMatch('episode_count'), RenameMatch('season_count')] + + properties = {'episode_count': [None], 'season_count': [None]} + + def when(self, matches, context): + to_remove = [] + episode_count = [] + season_count = [] + + for count in matches.named('count'): + previous = matches.previous(count, lambda match: match.name in ['episode', 'season'], 0) + if previous: + if previous.name == 'episode': + episode_count.append(count) + elif previous.name == 'season': + season_count.append(count) + else: + to_remove.append(count) + if to_remove or episode_count or season_count: + return to_remove, episode_count, season_count + return False + + +class SeePatternRange(Rule): + """ + Create matches for episode range for SEE pattern. E.g.: Cap.102_104 + """ + priority = 128 + consequence = [RemoveMatch, AppendMatch] + + def __init__(self, range_separators): + super(SeePatternRange, self).__init__() + self.range_separators = range_separators + + def when(self, matches, context): + to_remove = [] + to_append = [] + + for separator in matches.tagged('see-pattern', lambda m: m.name == 'episodeSeparator'): + previous_match = matches.previous(separator, lambda m: m.name == 'episode' and 'see-pattern' in m.tags, 0) + next_match = matches.next(separator, lambda m: m.name == 'season' and 'see-pattern' in m.tags, 0) + if not next_match: + continue + + next_match = matches.next(next_match, lambda m: m.name == 'episode' and 'see-pattern' in m.tags, 0) + if previous_match and next_match and separator.value in self.range_separators: + to_remove.append(next_match) + + for episode_number in range(previous_match.value + 1, next_match.value + 1): + match = copy.copy(next_match) + match.value = episode_number + to_append.append(match) + + to_remove.append(separator) + + if to_remove or to_append: + return to_remove, to_append + return False + + +class AbstractSeparatorRange(Rule): + """ + Remove separator matches and create matches for season range. + """ + priority = 128 + consequence = [RemoveMatch, AppendMatch] + + def __init__(self, range_separators, property_name): + super(AbstractSeparatorRange, self).__init__() + self.range_separators = range_separators + self.property_name = property_name + + def when(self, matches, context): + to_remove = [] + to_append = [] + + for separator in matches.named(self.property_name + 'Separator'): + previous_match = matches.previous(separator, lambda m: m.name == self.property_name, 0) + next_match = matches.next(separator, lambda m: m.name == self.property_name, 0) + initiator = separator.initiator + + if previous_match and next_match and separator.value in self.range_separators: + to_remove.append(next_match) + for episode_number in range(previous_match.value + 1, next_match.value): + match = copy.copy(next_match) + match.value = episode_number + initiator.children.append(match) + to_append.append(match) + to_append.append(next_match) + to_remove.append(separator) + + previous_match = None + for next_match in matches.named(self.property_name): + if previous_match: + separator = matches.input_string[previous_match.initiator.end:next_match.initiator.start] + if separator not in self.range_separators: + separator = strip(separator) + if separator in self.range_separators: + initiator = previous_match.initiator + for episode_number in range(previous_match.value + 1, next_match.value): + match = copy.copy(next_match) + match.value = episode_number + initiator.children.append(match) + to_append.append(match) + to_append.append(Match(previous_match.end, next_match.start - 1, + name=self.property_name + 'Separator', + private=True, + input_string=matches.input_string)) + to_remove.append(next_match) # Remove and append match to support proper ordering + to_append.append(next_match) + + previous_match = next_match + + if to_remove or to_append: + return to_remove, to_append + return False + + +class RenameToAbsoluteEpisode(Rule): + """ + Rename episode to absolute_episodes. + + Absolute episodes are only used if two groups of episodes are detected: + S02E04-06 25-27 + 25-27 S02E04-06 + 2x04-06 25-27 + 28. Anime Name S02E05 + The matches in the group with higher episode values are renamed to absolute_episode. + """ + + consequence = RenameMatch('absolute_episode') + + def when(self, matches, context): # pylint:disable=inconsistent-return-statements + initiators = {match.initiator for match in matches.named('episode') + if len(match.initiator.children.named('episode')) > 1} + if len(initiators) != 2: + ret = [] + for filepart in matches.markers.named('path'): + if matches.range(filepart.start + 1, filepart.end, predicate=lambda m: m.name == 'episode'): + ret.extend( + matches.starting(filepart.start, predicate=lambda m: m.initiator.name == 'weak_episode')) + return ret + + initiators = sorted(initiators, key=lambda item: item.end) + if not matches.holes(initiators[0].end, initiators[1].start, predicate=lambda m: m.raw.strip(seps)): + first_range = matches.named('episode', predicate=lambda m: m.initiator == initiators[0]) + second_range = matches.named('episode', predicate=lambda m: m.initiator == initiators[1]) + if len(first_range) == len(second_range): + if second_range[0].value > first_range[0].value: + return second_range + if first_range[0].value > second_range[0].value: + return first_range + + +class EpisodeNumberSeparatorRange(AbstractSeparatorRange): + """ + Remove separator matches and create matches for episoderNumber range. + """ + + def __init__(self, range_separators): + super(EpisodeNumberSeparatorRange, self).__init__(range_separators, "episode") + + +class SeasonSeparatorRange(AbstractSeparatorRange): + """ + Remove separator matches and create matches for season range. + """ + + def __init__(self, range_separators): + super(SeasonSeparatorRange, self).__init__(range_separators, "season") + + +class RemoveWeakIfMovie(Rule): + """ + Remove weak-episode tagged matches if it seems to be a movie. + """ + priority = 64 + consequence = RemoveMatch + + def enabled(self, context): + return context.get('type') != 'episode' + + def when(self, matches, context): + to_remove = [] + to_ignore = set() + remove = False + for filepart in matches.markers.named('path'): + year = matches.range(filepart.start, filepart.end, predicate=lambda m: m.name == 'year', index=0) + if year: + remove = True + next_match = matches.range(year.end, filepart.end, predicate=lambda m: m.private, index=0) + if (next_match and not matches.holes(year.end, next_match.start, predicate=lambda m: m.raw.strip(seps)) + and not matches.at_match(next_match, predicate=lambda m: m.name == 'year')): + to_ignore.add(next_match.initiator) + + to_ignore.update(matches.range(filepart.start, filepart.end, + predicate=lambda m: len(m.children.named('episode')) > 1)) + + to_remove.extend(matches.conflicting(year)) + if remove: + to_remove.extend(matches.tagged('weak-episode', predicate=( + lambda m: m.initiator not in to_ignore and 'anime' not in m.tags))) + + return to_remove + + +class RemoveWeak(Rule): + """ + Remove weak-episode matches which appears after video, source, and audio matches. + """ + priority = 16 + consequence = RemoveMatch, AppendMatch + + def __init__(self, episode_words): + super(RemoveWeak, self).__init__() + self.episode_words = episode_words + + def when(self, matches, context): + to_remove = [] + to_append = [] + for filepart in matches.markers.named('path'): + weaks = matches.range(filepart.start, filepart.end, predicate=lambda m: 'weak-episode' in m.tags) + if weaks: + weak = weaks[0] + previous = matches.previous(weak, predicate=lambda m: m.name in ( + 'audio_codec', 'screen_size', 'streaming_service', 'source', 'video_profile', + 'audio_channels', 'audio_profile'), index=0) + if previous and not matches.holes( + previous.end, weak.start, predicate=lambda m: m.raw.strip(seps)): + if previous.raw.lower() in self.episode_words: + try: + episode = copy.copy(weak) + episode.name = 'episode' + episode.value = int(weak.value) + episode.start = previous.start + episode.private = False + episode.tags = [] + + to_append.append(episode) + except ValueError: + pass + + to_remove.extend(weaks) + if to_remove or to_append: + return to_remove, to_append + return False + + +class RemoveWeakIfSxxExx(Rule): + """ + Remove weak-episode tagged matches if SxxExx pattern is matched. + + Weak episodes at beginning of filepart are kept. + """ + priority = 64 + consequence = RemoveMatch + + def when(self, matches, context): + to_remove = [] + for filepart in matches.markers.named('path'): + if matches.range(filepart.start, filepart.end, + predicate=lambda m: not m.private and 'SxxExx' in m.tags): + for match in matches.range(filepart.start, filepart.end, predicate=lambda m: 'weak-episode' in m.tags): + if match.start != filepart.start or match.initiator.name != 'weak_episode': + to_remove.append(match) + return to_remove + + +class RemoveInvalidSeason(Rule): + """ + Remove invalid season matches. + """ + priority = 64 + consequence = RemoveMatch + + def when(self, matches, context): + to_remove = [] + for filepart in matches.markers.named('path'): + strong_season = matches.range(filepart.start, filepart.end, index=0, + predicate=lambda m: m.name == 'season' + and not m.private and 'SxxExx' in m.tags) + if strong_season: + if strong_season.initiator.children.named('episode'): + for season in matches.range(strong_season.end, filepart.end, + predicate=lambda m: m.name == 'season' and not m.private): + # remove weak season or seasons without episode matches + if 'SxxExx' not in season.tags or not season.initiator.children.named('episode'): + if season.initiator: + to_remove.append(season.initiator) + to_remove.extend(season.initiator.children) + else: + to_remove.append(season) + + return to_remove + + +class RemoveInvalidEpisode(Rule): + """ + Remove invalid episode matches. + """ + priority = 64 + consequence = RemoveMatch + + def when(self, matches, context): + to_remove = [] + for filepart in matches.markers.named('path'): + strong_episode = matches.range(filepart.start, filepart.end, index=0, + predicate=lambda m: m.name == 'episode' + and not m.private and 'SxxExx' in m.tags) + if strong_episode: + strong_ep_marker = RemoveInvalidEpisode.get_episode_prefix(matches, strong_episode) + for episode in matches.range(strong_episode.end, filepart.end, + predicate=lambda m: m.name == 'episode' and not m.private): + ep_marker = RemoveInvalidEpisode.get_episode_prefix(matches, episode) + if strong_ep_marker and ep_marker and strong_ep_marker.value.lower() != ep_marker.value.lower(): + if episode.initiator: + to_remove.append(episode.initiator) + to_remove.extend(episode.initiator.children) + else: + to_remove.append(ep_marker) + to_remove.append(episode) + + return to_remove + + @staticmethod + def get_episode_prefix(matches, episode): + """ + Return episode prefix: episodeMarker or episodeSeparator + """ + return matches.previous(episode, index=0, + predicate=lambda m: m.name in ('episodeMarker', 'episodeSeparator')) + + +class RemoveWeakDuplicate(Rule): + """ + Remove weak-duplicate tagged matches if duplicate patterns, for example The 100.109 + """ + priority = 64 + consequence = RemoveMatch + + def when(self, matches, context): + to_remove = [] + for filepart in matches.markers.named('path'): + patterns = defaultdict(list) + for match in reversed(matches.range(filepart.start, filepart.end, + predicate=lambda m: 'weak-duplicate' in m.tags)): + if match.pattern in patterns[match.name]: + to_remove.append(match) + else: + patterns[match.name].append(match.pattern) + return to_remove + + +class EpisodeDetailValidator(Rule): + """ + Validate episode_details if they are detached or next to season or episode. + """ + priority = 64 + consequence = RemoveMatch + + def when(self, matches, context): + ret = [] + for detail in matches.named('episode_details'): + if not seps_surround(detail) \ + and not matches.previous(detail, lambda match: match.name in ['season', 'episode']) \ + and not matches.next(detail, lambda match: match.name in ['season', 'episode']): + ret.append(detail) + return ret + + +class RemoveDetachedEpisodeNumber(Rule): + """ + If multiple episode are found, remove those that are not detached from a range and less than 10. + + Fairy Tail 2 - 16-20, 2 should be removed. + """ + priority = 64 + consequence = RemoveMatch + dependency = [RemoveWeakIfSxxExx, RemoveWeakDuplicate] + + def when(self, matches, context): + ret = [] + + episode_numbers = [] + episode_values = set() + for match in matches.named('episode', lambda m: not m.private and 'weak-episode' in m.tags): + if match.value not in episode_values: + episode_numbers.append(match) + episode_values.add(match.value) + + episode_numbers = list(sorted(episode_numbers, key=lambda m: m.value)) + if len(episode_numbers) > 1 and \ + episode_numbers[0].value < 10 and \ + episode_numbers[1].value - episode_numbers[0].value != 1: + parent = episode_numbers[0] + while parent: # TODO: Add a feature in rebulk to avoid this ... + ret.append(parent) + parent = parent.parent + return ret + + +class VersionValidator(Rule): + """ + Validate version if previous match is episode or if surrounded by separators. + """ + priority = 64 + dependency = [RemoveWeakIfMovie, RemoveWeakIfSxxExx] + consequence = RemoveMatch + + def when(self, matches, context): + ret = [] + for version in matches.named('version'): + episode_number = matches.previous(version, lambda match: match.name == 'episode', 0) + if not episode_number and not seps_surround(version.initiator): + ret.append(version) + return ret + + +class EpisodeSingleDigitValidator(Rule): + """ + Remove single digit episode when inside a group that doesn't own title. + """ + dependency = [TitleFromPosition] + + consequence = RemoveMatch + + def when(self, matches, context): + ret = [] + for episode in matches.named('episode', lambda match: len(match.initiator) == 1): + group = matches.markers.at_match(episode, lambda marker: marker.name == 'group', index=0) + if group: + if not matches.range(*group.span, predicate=lambda match: match.name == 'title'): + ret.append(episode) + return ret + + +class RenameToDiscMatch(Rule): + """ + Rename episodes detected with `d` episodeMarkers to `disc`. + """ + + consequence = [RenameMatch('disc'), RenameMatch('discMarker'), RemoveMatch] + + def when(self, matches, context): + discs = [] + markers = [] + to_remove = [] + + disc_disabled = is_disabled(context, 'disc') + + for marker in matches.named('episodeMarker', predicate=lambda m: m.value.lower() == 'd'): + if disc_disabled: + to_remove.append(marker) + to_remove.extend(marker.initiator.children) + continue + + markers.append(marker) + discs.extend(sorted(marker.initiator.children.named('episode'), key=lambda m: m.value)) + + if discs or markers or to_remove: + return discs, markers, to_remove + return False diff --git a/lib/guessit/rules/properties/film.py b/lib/guessit/rules/properties/film.py new file mode 100644 index 00000000..3c7e6c0f --- /dev/null +++ b/lib/guessit/rules/properties/film.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +film property +""" +from rebulk import Rebulk, AppendMatch, Rule +from rebulk.remodule import re + +from ..common.formatters import cleanup +from ..common.pattern import is_disabled +from ..common.validators import seps_surround + + +def film(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk().regex_defaults(flags=re.IGNORECASE, validate_all=True, validator={'__parent__': seps_surround}) + + rebulk.regex(r'f(\d{1,2})', name='film', private_parent=True, children=True, formatter=int, + disabled=lambda context: is_disabled(context, 'film')) + + rebulk.rules(FilmTitleRule) + + return rebulk + + +class FilmTitleRule(Rule): + """ + Rule to find out film_title (hole after film property + """ + consequence = AppendMatch + + properties = {'film_title': [None]} + + def enabled(self, context): + return not is_disabled(context, 'film_title') + + def when(self, matches, context): # pylint:disable=inconsistent-return-statements + bonus_number = matches.named('film', lambda match: not match.private, index=0) + if bonus_number: + filepath = matches.markers.at_match(bonus_number, lambda marker: marker.name == 'path', 0) + hole = matches.holes(filepath.start, bonus_number.start + 1, formatter=cleanup, index=0) + if hole and hole.value: + hole.name = 'film_title' + return hole diff --git a/lib/guessit/rules/properties/language.py b/lib/guessit/rules/properties/language.py new file mode 100644 index 00000000..3f83bc34 --- /dev/null +++ b/lib/guessit/rules/properties/language.py @@ -0,0 +1,510 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +language and subtitle_language properties +""" +# pylint: disable=no-member +import copy +from collections import defaultdict, namedtuple + +import babelfish +from rebulk import Rebulk, Rule, RemoveMatch, RenameMatch +from rebulk.remodule import re + +from ..common import seps +from ..common.pattern import is_disabled +from ..common.words import iter_words +from ..common.validators import seps_surround + + +def language(config, common_words): + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :param common_words: common words + :type common_words: set + :return: Created Rebulk object + :rtype: Rebulk + """ + subtitle_both = config['subtitle_affixes'] + subtitle_prefixes = sorted(subtitle_both + config['subtitle_prefixes'], key=length_comparator) + subtitle_suffixes = sorted(subtitle_both + config['subtitle_suffixes'], key=length_comparator) + lang_both = config['language_affixes'] + lang_prefixes = sorted(lang_both + config['language_prefixes'], key=length_comparator) + lang_suffixes = sorted(lang_both + config['language_suffixes'], key=length_comparator) + weak_affixes = frozenset(config['weak_affixes']) + + rebulk = Rebulk(disabled=lambda context: (is_disabled(context, 'language') and + is_disabled(context, 'subtitle_language'))) + + rebulk.string(*subtitle_prefixes, name="subtitle_language.prefix", ignore_case=True, private=True, + validator=seps_surround, tags=['release-group-prefix'], + disabled=lambda context: is_disabled(context, 'subtitle_language')) + rebulk.string(*subtitle_suffixes, name="subtitle_language.suffix", ignore_case=True, private=True, + validator=seps_surround, + disabled=lambda context: is_disabled(context, 'subtitle_language')) + rebulk.string(*lang_suffixes, name="language.suffix", ignore_case=True, private=True, + validator=seps_surround, tags=['source-suffix'], + disabled=lambda context: is_disabled(context, 'language')) + + def find_languages(string, context=None): + """Find languages in the string + + :return: list of tuple (property, Language, lang_word, word) + """ + return LanguageFinder(context, subtitle_prefixes, subtitle_suffixes, + lang_prefixes, lang_suffixes, weak_affixes).find(string) + + rebulk.functional(find_languages, + properties={'language': [None]}, + disabled=lambda context: not context.get('allowed_languages')) + rebulk.rules(SubtitleExtensionRule, + SubtitlePrefixLanguageRule, + SubtitleSuffixLanguageRule, + RemoveLanguage, + RemoveInvalidLanguages(common_words)) + + babelfish.language_converters['guessit'] = GuessitConverter(config['synonyms']) + + return rebulk + + +UNDETERMINED = babelfish.Language('und') +MULTIPLE = babelfish.Language('mul') +NON_SPECIFIC_LANGUAGES = frozenset([UNDETERMINED, MULTIPLE]) + + +class GuessitConverter(babelfish.LanguageReverseConverter): # pylint: disable=missing-docstring + _with_country_regexp = re.compile(r'(.*)\((.*)\)') + _with_country_regexp2 = re.compile(r'(.*)-(.*)') + + def __init__(self, synonyms): + self.guessit_exceptions = {} + for code, synlist in synonyms.items(): + if '_' in code: + (alpha3, country) = code.split('_') + else: + (alpha3, country) = (code, None) + for syn in synlist: + self.guessit_exceptions[syn.lower()] = (alpha3, country, None) + + @property + def codes(self): # pylint: disable=missing-docstring + return (babelfish.language_converters['alpha3b'].codes | + babelfish.language_converters['alpha2'].codes | + babelfish.language_converters['name'].codes | + babelfish.language_converters['opensubtitles'].codes | + babelfish.country_converters['name'].codes | + frozenset(self.guessit_exceptions.keys())) + + def convert(self, alpha3, country=None, script=None): + return str(babelfish.Language(alpha3, country, script)) + + def reverse(self, name): # pylint:disable=arguments-differ + name = name.lower() + # exceptions come first, as they need to override a potential match + # with any of the other guessers + try: + return self.guessit_exceptions[name] + except KeyError: + pass + + for conv in [babelfish.Language, + babelfish.Language.fromalpha3b, + babelfish.Language.fromalpha2, + babelfish.Language.fromname, + babelfish.Language.fromopensubtitles, + babelfish.Language.fromietf]: + try: + reverse = conv(name) + return reverse.alpha3, reverse.country, reverse.script + except (ValueError, babelfish.LanguageReverseError): + pass + + raise babelfish.LanguageReverseError(name) + + +def length_comparator(value): + """ + Return value length. + """ + return len(value) + + +_LanguageMatch = namedtuple('_LanguageMatch', ['property_name', 'word', 'lang']) + + +class LanguageWord(object): + """ + Extension to the Word namedtuple in order to create compound words. + + E.g.: pt-BR, soft subtitles, custom subs + """ + + def __init__(self, start, end, value, input_string, next_word=None): + self.start = start + self.end = end + self.value = value + self.input_string = input_string + self.next_word = next_word + + @property + def extended_word(self): # pylint:disable=inconsistent-return-statements + """ + Return the extended word for this instance, if any. + """ + if self.next_word: + separator = self.input_string[self.end:self.next_word.start] + next_separator = self.input_string[self.next_word.end:self.next_word.end + 1] + + if (separator == '-' and separator != next_separator) or separator in (' ', '.'): + value = self.input_string[self.start:self.next_word.end].replace('.', ' ') + + return LanguageWord(self.start, self.next_word.end, value, self.input_string, self.next_word.next_word) + + def __repr__(self): + return '<({start},{end}): {value}'.format(start=self.start, end=self.end, value=self.value) + + +def to_rebulk_match(language_match): + """ + Convert language match to rebulk Match: start, end, dict + """ + word = language_match.word + start = word.start + end = word.end + name = language_match.property_name + if language_match.lang == UNDETERMINED: + return start, end, { + 'name': name, + 'value': word.value.lower(), + 'formatter': babelfish.Language, + 'tags': ['weak-language'] + } + + return start, end, { + 'name': name, + 'value': language_match.lang + } + + +class LanguageFinder(object): + """ + Helper class to search and return language matches: 'language' and 'subtitle_language' properties + """ + + def __init__(self, context, + subtitle_prefixes, subtitle_suffixes, + lang_prefixes, lang_suffixes, weak_affixes): + allowed_languages = context.get('allowed_languages') if context else None + self.allowed_languages = {l.lower() for l in allowed_languages or []} + self.weak_affixes = weak_affixes + self.prefixes_map = {} + self.suffixes_map = {} + + if not is_disabled(context, 'subtitle_language'): + self.prefixes_map['subtitle_language'] = subtitle_prefixes + self.suffixes_map['subtitle_language'] = subtitle_suffixes + + self.prefixes_map['language'] = lang_prefixes + self.suffixes_map['language'] = lang_suffixes + + def find(self, string): + """ + Return all matches for language and subtitle_language. + + Undetermined language matches are removed if a regular language is found. + Multi language matches are removed if there are only undetermined language matches + """ + regular_lang_map = defaultdict(set) + undetermined_map = defaultdict(set) + multi_map = defaultdict(set) + + for match in self.iter_language_matches(string): + key = match.property_name + if match.lang == UNDETERMINED: + undetermined_map[key].add(match) + elif match.lang == 'mul': + multi_map[key].add(match) + else: + regular_lang_map[key].add(match) + + for key, values in multi_map.items(): + if key in regular_lang_map or key not in undetermined_map: + for value in values: + yield to_rebulk_match(value) + + for key, values in undetermined_map.items(): + if key not in regular_lang_map: + for value in values: + yield to_rebulk_match(value) + + for values in regular_lang_map.values(): + for value in values: + yield to_rebulk_match(value) + + def iter_language_matches(self, string): + """ + Return language matches for the given string. + """ + candidates = [] + previous = None + for word in iter_words(string): + language_word = LanguageWord(start=word.span[0], end=word.span[1], value=word.value, input_string=string) + if previous: + previous.next_word = language_word + candidates.append(previous) + previous = language_word + if previous: + candidates.append(previous) + + for candidate in candidates: + for match in self.iter_matches_for_candidate(candidate): + yield match + + def iter_matches_for_candidate(self, language_word): + """ + Return language matches for the given candidate word. + """ + tuples = [ + (language_word, language_word.next_word, + self.prefixes_map, + lambda string, prefix: string.startswith(prefix), + lambda string, prefix: string[len(prefix):]), + (language_word.next_word, language_word, + self.suffixes_map, + lambda string, suffix: string.endswith(suffix), + lambda string, suffix: string[:len(string) - len(suffix)]) + ] + + for word, fallback_word, affixes, is_affix, strip_affix in tuples: + if not word: + continue + + match = self.find_match_for_word(word, fallback_word, affixes, is_affix, strip_affix) + if match: + yield match + + match = self.find_language_match_for_word(language_word) + if match: + yield match + + def find_match_for_word(self, word, fallback_word, affixes, is_affix, strip_affix): # pylint:disable=inconsistent-return-statements + """ + Return the language match for the given word and affixes. + """ + for current_word in (word.extended_word, word): + if not current_word: + continue + + word_lang = current_word.value.lower() + + for key, parts in affixes.items(): + for part in parts: + if not is_affix(word_lang, part): + continue + + match = None + value = strip_affix(word_lang, part) + if not value: + if fallback_word and ( + abs(fallback_word.start - word.end) <= 1 or abs(word.start - fallback_word.end) <= 1): + match = self.find_language_match_for_word(fallback_word, key=key) + + if not match and part not in self.weak_affixes: + match = self.create_language_match(key, LanguageWord(current_word.start, current_word.end, + 'und', current_word.input_string)) + else: + match = self.create_language_match(key, LanguageWord(current_word.start, current_word.end, + value, current_word.input_string)) + + if match: + return match + + def find_language_match_for_word(self, word, key='language'): # pylint:disable=inconsistent-return-statements + """ + Return the language match for the given word. + """ + for current_word in (word.extended_word, word): + if current_word: + match = self.create_language_match(key, current_word) + if match: + return match + + def create_language_match(self, key, word): # pylint:disable=inconsistent-return-statements + """ + Create a LanguageMatch for a given word + """ + lang = self.parse_language(word.value.lower()) + + if lang is not None: + return _LanguageMatch(property_name=key, word=word, lang=lang) + + def parse_language(self, lang_word): # pylint:disable=inconsistent-return-statements + """ + Parse the lang_word into a valid Language. + + Multi and Undetermined languages are also valid languages. + """ + try: + lang = babelfish.Language.fromguessit(lang_word) + if ((hasattr(lang, 'name') and lang.name.lower() in self.allowed_languages) or + (hasattr(lang, 'alpha2') and lang.alpha2.lower() in self.allowed_languages) or + lang.alpha3.lower() in self.allowed_languages): + return lang + + except babelfish.Error: + pass + + +class SubtitlePrefixLanguageRule(Rule): + """ + Convert language guess as subtitle_language if previous match is a subtitle language prefix + """ + consequence = RemoveMatch + + properties = {'subtitle_language': [None]} + + def enabled(self, context): + return not is_disabled(context, 'subtitle_language') + + def when(self, matches, context): + to_rename = [] + to_remove = matches.named('subtitle_language.prefix') + for lang in matches.named('language'): + prefix = matches.previous(lang, lambda match: match.name == 'subtitle_language.prefix', 0) + if not prefix: + group_marker = matches.markers.at_match(lang, lambda marker: marker.name == 'group', 0) + if group_marker: + # Find prefix if placed just before the group + prefix = matches.previous(group_marker, lambda match: match.name == 'subtitle_language.prefix', + 0) + if not prefix: + # Find prefix if placed before in the group + prefix = matches.range(group_marker.start, lang.start, + lambda match: match.name == 'subtitle_language.prefix', 0) + if prefix: + to_rename.append((prefix, lang)) + to_remove.extend(matches.conflicting(lang)) + if prefix in to_remove: + to_remove.remove(prefix) + if to_rename or to_remove: + return to_rename, to_remove + return False + + def then(self, matches, when_response, context): + to_rename, to_remove = when_response + super(SubtitlePrefixLanguageRule, self).then(matches, to_remove, context) + for prefix, match in to_rename: + # Remove suffix equivalent of prefix. + suffix = copy.copy(prefix) + suffix.name = 'subtitle_language.suffix' + if suffix in matches: + matches.remove(suffix) + matches.remove(match) + match.name = 'subtitle_language' + matches.append(match) + + +class SubtitleSuffixLanguageRule(Rule): + """ + Convert language guess as subtitle_language if next match is a subtitle language suffix + """ + dependency = SubtitlePrefixLanguageRule + consequence = RemoveMatch + + properties = {'subtitle_language': [None]} + + def enabled(self, context): + return not is_disabled(context, 'subtitle_language') + + def when(self, matches, context): + to_append = [] + to_remove = matches.named('subtitle_language.suffix') + for lang in matches.named('language'): + suffix = matches.next(lang, lambda match: match.name == 'subtitle_language.suffix', 0) + if suffix: + to_append.append(lang) + if suffix in to_remove: + to_remove.remove(suffix) + if to_append or to_remove: + return to_append, to_remove + return False + + def then(self, matches, when_response, context): + to_rename, to_remove = when_response + super(SubtitleSuffixLanguageRule, self).then(matches, to_remove, context) + for match in to_rename: + matches.remove(match) + match.name = 'subtitle_language' + matches.append(match) + + +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 source with it. + """ + consequence = [RemoveMatch, RenameMatch('subtitle_language')] + + properties = {'subtitle_language': [None]} + + def enabled(self, context): + return not is_disabled(context, 'subtitle_language') + + def when(self, matches, context): # pylint:disable=inconsistent-return-statements + subtitle_extension = matches.named('container', + lambda match: 'extension' in match.tags and 'subtitle' in match.tags, + 0) + if subtitle_extension: + subtitle_lang = matches.previous(subtitle_extension, lambda match: match.name == 'language', 0) + if subtitle_lang: + for weak in matches.named('subtitle_language', predicate=lambda m: 'weak-language' in m.tags): + weak.private = True + + return matches.conflicting(subtitle_lang, lambda m: m.name == 'source'), subtitle_lang + + +class RemoveLanguage(Rule): + """Remove language matches that were not converted to subtitle_language when language is disabled.""" + + consequence = RemoveMatch + + def enabled(self, context): + return is_disabled(context, 'language') + + def when(self, matches, context): + return matches.named('language') + + +class RemoveInvalidLanguages(Rule): + """Remove language matches that matches the blacklisted common words.""" + + consequence = RemoveMatch + priority = 32 + + def __init__(self, common_words): + """Constructor.""" + super(RemoveInvalidLanguages, self).__init__() + self.common_words = common_words + + def when(self, matches, context): + to_remove = [] + for match in matches.range(0, len(matches.input_string), + predicate=lambda m: m.name in ('language', 'subtitle_language')): + if match.raw.lower() not in self.common_words: + continue + + group = matches.markers.at_match(match, index=0, predicate=lambda m: m.name == 'group') + if group and ( + not matches.range( + group.start, group.end, predicate=lambda m: m.name not in ('language', 'subtitle_language') + ) and (not matches.holes(group.start, group.end, predicate=lambda m: m.value.strip(seps)))): + continue + + to_remove.append(match) + + return to_remove diff --git a/lib/guessit/rules/properties/mimetype.py b/lib/guessit/rules/properties/mimetype.py new file mode 100644 index 00000000..f9e642ff --- /dev/null +++ b/lib/guessit/rules/properties/mimetype.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +mimetype property +""" +import mimetypes + +from rebulk import Rebulk, CustomRule, POST_PROCESS +from rebulk.match import Match + +from ..common.pattern import is_disabled +from ...rules.processors import Processors + + +def mimetype(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'mimetype')) + rebulk.rules(Mimetype) + + return rebulk + + +class Mimetype(CustomRule): + """ + Mimetype post processor + :param matches: + :type matches: + :return: + :rtype: + """ + priority = POST_PROCESS + + dependency = Processors + + def when(self, matches, context): + mime, _ = mimetypes.guess_type(matches.input_string, strict=False) + return mime + + def then(self, matches, when_response, context): + mime = when_response + matches.append(Match(len(matches.input_string), len(matches.input_string), name='mimetype', value=mime)) + + @property + def properties(self): + """ + Properties for this rule. + """ + return {'mimetype': [None]} diff --git a/lib/guessit/rules/properties/other.py b/lib/guessit/rules/properties/other.py new file mode 100644 index 00000000..c7dc9a88 --- /dev/null +++ b/lib/guessit/rules/properties/other.py @@ -0,0 +1,383 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +other property +""" +import copy + +from rebulk import Rebulk, Rule, RemoveMatch, RenameMatch, POST_PROCESS, AppendMatch +from rebulk.remodule import re + +from ..common import dash +from ..common import seps +from ..common.pattern import is_disabled +from ..common.validators import seps_after, seps_before, seps_surround, and_ +from ...reutils import build_or_pattern +from ...rules.common.formatters import raw_cleanup + + +def other(config): # pylint:disable=unused-argument,too-many-statements + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'other')) + rebulk = rebulk.regex_defaults(flags=re.IGNORECASE, abbreviations=[dash]).string_defaults(ignore_case=True) + rebulk.defaults(name="other", validator=seps_surround) + + rebulk.regex('Audio-?Fix', 'Audio-?Fixed', value='Audio Fixed') + rebulk.regex('Sync-?Fix', 'Sync-?Fixed', value='Sync Fixed') + rebulk.regex('Dual', 'Dual-?Audio', value='Dual Audio') + rebulk.regex('ws', 'wide-?screen', value='Widescreen') + rebulk.regex('Re-?Enc(?:oded)?', value='Reencoded') + + rebulk.string('Repack', 'Rerip', value='Proper', + tags=['streaming_service.prefix', 'streaming_service.suffix']) + rebulk.string('Proper', value='Proper', + tags=['has-neighbor', 'streaming_service.prefix', 'streaming_service.suffix']) + + rebulk.regex('Real-Proper', 'Real-Repack', 'Real-Rerip', value='Proper', + tags=['streaming_service.prefix', 'streaming_service.suffix', 'real']) + rebulk.regex('Real', value='Proper', + tags=['has-neighbor', 'streaming_service.prefix', 'streaming_service.suffix', 'real']) + + rebulk.string('Fix', 'Fixed', value='Fix', tags=['has-neighbor-before', 'has-neighbor-after', + 'streaming_service.prefix', 'streaming_service.suffix']) + rebulk.string('Dirfix', 'Nfofix', 'Prooffix', value='Fix', + tags=['streaming_service.prefix', 'streaming_service.suffix']) + rebulk.regex('(?:Proof-?)?Sample-?Fix', value='Fix', + tags=['streaming_service.prefix', 'streaming_service.suffix']) + + rebulk.string('Fansub', value='Fan Subtitled', tags='has-neighbor') + rebulk.string('Fastsub', value='Fast Subtitled', tags='has-neighbor') + + season_words = build_or_pattern(["seasons?", "series?"]) + complete_articles = build_or_pattern(["The"]) + + def validate_complete(match): + """ + Make sure season word is are defined. + :param match: + :type match: + :return: + :rtype: + """ + children = match.children + if not children.named('completeWordsBefore') and not children.named('completeWordsAfter'): + return False + return True + + rebulk.regex('(?P<completeArticle>' + complete_articles + '-)?' + + '(?P<completeWordsBefore>' + season_words + '-)?' + + 'Complete' + '(?P<completeWordsAfter>-' + season_words + ')?', + private_names=['completeArticle', 'completeWordsBefore', 'completeWordsAfter'], + value={'other': 'Complete'}, + tags=['release-group-prefix'], + validator={'__parent__': and_(seps_surround, validate_complete)}) + rebulk.string('R5', value='Region 5') + rebulk.string('RC', value='Region C') + rebulk.regex('Pre-?Air', value='Preair') + rebulk.regex('(?:PS-?)Vita', value='PS Vita') + rebulk.regex('Vita', value='PS Vita', tags='has-neighbor') + rebulk.regex('(HD)(?P<another>Rip)', value={'other': 'HD', 'another': 'Rip'}, + private_parent=True, children=True, validator={'__parent__': seps_surround}, validate_all=True) + + for value in ('Screener', 'Remux', 'PAL', 'SECAM', 'NTSC', 'XXX'): + rebulk.string(value, value=value) + rebulk.string('3D', value='3D', tags='has-neighbor') + + rebulk.string('HQ', value='High Quality', tags='uhdbluray-neighbor') + rebulk.string('HR', value='High Resolution') + rebulk.string('LD', value='Line Dubbed') + rebulk.string('MD', value='Mic Dubbed') + rebulk.string('mHD', 'HDLight', value='Micro HD') + rebulk.string('LDTV', value='Low Definition') + rebulk.string('HFR', value='High Frame Rate') + rebulk.string('VFR', value='Variable Frame Rate') + rebulk.string('HD', value='HD', validator=None, + tags=['streaming_service.prefix', 'streaming_service.suffix']) + rebulk.regex('Full-?HD', 'FHD', value='Full HD', validator=None, + tags=['streaming_service.prefix', 'streaming_service.suffix']) + rebulk.regex('Ultra-?(?:HD)?', 'UHD', value='Ultra HD', validator=None, + tags=['streaming_service.prefix', 'streaming_service.suffix']) + rebulk.regex('Upscaled?', value='Upscaled') + + for value in ('Complete', 'Classic', 'Bonus', 'Trailer', 'Retail', + 'Colorized', 'Internal'): + rebulk.string(value, value=value, tags=['has-neighbor', 'release-group-prefix']) + rebulk.regex('LiNE', value='Line Audio', tags=['has-neighbor-before', 'has-neighbor-after', 'release-group-prefix']) + rebulk.regex('Read-?NFO', value='Read NFO') + rebulk.string('CONVERT', value='Converted', tags='has-neighbor') + rebulk.string('DOCU', 'DOKU', value='Documentary', tags='has-neighbor') + rebulk.string('OM', value='Open Matte', tags='has-neighbor') + rebulk.string('STV', value='Straight to Video', tags='has-neighbor') + rebulk.string('OAR', value='Original Aspect Ratio', tags='has-neighbor') + rebulk.string('Complet', value='Complete', tags=['has-neighbor', 'release-group-prefix']) + + for coast in ('East', 'West'): + rebulk.regex(r'(?:Live-)?(?:Episode-)?' + coast + '-?(?:Coast-)?Feed', value=coast + ' Coast Feed') + + rebulk.string('VO', 'OV', value='Original Video', tags='has-neighbor') + rebulk.string('Ova', 'Oav', value='Original Animated Video') + + rebulk.regex('Scr(?:eener)?', value='Screener', validator=None, + tags=['other.validate.screener', 'source-prefix', 'source-suffix']) + rebulk.string('Mux', value='Mux', validator=seps_after, + tags=['other.validate.mux', 'video-codec-prefix', 'source-suffix']) + rebulk.string('HC', 'vost', value='Hardcoded Subtitles') + + rebulk.string('SDR', value='Standard Dynamic Range', tags='uhdbluray-neighbor') + rebulk.regex('HDR(?:10)?', value='HDR10', tags='uhdbluray-neighbor') + rebulk.regex('Dolby-?Vision', value='Dolby Vision', tags='uhdbluray-neighbor') + rebulk.regex('BT-?2020', value='BT.2020', tags='uhdbluray-neighbor') + + rebulk.string('Sample', value='Sample', tags=['at-end', 'not-a-release-group']) + rebulk.string('Extras', value='Extras', tags='has-neighbor') + rebulk.regex('Digital-?Extras?', value='Extras') + rebulk.string('Proof', value='Proof', tags=['at-end', 'not-a-release-group']) + rebulk.string('Obfuscated', 'Scrambled', value='Obfuscated', tags=['at-end', 'not-a-release-group']) + rebulk.string('xpost', 'postbot', 'asrequested', value='Repost', tags='not-a-release-group') + + rebulk.rules(RenameAnotherToOther, ValidateHasNeighbor, ValidateHasNeighborAfter, ValidateHasNeighborBefore, + ValidateScreenerRule, ValidateMuxRule, ValidateHardcodedSubs, ValidateStreamingServiceNeighbor, + ValidateAtEnd, ValidateReal, ProperCountRule) + + return rebulk + + +class ProperCountRule(Rule): + """ + Add proper_count property + """ + priority = POST_PROCESS + + consequence = AppendMatch + + properties = {'proper_count': [None]} + + def when(self, matches, context): # pylint:disable=inconsistent-return-statements + propers = matches.named('other', lambda match: match.value == 'Proper') + if propers: + raws = {} # Count distinct raw values + for proper in propers: + raws[raw_cleanup(proper.raw)] = proper + proper_count_match = copy.copy(propers[-1]) + proper_count_match.name = 'proper_count' + + value = 0 + for raw in raws.values(): + value += 2 if 'real' in raw.tags else 1 + + proper_count_match.value = value + return proper_count_match + + +class RenameAnotherToOther(Rule): + """ + Rename `another` properties to `other` + """ + priority = 32 + consequence = RenameMatch('other') + + def when(self, matches, context): + return matches.named('another') + + +class ValidateHasNeighbor(Rule): + """ + Validate tag has-neighbor + """ + consequence = RemoveMatch + priority = 64 + + def when(self, matches, context): + ret = [] + for to_check in matches.range(predicate=lambda match: 'has-neighbor' in match.tags): + previous_match = matches.previous(to_check, index=0) + previous_group = matches.markers.previous(to_check, lambda marker: marker.name == 'group', 0) + if previous_group and (not previous_match or previous_group.end > previous_match.end): + previous_match = previous_group + if previous_match and not matches.input_string[previous_match.end:to_check.start].strip(seps): + break + next_match = matches.next(to_check, index=0) + next_group = matches.markers.next(to_check, lambda marker: marker.name == 'group', 0) + if next_group and (not next_match or next_group.start < next_match.start): + next_match = next_group + if next_match and not matches.input_string[to_check.end:next_match.start].strip(seps): + break + ret.append(to_check) + return ret + + +class ValidateHasNeighborBefore(Rule): + """ + Validate tag has-neighbor-before that previous match exists. + """ + consequence = RemoveMatch + priority = 64 + + def when(self, matches, context): + ret = [] + for to_check in matches.range(predicate=lambda match: 'has-neighbor-before' in match.tags): + next_match = matches.next(to_check, index=0) + next_group = matches.markers.next(to_check, lambda marker: marker.name == 'group', 0) + if next_group and (not next_match or next_group.start < next_match.start): + next_match = next_group + if next_match and not matches.input_string[to_check.end:next_match.start].strip(seps): + break + ret.append(to_check) + return ret + + +class ValidateHasNeighborAfter(Rule): + """ + Validate tag has-neighbor-after that next match exists. + """ + consequence = RemoveMatch + priority = 64 + + def when(self, matches, context): + ret = [] + for to_check in matches.range(predicate=lambda match: 'has-neighbor-after' in match.tags): + previous_match = matches.previous(to_check, index=0) + previous_group = matches.markers.previous(to_check, lambda marker: marker.name == 'group', 0) + if previous_group and (not previous_match or previous_group.end > previous_match.end): + previous_match = previous_group + if previous_match and not matches.input_string[previous_match.end:to_check.start].strip(seps): + break + ret.append(to_check) + return ret + + +class ValidateScreenerRule(Rule): + """ + Validate tag other.validate.screener + """ + consequence = RemoveMatch + priority = 64 + + def when(self, matches, context): + ret = [] + for screener in matches.named('other', lambda match: 'other.validate.screener' in match.tags): + source_match = matches.previous(screener, lambda match: match.initiator.name == 'source', 0) + if not source_match or matches.input_string[source_match.end:screener.start].strip(seps): + ret.append(screener) + return ret + + +class ValidateMuxRule(Rule): + """ + Validate tag other.validate.mux + """ + consequence = RemoveMatch + priority = 64 + + def when(self, matches, context): + ret = [] + for mux in matches.named('other', lambda match: 'other.validate.mux' in match.tags): + source_match = matches.previous(mux, lambda match: match.initiator.name == 'source', 0) + if not source_match: + ret.append(mux) + return ret + + +class ValidateHardcodedSubs(Rule): + """Validate HC matches.""" + + priority = 32 + consequence = RemoveMatch + + def when(self, matches, context): + to_remove = [] + for hc_match in matches.named('other', predicate=lambda match: match.value == 'Hardcoded Subtitles'): + next_match = matches.next(hc_match, predicate=lambda match: match.name == 'subtitle_language', index=0) + if next_match and not matches.holes(hc_match.end, next_match.start, + predicate=lambda match: match.value.strip(seps)): + continue + + previous_match = matches.previous(hc_match, + predicate=lambda match: match.name == 'subtitle_language', index=0) + if previous_match and not matches.holes(previous_match.end, hc_match.start, + predicate=lambda match: match.value.strip(seps)): + continue + + to_remove.append(hc_match) + + return to_remove + + +class ValidateStreamingServiceNeighbor(Rule): + """Validate streaming service's neighbors.""" + + priority = 32 + consequence = RemoveMatch + + def when(self, matches, context): + to_remove = [] + for match in matches.named('other', + predicate=lambda m: (m.initiator.name != 'source' + and ('streaming_service.prefix' in m.tags + or 'streaming_service.suffix' in m.tags))): + match = match.initiator + if not seps_after(match): + if 'streaming_service.prefix' in match.tags: + next_match = matches.next(match, lambda m: m.name == 'streaming_service', 0) + if next_match and not matches.holes(match.end, next_match.start, + predicate=lambda m: m.value.strip(seps)): + continue + if match.children: + to_remove.extend(match.children) + to_remove.append(match) + + elif not seps_before(match): + if 'streaming_service.suffix' in match.tags: + previous_match = matches.previous(match, lambda m: m.name == 'streaming_service', 0) + if previous_match and not matches.holes(previous_match.end, match.start, + predicate=lambda m: m.value.strip(seps)): + continue + + if match.children: + to_remove.extend(match.children) + to_remove.append(match) + + return to_remove + + +class ValidateAtEnd(Rule): + """Validate other which should occur at the end of a filepart.""" + + priority = 32 + consequence = RemoveMatch + + def when(self, matches, context): + to_remove = [] + for filepart in matches.markers.named('path'): + for match in matches.range(filepart.start, filepart.end, + predicate=lambda m: m.name == 'other' and 'at-end' in m.tags): + if (matches.holes(match.end, filepart.end, predicate=lambda m: m.value.strip(seps)) or + matches.range(match.end, filepart.end, predicate=lambda m: m.name not in ( + 'other', 'container'))): + to_remove.append(match) + + return to_remove + + +class ValidateReal(Rule): + """ + Validate Real + """ + consequence = RemoveMatch + priority = 64 + + def when(self, matches, context): + ret = [] + for filepart in matches.markers.named('path'): + for match in matches.range(filepart.start, filepart.end, lambda m: m.name == 'other' and 'real' in m.tags): + if not matches.range(filepart.start, match.start): + ret.append(match) + + return ret diff --git a/lib/guessit/rules/properties/part.py b/lib/guessit/rules/properties/part.py new file mode 100644 index 00000000..c1123394 --- /dev/null +++ b/lib/guessit/rules/properties/part.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +part property +""" +from rebulk.remodule import re + +from rebulk import Rebulk +from ..common import dash +from ..common.pattern import is_disabled +from ..common.validators import seps_surround, int_coercable, and_ +from ..common.numeral import numeral, parse_numeral +from ...reutils import build_or_pattern + + +def part(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'part')) + rebulk.regex_defaults(flags=re.IGNORECASE, abbreviations=[dash], validator={'__parent__': seps_surround}) + + prefixes = config['prefixes'] + + def validate_roman(match): + """ + Validate a roman match if surrounded by separators + :param match: + :type match: + :return: + :rtype: + """ + if int_coercable(match.raw): + return True + return seps_surround(match) + + rebulk.regex(build_or_pattern(prefixes) + r'-?(?P<part>' + numeral + r')', + prefixes=prefixes, validate_all=True, private_parent=True, children=True, formatter=parse_numeral, + validator={'part': and_(validate_roman, lambda m: 0 < m.value < 100)}) + + return rebulk diff --git a/lib/guessit/rules/properties/release_group.py b/lib/guessit/rules/properties/release_group.py new file mode 100644 index 00000000..ecff808b --- /dev/null +++ b/lib/guessit/rules/properties/release_group.py @@ -0,0 +1,347 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +release_group property +""" +import copy + +from rebulk import Rebulk, Rule, AppendMatch, RemoveMatch +from rebulk.match import Match + +from ..common import seps +from ..common.comparators import marker_sorted +from ..common.expected import build_expected_function +from ..common.formatters import cleanup +from ..common.pattern import is_disabled +from ..common.validators import int_coercable, seps_surround +from ..properties.title import TitleFromPosition + + +def release_group(config): + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + forbidden_groupnames = config['forbidden_names'] + + groupname_ignore_seps = config['ignored_seps'] + groupname_seps = ''.join([c for c in seps if c not in groupname_ignore_seps]) + + def clean_groupname(string): + """ + Removes and strip separators from input_string + :param string: + :type string: + :return: + :rtype: + """ + string = string.strip(groupname_seps) + if not (string.endswith(tuple(groupname_ignore_seps)) and string.startswith(tuple(groupname_ignore_seps))) \ + and not any(i in string.strip(groupname_ignore_seps) for i in groupname_ignore_seps): + string = string.strip(groupname_ignore_seps) + for forbidden in forbidden_groupnames: + if string.lower().startswith(forbidden) and string[len(forbidden):len(forbidden) + 1] in seps: + string = string[len(forbidden):] + string = string.strip(groupname_seps) + if string.lower().endswith(forbidden) and string[-len(forbidden) - 1:-len(forbidden)] in seps: + string = string[:len(forbidden)] + string = string.strip(groupname_seps) + return string.strip() + + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'release_group')) + + expected_group = build_expected_function('expected_group') + + rebulk.functional(expected_group, name='release_group', tags=['expected'], + validator=seps_surround, + conflict_solver=lambda match, other: other, + disabled=lambda context: not context.get('expected_group')) + + return rebulk.rules( + DashSeparatedReleaseGroup(clean_groupname), + SceneReleaseGroup(clean_groupname), + AnimeReleaseGroup + ) + + +_scene_previous_names = ('video_codec', 'source', 'video_api', 'audio_codec', 'audio_profile', 'video_profile', + 'audio_channels', 'screen_size', 'other', 'container', 'language', 'subtitle_language', + 'subtitle_language.suffix', 'subtitle_language.prefix', 'language.suffix') + +_scene_previous_tags = ('release-group-prefix',) + +_scene_no_previous_tags = ('no-release-group-prefix',) + + +class DashSeparatedReleaseGroup(Rule): + """ + Detect dash separated release groups that might appear at the end or at the beginning of a release name. + + Series.S01E02.Pilot.DVDRip.x264-CS.mkv + release_group: CS + abc-the.title.name.1983.1080p.bluray.x264.mkv + release_group: abc + + At the end: Release groups should be dash-separated and shouldn't contain spaces nor + appear in a group with other matches. The preceding matches should be separated by dot. + If a release group is found, the conflicting matches are removed. + + At the beginning: Release groups should be dash-separated and shouldn't contain spaces nor appear in a group. + It should be followed by a hole with dot-separated words. + Detection only happens if no matches exist at the beginning. + """ + consequence = [RemoveMatch, AppendMatch] + + def __init__(self, value_formatter): + """Default constructor.""" + super(DashSeparatedReleaseGroup, self).__init__() + self.value_formatter = value_formatter + + @classmethod + def is_valid(cls, matches, candidate, start, end, at_end): # pylint:disable=inconsistent-return-statements + """ + Whether a candidate is a valid release group. + """ + if not at_end: + if len(candidate.value) <= 1: + return False + + if matches.markers.at_match(candidate, predicate=lambda m: m.name == 'group'): + return False + + first_hole = matches.holes(candidate.end, end, predicate=lambda m: m.start == candidate.end, index=0) + if not first_hole: + return False + + raw_value = first_hole.raw + return raw_value[0] == '-' and '-' not in raw_value[1:] and '.' in raw_value and ' ' not in raw_value + + group = matches.markers.at_match(candidate, predicate=lambda m: m.name == 'group', index=0) + if group and matches.at_match(group, predicate=lambda m: not m.private and m.span != candidate.span): + return False + + count = 0 + match = candidate + while match: + current = matches.range(start, + match.start, + index=-1, + predicate=lambda m: not m.private and not 'expected' in m.tags) + if not current: + break + + separator = match.input_string[current.end:match.start] + if not separator and match.raw[0] == '-': + separator = '-' + + match = current + + if count == 0: + if separator != '-': + break + + count += 1 + continue + + if separator == '.': + return True + + def detect(self, matches, start, end, at_end): # pylint:disable=inconsistent-return-statements + """ + Detect release group at the end or at the beginning of a filepart. + """ + candidate = None + if at_end: + container = matches.ending(end, lambda m: m.name == 'container', index=0) + if container: + end = container.start + + candidate = matches.ending(end, index=0, predicate=( + lambda m: not m.private and not ( + m.name == 'other' and 'not-a-release-group' in m.tags + ) and '-' not in m.raw and m.raw.strip() == m.raw)) + + if not candidate: + if at_end: + candidate = matches.holes(start, end, seps=seps, index=-1, + predicate=lambda m: m.end == end and m.raw.strip(seps) and m.raw[0] == '-') + else: + candidate = matches.holes(start, end, seps=seps, index=0, + predicate=lambda m: m.start == start and m.raw.strip(seps)) + + if candidate and self.is_valid(matches, candidate, start, end, at_end): + return candidate + + def when(self, matches, context): # pylint:disable=inconsistent-return-statements + if matches.named('release_group'): + return + + to_remove = [] + to_append = [] + for filepart in matches.markers.named('path'): + candidate = self.detect(matches, filepart.start, filepart.end, True) + if candidate: + to_remove.extend(matches.at_match(candidate)) + else: + candidate = self.detect(matches, filepart.start, filepart.end, False) + + if candidate: + releasegroup = Match(candidate.start, candidate.end, name='release_group', + formatter=self.value_formatter, input_string=candidate.input_string) + + if releasegroup.value: + to_append.append(releasegroup) + if to_remove or to_append: + return to_remove, to_append + + +class SceneReleaseGroup(Rule): + """ + Add release_group match in existing matches (scene format). + + Something.XViD-ReleaseGroup.mkv + """ + dependency = [TitleFromPosition] + consequence = AppendMatch + + properties = {'release_group': [None]} + + def __init__(self, value_formatter): + """Default constructor.""" + super(SceneReleaseGroup, self).__init__() + self.value_formatter = value_formatter + + @staticmethod + def is_previous_match(match): + """ + Check if match can precede release_group + + :param match: + :return: + """ + return not match.tagged(*_scene_no_previous_tags) if match.name in _scene_previous_names else \ + match.tagged(*_scene_previous_tags) + + def when(self, matches, context): # pylint:disable=too-many-locals + # If a release_group is found before, ignore this kind of release_group rule. + + ret = [] + + for filepart in marker_sorted(matches.markers.named('path'), matches): + # pylint:disable=cell-var-from-loop + start, end = filepart.span + if matches.named('release_group', predicate=lambda m: m.start >= start and m.end <= end): + continue + + titles = matches.named('title', predicate=lambda m: m.start >= start and m.end <= end) + + def keep_only_first_title(match): + """ + Keep only first title from this filepart, as other ones are most likely release group. + + :param match: + :type match: + :return: + :rtype: + """ + return match in titles[1:] + + last_hole = matches.holes(start, end + 1, formatter=self.value_formatter, + ignore=keep_only_first_title, + predicate=lambda hole: cleanup(hole.value), index=-1) + + if last_hole: + def previous_match_filter(match): + """ + Filter to apply to find previous match + + :param match: + :type match: + :return: + :rtype: + """ + + if match.start < filepart.start: + return False + return not match.private or self.is_previous_match(match) + + previous_match = matches.previous(last_hole, + previous_match_filter, + index=0) + if previous_match and (self.is_previous_match(previous_match)) and \ + not matches.input_string[previous_match.end:last_hole.start].strip(seps) \ + and not int_coercable(last_hole.value.strip(seps)): + + last_hole.name = 'release_group' + last_hole.tags = ['scene'] + + # if hole is inside a group marker with same value, remove [](){} ... + group = matches.markers.at_match(last_hole, lambda marker: marker.name == 'group', 0) + if group: + group.formatter = self.value_formatter + if group.value == last_hole.value: + last_hole.start = group.start + 1 + last_hole.end = group.end - 1 + last_hole.tags = ['anime'] + + ignored_matches = matches.range(last_hole.start, last_hole.end, keep_only_first_title) + + for ignored_match in ignored_matches: + matches.remove(ignored_match) + + ret.append(last_hole) + return ret + + +class AnimeReleaseGroup(Rule): + """ + Add release_group match in existing matches (anime format) + ...[ReleaseGroup] Something.mkv + """ + dependency = [SceneReleaseGroup, TitleFromPosition] + consequence = [RemoveMatch, AppendMatch] + + properties = {'release_group': [None]} + + def when(self, matches, context): + to_remove = [] + to_append = [] + + # If a release_group is found before, ignore this kind of release_group rule. + if matches.named('release_group'): + return False + + if not matches.named('episode') and not matches.named('season') and matches.named('release_group'): + # This doesn't seems to be an anime, and we already found another release_group. + return False + + for filepart in marker_sorted(matches.markers.named('path'), matches): + + # pylint:disable=bad-continuation + empty_group = matches.markers.range(filepart.start, + filepart.end, + lambda marker: (marker.name == 'group' + and not matches.range(marker.start, marker.end, + lambda m: + 'weak-language' not in m.tags) + and marker.value.strip(seps) + and not int_coercable(marker.value.strip(seps))), 0) + + if empty_group: + group = copy.copy(empty_group) + group.marker = False + group.raw_start += 1 + group.raw_end -= 1 + group.tags = ['anime'] + group.name = 'release_group' + to_append.append(group) + to_remove.extend(matches.range(empty_group.start, empty_group.end, + lambda m: 'weak-language' in m.tags)) + + if to_remove or to_append: + return to_remove, to_append + return False diff --git a/lib/guessit/rules/properties/screen_size.py b/lib/guessit/rules/properties/screen_size.py new file mode 100644 index 00000000..83a797c1 --- /dev/null +++ b/lib/guessit/rules/properties/screen_size.py @@ -0,0 +1,163 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +screen_size property +""" +from rebulk.match import Match +from rebulk.remodule import re + +from rebulk import Rebulk, Rule, RemoveMatch, AppendMatch + +from ..common.pattern import is_disabled +from ..common.quantity import FrameRate +from ..common.validators import seps_surround +from ..common import dash, seps +from ...reutils import build_or_pattern + + +def screen_size(config): + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + interlaced = frozenset({res for res in config['interlaced']}) + progressive = frozenset({res for res in config['progressive']}) + frame_rates = [re.escape(rate) for rate in config['frame_rates']] + min_ar = config['min_ar'] + max_ar = config['max_ar'] + + rebulk = Rebulk() + rebulk = rebulk.string_defaults(ignore_case=True).regex_defaults(flags=re.IGNORECASE) + + rebulk.defaults(name='screen_size', validator=seps_surround, abbreviations=[dash], + disabled=lambda context: is_disabled(context, 'screen_size')) + + frame_rate_pattern = build_or_pattern(frame_rates, name='frame_rate') + interlaced_pattern = build_or_pattern(interlaced, name='height') + progressive_pattern = build_or_pattern(progressive, name='height') + + res_pattern = r'(?:(?P<width>\d{3,4})(?:x|\*))?' + rebulk.regex(res_pattern + interlaced_pattern + r'(?P<scan_type>i)' + frame_rate_pattern + '?') + rebulk.regex(res_pattern + progressive_pattern + r'(?P<scan_type>p)' + frame_rate_pattern + '?') + rebulk.regex(res_pattern + progressive_pattern + r'(?P<scan_type>p)?(?:hd)') + rebulk.regex(res_pattern + progressive_pattern + r'(?P<scan_type>p)?x?') + rebulk.string('4k', value='2160p') + rebulk.regex(r'(?P<width>\d{3,4})-?(?:x|\*)-?(?P<height>\d{3,4})', + conflict_solver=lambda match, other: '__default__' if other.name == 'screen_size' else other) + + rebulk.regex(frame_rate_pattern + '(p|fps)', name='frame_rate', + formatter=FrameRate.fromstring, disabled=lambda context: is_disabled(context, 'frame_rate')) + + rebulk.rules(PostProcessScreenSize(progressive, min_ar, max_ar), ScreenSizeOnlyOne, ResolveScreenSizeConflicts) + + return rebulk + + +class PostProcessScreenSize(Rule): + """ + Process the screen size calculating the aspect ratio if available. + + Convert to a standard notation (720p, 1080p, etc) when it's a standard resolution and + aspect ratio is valid or not available. + + It also creates an aspect_ratio match when available. + """ + consequence = AppendMatch + + def __init__(self, standard_heights, min_ar, max_ar): + super(PostProcessScreenSize, self).__init__() + self.standard_heights = standard_heights + self.min_ar = min_ar + self.max_ar = max_ar + + def when(self, matches, context): + to_append = [] + for match in matches.named('screen_size'): + if not is_disabled(context, 'frame_rate'): + for frame_rate in match.children.named('frame_rate'): + frame_rate.formatter = FrameRate.fromstring + to_append.append(frame_rate) + + values = match.children.to_dict() + if 'height' not in values: + continue + + scan_type = (values.get('scan_type') or 'p').lower() + height = values['height'] + if 'width' not in values: + match.value = '{0}{1}'.format(height, scan_type) + continue + + width = values['width'] + calculated_ar = float(width) / float(height) + + aspect_ratio = Match(match.start, match.end, input_string=match.input_string, + name='aspect_ratio', value=round(calculated_ar, 3)) + + if not is_disabled(context, 'aspect_ratio'): + to_append.append(aspect_ratio) + + if height in self.standard_heights and self.min_ar < calculated_ar < self.max_ar: + match.value = '{0}{1}'.format(height, scan_type) + else: + match.value = '{0}x{1}'.format(width, height) + + return to_append + + +class ScreenSizeOnlyOne(Rule): + """ + Keep a single screen_size per filepath part. + """ + consequence = RemoveMatch + + def when(self, matches, context): + to_remove = [] + for filepart in matches.markers.named('path'): + screensize = list(reversed(matches.range(filepart.start, filepart.end, + lambda match: match.name == 'screen_size'))) + if len(screensize) > 1 and len(set((match.value for match in screensize))) > 1: + to_remove.extend(screensize[1:]) + + return to_remove + + +class ResolveScreenSizeConflicts(Rule): + """ + Resolve screen_size conflicts with season and episode matches. + """ + consequence = RemoveMatch + + def when(self, matches, context): + to_remove = [] + for filepart in matches.markers.named('path'): + screensize = matches.range(filepart.start, filepart.end, lambda match: match.name == 'screen_size', 0) + if not screensize: + continue + + conflicts = matches.conflicting(screensize, lambda match: match.name in ('season', 'episode')) + if not conflicts: + continue + + has_neighbor = False + video_profile = matches.range(screensize.end, filepart.end, lambda match: match.name == 'video_profile', 0) + if video_profile and not matches.holes(screensize.end, video_profile.start, + predicate=lambda h: h.value and h.value.strip(seps)): + to_remove.extend(conflicts) + has_neighbor = True + + previous = matches.previous(screensize, index=0, predicate=( + lambda m: m.name in ('date', 'source', 'other', 'streaming_service'))) + if previous and not matches.holes(previous.end, screensize.start, + predicate=lambda h: h.value and h.value.strip(seps)): + to_remove.extend(conflicts) + has_neighbor = True + + if not has_neighbor: + to_remove.append(screensize) + + return to_remove diff --git a/lib/guessit/rules/properties/size.py b/lib/guessit/rules/properties/size.py new file mode 100644 index 00000000..c61580c0 --- /dev/null +++ b/lib/guessit/rules/properties/size.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +size property +""" +import re + +from rebulk import Rebulk + +from ..common import dash +from ..common.quantity import Size +from ..common.pattern import is_disabled +from ..common.validators import seps_surround + + +def size(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'size')) + rebulk.regex_defaults(flags=re.IGNORECASE, abbreviations=[dash]) + rebulk.defaults(name='size', validator=seps_surround) + rebulk.regex(r'\d+-?[mgt]b', r'\d+\.\d+-?[mgt]b', formatter=Size.fromstring, tags=['release-group-prefix']) + + return rebulk diff --git a/lib/guessit/rules/properties/source.py b/lib/guessit/rules/properties/source.py new file mode 100644 index 00000000..2fe55618 --- /dev/null +++ b/lib/guessit/rules/properties/source.py @@ -0,0 +1,235 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +source property +""" +import copy + +from rebulk.remodule import re + +from rebulk import AppendMatch, Rebulk, RemoveMatch, Rule + +from .audio_codec import HqConflictRule +from ..common import dash, seps +from ..common.pattern import is_disabled +from ..common.validators import seps_before, seps_after, or_ + + +def source(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'source')) + rebulk = rebulk.regex_defaults(flags=re.IGNORECASE, abbreviations=[dash], private_parent=True, children=True) + rebulk = rebulk.defaults(name='source', + tags=['video-codec-prefix', 'streaming_service.suffix'], + validate_all=True, + validator={'__parent__': or_(seps_before, seps_after)}) + + rip_prefix = '(?P<other>Rip)-?' + rip_suffix = '-?(?P<other>Rip)' + rip_optional_suffix = '(?:' + rip_suffix + ')?' + + def build_source_pattern(*patterns, **kwargs): + """Helper pattern to build source pattern.""" + prefix_format = kwargs.get('prefix') or '' + suffix_format = kwargs.get('suffix') or '' + + string_format = prefix_format + '({0})' + suffix_format + return [string_format.format(pattern) for pattern in patterns] + + def demote_other(match, other): # pylint: disable=unused-argument + """Default conflict solver with 'other' property.""" + return other if other.name == 'other' or other.name == 'release_group' else '__default__' + + rebulk.regex(*build_source_pattern('VHS', suffix=rip_optional_suffix), + value={'source': 'VHS', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('CAM', suffix=rip_optional_suffix), + value={'source': 'Camera', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('HD-?CAM', suffix=rip_optional_suffix), + value={'source': 'HD Camera', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('TELESYNC', 'TS', suffix=rip_optional_suffix), + value={'source': 'Telesync', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('HD-?TELESYNC', 'HD-?TS', suffix=rip_optional_suffix), + value={'source': 'HD Telesync', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('WORKPRINT', 'WP'), value='Workprint') + rebulk.regex(*build_source_pattern('TELECINE', 'TC', suffix=rip_optional_suffix), + value={'source': 'Telecine', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('HD-?TELECINE', 'HD-?TC', suffix=rip_optional_suffix), + value={'source': 'HD Telecine', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('PPV', suffix=rip_optional_suffix), + value={'source': 'Pay-per-view', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('SD-?TV', suffix=rip_optional_suffix), + value={'source': 'TV', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('TV', suffix=rip_suffix), # TV is too common to allow matching + value={'source': 'TV', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('TV', 'SD-?TV', prefix=rip_prefix), + value={'source': 'TV', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('TV-?(?=Dub)'), value='TV') + rebulk.regex(*build_source_pattern('DVB', 'PD-?TV', suffix=rip_optional_suffix), + value={'source': 'Digital TV', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('DVD', suffix=rip_optional_suffix), + value={'source': 'DVD', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('DM', suffix=rip_optional_suffix), + value={'source': 'Digital Master', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('VIDEO-?TS', 'DVD-?R(?:$|(?!E))', # 'DVD-?R(?:$|^E)' => DVD-Real ... + 'DVD-?9', 'DVD-?5'), value='DVD') + + rebulk.regex(*build_source_pattern('HD-?TV', suffix=rip_optional_suffix), conflict_solver=demote_other, + value={'source': 'HDTV', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('TV-?HD', suffix=rip_suffix), conflict_solver=demote_other, + value={'source': 'HDTV', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('TV', suffix='-?(?P<other>Rip-?HD)'), conflict_solver=demote_other, + value={'source': 'HDTV', 'other': 'Rip'}) + + rebulk.regex(*build_source_pattern('VOD', suffix=rip_optional_suffix), + value={'source': 'Video on Demand', 'other': 'Rip'}) + + rebulk.regex(*build_source_pattern('WEB', 'WEB-?DL', suffix=rip_suffix), + value={'source': 'Web', 'other': 'Rip'}) + # WEBCap is a synonym to WEBRip, mostly used by non english + rebulk.regex(*build_source_pattern('WEB-?(?P<another>Cap)', suffix=rip_optional_suffix), + value={'source': 'Web', 'other': 'Rip', 'another': 'Rip'}) + rebulk.regex(*build_source_pattern('WEB-?DL', 'WEB-?U?HD', 'DL-?WEB', 'DL(?=-?Mux)'), + value={'source': 'Web'}) + rebulk.regex('(WEB)', value='Web', tags='weak.source') + + rebulk.regex(*build_source_pattern('HD-?DVD', suffix=rip_optional_suffix), + value={'source': 'HD-DVD', 'other': 'Rip'}) + + rebulk.regex(*build_source_pattern('Blu-?ray', 'BD', 'BD[59]', 'BD25', 'BD50', suffix=rip_optional_suffix), + value={'source': 'Blu-ray', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('(?P<another>BR)-?(?=Scr(?:eener)?)', '(?P<another>BR)-?(?=Mux)'), # BRRip + value={'source': 'Blu-ray', 'another': 'Reencoded'}) + rebulk.regex(*build_source_pattern('(?P<another>BR)', suffix=rip_suffix), # BRRip + value={'source': 'Blu-ray', 'other': 'Rip', 'another': 'Reencoded'}) + + rebulk.regex(*build_source_pattern('Ultra-?Blu-?ray', 'Blu-?ray-?Ultra'), value='Ultra HD Blu-ray') + + rebulk.regex(*build_source_pattern('AHDTV'), value='Analog HDTV') + rebulk.regex(*build_source_pattern('UHD-?TV', suffix=rip_optional_suffix), conflict_solver=demote_other, + value={'source': 'Ultra HDTV', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('UHD', suffix=rip_suffix), conflict_solver=demote_other, + value={'source': 'Ultra HDTV', 'other': 'Rip'}) + + rebulk.regex(*build_source_pattern('DSR', 'DTH', suffix=rip_optional_suffix), + value={'source': 'Satellite', 'other': 'Rip'}) + rebulk.regex(*build_source_pattern('DSR?', 'SAT', suffix=rip_suffix), + value={'source': 'Satellite', 'other': 'Rip'}) + + rebulk.rules(ValidateSourcePrefixSuffix, ValidateWeakSource, UltraHdBlurayRule) + + return rebulk + + +class UltraHdBlurayRule(Rule): + """ + Replace other:Ultra HD and source:Blu-ray with source:Ultra HD Blu-ray + """ + dependency = HqConflictRule + consequence = [RemoveMatch, AppendMatch] + + @classmethod + def find_ultrahd(cls, matches, start, end, index): + """Find Ultra HD match.""" + return matches.range(start, end, index=index, predicate=( + lambda m: not m.private and m.name == 'other' and m.value == 'Ultra HD' + )) + + @classmethod + def validate_range(cls, matches, start, end): + """Validate no holes or invalid matches exist in the specified range.""" + return ( + not matches.holes(start, end, predicate=lambda m: m.value.strip(seps)) and + not matches.range(start, end, predicate=( + lambda m: not m.private and ( + m.name not in ('screen_size', 'color_depth') and ( + m.name != 'other' or 'uhdbluray-neighbor' not in m.tags)))) + ) + + def when(self, matches, context): + to_remove = [] + to_append = [] + for filepart in matches.markers.named('path'): + for match in matches.range(filepart.start, filepart.end, predicate=( + lambda m: not m.private and m.name == 'source' and m.value == 'Blu-ray')): + other = self.find_ultrahd(matches, filepart.start, match.start, -1) + if not other or not self.validate_range(matches, other.end, match.start): + other = self.find_ultrahd(matches, match.end, filepart.end, 0) + if not other or not self.validate_range(matches, match.end, other.start): + if not matches.range(filepart.start, filepart.end, predicate=( + lambda m: m.name == 'screen_size' and m.value == '2160p')): + continue + + if other: + other.private = True + + new_source = copy.copy(match) + new_source.value = 'Ultra HD Blu-ray' + to_remove.append(match) + to_append.append(new_source) + + if to_remove or to_append: + return to_remove, to_append + return False + + +class ValidateSourcePrefixSuffix(Rule): + """ + Validate source with source prefix, source suffix. + """ + priority = 64 + consequence = RemoveMatch + + def when(self, matches, context): + ret = [] + for filepart in matches.markers.named('path'): + for match in matches.range(filepart.start, filepart.end, predicate=lambda m: m.name == 'source'): + match = match.initiator + if not seps_before(match) and \ + not matches.range(match.start - 1, match.start - 2, + lambda m: 'source-prefix' in m.tags): + if match.children: + ret.extend(match.children) + ret.append(match) + continue + if not seps_after(match) and \ + not matches.range(match.end, match.end + 1, + lambda m: 'source-suffix' in m.tags): + if match.children: + ret.extend(match.children) + ret.append(match) + continue + + return ret + + +class ValidateWeakSource(Rule): + """ + Validate weak source + """ + dependency = [ValidateSourcePrefixSuffix] + priority = 64 + consequence = RemoveMatch + + def when(self, matches, context): + ret = [] + for filepart in matches.markers.named('path'): + for match in matches.range(filepart.start, filepart.end, predicate=lambda m: m.name == 'source'): + # if there are more than 1 source in this filepart, just before the year and with holes for the title + # most likely the source is part of the title + if 'weak.source' in match.tags \ + and matches.range(match.end, filepart.end, predicate=lambda m: m.name == 'source') \ + and matches.holes(filepart.start, match.start, + predicate=lambda m: m.value.strip(seps), index=-1): + if match.children: + ret.extend(match.children) + ret.append(match) + continue + + return ret diff --git a/lib/guessit/rules/properties/streaming_service.py b/lib/guessit/rules/properties/streaming_service.py new file mode 100644 index 00000000..f467f20a --- /dev/null +++ b/lib/guessit/rules/properties/streaming_service.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +streaming_service property +""" +import re + +from rebulk import Rebulk +from rebulk.rules import Rule, RemoveMatch + +from ..common.pattern import is_disabled +from ...rules.common import seps, dash +from ...rules.common.validators import seps_before, seps_after + + +def streaming_service(config): # pylint: disable=too-many-statements,unused-argument + """Streaming service property. + + :param config: rule configuration + :type config: dict + :return: + :rtype: Rebulk + """ + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'streaming_service')) + rebulk = rebulk.string_defaults(ignore_case=True).regex_defaults(flags=re.IGNORECASE, abbreviations=[dash]) + rebulk.defaults(name='streaming_service', tags=['source-prefix']) + + for value, items in config.items(): + patterns = items if isinstance(items, list) else [items] + for pattern in patterns: + if pattern.startswith('re:'): + rebulk.regex(pattern, value=value) + else: + rebulk.string(pattern, value=value) + + rebulk.rules(ValidateStreamingService) + + return rebulk + + +class ValidateStreamingService(Rule): + """Validate streaming service matches.""" + + priority = 128 + consequence = RemoveMatch + + def when(self, matches, context): + """Streaming service is always before source. + + :param matches: + :type matches: rebulk.match.Matches + :param context: + :type context: dict + :return: + """ + to_remove = [] + for service in matches.named('streaming_service'): + next_match = matches.next(service, lambda match: 'streaming_service.suffix' in match.tags, 0) + previous_match = matches.previous(service, lambda match: 'streaming_service.prefix' in match.tags, 0) + has_other = service.initiator and service.initiator.children.named('other') + + if not has_other: + if (not next_match or + matches.holes(service.end, next_match.start, + predicate=lambda match: match.value.strip(seps)) or + not seps_before(service)): + if (not previous_match or + matches.holes(previous_match.end, service.start, + predicate=lambda match: match.value.strip(seps)) or + not seps_after(service)): + to_remove.append(service) + continue + + if service.value == 'Comedy Central': + # Current match is a valid streaming service, removing invalid Criterion Collection (CC) matches + to_remove.extend(matches.named('edition', predicate=lambda match: match.value == 'Criterion')) + + return to_remove diff --git a/lib/guessit/rules/properties/title.py b/lib/guessit/rules/properties/title.py new file mode 100644 index 00000000..0d263016 --- /dev/null +++ b/lib/guessit/rules/properties/title.py @@ -0,0 +1,349 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +title property +""" + +from rebulk import Rebulk, Rule, AppendMatch, RemoveMatch, AppendTags +from rebulk.formatters import formatters + +from .film import FilmTitleRule +from .language import ( + SubtitlePrefixLanguageRule, + SubtitleSuffixLanguageRule, + SubtitleExtensionRule, + NON_SPECIFIC_LANGUAGES +) +from ..common import seps, title_seps +from ..common.comparators import marker_sorted +from ..common.expected import build_expected_function +from ..common.formatters import cleanup, reorder_title +from ..common.pattern import is_disabled +from ..common.validators import seps_surround + + +def title(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'title')) + rebulk.rules(TitleFromPosition, PreferTitleWithYear) + + expected_title = build_expected_function('expected_title') + + rebulk.functional(expected_title, name='title', tags=['expected', 'title'], + validator=seps_surround, + formatter=formatters(cleanup, reorder_title), + conflict_solver=lambda match, other: other, + disabled=lambda context: not context.get('expected_title')) + + return rebulk + + +class TitleBaseRule(Rule): + """ + Add title match in existing matches + """ + # pylint:disable=no-self-use,unused-argument + consequence = [AppendMatch, RemoveMatch] + + def __init__(self, match_name, match_tags=None, alternative_match_name=None): + super(TitleBaseRule, self).__init__() + self.match_name = match_name + self.match_tags = match_tags + self.alternative_match_name = alternative_match_name + + def hole_filter(self, hole, matches): + """ + Filter holes for titles. + :param hole: + :type hole: + :param matches: + :type matches: + :return: + :rtype: + """ + return True + + def filepart_filter(self, filepart, matches): + """ + Filter filepart for titles. + :param filepart: + :type filepart: + :param matches: + :type matches: + :return: + :rtype: + """ + return True + + def holes_process(self, holes, matches): + """ + process holes + :param holes: + :type holes: + :param matches: + :type matches: + :return: + :rtype: + """ + cropped_holes = [] + group_markers = matches.markers.named('group') + for group_marker in group_markers: + path_marker = matches.markers.at_match(group_marker, predicate=lambda m: m.name == 'path', index=0) + if path_marker and path_marker.span == group_marker.span: + group_markers.remove(group_marker) + + for hole in holes: + cropped_holes.extend(hole.crop(group_markers)) + + return cropped_holes + + @staticmethod + def is_ignored(match): + """ + Ignore matches when scanning for title (hole). + + Full word language and countries won't be ignored if they are uppercase. + """ + return not (len(match) > 3 and match.raw.isupper()) and match.name in ('language', 'country', 'episode_details') + + def should_keep(self, match, to_keep, matches, filepart, hole, starting): + """ + Check if this match should be accepted when ending or starting a hole. + :param match: + :type match: + :param to_keep: + :type to_keep: list[Match] + :param matches: + :type matches: Matches + :param hole: the filepart match + :type hole: Match + :param hole: the hole match + :type hole: Match + :param starting: true if match is starting the hole + :type starting: bool + :return: + :rtype: + """ + if match.name in ('language', 'country'): + # Keep language if exactly matching the hole. + if len(hole.value) == len(match.raw): + return True + + # Keep language if other languages exists in the filepart. + outside_matches = filepart.crop(hole) + other_languages = [] + for outside in outside_matches: + other_languages.extend(matches.range(outside.start, outside.end, + lambda c_match: c_match.name == match.name and + c_match not in to_keep and + c_match.value not in NON_SPECIFIC_LANGUAGES)) + + if not other_languages and (not starting or len(match.raw) <= 3): + return True + + return False + + def should_remove(self, match, matches, filepart, hole, context): + """ + Check if this match should be removed after beeing ignored. + :param match: + :param matches: + :param filepart: + :param hole: + :return: + """ + if context.get('type') == 'episode' and match.name == 'episode_details': + return match.start >= hole.start and match.end <= hole.end + return True + + def check_titles_in_filepart(self, filepart, matches, context): # pylint:disable=inconsistent-return-statements + """ + Find title in filepart (ignoring language) + """ + # pylint:disable=too-many-locals,too-many-branches,too-many-statements + start, end = filepart.span + + holes = matches.holes(start, end + 1, formatter=formatters(cleanup, reorder_title), + ignore=self.is_ignored, + predicate=lambda m: m.value) + + holes = self.holes_process(holes, matches) + + for hole in holes: + if not hole or (self.hole_filter and not self.hole_filter(hole, matches)): + continue + + to_remove = [] + to_keep = [] + + ignored_matches = matches.range(hole.start, hole.end, self.is_ignored) + + if ignored_matches: + for ignored_match in reversed(ignored_matches): + # pylint:disable=undefined-loop-variable, cell-var-from-loop + trailing = matches.chain_before(hole.end, seps, predicate=lambda m: m == ignored_match) + if trailing: + should_keep = self.should_keep(ignored_match, to_keep, matches, filepart, hole, False) + if should_keep: + # pylint:disable=unpacking-non-sequence + try: + append, crop = should_keep + except TypeError: + append, crop = should_keep, should_keep + if append: + to_keep.append(ignored_match) + if crop: + hole.end = ignored_match.start + + for ignored_match in ignored_matches: + if ignored_match not in to_keep: + starting = matches.chain_after(hole.start, seps, + predicate=lambda m: m == ignored_match) + if starting: + should_keep = self.should_keep(ignored_match, to_keep, matches, filepart, hole, True) + if should_keep: + # pylint:disable=unpacking-non-sequence + try: + append, crop = should_keep + except TypeError: + append, crop = should_keep, should_keep + if append: + to_keep.append(ignored_match) + if crop: + hole.start = ignored_match.end + + for match in ignored_matches: + if self.should_remove(match, matches, filepart, hole, context): + to_remove.append(match) + for keep_match in to_keep: + if keep_match in to_remove: + to_remove.remove(keep_match) + + if hole and hole.value: + hole.name = self.match_name + hole.tags = self.match_tags + if self.alternative_match_name: + # Split and keep values that can be a title + titles = hole.split(title_seps, lambda m: m.value) + for title_match in list(titles[1:]): + previous_title = titles[titles.index(title_match) - 1] + separator = matches.input_string[previous_title.end:title_match.start] + if len(separator) == 1 and separator == '-' \ + and previous_title.raw[-1] not in seps \ + and title_match.raw[0] not in seps: + titles[titles.index(title_match) - 1].end = title_match.end + titles.remove(title_match) + else: + title_match.name = self.alternative_match_name + + else: + titles = [hole] + return titles, to_remove + + def when(self, matches, context): + ret = [] + to_remove = [] + + if matches.named(self.match_name, lambda match: 'expected' in match.tags): + return False + + fileparts = [filepart for filepart in list(marker_sorted(matches.markers.named('path'), matches)) + if not self.filepart_filter or self.filepart_filter(filepart, matches)] + + # Priorize fileparts containing the year + years_fileparts = [] + for filepart in fileparts: + year_match = matches.range(filepart.start, filepart.end, lambda match: match.name == 'year', 0) + if year_match: + years_fileparts.append(filepart) + + for filepart in fileparts: + try: + years_fileparts.remove(filepart) + except ValueError: + pass + titles = self.check_titles_in_filepart(filepart, matches, context) + if titles: + titles, to_remove_c = titles + ret.extend(titles) + to_remove.extend(to_remove_c) + break + + # Add title match in all fileparts containing the year. + for filepart in years_fileparts: + titles = self.check_titles_in_filepart(filepart, matches, context) + if titles: + # pylint:disable=unbalanced-tuple-unpacking + titles, to_remove_c = titles + ret.extend(titles) + to_remove.extend(to_remove_c) + + if ret or to_remove: + return ret, to_remove + return False + + +class TitleFromPosition(TitleBaseRule): + """ + Add title match in existing matches + """ + dependency = [FilmTitleRule, SubtitlePrefixLanguageRule, SubtitleSuffixLanguageRule, SubtitleExtensionRule] + + properties = {'title': [None], 'alternative_title': [None]} + + def __init__(self): + super(TitleFromPosition, self).__init__('title', ['title'], 'alternative_title') + + def enabled(self, context): + return not is_disabled(context, 'alternative_title') + + +class PreferTitleWithYear(Rule): + """ + Prefer title where filepart contains year. + """ + dependency = TitleFromPosition + consequence = [RemoveMatch, AppendTags(['equivalent-ignore'])] + + properties = {'title': [None]} + + def when(self, matches, context): + with_year_in_group = [] + with_year = [] + titles = matches.named('title') + + for title_match in titles: + filepart = matches.markers.at_match(title_match, lambda marker: marker.name == 'path', 0) + if filepart: + year_match = matches.range(filepart.start, filepart.end, lambda match: match.name == 'year', 0) + if year_match: + group = matches.markers.at_match(year_match, lambda m: m.name == 'group') + if group: + with_year_in_group.append(title_match) + else: + with_year.append(title_match) + + to_tag = [] + if with_year_in_group: + title_values = {title_match.value for title_match in with_year_in_group} + to_tag.extend(with_year_in_group) + elif with_year: + title_values = {title_match.value for title_match in with_year} + to_tag.extend(with_year) + else: + title_values = {title_match.value for title_match in titles} + + to_remove = [] + for title_match in titles: + if title_match.value not in title_values: + to_remove.append(title_match) + if to_remove or to_tag: + return to_remove, to_tag + return False diff --git a/lib/guessit/rules/properties/type.py b/lib/guessit/rules/properties/type.py new file mode 100644 index 00000000..6a2877ef --- /dev/null +++ b/lib/guessit/rules/properties/type.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +type property +""" +from rebulk import CustomRule, Rebulk, POST_PROCESS +from rebulk.match import Match + +from ..common.pattern import is_disabled +from ...rules.processors import Processors + + +def _type(matches, value): + """ + Define type match with given value. + :param matches: + :param value: + :return: + """ + matches.append(Match(len(matches.input_string), len(matches.input_string), name='type', value=value)) + + +def type_(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'type')) + rebulk = rebulk.rules(TypeProcessor) + + return rebulk + + +class TypeProcessor(CustomRule): + """ + Post processor to find file type based on all others found matches. + """ + priority = POST_PROCESS + + dependency = Processors + + properties = {'type': ['episode', 'movie']} + + def when(self, matches, context): # pylint:disable=too-many-return-statements + option_type = context.get('type', None) + if option_type: + return option_type + + episode = matches.named('episode') + season = matches.named('season') + absolute_episode = matches.named('absolute_episode') + episode_details = matches.named('episode_details') + + if episode or season or episode_details or absolute_episode: + return 'episode' + + film = matches.named('film') + if film: + return 'movie' + + year = matches.named('year') + date = matches.named('date') + + if date and not year: + return 'episode' + + bonus = matches.named('bonus') + if bonus and not year: + return 'episode' + + crc32 = matches.named('crc32') + anime_release_group = matches.named('release_group', lambda match: 'anime' in match.tags) + if crc32 and anime_release_group: + return 'episode' + + return 'movie' + + def then(self, matches, when_response, context): + _type(matches, when_response) diff --git a/lib/guessit/rules/properties/video_codec.py b/lib/guessit/rules/properties/video_codec.py new file mode 100644 index 00000000..842a03c7 --- /dev/null +++ b/lib/guessit/rules/properties/video_codec.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +video_codec and video_profile property +""" +from rebulk import Rebulk, Rule, RemoveMatch +from rebulk.remodule import re + +from ..common import dash +from ..common.pattern import is_disabled +from ..common.validators import seps_after, seps_before, seps_surround + + +def video_codec(config): # pylint:disable=unused-argument + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk() + rebulk = rebulk.regex_defaults(flags=re.IGNORECASE, abbreviations=[dash]).string_defaults(ignore_case=True) + rebulk.defaults(name="video_codec", + tags=['source-suffix', 'streaming_service.suffix'], + disabled=lambda context: is_disabled(context, 'video_codec')) + + rebulk.regex(r'Rv\d{2}', value='RealVideo') + rebulk.regex('Mpe?g-?2', '[hx]-?262', value='MPEG-2') + rebulk.string("DVDivX", "DivX", value="DivX") + rebulk.string('XviD', value='Xvid') + rebulk.regex('VC-?1', value='VC-1') + rebulk.string('VP7', value='VP7') + rebulk.string('VP8', 'VP80', value='VP8') + rebulk.string('VP9', value='VP9') + rebulk.regex('[hx]-?263', value='H.263') + rebulk.regex('[hx]-?264', '(MPEG-?4)?AVC(?:HD)?', value='H.264') + rebulk.regex('[hx]-?265', 'HEVC', value='H.265') + rebulk.regex('(?P<video_codec>hevc)(?P<color_depth>10)', value={'video_codec': 'H.265', 'color_depth': '10-bit'}, + tags=['video-codec-suffix'], children=True) + + # http://blog.mediacoderhq.com/h264-profiles-and-levels/ + # https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC + rebulk.defaults(clear=True, + name="video_profile", + validator=seps_surround, + disabled=lambda context: is_disabled(context, 'video_profile')) + + rebulk.string('BP', value='Baseline', tags='video_profile.rule') + rebulk.string('XP', 'EP', value='Extended', tags='video_profile.rule') + rebulk.string('MP', value='Main', tags='video_profile.rule') + rebulk.string('HP', 'HiP', value='High', tags='video_profile.rule') + + # https://en.wikipedia.org/wiki/Scalable_Video_Coding + rebulk.string('SC', 'SVC', value='Scalable Video Coding', tags='video_profile.rule') + # https://en.wikipedia.org/wiki/AVCHD + rebulk.regex('AVC(?:HD)?', value='Advanced Video Codec High Definition', tags='video_profile.rule') + # https://en.wikipedia.org/wiki/H.265/HEVC + rebulk.string('HEVC', value='High Efficiency Video Coding', tags='video_profile.rule') + + rebulk.regex('Hi422P', value='High 4:2:2') + rebulk.regex('Hi444PP', value='High 4:4:4 Predictive') + rebulk.regex('Hi10P?', value='High 10') # no profile validation is required + + rebulk.string('DXVA', value='DXVA', name='video_api', + disabled=lambda context: is_disabled(context, 'video_api')) + + rebulk.defaults(clear=True, + name='color_depth', + validator=seps_surround, + disabled=lambda context: is_disabled(context, 'color_depth')) + rebulk.regex('12.?bits?', value='12-bit') + rebulk.regex('10.?bits?', 'YUV420P10', 'Hi10P?', value='10-bit') + rebulk.regex('8.?bits?', value='8-bit') + + rebulk.rules(ValidateVideoCodec, VideoProfileRule) + + return rebulk + + +class ValidateVideoCodec(Rule): + """ + Validate video_codec with source property or separated + """ + priority = 64 + consequence = RemoveMatch + + def enabled(self, context): + return not is_disabled(context, 'video_codec') + + def when(self, matches, context): + ret = [] + for codec in matches.named('video_codec'): + if not seps_before(codec) and \ + not matches.at_index(codec.start - 1, lambda match: 'video-codec-prefix' in match.tags): + ret.append(codec) + continue + if not seps_after(codec) and \ + not matches.at_index(codec.end + 1, lambda match: 'video-codec-suffix' in match.tags): + ret.append(codec) + continue + return ret + + +class VideoProfileRule(Rule): + """ + Rule to validate video_profile + """ + consequence = RemoveMatch + + def enabled(self, context): + return not is_disabled(context, 'video_profile') + + def when(self, matches, context): + profile_list = matches.named('video_profile', lambda match: 'video_profile.rule' in match.tags) + ret = [] + for profile in profile_list: + codec = matches.at_span(profile.span, lambda match: match.name == 'video_codec', 0) + if not codec: + codec = matches.previous(profile, lambda match: match.name == 'video_codec') + if not codec: + codec = matches.next(profile, lambda match: match.name == 'video_codec') + if not codec: + ret.append(profile) + return ret diff --git a/lib/guessit/rules/properties/website.py b/lib/guessit/rules/properties/website.py new file mode 100644 index 00000000..c1965311 --- /dev/null +++ b/lib/guessit/rules/properties/website.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Website property. +""" +from pkg_resources import resource_stream # @UnresolvedImport +from rebulk.remodule import re + +from rebulk import Rebulk, Rule, RemoveMatch +from ..common import seps +from ..common.formatters import cleanup +from ..common.pattern import is_disabled +from ..common.validators import seps_surround +from ...reutils import build_or_pattern + + +def website(config): + """ + Builder for rebulk object. + + :param config: rule configuration + :type config: dict + :return: Created Rebulk object + :rtype: Rebulk + """ + rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'website')) + rebulk = rebulk.regex_defaults(flags=re.IGNORECASE).string_defaults(ignore_case=True) + rebulk.defaults(name="website") + + with resource_stream('guessit', 'tlds-alpha-by-domain.txt') as tld_file: + tlds = [ + tld.strip().decode('utf-8') + for tld in tld_file.readlines() + if b'--' not in tld + ][1:] # All registered domain extension + + safe_tlds = config['safe_tlds'] # For sure a website extension + safe_subdomains = config['safe_subdomains'] # For sure a website subdomain + safe_prefix = config['safe_prefixes'] # Those words before a tlds are sure + website_prefixes = config['prefixes'] + + rebulk.regex(r'(?:[^a-z0-9]|^)((?:'+build_or_pattern(safe_subdomains) + + r'\.)+(?:[a-z-]+\.)+(?:'+build_or_pattern(tlds) + + r'))(?:[^a-z0-9]|$)', + children=True) + rebulk.regex(r'(?:[^a-z0-9]|^)((?:'+build_or_pattern(safe_subdomains) + + r'\.)*[a-z-]+\.(?:'+build_or_pattern(safe_tlds) + + r'))(?:[^a-z0-9]|$)', + safe_subdomains=safe_subdomains, safe_tlds=safe_tlds, children=True) + rebulk.regex(r'(?:[^a-z0-9]|^)((?:'+build_or_pattern(safe_subdomains) + + r'\.)*[a-z-]+\.(?:'+build_or_pattern(safe_prefix) + + r'\.)+(?:'+build_or_pattern(tlds) + + r'))(?:[^a-z0-9]|$)', + safe_subdomains=safe_subdomains, safe_prefix=safe_prefix, tlds=tlds, children=True) + + rebulk.string(*website_prefixes, + validator=seps_surround, private=True, tags=['website.prefix']) + + class PreferTitleOverWebsite(Rule): + """ + If found match is more likely a title, remove website. + """ + consequence = RemoveMatch + + @staticmethod + def valid_followers(match): + """ + Validator for next website matches + """ + return match.named('season', 'episode', 'year') + + def when(self, matches, context): + to_remove = [] + for website_match in matches.named('website'): + safe = False + for safe_start in safe_subdomains + safe_prefix: + if website_match.value.lower().startswith(safe_start): + safe = True + break + if not safe: + suffix = matches.next(website_match, PreferTitleOverWebsite.valid_followers, 0) + if suffix: + group = matches.markers.at_match(website_match, lambda marker: marker.name == 'group', 0) + if not group: + to_remove.append(website_match) + return to_remove + + rebulk.rules(PreferTitleOverWebsite, ValidateWebsitePrefix) + + return rebulk + + +class ValidateWebsitePrefix(Rule): + """ + Validate website prefixes + """ + priority = 64 + consequence = RemoveMatch + + def when(self, matches, context): + to_remove = [] + for prefix in matches.tagged('website.prefix'): + website_match = matches.next(prefix, predicate=lambda match: match.name == 'website', index=0) + if (not website_match or + matches.holes(prefix.end, website_match.start, + formatter=cleanup, seps=seps, predicate=lambda match: match.value)): + to_remove.append(prefix) + return to_remove diff --git a/lib/guessit/test/__init__.py b/lib/guessit/test/__init__.py new file mode 100644 index 00000000..e5be370e --- /dev/null +++ b/lib/guessit/test/__init__.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name diff --git a/lib/guessit/test/config/dummy.txt b/lib/guessit/test/config/dummy.txt new file mode 100644 index 00000000..7d6ca31b --- /dev/null +++ b/lib/guessit/test/config/dummy.txt @@ -0,0 +1 @@ +Not a configuration file \ No newline at end of file diff --git a/lib/guessit/test/config/test.json b/lib/guessit/test/config/test.json new file mode 100644 index 00000000..22f45d2a --- /dev/null +++ b/lib/guessit/test/config/test.json @@ -0,0 +1,4 @@ +{ + "expected_title": ["The 100", "OSS 117"], + "yaml": false +} diff --git a/lib/guessit/test/config/test.yaml b/lib/guessit/test/config/test.yaml new file mode 100644 index 00000000..6a4dfe15 --- /dev/null +++ b/lib/guessit/test/config/test.yaml @@ -0,0 +1,4 @@ +expected_title: + - The 100 + - OSS 117 +yaml: True diff --git a/lib/guessit/test/config/test.yml b/lib/guessit/test/config/test.yml new file mode 100644 index 00000000..6a4dfe15 --- /dev/null +++ b/lib/guessit/test/config/test.yml @@ -0,0 +1,4 @@ +expected_title: + - The 100 + - OSS 117 +yaml: True diff --git a/lib/guessit/test/enable_disable_properties.yml b/lib/guessit/test/enable_disable_properties.yml new file mode 100644 index 00000000..ada9c347 --- /dev/null +++ b/lib/guessit/test/enable_disable_properties.yml @@ -0,0 +1,335 @@ +? vorbis +: options: --exclude audio_codec + -audio_codec: Vorbis + +? DTS-ES +: options: --exclude audio_profile + audio_codec: DTS + -audio_profile: Extended Surround + +? DTS.ES +: options: --include audio_codec + audio_codec: DTS + -audio_profile: Extended Surround + +? 5.1 +? 5ch +? 6ch +: options: --exclude audio_channels + -audio_channels: '5.1' + +? Movie Title-x01-Other Title.mkv +? Movie Title-x01-Other Title +? directory/Movie Title-x01-Other Title/file.mkv +: options: --exclude bonus + -bonus: 1 + -bonus_title: Other Title + +? Title-x02-Bonus Title.mkv +: options: --include bonus + bonus: 2 + -bonus_title: Other Title + +? cd 1of3 +: options: --exclude cd + -cd: 1 + -cd_count: 3 + +? This.is.Us +: options: --exclude country + title: This is Us + -country: US + +? 2015.01.31 +: options: --exclude date + year: 2015 + -date: 2015-01-31 + +? Something 2 mar 2013) +: options: --exclude date + -date: 2013-03-02 + +? 2012 2009 S01E02 2015 # If no year is marked, the second one is guessed. +: options: --exclude year + -year: 2009 + +? Director's cut +: options: --exclude edition + -edition: Director's Cut + +? 2x5 +? 2X5 +? 02x05 +? 2X05 +? 02x5 +? S02E05 +? s02e05 +? s02e5 +? s2e05 +? s02ep05 +? s2EP5 +: options: --exclude season + -season: 2 + -episode: 5 + +? 2x6 +? 2X6 +? 02x06 +? 2X06 +? 02x6 +? S02E06 +? s02e06 +? s02e6 +? s2e06 +? s02ep06 +? s2EP6 +: options: --exclude episode + -season: 2 + -episode: 6 + +? serie Season 2 other +: options: --exclude season + -season: 2 + +? Some Dummy Directory/S02 Some Series/E01-Episode title.mkv +: options: --exclude episode_title + -episode_title: Episode title + season: 2 + episode: 1 + +? Another Dummy Directory/S02 Some Series/E01-Episode title.mkv +: options: --include season --include episode + -episode_title: Episode title + season: 2 + episode: 1 + +# pattern contains season and episode: it wont work enabling only one +? Some Series S03E01E02 +: options: --include episode + -season: 3 + -episode: [1, 2] + +# pattern contains season and episode: it wont work enabling only one +? Another Series S04E01E02 +: options: --include season + -season: 4 + -episode: [1, 2] + +? Show.Name.Season.4.Episode.1 +: options: --include episode + -season: 4 + episode: 1 + +? Another.Show.Name.Season.4.Episode.1 +: options: --include season + season: 4 + -episode: 1 + +? Some Series S01 02 03 +: options: --exclude season + -season: [1, 2, 3] + +? Some Series E01 02 04 +: options: --exclude episode + -episode: [1, 2, 4] + +? A very special episode s06 special +: options: -t episode --exclude episode_details + season: 6 + -episode_details: Special + +? S01D02.3-5-GROUP +: options: --exclude disc + -season: 1 + -disc: [2, 3, 4, 5] + -episode: [2, 3, 4, 5] + +? S01D02&4-6&8 +: options: --exclude season + -season: 1 + -disc: [2, 4, 5, 6, 8] + -episode: [2, 4, 5, 6, 8] + +? Film Title-f01-Series Title.mkv +: options: --exclude film + -film: 1 + -film_title: Film Title + +? Another Film Title-f01-Series Title.mkv +: options: --exclude film_title + film: 1 + -film_title: Film Title + +? English +? .ENG. +: options: --exclude language + -language: English + +? SubFrench +? SubFr +? STFr +: options: --exclude subtitle_language + -language: French + -subtitle_language: French + +? ST.FR +: options: --exclude subtitle_language + language: French + -subtitle_language: French + +? ENG.-.sub.FR +? ENG.-.FR Sub +: options: --include language + language: [English, French] + -subtitle_language: French + +? ENG.-.SubFR +: options: --include language + language: English + -subtitle_language: French + +? ENG.-.FRSUB +? ENG.-.FRSUBS +? ENG.-.FR-SUBS +: options: --include subtitle_language + -language: English + subtitle_language: French + +? DVD.Real.XViD +? DVD.fix.XViD +: options: --exclude other + -other: Fix + -proper_count: 1 + +? Part 3 +? Part III +? Part Three +? Part Trois +? Part3 +: options: --exclude part + -part: 3 + +? Some.Title.XViD-by.Artik[SEDG].avi +: options: --exclude release_group + -release_group: Artik[SEDG] + +? "[ABC] Some.Title.avi" +? some/folder/[ABC]Some.Title.avi +: options: --exclude release_group + -release_group: ABC + +? 360p +? 360px +? "360" +? +500x360 +: options: --exclude screen_size + -screen_size: 360p + +? 640x360 +: options: --exclude aspect_ratio + screen_size: 360p + -aspect_ratio: 1.778 + +? 8196x4320 +: options: --exclude screen_size + -screen_size: 4320p + -aspect_ratio: 1.897 + +? 4.3gb +: options: --exclude size + -size: 4.3GB + +? VhS_rip +? VHS.RIP +: options: --exclude source + -source: VHS + -other: Rip + +? DVD.RIP +: options: --include other + -source: DVD + -other: Rip + +? Title Only.avi +: options: --exclude title + -title: Title Only + +? h265 +? x265 +? h.265 +? x.265 +? hevc +: options: --exclude video_codec + -video_codec: H.265 + +? hevc10 +: options: --include color_depth + -video_codec: H.265 + -color_depth: 10-bit + +? HEVC-YUV420P10 +: options: --include color_depth + -video_codec: H.265 + color_depth: 10-bit + +? h265-HP +: options: --exclude video_profile + video_codec: H.265 + -video_profile: High + +? House.of.Cards.2013.S02E03.1080p.NF.WEBRip.DD5.1.x264-NTb.mkv +? House.of.Cards.2013.S02E03.1080p.Netflix.WEBRip.DD5.1.x264-NTb.mkv +: options: --exclude streaming_service + -streaming_service: Netflix + +? wawa.co.uk +: options: --exclude website + -website: wawa.co.uk + +? movie.mp4 +: options: --exclude mimetype + -mimetype: video/mp4 + +? another movie.mkv +: options: --exclude container + -container: mkv + +? series s02e01 +: options: --exclude type + -type: episode + +? series s02e01 +: options: --exclude type + -type: episode + +? Hotel.Hell.S01E01.720p.DD5.1.448kbps-ALANiS +: options: --exclude audio_bit_rate + -audio_bit_rate: 448Kbps + +? Katy Perry - Pepsi & Billboard Summer Beats Concert Series 2012 1080i HDTV 20 Mbps DD2.0 MPEG2-TrollHD.ts +: options: --exclude video_bit_rate + -video_bit_rate: 20Mbps + +? "[Figmentos] Monster 34 - At the End of Darkness [781219F1].mkv" +: options: --exclude crc32 + -crc32: 781219F1 + +? 1080p25 +: options: --exclude frame_rate + screen_size: 1080p + -frame_rate: 25fps + +? 1080p25 +: options: --exclude screen_size + -screen_size: 1080p + -frame_rate: 25fps + +? 1080p25 +: options: --include frame_rate + -screen_size: 1080p + -frame_rate: 25fps + +? 1080p 30fps +: options: --exclude screen_size + -screen_size: 1080p + frame_rate: 30fps diff --git a/lib/guessit/test/episodes.yml b/lib/guessit/test/episodes.yml new file mode 100644 index 00000000..4bbbde4a --- /dev/null +++ b/lib/guessit/test/episodes.yml @@ -0,0 +1,4693 @@ +? __default__ +: type: episode + +? Series/Californication/Season 2/Californication.2x05.Vaginatown.HDTV.XviD-0TV.avi +: title: Californication + season: 2 + episode: 5 + episode_title: Vaginatown + source: HDTV + video_codec: Xvid + release_group: 0TV + container: avi + +? Series/dexter/Dexter.5x02.Hello,.Bandit.ENG.-.sub.FR.HDTV.XviD-AlFleNi-TeaM.[tvu.org.ru].avi +: title: Dexter + season: 5 + episode: 2 + episode_title: Hello, Bandit + language: English + subtitle_language: French + source: HDTV + video_codec: Xvid + release_group: AlFleNi-TeaM + website: tvu.org.ru + container: avi + +? Series/Treme/Treme.1x03.Right.Place,.Wrong.Time.HDTV.XviD-NoTV.avi +: title: Treme + season: 1 + episode: 3 + episode_title: Right Place, Wrong Time + source: HDTV + video_codec: Xvid + release_group: NoTV + +? Series/Duckman/Duckman - S1E13 Joking The Chicken (unedited).avi +: title: Duckman + season: 1 + episode: 13 + episode_title: Joking The Chicken + +? Series/Simpsons/Saison 12 Français/Simpsons,.The.12x08.A.Bas.Le.Sergent.Skinner.FR.avi +: title: The Simpsons + season: 12 + episode: 8 + episode_title: A Bas Le Sergent Skinner + language: French + +? Series/Duckman/Duckman - 101 (01) - 20021107 - I, Duckman.avi +: title: Duckman + season: 1 + episode: 1 + episode_title: I, Duckman + date: 2002-11-07 + +? Series/Simpsons/Saison 12 Français/Simpsons,.The.12x08.A.Bas.Le.Sergent.Skinner.FR.avi +: title: The Simpsons + season: 12 + episode: 8 + episode_title: A Bas Le Sergent Skinner + language: French + +? Series/Futurama/Season 3 (mkv)/[™] Futurama - S03E22 - Le chef de fer à 30% ( 30 Percent Iron Chef ).mkv +: title: Futurama + season: 3 + episode: 22 + episode_title: Le chef de fer à 30% + +? Series/The Office/Season 6/The Office - S06xE01.avi +: title: The Office + season: 6 + episode: 1 + +? series/The Office/Season 4/The Office [401] Fun Run.avi +: title: The Office + season: 4 + episode: 1 + episode_title: Fun Run + +? Series/Mad Men Season 1 Complete/Mad.Men.S01E01.avi +: title: Mad Men + season: 1 + episode: 1 + other: Complete + +? series/Psych/Psych S02 Season 2 Complete English DVD/Psych.S02E02.65.Million.Years.Off.avi +: title: Psych + season: 2 + episode: 2 + episode_title: 65 Million Years Off + language: english + source: DVD + other: Complete + +? series/Psych/Psych S02 Season 2 Complete English DVD/Psych.S02E03.Psy.Vs.Psy.Français.srt +: title: Psych + season: 2 + episode: 3 + episode_title: Psy Vs Psy + source: DVD + language: English + subtitle_language: French + other: Complete + +? Series/Pure Laine/Pure.Laine.1x01.Toutes.Couleurs.Unies.FR.(Québec).DVB-Kceb.[tvu.org.ru].avi +: title: Pure Laine + season: 1 + episode: 1 + episode_title: Toutes Couleurs Unies + source: Digital TV + release_group: Kceb + language: french + website: tvu.org.ru + +? Series/Pure Laine/2x05 - Pure Laine - Je Me Souviens.avi +: title: Pure Laine + season: 2 + episode: 5 + episode_title: Je Me Souviens + +? Series/Tout sur moi/Tout sur moi - S02E02 - Ménage à trois (14-01-2008) [Rip by Ampli].avi +: title: Tout sur moi + season: 2 + episode: 2 + episode_title: Ménage à trois + date: 2008-01-14 + +? The.Mentalist.2x21.18-5-4.ENG.-.sub.FR.HDTV.XviD-AlFleNi-TeaM.[tvu.org.ru].avi +: title: The Mentalist + season: 2 + episode: 21 + episode_title: 18-5-4 + language: english + subtitle_language: french + source: HDTV + video_codec: Xvid + release_group: AlFleNi-TeaM + website: tvu.org.ru + +? series/__ Incomplete __/Dr Slump (Catalan)/Dr._Slump_-_003_DVB-Rip_Catalan_by_kelf.avi +: title: Dr Slump + episode: 3 + source: Digital TV + other: Rip + language: catalan + +# Disabling this test because it just doesn't looks like a serie ... +#? series/Ren and Stimpy - Black_hole_[DivX].avi +#: title: Ren and Stimpy +# episode_title: Black hole +# video_codec: DivX + +# Disabling this test because it just doesn't looks like a serie ... +# ? Series/Walt Disney/Donald.Duck.-.Good.Scouts.[www.bigernie.jump.to].avi +#: title: Donald Duck +# episode_title: Good Scouts +# website: www.bigernie.jump.to + +? Series/Neverwhere/Neverwhere.05.Down.Street.[tvu.org.ru].avi +: title: Neverwhere + episode: 5 + episode_title: Down Street + website: tvu.org.ru + +? Series/South Park/Season 4/South.Park.4x07.Cherokee.Hair.Tampons.DVDRip.[tvu.org.ru].avi +: title: South Park + season: 4 + episode: 7 + episode_title: Cherokee Hair Tampons + source: DVD + other: Rip + website: tvu.org.ru + +? Series/Kaamelott/Kaamelott - Livre V - Ep 23 - Le Forfait.avi +: title: Kaamelott + alternative_title: Livre V + episode: 23 + episode_title: Le Forfait + +? Series/Duckman/Duckman - 110 (10) - 20021218 - Cellar Beware.avi +: title: Duckman + season: 1 + episode: 10 + date: 2002-12-18 + episode_title: Cellar Beware + +# Removing this test because it doesn't look like a series +# ? Series/Ren & Stimpy/Ren And Stimpy - Onward & Upward-Adult Party Cartoon.avi +# : title: Ren And Stimpy +# episode_title: Onward & Upward-Adult Party Cartoon + +? Series/Breaking Bad/Minisodes/Breaking.Bad.(Minisodes).01.Good.Cop.Bad.Cop.WEBRip.XviD.avi +: title: Breaking Bad + episode_format: Minisode + episode: 1 + episode_title: Good Cop Bad Cop + source: Web + other: Rip + video_codec: Xvid + +? Series/My Name Is Earl/My.Name.Is.Earl.S01Extras.-.Bad.Karma.DVDRip.XviD.avi +: title: My Name Is Earl + season: 1 + episode_title: Bad Karma + source: DVD + other: [Extras, Rip] + video_codec: Xvid + +? series/Freaks And Geeks/Season 1/Episode 4 - Kim Kelly Is My Friend-eng(1).srt +: title: Freaks And Geeks + season: 1 + episode: 4 + episode_title: Kim Kelly Is My Friend + subtitle_language: English # This is really a subtitle_language, despite guessit 1.x assert for language. + +? /mnt/series/The Big Bang Theory/S01/The.Big.Bang.Theory.S01E01.mkv +: title: The Big Bang Theory + season: 1 + episode: 1 + +? /media/Parks_and_Recreation-s03-e01.mkv +: title: Parks and Recreation + season: 3 + episode: 1 + +? /media/Parks_and_Recreation-s03-e02-Flu_Season.mkv +: title: Parks and Recreation + season: 3 + episode_title: Flu Season + episode: 2 + +? /media/Parks_and_Recreation-s03-x01.mkv +: title: Parks and Recreation + season: 3 + episode: 1 + +? /media/Parks_and_Recreation-s03-x02-Gag_Reel.mkv +: title: Parks and Recreation + season: 3 + episode: 2 + episode_title: Gag Reel + +? /media/Band_of_Brothers-e01-Currahee.mkv +: title: Band of Brothers + episode: 1 + episode_title: Currahee + +? /media/Band_of_Brothers-x02-We_Stand_Alone_Together.mkv +: title: Band of Brothers + bonus: 2 + bonus_title: We Stand Alone Together + +? /TV Shows/Mad.M-5x9.mkv +: title: Mad M + season: 5 + episode: 9 + +? /TV Shows/new.girl.117.hdtv-lol.mp4 +: title: new girl + season: 1 + episode: 17 + source: HDTV + release_group: lol + +? Kaamelott - 5x44x45x46x47x48x49x50.avi +: title: Kaamelott + season: 5 + episode: [44, 45, 46, 47, 48, 49, 50] + +? Example S01E01-02.avi +? Example S01E01E02.avi +: title: Example + season: 1 + episode: [1, 2] + +? Series/Baccano!/Baccano!_-_T1_-_Trailer_-_[Ayu](dae8173e).mkv +: title: Baccano! + other: Trailer + release_group: Ayu + episode_title: T1 + crc32: dae8173e + +? Series/Doctor Who (2005)/Season 06/Doctor Who (2005) - S06E01 - The Impossible Astronaut (1).avi +: title: Doctor Who + year: 2005 + season: 6 + episode: 1 + episode_title: The Impossible Astronaut + +? The Sopranos - [05x07] - In Camelot.mp4 +: title: The Sopranos + season: 5 + episode: 7 + episode_title: In Camelot + +? The.Office.(US).1x03.Health.Care.HDTV.XviD-LOL.avi +: title: The Office + country: US + season: 1 + episode: 3 + episode_title: Health Care + source: HDTV + video_codec: Xvid + release_group: LOL + +? /Volumes/data-1/Series/Futurama/Season 3/Futurama_-_S03_DVD_Bonus_-_Deleted_Scenes_Part_3.ogm +: title: Futurama + season: 3 + part: 3 + source: DVD + other: Bonus + +? Ben.and.Kate.S01E02.720p.HDTV.X264-DIMENSION.mkv +: title: Ben and Kate + season: 1 + episode: 2 + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: DIMENSION + +? /volume1/TV Series/Drawn Together/Season 1/Drawn Together 1x04 Requiem for a Reality Show.avi +: title: Drawn Together + season: 1 + episode: 4 + episode_title: Requiem for a Reality Show + +? Sons.of.Anarchy.S05E06.720p.WEB.DL.DD5.1.H.264-CtrlHD.mkv +: title: Sons of Anarchy + season: 5 + episode: 6 + screen_size: 720p + source: Web + audio_channels: "5.1" + audio_codec: Dolby Digital + video_codec: H.264 + release_group: CtrlHD + +? /media/bdc64bfe-e36f-4af8-b550-e6fd2dfaa507/TV_Shows/Doctor Who (2005)/Saison 6/Doctor Who (2005) - S06E13 - The Wedding of River Song.mkv +: title: Doctor Who + season: 6 + episode: 13 + year: 2005 + episode_title: The Wedding of River Song + uuid: bdc64bfe-e36f-4af8-b550-e6fd2dfaa507 + +? /mnt/videos/tvshows/Doctor Who/Season 06/E13 - The Wedding of River Song.mkv +: title: Doctor Who + season: 6 + episode: 13 + episode_title: The Wedding of River Song + +? The.Simpsons.S24E03.Adventures.in.Baby-Getting.720p.WEB-DL.DD5.1.H.264-CtrlHD.mkv +: title: The Simpsons + season: 24 + episode: 3 + episode_title: Adventures in Baby-Getting + screen_size: 720p + source: Web + audio_channels: "5.1" + audio_codec: Dolby Digital + video_codec: H.264 + release_group: CtrlHD + +? /home/disaster/Videos/TV/Merlin/merlin_2008.5x02.arthurs_bane_part_two.repack.720p_hdtv_x264-fov.mkv +: title: merlin + season: 5 + episode: 2 + part: 2 + episode_title: arthurs bane + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: fov + year: 2008 + other: Proper + proper_count: 1 + +? "Da Vinci's Demons - 1x04 - The Magician.mkv" +: title: "Da Vinci's Demons" + season: 1 + episode: 4 + episode_title: The Magician + +? CSI.S013E18.Sheltered.720p.WEB-DL.DD5.1.H.264.mkv +: title: CSI + season: 13 + episode: 18 + episode_title: Sheltered + screen_size: 720p + source: Web + audio_channels: "5.1" + audio_codec: Dolby Digital + video_codec: H.264 + +? Game of Thrones S03E06 1080i HDTV DD5.1 MPEG2-TrollHD.ts +: title: Game of Thrones + season: 3 + episode: 6 + screen_size: 1080i + source: HDTV + audio_channels: "5.1" + audio_codec: Dolby Digital + video_codec: MPEG-2 + release_group: TrollHD + +? gossip.girl.s01e18.hdtv.xvid-2hd.eng.srt +: title: gossip girl + season: 1 + episode: 18 + source: HDTV + video_codec: Xvid + release_group: 2hd + subtitle_language: english + +? Wheels.S03E01E02.720p.HDTV.x264-IMMERSE.mkv +: title: Wheels + season: 3 + episode: [1, 2] + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: IMMERSE + +? Wheels.S03E01-02.720p.HDTV.x264-IMMERSE.mkv +: title: Wheels + season: 3 + episode: [1, 2] + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: IMMERSE + +? Wheels.S03E01-E02.720p.HDTV.x264-IMMERSE.mkv +: title: Wheels + season: 3 + episode: [1, 2] + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: IMMERSE + +? Wheels.S03E01-04.720p.HDTV.x264-IMMERSE.mkv +: title: Wheels + season: 3 + episode: [1, 2, 3, 4] + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: IMMERSE + +? Marvels.Agents.of.S.H.I.E.L.D-S01E06.720p.HDTV.X264-DIMENSION.mkv +: title: Marvels Agents of S.H.I.E.L.D + season: 1 + episode: 6 + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: DIMENSION + +? Marvels.Agents.of.S.H.I.E.L.D.S01E06.720p.HDTV.X264-DIMENSION.mkv +: title: Marvels Agents of S.H.I.E.L.D. + season: 1 + episode: 6 + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: DIMENSION + +? Marvels.Agents.of.S.H.I.E.L.D..S01E06.720p.HDTV.X264-DIMENSION.mkv +: title: Marvels Agents of S.H.I.E.L.D. + season: 1 + episode: 6 + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: DIMENSION + +? Series/Friday Night Lights/Season 1/Friday Night Lights S01E19 - Ch-Ch-Ch-Ch-Changes.avi +: title: Friday Night Lights + season: 1 + episode: 19 + episode_title: Ch-Ch-Ch-Ch-Changes + +? Dexter Saison VII FRENCH.BDRip.XviD-MiND.nfo +: title: Dexter + season: 7 + video_codec: Xvid + language: French + source: Blu-ray + other: Rip + release_group: MiND + +? Dexter Saison sept FRENCH.BDRip.XviD-MiND.nfo +: title: Dexter + season: 7 + video_codec: Xvid + language: French + source: Blu-ray + other: Rip + release_group: MiND + +? "Pokémon S16 - E29 - 1280*720 HDTV VF.mkv" +: title: Pokémon + source: HDTV + language: French + season: 16 + episode: 29 + screen_size: 720p + +? One.Piece.E576.VOSTFR.720p.HDTV.x264-MARINE-FORD.mkv +: episode: 576 + video_codec: H.264 + source: HDTV + title: One Piece + release_group: MARINE-FORD + subtitle_language: French + screen_size: 720p + +? Dexter.S08E12.FINAL.MULTi.1080p.BluRay.x264-MiND.mkv +: video_codec: H.264 + episode: 12 + season: 8 + source: Blu-ray + title: Dexter + episode_details: Final + language: Multiple languages + release_group: MiND + screen_size: 1080p + +? One Piece - E623 VOSTFR HD [www.manga-ddl-free.com].mkv +: website: www.manga-ddl-free.com + episode: 623 + subtitle_language: French + title: One Piece + other: HD + +? Falling Skies Saison 1.HDLight.720p.x264.VFF.mkv +: language: French + screen_size: 720p + season: 1 + title: Falling Skies + video_codec: H.264 + other: Micro HD + +? Sleepy.Hollow.S01E09.720p.WEB-DL.DD5.1.H.264-BP.mkv +: episode: 9 + video_codec: H.264 + source: Web + title: Sleepy Hollow + audio_channels: "5.1" + screen_size: 720p + season: 1 +# video_profile: BP # TODO: related to https://github.com/guessit-io/guessit/issues/458#issuecomment-305719715 + audio_codec: Dolby Digital + +? Sleepy.Hollow.S01E09.720p.WEB-DL.DD5.1.H.264-BS.mkv +: episode: 9 + video_codec: H.264 + source: Web + title: Sleepy Hollow + audio_channels: "5.1" + screen_size: 720p + season: 1 + release_group: BS + audio_codec: Dolby Digital + +? Battlestar.Galactica.S00.Pilot.FRENCH.DVDRip.XviD-NOTAG.avi +: title: Battlestar Galactica + season: 0 + episode_details: Pilot + episode_title: Pilot + language: French + source: DVD + other: Rip + video_codec: Xvid + release_group: NOTAG + +? The Big Bang Theory S00E00 Unaired Pilot VOSTFR TVRip XviD-VioCs +: title: The Big Bang Theory + season: 0 + episode: 0 + subtitle_language: French + source: TV + other: Rip + video_codec: Xvid + release_group: VioCs + episode_details: [Unaired, Pilot] + +? The Big Bang Theory S01E00 PROPER Unaired Pilot TVRip XviD-GIGGITY +: title: The Big Bang Theory + season: 1 + episode: 0 + source: TV + video_codec: Xvid + release_group: GIGGITY + other: [Proper, Rip] + proper_count: 1 + episode_details: [Unaired, Pilot] + +? Pawn.Stars.S2014E18.720p.HDTV.x264-KILLERS +: title: Pawn Stars + season: 2014 + year: 2014 + episode: 18 + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: KILLERS + +? 2.Broke.Girls.S03E10.480p.HDTV.x264-mSD.mkv +: title: 2 Broke Girls + season: 3 + episode: 10 + screen_size: 480p + source: HDTV + video_codec: H.264 + release_group: mSD + +? the.100.109.hdtv-lol.mp4 +: title: the 100 + season: 1 + episode: 9 + source: HDTV + release_group: lol + +? Criminal.Minds.5x03.Reckoner.ENG.-.sub.FR.HDTV.XviD-STi.[tvu.org.ru].avi +: title: Criminal Minds + language: English + subtitle_language: French + season: 5 + episode: 3 + video_codec: Xvid + source: HDTV + website: tvu.org.ru + release_group: STi + episode_title: Reckoner + +? 03-Criminal.Minds.avi +: title: Criminal Minds + episode: 3 + +? '[Evil-Saizen]_Laughing_Salesman_14_[DVD][1C98686A].mkv' +: crc32: 1C98686A + episode: 14 + source: DVD + release_group: Evil-Saizen + title: Laughing Salesman + +? '[Kaylith] Zankyou no Terror - 04 [480p][B4D4514E].mp4' +: crc32: B4D4514E + episode: 4 + release_group: Kaylith + screen_size: 480p + title: Zankyou no Terror + +? '[PuyaSubs!] Seirei Tsukai no Blade Dance - 05 [720p][32DD560E].mkv' +: crc32: 32DD560E + episode: 5 + release_group: PuyaSubs! + screen_size: 720p + title: Seirei Tsukai no Blade Dance + +? '[Doremi].Happiness.Charge.Precure.27.[1280x720].[DC91581A].mkv' +: crc32: DC91581A + episode: 27 + release_group: Doremi + screen_size: 720p + title: Happiness Charge Precure + +? "[Daisei] Free!:Iwatobi Swim Club - 01 ~ (BD 720p 10-bit AAC) [99E8E009].mkv" +: audio_codec: AAC + crc32: 99E8E009 + episode: 1 + source: Blu-ray + release_group: Daisei + screen_size: 720p + title: Free!:Iwatobi Swim Club + color_depth: 10-bit + +? '[Tsundere] Boku wa Tomodachi ga Sukunai - 03 [BDRip h264 1920x1080 10bit FLAC][AF0C22CC].mkv' +: audio_codec: FLAC + crc32: AF0C22CC + episode: 3 + source: Blu-ray + release_group: Tsundere + screen_size: 1080p + title: Boku wa Tomodachi ga Sukunai + video_codec: H.264 + color_depth: 10-bit + +? '[t.3.3.d]_Mikakunin_de_Shinkoukei_-_12_[720p][5DDC1352].mkv' +: crc32: 5DDC1352 + episode: 12 + screen_size: 720p + title: Mikakunin de Shinkoukei + release_group: t.3.3.d + +? '[Anime-Koi] Sabagebu! - 06 [h264-720p][ABB3728A].mkv' +: crc32: ABB3728A + episode: 6 + release_group: Anime-Koi + screen_size: 720p + title: Sabagebu! + video_codec: H.264 + +? '[aprm-Diogo4D] [BD][1080p] Nagi no Asukara 08 [4D102B7C].mkv' +: crc32: 4D102B7C + episode: 8 + source: Blu-ray + release_group: aprm-Diogo4D + screen_size: 1080p + title: Nagi no Asukara + +? '[Akindo-SSK] Zankyou no Terror - 05 [720P][Sub_ITA][F5CCE87C].mkv' +: crc32: F5CCE87C + episode: 5 + release_group: Akindo-SSK + screen_size: 720p + title: Zankyou no Terror + subtitle_language: it + +? Naruto Shippuden Episode 366 VOSTFR.avi +: episode: 366 + title: Naruto Shippuden + subtitle_language: fr + +? Naruto Shippuden Episode 366v2 VOSTFR.avi +: episode: 366 + version: 2 + title: Naruto Shippuden + subtitle_language: fr + +? '[HorribleSubs] Ao Haru Ride - 06 [480p].mkv' +: episode: 6 + release_group: HorribleSubs + screen_size: 480p + title: Ao Haru Ride + +? '[DeadFish] Tari Tari - 01 [BD][720p][AAC].mp4' +: audio_codec: AAC + episode: 1 + source: Blu-ray + release_group: DeadFish + screen_size: 720p + title: Tari Tari + +? '[NoobSubs] Sword Art Online II 06 (720p 8bit AAC).mp4' +: audio_codec: AAC + episode: 6 + release_group: NoobSubs + screen_size: 720p + title: Sword Art Online II + color_depth: 8-bit + +? '[DeadFish] 01 - Tari Tari [BD][720p][AAC].mp4' +: audio_codec: AAC + episode: 1 + source: Blu-ray + release_group: DeadFish + screen_size: 720p + title: Tari Tari + +? '[NoobSubs] 06 Sword Art Online II (720p 8bit AAC).mp4' +: audio_codec: AAC + episode: 6 + release_group: NoobSubs + screen_size: 720p + title: Sword Art Online II + color_depth: 8-bit + +? '[DeadFish] 12 - Tari Tari [BD][720p][AAC].mp4' +: audio_codec: AAC + episode: 12 + source: Blu-ray + release_group: DeadFish + screen_size: 720p + title: Tari Tari + +? Something.Season.2.1of4.Ep.Title.HDTV.torrent +: episode_count: 4 + episode: 1 + source: HDTV + season: 2 + title: Something + episode_title: Title + container: torrent + +? Something.Season.2of5.3of9.Ep.Title.HDTV.torrent +: episode_count: 9 + episode: 3 + source: HDTV + season: 2 + season_count: 5 + title: Something + episode_title: Title + container: torrent + +? Something.Other.Season.3of5.Complete.HDTV.torrent +: source: HDTV + other: Complete + season: 3 + season_count: 5 + title: Something Other + container: torrent + +? Something.Other.Season.1-3.avi +: season: [1, 2, 3] + title: Something Other + +? Something.Other.Season.1&3.avi +: season: [1, 3] + title: Something Other + +? Something.Other.Season.1&3-1to12ep.avi +: season: [1, 3] + title: Something Other + +? W2Test.123.HDTV.XViD-FlexGet +: episode: 23 + season: 1 + source: HDTV + release_group: FlexGet + title: W2Test + video_codec: Xvid + +? W2Test.123.HDTV.XViD-FlexGet +: options: --episode-prefer-number + episode: 123 + source: HDTV + release_group: FlexGet + title: W2Test + video_codec: Xvid + +? FooBar.0307.PDTV-FlexGet +: episode: 7 + source: Digital TV + release_group: FlexGet + season: 3 + title: FooBar + +? FooBar.0307.PDTV-FlexGet +? FooBar.307.PDTV-FlexGet +: options: --episode-prefer-number + episode: 307 + source: Digital TV + release_group: FlexGet + title: FooBar + +? FooBar.07.PDTV-FlexGet +: episode: 7 + source: Digital TV + release_group: FlexGet + title: FooBar + +? FooBar.7.PDTV-FlexGet +: episode: 7 + source: Digital TV + release_group: FlexGet + title: FooBar + +? FooBar.0307.PDTV-FlexGet +: episode: 7 + source: Digital TV + release_group: FlexGet + season: 3 + title: FooBar + +? FooBar.307.PDTV-FlexGet +: episode: 7 + source: Digital TV + release_group: FlexGet + season: 3 + title: FooBar + +? FooBar.07.PDTV-FlexGet +: episode: 7 + source: Digital TV + release_group: FlexGet + title: FooBar + +? FooBar.07v4.PDTV-FlexGet +: episode: 7 + version: 4 + source: Digital TV + release_group: FlexGet + title: FooBar + +? FooBar.7.PDTV-FlexGet +: source: Digital TV + release_group: FlexGet + title: FooBar 7 + type: movie + +? FooBar.7.PDTV-FlexGet +: options: -t episode + episode: 7 + source: Digital TV + release_group: FlexGet + title: FooBar + +? FooBar.7v3.PDTV-FlexGet +: options: -t episode + episode: 7 + version: 3 + source: Digital TV + release_group: FlexGet + title: FooBar + +? Test.S02E01.hdtv.real.proper +: episode: 1 + source: HDTV + other: Proper + proper_count: 2 + season: 2 + title: Test + +? Real.Test.S02E01.hdtv.proper +: episode: 1 + source: HDTV + other: Proper + proper_count: 1 + season: 2 + title: Real Test + +? Test.Real.S02E01.hdtv.proper +: episode: 1 + source: HDTV + other: Proper + proper_count: 1 + season: 2 + title: Test Real + +? Test.S02E01.hdtv.proper +: episode: 1 + source: HDTV + other: Proper + proper_count: 1 + season: 2 + title: Test + +? Test.S02E01.hdtv.real.repack.proper +: episode: 1 + source: HDTV + other: Proper + proper_count: 3 + season: 2 + title: Test + +? Date.Show.03-29-2012.HDTV.XViD-FlexGet +: date: 2012-03-29 + source: HDTV + release_group: FlexGet + title: Date Show + video_codec: Xvid + +? Something.1x5.Season.Complete-FlexGet +: episode: 5 + other: Complete + season: 1 + title: Something + release_group: FlexGet + +? Something Seasons 1 & 2 - Complete +: other: Complete + season: + - 1 + - 2 + title: Something + +? Something Seasons 4 Complete +: other: Complete + season: 4 + title: Something + +? Something.1xAll.Season.Complete-FlexGet +: other: Complete + season: 1 + title: Something + release_group: FlexGet + +? Something.1xAll-FlexGet +: other: Complete + season: 1 + title: Something + release_group: FlexGet + +? FlexGet.US.S2013E14.Title.Here.720p.HDTV.AAC5.1.x264-NOGRP +: audio_channels: '5.1' + audio_codec: AAC + country: US + episode: 14 + source: HDTV + release_group: NOGRP + screen_size: 720p + season: 2013 + title: FlexGet + episode_title: Title Here + video_codec: H.264 + year: 2013 + +? FlexGet.14.of.21.Title.Here.720p.HDTV.AAC5.1.x264-NOGRP +: audio_channels: '5.1' + audio_codec: AAC + episode_count: 21 + episode: 14 + source: HDTV + release_group: NOGRP + screen_size: 720p + title: FlexGet + episode_title: Title Here + video_codec: H.264 + +? FlexGet.Series.2013.14.of.21.Title.Here.720p.HDTV.AAC5.1.x264-NOGRP +: audio_channels: '5.1' + audio_codec: AAC + episode_count: 21 + episode: 14 + source: HDTV + release_group: NOGRP + screen_size: 720p + season: 2013 + title: FlexGet Series + episode_title: Title Here + video_codec: H.264 + year: 2013 + +? Something.S04E05E09 +: episode: # 1.x guessit this as a range from 5 to 9. But not sure if it should ... + - 5 + - 9 + season: 4 + title: Something + +? FooBar 360 1080i +: options: --episode-prefer-number + episode: 360 + screen_size: 1080i + title: FooBar + +? FooBar 360 1080i +: episode: 60 + season: 3 + screen_size: 1080i + title: FooBar + +? FooBar 360 +: season: 3 + episode: 60 + title: FooBar + -screen_size: 360p + +? BarFood christmas special HDTV +: options: --expected-title BarFood + source: HDTV + title: BarFood + episode_title: christmas special + episode_details: Special + +? Something.2008x12.13-FlexGet +: title: Something + date: 2008-12-13 + episode_title: FlexGet + +? '[Ignored] Test 12' +: episode: 12 + release_group: Ignored + title: Test + +? '[FlexGet] Test 12' +: episode: 12 + release_group: FlexGet + title: Test + +? Test.13.HDTV-Ignored +: episode: 13 + source: HDTV + release_group: Ignored + title: Test + +? Test.13.HDTV-Ignored +: options: --expected-series test + episode: 13 + source: HDTV + release_group: Ignored + title: Test + +? Test.13.HDTV-Ignored +: title: Test + episode: 13 + source: HDTV + release_group: Ignored + +? Test.13.HDTV-Ignored +: episode: 13 + source: HDTV + release_group: Ignored + title: Test + +? Test.13.HDTV-FlexGet +: episode: 13 + source: HDTV + release_group: FlexGet + title: Test + +? Test.14.HDTV-Name +: episode: 14 + source: HDTV + release_group: Name + title: Test + +? Real.Time.With.Bill.Maher.2014.10.31.HDTV.XviD-AFG.avi +: date: 2014-10-31 + source: HDTV + release_group: AFG + title: Real Time With Bill Maher + video_codec: Xvid + +? Arrow.S03E21.Al.Sah-Him.1080p.WEB-DL.DD5.1.H.264-BS.mkv +: title: Arrow + season: 3 + episode: 21 + episode_title: Al Sah-Him + screen_size: 1080p + audio_codec: Dolby Digital + audio_channels: "5.1" + video_codec: H.264 + release_group: BS + source: Web + +? How to Make It in America - S02E06 - I'm Sorry, Who's Yosi?.mkv +: title: How to Make It in America + season: 2 + episode: 6 + episode_title: I'm Sorry, Who's Yosi? + +? 24.S05E07.FRENCH.DVDRip.XviD-FiXi0N.avi +: episode: 7 + source: DVD + other: Rip + language: fr + season: 5 + title: '24' + video_codec: Xvid + release_group: FiXi0N + +? 12.Monkeys.S01E12.FRENCH.BDRip.x264-VENUE.mkv +: episode: 12 + source: Blu-ray + other: Rip + language: fr + release_group: VENUE + season: 1 + title: 12 Monkeys + video_codec: H.264 + +? 90.Day.Fiance.S02E07.I.Have.To.Tell.You.Something.720p.HDTV.x264-W4F +: episode: 7 + source: HDTV + screen_size: 720p + season: 2 + title: 90 Day Fiance + episode_title: I Have To Tell You Something + release_group: W4F + +? Doctor.Who.2005.S04E06.FRENCH.LD.DVDRip.XviD-TRACKS.avi +: episode: 6 + source: DVD + language: fr + release_group: TRACKS + season: 4 + title: Doctor Who + other: [Line Dubbed, Rip] + video_codec: Xvid + year: 2005 + +? Astro.Le.Petit.Robot.S01E01+02.FRENCH.DVDRiP.X264.INT-BOOLZ.mkv +: episode: [1, 2] + source: DVD + other: Rip + language: fr + release_group: INT-BOOLZ + season: 1 + title: Astro Le Petit Robot + video_codec: H.264 + +? Annika.Bengtzon.2012.E01.Le.Testament.De.Nobel.FRENCH.DVDRiP.XViD-STVFRV.avi +: episode: 1 + source: DVD + other: Rip + language: fr + release_group: STVFRV + title: Annika Bengtzon + episode_title: Le Testament De Nobel + video_codec: Xvid + year: 2012 + +? Dead.Set.02.FRENCH.LD.DVDRip.XviD-EPZ.avi +: episode: 2 + source: DVD + language: fr + other: [Line Dubbed, Rip] + release_group: EPZ + title: Dead Set + video_codec: Xvid + +? Phineas and Ferb S01E00 & S01E01 & S01E02 +: episode: [0, 1, 2] + season: 1 + title: Phineas and Ferb + +? Show.Name.S01E02.S01E03.HDTV.XViD.Etc-Group +: episode: [2, 3] + source: HDTV + release_group: Etc-Group + season: 1 + title: Show Name + video_codec: Xvid + +? Show Name - S01E02 - S01E03 - S01E04 - Ep Name +: episode: [2, 3, 4] + season: 1 + title: Show Name + episode_title: Ep Name + +? Show.Name.1x02.1x03.HDTV.XViD.Etc-Group +: episode: [2, 3] + source: HDTV + release_group: Etc-Group + season: 1 + title: Show Name + video_codec: Xvid + +? Show Name - 1x02 - 1x03 - 1x04 - Ep Name +: episode: [2, 3, 4] + season: 1 + title: Show Name + episode_title: Ep Name + +? Show.Name.S01E02.HDTV.XViD.Etc-Group +: episode: 2 + source: HDTV + release_group: Etc-Group + season: 1 + title: Show Name + video_codec: Xvid + +? Show Name - S01E02 - My Ep Name +: episode: 2 + season: 1 + title: Show Name + episode_title: My Ep Name + +? Show Name - S01.E03 - My Ep Name +: episode: 3 + season: 1 + title: Show Name + episode_title: My Ep Name + +? Show.Name.S01E02E03.HDTV.XViD.Etc-Group +: episode: [2, 3] + source: HDTV + release_group: Etc-Group + season: 1 + title: Show Name + video_codec: Xvid + +? Show Name - S01E02-03 - My Ep Name +: episode: [2, 3] + season: 1 + title: Show Name + episode_title: My Ep Name + +? Show.Name.S01.E02.E03 +: episode: [2, 3] + season: 1 + title: Show Name + +? Show_Name.1x02.HDTV_XViD_Etc-Group +: episode: 2 + source: HDTV + release_group: Etc-Group + season: 1 + title: Show Name + video_codec: Xvid + +? Show Name - 1x02 - My Ep Name +: episode: 2 + season: 1 + title: Show Name + episode_title: My Ep Name + +? Show_Name.1x02x03x04.HDTV_XViD_Etc-Group +: episode: [2, 3, 4] + source: HDTV + release_group: Etc-Group + season: 1 + title: Show Name + video_codec: Xvid + +? Show Name - 1x02-03-04 - My Ep Name +: episode: [2, 3, 4] + season: 1 + title: Show Name + episode_title: My Ep Name + +# 1x guess this as episode 100 but 101 as episode 1 season 1. +? Show.Name.100.Event.2010.11.23.HDTV.XViD.Etc-Group +: date: 2010-11-23 + season: 1 + episode: 0 + source: HDTV + release_group: Etc-Group + title: Show Name + episode_title: Event + video_codec: Xvid + +? Show.Name.101.Event.2010.11.23.HDTV.XViD.Etc-Group +: date: 2010-11-23 + season: 1 + episode: 1 + source: HDTV + release_group: Etc-Group + title: Show Name + episode_title: Event + video_codec: Xvid + +? Show.Name.2010.11.23.HDTV.XViD.Etc-Group +: date: 2010-11-23 + source: HDTV + release_group: Etc-Group + title: Show Name + +? Show Name - 2010-11-23 - Ep Name +: date: 2010-11-23 + title: Show Name + episode_title: Ep Name + +? Show Name Season 1 Episode 2 Ep Name +: episode: 2 + season: 1 + title: Show Name + episode_title: Ep Name + +? Show.Name.S01.HDTV.XViD.Etc-Group +: source: HDTV + release_group: Etc-Group + season: 1 + title: Show Name + video_codec: Xvid + +? Show.Name.E02-03 +: episode: [2, 3] + title: Show Name + +? Show.Name.E02.2010 +: episode: 2 + year: 2010 + title: Show Name + +? Show.Name.E23.Test +: episode: 23 + title: Show Name + episode_title: Test + +? Show.Name.Part.3.HDTV.XViD.Etc-Group +: part: 3 + title: Show Name + source: HDTV + video_codec: Xvid + release_group: Etc-Group + type: movie + # Fallback to movie type because we can't tell it's a series ... + +? Show.Name.Part.1.and.Part.2.Blah-Group +: part: [1, 2] + title: Show Name + type: movie + # Fallback to movie type because we can't tell it's a series ... + +? Show Name - 01 - Ep Name +: episode: 1 + title: Show Name + episode_title: Ep Name + +? 01 - Ep Name +: episode: 1 + title: Ep Name + +? Show.Name.102.HDTV.XViD.Etc-Group +: episode: 2 + source: HDTV + release_group: Etc-Group + season: 1 + title: Show Name + video_codec: Xvid + +? '[HorribleSubs] Maria the Virgin Witch - 01 [720p].mkv' +: episode: 1 + release_group: HorribleSubs + screen_size: 720p + title: Maria the Virgin Witch + +? '[ISLAND]One_Piece_679_[VOSTFR]_[V1]_[8bit]_[720p]_[EB7838FC].mp4' +: crc32: EB7838FC + episode: 679 + release_group: ISLAND + screen_size: 720p + title: One Piece + subtitle_language: fr + color_depth: 8-bit + version: 1 + +? '[ISLAND]One_Piece_679_[VOSTFR]_[8bit]_[720p]_[EB7838FC].mp4' +: crc32: EB7838FC + episode: 679 + release_group: ISLAND + screen_size: 720p + title: One Piece + subtitle_language: fr + color_depth: 8-bit + +? '[Kaerizaki-Fansub]_One_Piece_679_[VOSTFR][HD_1280x720].mp4' +: episode: 679 + other: HD + release_group: Kaerizaki-Fansub + screen_size: 720p + title: One Piece + subtitle_language: fr + +? '[Kaerizaki-Fansub]_One_Piece_679_[VOSTFR][FANSUB][HD_1280x720].mp4' +: episode: 679 + other: [Fan Subtitled, HD] + release_group: Kaerizaki-Fansub + screen_size: 720p + title: One Piece + subtitle_language: fr + +? '[Kaerizaki-Fansub]_One_Piece_681_[VOSTFR][HD_1280x720]_V2.mp4' +: episode: 681 + other: HD + release_group: Kaerizaki-Fansub + screen_size: 720p + title: One Piece + subtitle_language: fr + version: 2 + +? '[Kaerizaki-Fansub] High School DxD New 04 VOSTFR HD (1280x720) V2.mp4' +: episode: 4 + other: HD + release_group: Kaerizaki-Fansub + screen_size: 720p + title: High School DxD New + subtitle_language: fr + version: 2 + +? '[Kaerizaki-Fansub] One Piece 603 VOSTFR PS VITA (960x544) V2.mp4' +: episode: 603 + release_group: Kaerizaki-Fansub + other: PS Vita + screen_size: 960x544 + title: One Piece + subtitle_language: fr + version: 2 + +? '[Group Name] Show Name.13' +: episode: 13 + release_group: Group Name + title: Show Name + +? '[Group Name] Show Name - 13' +: episode: 13 + release_group: Group Name + title: Show Name + +? '[Group Name] Show Name 13' +: episode: 13 + release_group: Group Name + title: Show Name + +# [Group Name] Show Name.13-14 +# [Group Name] Show Name - 13-14 +# Show Name 13-14 + +? '[Stratos-Subs]_Infinite_Stratos_-_12_(1280x720_H.264_AAC)_[379759DB]' +: audio_codec: AAC + crc32: 379759DB + episode: 12 + release_group: Stratos-Subs + screen_size: 720p + title: Infinite Stratos + video_codec: H.264 + +# [ShinBunBu-Subs] Bleach - 02-03 (CX 1280x720 x264 AAC) + +? '[SGKK] Bleach 312v1 [720p/MKV]' +: episode: 312 + release_group: SGKK + screen_size: 720p + title: Bleach + version: 1 + +? '[Ayako]_Infinite_Stratos_-_IS_-_07_[H264][720p][EB7838FC]' +: crc32: EB7838FC + episode: 7 + release_group: Ayako + screen_size: 720p + title: Infinite Stratos + video_codec: H.264 + +? '[Ayako] Infinite Stratos - IS - 07v2 [H264][720p][44419534]' +: crc32: '44419534' + episode: 7 + release_group: Ayako + screen_size: 720p + title: Infinite Stratos + video_codec: H.264 + version: 2 + +? '[Ayako-Shikkaku] Oniichan no Koto Nanka Zenzen Suki Janain Dakara ne - 10 [LQ][h264][720p] [8853B21C]' +: crc32: 8853B21C + episode: 10 + release_group: Ayako-Shikkaku + screen_size: 720p + title: Oniichan no Koto Nanka Zenzen Suki Janain Dakara ne + video_codec: H.264 + +? Bleach - s16e03-04 - 313-314 +? Bleach.s16e03-04.313-314-GROUP +? Bleach s16e03e04 313-314 +: title: Bleach + season: 16 + episode: [3, 4] + absolute_episode: [313, 314] + +? Bleach - 313-314 +: options: -E + episode: [313, 314] + title: Bleach + +? '[ShinBunBu-Subs] Bleach - 02-03 (CX 1280x720 x264 AAC)' +: audio_codec: AAC + episode: [2, 3] + release_group: ShinBunBu-Subs + screen_size: 720p + title: Bleach + video_codec: H.264 + +? 003. Show Name - Ep Name.avi +: episode: 3 + title: Show Name + episode_title: Ep Name + +? 003-004. Show Name - Ep Name.avi +: episode: [3, 4] + title: Show Name + episode_title: Ep Name + +? One Piece - 102 +: episode: 2 + season: 1 + title: One Piece + +? "[ACX]_Wolf's_Spirit_001.mkv" +: episode: 1 + release_group: ACX + title: "Wolf's Spirit" + +? Project.Runway.S14E00.and.S14E01.(Eng.Subs).SDTV.x264-[2Maverick].mp4 +: episode: [0, 1] + source: TV + release_group: 2Maverick + season: 14 + title: Project Runway + subtitle_language: en + video_codec: H.264 + +? '[Hatsuyuki-Kaitou]_Fairy_Tail_2_-_16-20_[720p][10bit].torrent' +: episode: [16, 17, 18, 19, 20] + release_group: Hatsuyuki-Kaitou + screen_size: 720p + title: Fairy Tail 2 + color_depth: 10-bit + +? '[Hatsuyuki-Kaitou]_Fairy_Tail_2_-_16-20_(191-195)_[720p][10bit].torrent' +: episode: [16, 17, 18, 19, 20] + absolute_episode: [191, 192, 193, 194, 195] + release_group: Hatsuyuki-Kaitou + screen_size: 720p + title: Fairy Tail 2 + +? "Looney Tunes 1940x01 Porky's Last Stand.mkv" +: episode: 1 + season: 1940 + title: Looney Tunes + episode_title: Porky's Last Stand + year: 1940 + +? The.Good.Wife.S06E01.E10.720p.WEB-DL.DD5.1.H.264-CtrlHD/The.Good.Wife.S06E09.Trust.Issues.720p.WEB-DL.DD5.1.H.264-CtrlHD.mkv +: audio_channels: '5.1' + audio_codec: Dolby Digital + episode: 9 + source: Web + release_group: CtrlHD + screen_size: 720p + season: 6 + title: The Good Wife + episode_title: Trust Issues + video_codec: H.264 + +? Fear the Walking Dead - 01x02 - So Close, Yet So Far.REPACK-KILLERS.French.C.updated.Addic7ed.com.mkv +: episode: 2 + language: fr + other: Proper + proper_count: 1 + season: 1 + title: Fear the Walking Dead + episode_title: So Close, Yet So Far + +? Fear the Walking Dead - 01x02 - En Close, Yet En Far.REPACK-KILLERS.French.C.updated.Addic7ed.com.mkv +: episode: 2 + language: fr + other: Proper + proper_count: 1 + season: 1 + title: Fear the Walking Dead + episode_title: En Close, Yet En Far + +? /av/unsorted/The.Daily.Show.2015.07.22.Jake.Gyllenhaal.720p.HDTV.x264-BATV.mkv +: date: 2015-07-22 + source: HDTV + release_group: BATV + screen_size: 720p + title: The Daily Show + episode_title: Jake Gyllenhaal + video_codec: H.264 + +? "[7.1.7.8.5] Foo Bar - 11 (H.264) [5235532D].mkv" +: episode: 11 + +? my 720p show S01E02 +: options: -T "my 720p show" + title: my 720p show + season: 1 + episode: 2 + +? my 720p show S01E02 720p +: options: -T "my 720p show" + title: my 720p show + season: 1 + episode: 2 + screen_size: 720p + +? -my 720p show S01E02 +: options: -T "re:my \d+p show" + screen_size: 720p + +? Show S01E02 +: options: -T "The Show" + title: Show + season: 1 + episode: 2 + +? Foo's & Bars (2009) S01E01 720p XviD-2HD[AOEU] +: episode: 1 + release_group: 2HD[AOEU] + screen_size: 720p + season: 1 + title: Foo's & Bars + video_codec: Xvid + year: 2009 + +? Date.Series.10-11-2008.XViD +: date: 2008-11-10 + title: Date Series + video_codec: Xvid + +? Scrubs/SEASON-06/Scrubs.S06E09.My.Perspective.DVDRip.XviD-WAT/scrubs.s06e09.dvdrip.xvid-wat.avi +: container: avi + episode: 9 + episode_title: My Perspective + source: DVD + other: Rip + release_group: WAT + season: 6 + title: Scrubs + video_codec: Xvid + +? '[PuyaSubs!] Digimon Adventure tri - 01 [720p][F9967949].mkv' +: container: mkv + crc32: F9967949 + episode: 1 + release_group: PuyaSubs! + screen_size: 720p + title: Digimon Adventure tri + +? Sherlock.S01.720p.BluRay.x264-AVCHD +: source: Blu-ray + screen_size: 720p + season: 1 + title: Sherlock + video_codec: H.264 + +? Running.Wild.With.Bear.Grylls.S02E07.Michael.B.Jordan.PROPER.HDTV.x264-W4F.avi +: container: avi + episode: 7 + episode_title: Michael B Jordan + source: HDTV + other: Proper + proper_count: 1 + release_group: W4F + season: 2 + title: Running Wild With Bear Grylls + video_codec: H.264 + +? Homeland.S05E11.Our.Man.in.Damascus.German.Sub.720p.HDTV.x264.iNTERNAL-BaCKToRG +: episode: 11 + episode_title: Our Man in Damascus + source: HDTV + other: Internal + release_group: BaCKToRG + screen_size: 720p + season: 5 + subtitle_language: de + title: Homeland + type: episode + video_codec: H.264 + +? Breaking.Bad.S01E01.2008.BluRay.VC1.1080P.5.1.WMV-NOVO +: title: Breaking Bad + season: 1 + episode: 1 + year: 2008 + source: Blu-ray + screen_size: 1080p + audio_channels: '5.1' + container: WMV + release_group: NOVO + type: episode + +? Cosmos.A.Space.Time.Odyssey.S01E02.HDTV.x264.PROPER-LOL +: title: Cosmos A Space Time Odyssey + season: 1 + episode: 2 + source: HDTV + video_codec: H.264 + other: Proper + proper_count: 1 + release_group: LOL + type: episode + +? Fear.The.Walking.Dead.S02E01.HDTV.x264.AAC.MP4-k3n +: title: Fear The Walking Dead + season: 2 + episode: 1 + source: HDTV + video_codec: H.264 + audio_codec: AAC + container: mp4 + release_group: k3n + type: episode + +? Elementary.S01E01.Pilot.DVDSCR.x264.PREAiR-NoGRP +: title: Elementary + season: 1 + episode: 1 + episode_details: Pilot + episode_title: Pilot + source: DVD + video_codec: H.264 + other: [Screener, Preair] + release_group: NoGRP + type: episode + +? Once.Upon.a.Time.S05E19.HDTV.x264.REPACK-LOL[ettv] +: title: Once Upon a Time + season: 5 + episode: 19 + source: HDTV + video_codec: H.264 + other: Proper + proper_count: 1 + release_group: LOL[ettv] + type: episode + +? Show.Name.S01E03.WEB-DL.x264.HUN-nIk +: title: Show Name + season: 1 + episode: 3 + source: Web + video_codec: H.264 + language: hu + release_group: nIk + type: episode + +? Game.of.Thrones.S6.Ep5.X265.Dolby.2.0.KTM3.mp4 +: audio_channels: '2.0' + audio_codec: Dolby Digital + container: mp4 + episode: 5 + release_group: KTM3 + season: 6 + title: Game of Thrones + type: episode + video_codec: H.265 + +? Fargo.-.Season.1.-.720p.BluRay.-.x264.-.ShAaNiG +: source: Blu-ray + release_group: ShAaNiG + screen_size: 720p + season: 1 + title: Fargo + type: episode + video_codec: H.264 + +? Show.Name.S02E02.Episode.Title.1080p.WEB-DL.x264.5.1Ch.-.Group +: audio_channels: '5.1' + episode: 2 + episode_title: Episode Title + source: Web + release_group: Group + screen_size: 1080p + season: 2 + title: Show Name + type: episode + video_codec: H.264 + +? Breaking.Bad.S01E01.2008.BluRay.VC1.1080P.5.1.WMV-NOVO +: audio_channels: '5.1' + container: wmv + episode: 1 + source: Blu-ray + release_group: NOVO + screen_size: 1080p + season: 1 + title: Breaking Bad + type: episode + year: 2008 + +? Cosmos.A.Space.Time.Odyssey.S01E02.HDTV.x264.PROPER-LOL +: episode: 2 + source: HDTV + other: Proper + proper_count: 1 + release_group: LOL + season: 1 + title: Cosmos A Space Time Odyssey + type: episode + video_codec: H.264 + +? Elementary.S01E01.Pilot.DVDSCR.x264.PREAiR-NoGRP +: episode: 1 + episode_details: Pilot + episode_title: Pilot + source: DVD + other: + - Screener + - Preair + release_group: NoGRP + season: 1 + title: Elementary + type: episode + video_codec: H.264 + +? Fear.The.Walking.Dead.S02E01.HDTV.x264.AAC.MP4-k3n.mp4 +: audio_codec: AAC + container: mp4 + episode: 1 + source: HDTV + release_group: k3n + season: 2 + title: Fear The Walking Dead + type: episode + video_codec: H.264 + +? Game.of.Thrones.S03.1080p.BluRay.DTS-HD.MA.5.1.AVC.REMUX-FraMeSToR +: audio_channels: '5.1' + audio_codec: DTS-HD + audio_profile: Master Audio + source: Blu-ray + other: Remux + release_group: FraMeSToR + screen_size: 1080p + season: 3 + title: Game of Thrones + type: episode + +? Show.Name.S01E02.HDTV.x264.NL-subs-ABC +: episode: 2 + source: HDTV + release_group: ABC + season: 1 + subtitle_language: nl + title: Show Name + type: episode + video_codec: H.264 + +? Friends.S01-S10.COMPLETE.720p.BluRay.x264-PtM +: source: Blu-ray + other: Complete + release_group: PtM + screen_size: 720p + season: # Should it be [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] ? + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + - 9 + - 10 + title: Friends + type: episode + video_codec: H.264 + +? Duck.Dynasty.S02E07.Streik.German.DOKU.DL.WS.DVDRiP.x264-CDP +: episode: 7 + episode_title: Streik + source: DVD + language: + - German + - Multi + other: [Documentary, Widescreen, Rip] + release_group: CDP + season: 2 + title: Duck Dynasty + type: episode + video_codec: H.264 + +? Family.Guy.S13E14.JOLO.German.AC3D.DL.720p.WebHD.x264-CDD +: audio_codec: Dolby Digital + episode: 14 + episode_title: JOLO + source: Web + language: + - German + - Multi + release_group: CDD + screen_size: 720p + season: 13 + title: Family Guy + type: episode + video_codec: H.264 + +? How.I.Met.Your.Mother.COMPLETE.SERIES.DVDRip.XviD-AR +: options: -L en -C us + source: DVD + other: [Complete, Rip] + release_group: AR + title: How I Met Your Mother + type: movie # Should be episode + video_codec: Xvid + +? Show Name The Complete Seasons 1 to 5 720p BluRay x265 HEVC-SUJAIDR[UTR] +: source: Blu-ray + other: Complete + release_group: SUJAIDR[UTR] + screen_size: 720p + season: + - 1 + - 2 + - 3 + - 4 + - 5 + title: Show Name + type: episode + video_codec: H.265 + +? Fear.the.Walking.Dead.-.Season.2.epi.02.XviD.Eng.Ac3-5.1.sub.ita.eng.iCV-MIRCrew +: options: -t episode + audio_channels: '5.1' + audio_codec: Dolby Digital + episode: 2 + episode_title: epi + language: en + release_group: iCV-MIRCrew + season: 2 + subtitle_language: it + title: Fear the Walking Dead + type: episode + video_codec: Xvid + +? Game.Of.Thrones.S06E04.720p.PROPER.HDTV.x264-HDD +: episode: 4 + source: HDTV + other: Proper + proper_count: 1 + release_group: HDD + screen_size: 720p + season: 6 + title: Game Of Thrones + type: episode + video_codec: H.264 + +? Marvels.Daredevil.S02E04.WEBRip.x264-NF69.mkv +: container: mkv + episode: 4 + source: Web + other: Rip + release_group: NF69 + season: 2 + title: Marvels Daredevil + type: episode + video_codec: H.264 + +? The.Walking.Dead.S06E01.FRENCH.1080p.WEB-DL.DD5.1.HEVC.x265-GOLF68 +: audio_channels: '5.1' + audio_codec: Dolby Digital + episode: 1 + source: Web + language: fr + release_group: GOLF68 + screen_size: 1080p + season: 6 + title: The Walking Dead + type: episode + video_codec: H.265 + +? American.Crime.S01E03.FASTSUB.VOSTFR.720p.HDTV.x264-F4ST +: episode: 3 + source: HDTV + other: Fast Subtitled + release_group: F4ST + screen_size: 720p + season: 1 + subtitle_language: fr + title: American Crime + type: episode + video_codec: H.264 + +? Gotham.S02E12.FASTSUB.VOSTFR.HDTV.X264-F4ST3R +: episode: 12 + source: HDTV + other: Fast Subtitled + release_group: F4ST3R + season: 2 + subtitle_language: fr + title: Gotham + type: episode + video_codec: H.264 + +# WEBRip + LD +? Australian.Story.2016.05.23.Into.The.Fog.of.War.Part.1.360p.LDTV.WEBRIP.[MPup] +: title: Australian Story + date: 2016-05-23 + episode_title: Into The Fog of War + part: 1 + screen_size: 360p + other: [Low Definition, Rip] + source: Web + release_group: MPup + type: episode + +# AHDTV +? Show.Name.S04E06.FRENCH.AHDTV.XviD +: title: Show Name + season: 4 + episode: 6 + language: fr + source: Analog HDTV + video_codec: Xvid + type: episode + +# WEBDLRip +? Show.Name.s06e14.WEBDLRip.-qqss44.avi +: title: Show Name + season: 6 + episode: 14 + source: Web + other: Rip + release_group: qqss44 + container: avi + type: episode + +# WEBCap +? Steven.Universe.S03E06.Steven.Floats.720p.WEBCap.x264-SRS +: title: Steven Universe + season: 3 + episode: 6 + episode_title: Steven Floats + screen_size: 720p + source: Web + other: Rip + video_codec: H.264 + release_group: SRS + type: episode + +# DSR +? Show.Name.S05E09.Some.Episode.Title.WS.DSR.x264-[NY2] +: title: Show Name + season: 5 + episode: 9 + episode_title: Some Episode Title + other: Widescreen + source: Satellite + video_codec: H.264 + release_group: NY2 + type: episode + +# DSRip +? Squidbillies.S04E05.WS.DSRip.XviD-aAF +: title: Squidbillies + season: 4 + episode: 5 + other: [Widescreen, Rip] + source: Satellite + video_codec: Xvid + release_group: aAF + type: episode + + +? /series/The.B*.B*.T*.S10E01.1080p.HDTV.X264-DIMENSION[rarbg]/The.B*.B*.T*.S10E01.1080p.HDTV.X264-DIMENSION.mkv +: container: mkv + episode: 1 + source: HDTV + release_group: DIMENSION + screen_size: 1080p + season: 10 + title: The B B T + type: episode + video_codec: H.264 + +? '[Y-F] Very long Show Name Here - 03 Vostfr HD 8bits' +: release_group: Y-F + title: Very long Show Name Here + episode: 3 + subtitle_language: fr + other: HD + color_depth: 8-bit + type: episode + +? '[.www.site.com.].-.Snooze.and.Go.Sleep.S03E02.1080p.HEVC.x265-MeGusta' +: episode: 2 + release_group: MeGusta + screen_size: 1080p + season: 3 + title: Snooze and Go Sleep + type: episode + video_codec: H.265 + website: www.site.com + +? Show.Name.S01.720p.HDTV.DD5.1.x264-Group/show.name.0106.720p-group.mkv +: title: Show Name + season: 1 + screen_size: 720p + source: HDTV + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: Group + episode: 6 + container: mkv + type: episode + + +? Coupling Season 1 - 4 Complete DVDRip/Coupling Season 4/Coupling - (4x03) - Bed Time.mkv +: title: Coupling + other: [Complete, Rip] + source: DVD + season: 4 + episode: 3 + episode_title: Bed Time + container: mkv + type: episode + + +? Vice.News.Tonight.2016.10.10.1080p.HBO.WEBRip.AAC2.0.H.264-monkee +: title: Vice News Tonight + date: 2016-10-10 + screen_size: 1080p + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +? frasier.s8e6-768660.srt +: container: srt + episode: 6 + episode_title: '768660' + season: 8 + title: frasier + type: episode + +? Show.Name.S03E15.480p.177mb.Proper.HDTV.x264 +: title: Show Name + season: 3 + episode: 15 + screen_size: 480p + size: 177MB + other: Proper + proper_count: 1 + source: HDTV + video_codec: H.264 + type: episode + +? Show.Name.S03E15.480p.4.8GB.Proper.HDTV.x264 +: title: Show Name + season: 3 + episode: 15 + screen_size: 480p + size: 4.8GB + other: Proper + proper_count: 1 + source: HDTV + video_codec: H.264 + type: episode + +? Show.Name.S03.1.1TB.Proper.HDTV.x264 +: title: Show Name + season: 3 + size: 1.1TB + other: Proper + proper_count: 1 + source: HDTV + video_codec: H.264 + type: episode + +? Some.Show.S02E14.1080p.HDTV.X264-reenc.GROUP +? Some.Show.S02E14.1080p.HDTV.X264-re-enc.GROUP +? Some.Show.S02E14.1080p.HDTV.X264-re-encoded.GROUP +? Some.Show.S02E14.1080p.HDTV.X264-reencoded.GROUP +: title: Some Show + season: 2 + episode: 14 + screen_size: 1080p + source: HDTV + video_codec: H.264 + other: Reencoded + release_group: GROUP + type: episode + +# DDP is DD+ +? Show.Name.2016.S01E01.2160p.AMZN.WEBRip.DDP5.1.x264-Group +: title: Show Name + year: 2016 + season: 1 + episode: 1 + screen_size: 2160p + streaming_service: Amazon Prime + source: Web + other: Rip + audio_codec: Dolby Digital Plus + audio_channels: '5.1' + video_codec: H.264 + release_group: Group + type: episode + +? Show Name S02e19 [Mux - H264 - Ita Aac] DLMux by UBi +: title: Show Name + season: 2 + episode: 19 + video_codec: H.264 + language: it + audio_codec: AAC + source: Web + other: Mux + release_group: UBi + type: episode + +? Show Name S01e10[Mux - 1080p - H264 - Ita Eng Ac3 - Sub Ita Eng]DLMux By GiuseppeTnT Littlelinx +: title: Show Name + season: 1 + episode: 10 + screen_size: 1080p + video_codec: H.264 + language: [it, en] + source: Web + other: Mux + audio_codec: Dolby Digital + subtitle_language: [it, en] + release_group: GiuseppeTnT Littlelinx + type: episode + +? Show Name S04e07-08 [H264 - Ita Aac] HDTVMux by Group +: title: Show Name + season: 4 + episode: [7, 8] + video_codec: H.264 + language: it + audio_codec: AAC + source: HDTV + other: Mux + release_group: Group + type: episode + +? Show Name 3x18 Un Tuffo Nel Passato ITA HDTVMux x264 Group +: title: Show Name + season: 3 + episode: 18 + episode_title: Un Tuffo Nel Passato + language: it + source: HDTV + other: Mux + video_codec: H.264 + release_group: Group + type: episode + +? Show.Name.S03.1080p.BlurayMUX.AVC.DTS-HD.MA +: title: Show Name + season: 3 + screen_size: 1080p + source: Blu-ray + other: Mux + video_codec: H.264 + audio_codec: DTS-HD + audio_profile: Master Audio + type: episode + +? Show.Name.-.07.(2016).[RH].[English.Dubbed][WEBRip]..[HD.1080p] +: options: -t episode + episode: 7 + source: Web + other: Rip + language: en + other: [HD, Rip] + screen_size: 1080p + title: Show Name + type: episode + year: 2016 + +? Show.Name.-.476-479.(2007).[HorribleSubs][WEBRip]..[HD.720p] +: options: -t episode + episode: + - 476 + - 477 + - 478 + - 479 + source: Web + other: [Rip, HD] + release_group: HorribleSubs + screen_size: 720p + title: Show Name + type: episode + year: 2007 + +? /11.22.63/Season 1/11.22.63.106.hdtv-abc +: options: -T 11.22.63 + title: 11.22.63 + season: 1 + episode: 6 + source: HDTV + release_group: abc + type: episode + +? Proof.2015.S01E10.1080p.WEB-DL.DD5.1.H.264-KINGS.mkv +: title: Proof + season: 1 + episode: 10 + screen_size: 1080p + source: Web + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: KINGS + container: mkv + type: episode + +# Hardcoded subtitles +? Show.Name.S06E16.HC.SWESUB.HDTV.x264 +: title: Show Name + season: 6 + episode: 16 + other: Hardcoded Subtitles + source: HDTV + video_codec: H.264 + subtitle_language: sv + type: episode + +? From [ WWW.TORRENTING.COM ] - White.Rabbit.Project.S01E08.1080p.NF.WEBRip.DD5.1.x264-ViSUM/White.Rabbit.Project.S01E08.1080p.NF.WEBRip.DD5.1.x264-ViSUM.mkv +: title: White Rabbit Project + website: WWW.TORRENTING.COM + season: 1 + episode: 8 + screen_size: 1080p + streaming_service: Netflix + source: Web + other: Rip + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: ViSUM + container: mkv + type: episode + +? /tv/Daniel Tiger's Neighborhood/S02E06 - Playtime Is Different.mp4 +: season: 2 + episode: 6 + title: Daniel Tiger's Neighborhood + episode_title: Playtime Is Different + container: mp4 + type: episode + +? Zoo.S02E05.1080p.WEB-DL.DD5.1.H.264.HKD/160725_02.mkv +: title: Zoo + season: 2 + episode: 5 + screen_size: 1080p + source: Web + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: HKD + container: mkv + type: episode + +? We.Bare.Bears.S01E14.Brother.Up.1080p.WEB-DL.AAC2.0.H.264-TVSmash/mxNMuJWeO7PUWCMEwqKSsS6D8Vs9S6V3PHD.mkv +: title: We Bare Bears + season: 1 + episode: 14 + episode_title: Brother Up + screen_size: 1080p + source: Web + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: TVSmash + container: mkv + type: episode + +? Beyond.S01E02.Tempus.Fugit.720p.FREE.WEBRip.AAC2.0.x264-BTW/gNWDXow11s7E0X7GTDrZ.mkv +: title: Beyond + season: 1 + episode: 2 + episode_title: Tempus Fugit + screen_size: 720p + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: BTW + container: mkv + type: episode + +? Bones.S12E02.The.Brain.In.The.Bot.1080p.WEB-DL.DD5.1.H.264-R2D2/161219_06.mkv +: title: Bones + season: 12 + episode: 2 + episode_title: The Brain In The Bot + screen_size: 1080p + source: Web + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: R2D2 + container: mkv + type: episode + +? The.Messengers.2015.S01E07.1080p.WEB-DL.DD5.1.H264.Nlsubs-Q/QoQ-sbuSLN.462.H.1.5DD.LD-BEW.p0801.70E10S.5102.sregnesseM.ehT.mkv +: title: The Messengers + year: 2015 + season: 1 + episode: 7 + screen_size: 1080p + source: Web + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + subtitle_language: nl + release_group: Q + container: mkv + type: episode + +? /Finding.Carter.S02E01.Love.the.Way.You.Lie.1080p.WEB-DL.AAC2.0.H.264-NL/LN-462.H.0.2CAA.LD-BEW.p0801.eiL.uoY.yaW.eht.evoL.10E20S.retraC.gnidniF.mkv +: title: Finding Carter + season: 2 + episode: 1 + episode_title: Love the Way You Lie + screen_size: 1080p + source: Web + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: NL + container: mkv + type: episode + +? Mr.Robot.S02E12.1080p.WEB-DL.DD5.1-NL.Subs-Het.Robot.Team.OYM/sbuS LN-1.5DD LD-BEW p0801 21E20S toboR .rM.mkv +: title: Mr Robot + season: 2 + episode: 12 + screen_size: 1080p + source: Web + audio_codec: Dolby Digital + audio_channels: '5.1' + release_group: Het.Robot.Team.OYM + type: episode + +? Show.Name.-.Temporada.1.720p.HDTV.x264[Cap.102]SPANISH.AUDIO-NEWPCT +? /Show Name/Season 01/Show.Name.-.Temporada.1.720p.HDTV.x264[Cap.102]SPANISH.AUDIO-NEWPCT +? /Show Name/Temporada 01/Show.Name.-.Temporada.1.720p.HDTV.x264[Cap.102]SPANISH.AUDIO-NEWPCT +: title: Show Name + season: 1 + episode: 2 + screen_size: 720p + source: HDTV + video_codec: H.264 + language: es + release_group: NEWPCT + type: episode + +# newpct +? Show Name - Temporada 4 [HDTV][Cap.408][Espanol Castellano] +? Show Name - Temporada 4 [HDTV][Cap.408][Español Castellano] +: title: Show Name + season: 4 + episode: 8 + source: HDTV + language: ca + type: episode + +# newpct +? -Show Name - Temporada 4 [HDTV][Cap.408][Espanol Castellano] +? -Show Name - Temporada 4 [HDTV][Cap.408][Español Castellano] +: release_group: Castellano + +# newpct +? Show.Name.-.Temporada1.[HDTV][Cap.105][Español.Castellano] +: title: Show Name + source: HDTV + season: 1 + episode: 5 + language: ca + type: episode + +# newpct +? Show.Name.-.Temporada1.[HDTV][Cap.105][Español] +: title: Show Name + source: HDTV + season: 1 + episode: 5 + language: es + type: episode + +# newpct - season and episode with range: +? Show.Name.-.Temporada.1.720p.HDTV.x264[Cap.102_104]SPANISH.AUDIO-NEWPCT +: title: Show Name + season: 1 + episode: [2, 3, 4] + screen_size: 720p + source: HDTV + video_codec: H.264 + language: es + release_group: NEWPCT + type: episode + +# newpct - season and episode (2 digit season) +? Show.Name.-.Temporada.15.720p.HDTV.x264[Cap.1503]SPANISH.AUDIO-NEWPCT +: title: Show Name + season: 15 + episode: 3 + screen_size: 720p + source: HDTV + video_codec: H.264 + language: es + release_group: NEWPCT + type: episode + +# newpct - season and episode (2 digit season with range) +? Show.Name.-.Temporada.15.720p.HDTV.x264[Cap.1503_1506]SPANISH.AUDIO-NEWPCT +: title: Show Name + season: 15 + episode: [3, 4, 5, 6] + screen_size: 720p + source: HDTV + video_codec: H.264 + language: es + release_group: NEWPCT + type: episode + +# newpct - season and episode: +? Show.Name.-.Temp.1.720p.HDTV.x264[Cap.102]SPANISH.AUDIO-NEWPCT +: title: Show Name + season: 1 + episode: 2 + screen_size: 720p + source: HDTV + video_codec: H.264 + language: es + release_group: NEWPCT + type: episode + +# newpct - season and episode: +? Show.Name.-.Tem.1.720p.HDTV.x264[Cap.102]SPANISH.AUDIO-NEWPCT +: title: Show Name + season: 1 + episode: 2 + screen_size: 720p + source: HDTV + video_codec: H.264 + language: es + release_group: NEWPCT + type: episode + +# newpct - season and episode: +? Show.Name.-.Tem.1.720p.HDTV.x264[Cap.112_114.Final]SPANISH.AUDIO-NEWPCT +: title: Show Name + season: 1 + episode: [12, 13, 14] + screen_size: 720p + source: HDTV + video_codec: H.264 + language: es + release_group: NEWPCT + episode_details: Final + type: episode + +? Mastercook Italia - Stagione 6 (2016) 720p ep13 spyro.mkv +: title: Mastercook Italia + season: 6 + episode: 13 + year: 2016 + screen_size: 720p + episode_title: spyro + container: mkv + type: episode + +? Mastercook Italia - Stagione 6 (2016) 720p Episodio 13 spyro.mkv +: title: Mastercook Italia + season: 6 + year: 2016 + screen_size: 720p + episode: 13 + episode_title: spyro + container: mkv + type: episode + +# Italian releases +? Show Name 3x18 Un Tuffo Nel Passato ITA HDTVMux x264 NovaRip +: title: Show Name + season: 3 + episode: 18 + episode_title: Un Tuffo Nel Passato + language: it + source: HDTV + other: Mux + video_codec: H.264 + release_group: NovaRip + type: episode + +# Italian releases +? Show Name 3x18 Un Tuffo Nel Passato ITA HDTVMux x264 NovaRip +: title: Show Name + season: 3 + episode: 18 + episode_title: Un Tuffo Nel Passato + language: it + source: HDTV + other: Mux + video_codec: H.264 + release_group: NovaRip + type: episode + +# Subbed: No language hint +? Show.Name.S06E03.1080p.HDTV.Legendado +: subtitle_language: und + +# Subbed: No language hint +? Show.Name.S01E09.Subbed.1080p.BluRay.x264-RRH +: title: Show Name + season: 1 + episode: 9 + subtitle_language: und + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + release_group: RRH + type: episode + +# Legendado PT-BR +? Show.Name.S06E05.1080p.WEBRip.Legendado.PT-BR +? Show.Name.S06E05.1080p.WEBRip.Legendas.PT-BR +? Show.Name.S06E05.1080p.WEBRip.Legenda.PT-BR +: title: Show Name + season: 6 + episode: 5 + screen_size: 1080p + source: Web + other: Rip + subtitle_language: pt-BR + type: episode + +? Show.Name.S01E07.Super, Title.WEB-DL 720p.br.srt +: title: Show Name + season: 1 + episode: 7 + episode_title: Super, Title + source: Web + screen_size: 720p + subtitle_language: pt-BR + container: srt + type: episode + +? -Show.Name.S01E07.Super, Title.WEB-DL 720p.br.srt +: language: pt-BR + +# Legendado PT +? Show.Name.S06E05.1080p.WEBRip.Legendado.PT +: title: Show Name + season: 6 + episode: 5 + screen_size: 1080p + source: Web + other: Rip + subtitle_language: pt + type: episode + +? Show.Name.S05E01.SPANISH.SUBBED.720p.HDTV.x264-sPHD +: title: Show Name + season: 5 + episode: 1 + subtitle_language: spa + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: sPHD + type: episode + +? Show.Name.S01E01.German.Subbed.HDTV.XviD-ASAP +: title: Show Name + season: 1 + episode: 1 + subtitle_language: deu + source: HDTV + video_codec: Xvid + release_group: ASAP + type: episode + +? Show.Name.S04E21.Aint.Nothing.Like.the.Real.Thing.German.Custom.Subbed.720p.HDTV.x264.iNTERNAL-BaCKToRG +: title: Show Name + season: 4 + episode: 21 + episode_title: Aint Nothing Like the Real Thing + subtitle_language: deu + screen_size: 720p + source: HDTV + video_codec: H.264 + type: episode + +? Show.Name.S01.Season.Complet.WEBRiP.Ro.Subbed.TM +: title: Show Name + season: 1 + other: [Complete, Rip] + source: Web + subtitle_language: ro + type: episode + +? Show.Name.(2013).Season.3.-.Eng.Soft.Subtitles.720p.WEBRip.x264.[MKV,AC3,5.1].Ehhhh +: title: Show Name + year: 2013 + season: 3 + subtitle_language: en + screen_size: 720p + source: Web + other: Rip + video_codec: H.264 + container: mkv + audio_codec: Dolby Digital + audio_channels: '5.1' + release_group: Ehhhh + type: episode + +# Dublado +? Show.Name.S02E03.720p.HDTV.x264-Belex.-.Dual.Audio.-.Dublado +: title: Show Name + season: 2 + episode: 3 + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: Belex + other: Dual Audio + language: und + type: episode + +? Show.Name.S06E10.1080p.WEB-DL.DUAL.[Dublado].RK +: title: Show Name + season: 6 + episode: 10 + screen_size: 1080p + source: Web + other: Dual Audio + language: und + release_group: RK + type: episode + +? Show.Name.S06E12.720p.WEB-DL.Dual.Audio.Dublado +: title: Show Name + season: 6 + episode: 12 + screen_size: 720p + source: Web + other: Dual Audio + language: und + type: episode + +? Show.Name.S05E07.720p.DUBLADO.HDTV.x264-0SEC-pia.mkv +: title: Show Name + season: 5 + episode: 7 + screen_size: 720p + language: und + source: HDTV + video_codec: H.264 + release_group: 0SEC-pia + container: mkv + type: episode + +? Show.Name.S02E07.Shiva.AC3.Dubbed.WEBRip.x264 +: title: Show Name + season: 2 + episode: 7 + episode_title: Shiva + audio_codec: Dolby Digital + language: und + source: Web + other: Rip + video_codec: H.264 + type: episode + +# Legendas +? Show.Name.S05.1080p.BluRay.x264-Belex.-.Dual.Audio.+.Legendas +: title: Show Name + season: 5 + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + release_group: Belex + other: Dual Audio + subtitle_language: und + type: episode + +# Legendas +? Show.Name.S05.1080p.BluRay.x264-Belex.-.Dual.Audio.+.Legendas +: title: Show Name + season: 5 + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + release_group: Belex + other: Dual Audio + subtitle_language: und + type: episode + +# Subtitulado +? Show.Name.S01E03.HDTV.Subtitulado.Esp.SC +? Show.Name.S01E03.HDTV.Subtitulado.Espanol.SC +? Show.Name.S01E03.HDTV.Subtitulado.Español.SC +: title: Show Name + season: 1 + episode: 3 + source: HDTV + subtitle_language: es + release_group: SC + type: episode + +# Subtitles/Subbed +? Show.Name.S02E08.720p.WEB-DL.Subtitles +? Show.Name.S02E08.Subbed.720p.WEB-DL +: title: Show Name + season: 2 + episode: 8 + screen_size: 720p + source: Web + subtitle_language: und + type: episode + +# Dubbed +? Show.Name.s01e01.german.Dubbed +: title: Show Name + season: 1 + episode: 1 + language: de + type: episode + +? Show.Name.S06E05.Das.Toor.German.AC3.Dubbed.HDTV.German +: title: Show Name + season: 6 + episode: 5 + language: de + audio_codec: Dolby Digital + source: HDTV + type: episode + +? Show.Name.S01E01.Savage.Season.GERMAN.DUBBED.WS.HDTVRip.x264-TVP +: title: Show Name + season: 1 + episode: 1 + episode_title: Savage Season + language: de + other: [Widescreen, Rip] + source: HDTV + video_codec: H.264 + release_group: TVP + type: episode + +# Dubbed +? "[AnimeRG].Show.Name.-.03.[Eng.Dubbed].[720p].[WEB-DL].[JRR]" +: title: Show Name + episode: 3 + language: en + screen_size: 720p + source: Web + release_group: JRR + type: episode + +# Dubbed +? "[RH].Show.Name.-.03.[English.Dubbed].[1080p]" +: title: Show Name + episode: 3 + language: en + screen_size: 1080p + release_group: RH + type: episode + +# Hebsubs +? Show.Name.S05E05.HDTV.XviD-AFG.HebSubs +: title: Show Name + season: 5 + episode: 5 + source: HDTV + video_codec: Xvid + release_group: AFG + subtitle_language: he + type: episode + +? Show Name - S02E31 - Episode 55 (720p.HDTV) +: title: Show Name + season: 2 + episode: 31 + episode_title: Episode 55 + screen_size: 720p + source: HDTV + type: episode + +# Scenario: Removing invalid season and episode matches. Correct episode_title match +? Show.Name.S02E06.eps2.4.m4ster-s1ave.aes.1080p.AMZN.WEBRip.DD5.1.x264-GROUP +: title: Show Name + season: 2 + episode: 6 + episode_title: eps2 4 m4ster-s1ave aes + screen_size: 1080p + streaming_service: Amazon Prime + source: Web + other: Rip + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: GROUP + type: episode + +? Show.Name.S01E05.3xpl0its.wmv.720p.WEBdl.EN-SUB.x264-[MULVAcoded].mkv +: title: Show Name + season: 1 + episode: 5 + episode_title: 3xpl0its + screen_size: 720p + source: Web + subtitle_language: en + video_codec: H.264 + type: episode + +# Regression: S4L release group detected as season 4 +# https://github.com/guessit-io/guessit/issues/352 +? Show Name S01E06 DVD-RIP x264-S4L +: title: Show Name + season: 1 + episode: 6 + source: DVD + video_codec: H.264 + release_group: S4L + type: episode + +# Corner case with only date and 720p +? The.Show.Name.2016.05.18.720.HDTV.x264-GROUP.VTV +: title: The Show Name + date: 2016-05-18 + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: GROUP.VTV + type: episode + +# Corner case with only date and 720p +? -The.Show.Name.2016.05.18.720.HDTV.x264-GROUP.VTV +: season: 7 + episode: 20 + +# https://github.com/guessit-io/guessit/issues/308 (conflict with screen size) +? "[SuperGroup].Show.Name.-.06.[720.Hi10p][1F5578AC]" +: title: Show Name + episode: 6 + screen_size: 720p + color_depth: 10-bit + crc32: 1F5578AC + release_group: SuperGroup + type: episode + +# https://github.com/guessit-io/guessit/issues/308 (conflict with screen size) +? "[SuperGroup].Show.Name.-.06.[1080.Hi10p][1F5578AC]" +: title: Show Name + episode: 6 + screen_size: 1080p + color_depth: 10-bit + crc32: 1F5578AC + release_group: SuperGroup + type: episode + +? "[MK-Pn8].Dimension.W.-.05.[720p][Hi10][Dual][TV-Dub][EDA6E7F1]" +: options: -C us -L und + release_group: MK-Pn8 + title: Dimension W + episode: 5 + screen_size: 720p + color_depth: 10-bit + other: Dual Audio + source: TV + language: und + crc32: EDA6E7F1 + type: episode + +? "[Zero-Raws].Show.Name.493-498.&.500-507.(CX.1280x720.VFR.x264.AAC)" +: release_group: Zero-Raws + title: Show Name + episode: [493, 494, 495, 496, 497, 498, 500, 501, 502, 503, 504, 505, 506, 507] + screen_size: 720p + other: Variable Frame Rate + video_codec: H.264 + audio_codec: AAC + type: episode + +# NetflixUHD +? Show.Name.S01E06.NetflixUHD +: title: Show Name + season: 1 + episode: 6 + streaming_service: Netflix + other: Ultra HD + type: episode + +? Show.Name.S04E13.FINAL.MULTI.DD51.2160p.NetflixUHDRip.x265-TVS +: title: Show Name + season: 4 + episode: 13 + episode_details: Final + language: mul + audio_codec: Dolby Digital + audio_channels: '5.1' + screen_size: 2160p + streaming_service: Netflix + source: Ultra HDTV + other: Rip + video_codec: H.265 + release_group: TVS + type: episode + +? Show.Name.S06E11.Of.Late.I.Think.of.Rosewood.iTunesHD.x264 +: title: Show Name + season: 6 + episode: 11 + episode_title: Of Late I Think of Rosewood + streaming_service: iTunes + other: HD + video_codec: H.264 + type: episode + +? Show.Name.S01.720p.iTunes.h264-Group +: title: Show Name + season: 1 + screen_size: 720p + streaming_service: iTunes + video_codec: H.264 + release_group: Group + type: episode + +? Show.Name.1x01.eps1.0.hellofriend.(HDiTunes.Ac3.Esp).(2015).By.Malaguita.avi +: title: Show Name + season: 1 + episode: 1 + episode_title: eps1 0 hellofriend + other: HD + streaming_service: iTunes + audio_codec: Dolby Digital + language: spa + year: 2015 + container: avi + type: episode + +? "[Hanamaru&LoliHouse] The Dragon Dentist - 01 [WebRip 1920x1080 HEVC-yuv420p10 AAC].mkv" +: release_group: Hanamaru&LoliHouse + title: The Dragon Dentist + episode: 1 + source: Web + other: Rip + screen_size: 1080p + video_codec: H.265 + color_depth: 10-bit + audio_codec: AAC + container: mkv + type: episode + +? Show Name - Season 1 Episode 50 +: title: Show Name + season: 1 + episode: 50 + type: episode + +? Vikings.Seizoen.4.1080p.Web.NLsubs +: title: Vikings + season: 4 + screen_size: 1080p + source: Web + subtitle_language: nl + type: episode + +? Star.Wars.Rebels.S01E01.Spark.of.Rebellion.ALTERNATE.CUT.HDTV.x264-W4F.mp4 +: title: Star Wars Rebels + season: 1 + episode: 1 + episode_title: Spark of Rebellion + edition: Alternative Cut + source: HDTV + video_codec: H.264 + release_group: W4F + container: mp4 + type: episode + +? DCs.Legends.of.Tomorrow.S02E12.HDTV.XviD-FUM +: title: DCs Legends of Tomorrow + season: 2 + episode: 12 + source: HDTV + video_codec: Xvid + release_group: FUM + type: episode + +? DC's Legends of Tomorrow 2016 - S02E02 +: title: DC's Legends of Tomorrow + year: 2016 + season: 2 + episode: 2 + type: episode + +? Broadchurch.S01.DIRFIX.720p.BluRay.x264-SHORTBREHD +: title: Broadchurch + season: 1 + other: Fix + screen_size: 720p + source: Blu-ray + video_codec: H.264 + release_group: SHORTBREHD + -proper_count: 1 + type: episode + +? Simply Red - 2016-07-08 Montreux Jazz Festival 720p +: title: Simply Red + date: 2016-07-08 + episode_title: Montreux Jazz Festival + screen_size: 720p + type: episode + +? Ridiculousness.S07E14.iNTERNAL.HDTV.x264-YesTV +: title: Ridiculousness + season: 7 + episode: 14 + other: Internal + source: HDTV + video_codec: H.264 + release_group: YesTV + type: episode + +? Stephen.Colbert.2016.05.25.James.McAvoy.iNTERNAL.XviD-AFG +: title: Stephen Colbert + date: 2016-05-25 + episode_title: James McAvoy + other: Internal + video_codec: Xvid + release_group: AFG + type: episode + +? The.100.S01E13.iNTERNAL.READNFO.720p.HDTV.x264-2HD +: title: The 100 + season: 1 + episode: 13 + other: [Internal, Read NFO] + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: 2HD + type: episode + +? The.100.S01E13.READ.NFO.720p.HDTV.x264-2HD +: title: The 100 + season: 1 + episode: 13 + other: Read NFO + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: 2HD + type: episode + +? Dr.Ken.S01E21.SAMPLEFIX.720p.HDTV.x264-SVA +: title: Dr Ken + season: 1 + episode: 21 + other: Fix + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: SVA + type: episode + +? Rick and Morty Season 1 [UNCENSORED] [BDRip] [1080p] [HEVC] +: title: Rick and Morty + season: 1 + edition: Uncensored + other: Rip + source: Blu-ray + screen_size: 1080p + video_codec: H.265 + type: episode + +? 12.Monkeys.S01E01.LiMiTED.FRENCH.1080p.WEB-DL.H264-AUTHORiTY +: title: 12 Monkeys + season: 1 + episode: 1 + edition: Limited + language: french + screen_size: 1080p + source: Web + video_codec: H.264 + release_group: AUTHORiTY + type: episode + +? Undateable.2014.S03E05.West.Feed.HDTV.x264-2HD +: title: Undateable + year: 2014 + season: 3 + episode: 5 + other: West Coast Feed + source: HDTV + video_codec: H.264 + release_group: 2HD + type: episode + +? Undateable.2014.S02E07-E08.Live.Episode.West.Coast.Feed.HDTV.x264-2HD +: title: Undateable + year: 2014 + season: 2 + episode: [7, 8] + other: West Coast Feed + source: HDTV + video_codec: H.264 + release_group: 2HD + type: episode + +? Undateable.S03E01-E02.LIVE.EAST.FEED.720p.HDTV.x264-KILLERS +: title: Undateable + season: 3 + episode: [1, 2] + other: East Coast Feed + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: KILLERS + type: episode + +? Undateable.2014.S02E07.Live.Episode.East.Coast.Feed.HDTV.x264-2HD +: title: Undateable + year: 2014 + season: 2 + episode: 7 + other: East Coast Feed + source: HDTV + video_codec: H.264 + release_group: 2HD + type: episode + +? Undateable.2014.S02E07.East.Coast.Feed.720p.WEB-DL.DD5.1.H.264-NTb +: title: Undateable + year: 2014 + season: 2 + episode: 7 + other: East Coast Feed + screen_size: 720p + source: Web + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: NTb + type: episode + +? True Detective S02E04 720p HDTV x264-0SEC [GloDLS].mkv +: title: True Detective + season: 2 + episode: 4 + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: 0SEC [GloDLS] + container: mkv + type: episode + +? Anthony.Bourdain.Parts.Unknown.S09E01.Los.Angeles.720p.HDTV.x264-MiNDTHEGAP +: title: Anthony Bourdain Parts Unknown + season: 9 + episode: 1 + episode_title: Los Angeles + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: MiNDTHEGAP + type: episode + +? -feud.s01e05.and.the.winner.is.(the.oscars.of.1963).720p.amzn.webrip.dd5.1.x264-casstudio.mkv +: year: 1963 + +? feud.s01e05.and.the.winner.is.(the.oscars.of.1963).720p.amzn.webrip.dd5.1.x264-casstudio.mkv +: title: feud + season: 1 + episode: 5 + episode_title: and the winner is + screen_size: 720p + streaming_service: Amazon Prime + source: Web + other: Rip + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: casstudio + container: mkv + type: episode + +? Adventure.Time.S08E16.Elements.Part.1.Skyhooks.720p.WEB-DL.AAC2.0.H.264-RTN.mkv +: title: Adventure Time + season: 8 + episode: 16 + episode_title: Elements Part 1 Skyhooks + screen_size: 720p + source: Web + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: RTN + container: mkv + type: episode + +? D:\TV\SITCOMS (CLASSIC)\That '70s Show\Season 07\That '70s Show - S07E22 - 2000 Light Years from Home.mkv +: title: That '70s Show + season: 7 + episode: 22 + episode_title: 2000 Light Years from Home + container: mkv + type: episode + +? Show.Name.S02E01.Super.Title.720p.WEB-DL.DD5.1.H.264-ABC.nzb +: title: Show Name + season: 2 + episode: 1 + episode_title: Super Title + screen_size: 720p + source: Web + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: ABC + container: nzb + type: episode + +? "[SGKK] Bleach 312v1 [720p/mkv]-Group.mkv" +: title: Bleach + episode: 312 + version: 1 + screen_size: 720p + release_group: Group + container: mkv + type: episode + +? The.Expanse.S02E08.720p.WEBRip.x264.EAC3-KiNGS.mkv +: title: The Expanse + season: 2 + episode: 8 + screen_size: 720p + source: Web + other: Rip + video_codec: H.264 + audio_codec: Dolby Digital Plus + release_group: KiNGS + container: mkv + type: episode + +? Series_name.2005.211.episode.title.avi +: title: Series name + year: 2005 + season: 2 + episode: 11 + episode_title: episode title + container: avi + type: episode + +? the.flash.2014.208.hdtv-lol[ettv].mkv +: title: the flash + year: 2014 + season: 2 + episode: 8 + source: HDTV + release_group: lol[ettv] + container: mkv + type: episode + +? "[Despair-Paradise].Kono.Subarashii.Sekai.ni.Shukufuku.wo!.2.-..09.vostfr.FHD" +: release_group: Despair-Paradise + title: Kono Subarashii Sekai ni Shukufuku wo! 2 + episode: 9 + subtitle_language: fr + other: Full HD + type: episode + +? Whose Line is it anyway/Season 01/Whose.Line.is.it.Anyway.US.S13E01.720p.WEB.x264-TBS.mkv +: title: Whose Line is it Anyway + season: 13 + episode: 1 + country: US + screen_size: 720p + source: Web + video_codec: H.264 + release_group: TBS + container: mkv + type: episode + +? Planet.Earth.II.S01.2160p.UHD.BluRay.HDR.DTS-HD.MA5.1.x265-ULTRAHDCLUB +: title: Planet Earth II + season: 1 + screen_size: 2160p + source: Ultra HD Blu-ray + other: HDR10 + audio_codec: DTS-HD + audio_profile: Master Audio + audio_channels: '5.1' + video_codec: H.265 + release_group: ULTRAHDCLUB + type: episode + +? Reizen.Waes.S03.FLEMISH.1080p.HDTV.MP2.H.264-NOGRP/Reizen.Waes.S03E05.China.PART1.FLEMISH.1080p.HDTV.MP2.H.264-NOGRP.mkv +: title: Reizen Waes + season: 3 + episode: 5 + part: 1 + language: nl-BE + screen_size: 1080p + source: HDTV + video_codec: H.264 + audio_codec: MP2 + release_group: NOGRP + container: mkv + type: episode + +? "/folder/Marvels.Agent.Carter.S02E05.The.Atomic.Job.1080p.WEB-DL.DD5.1.H264-Coo7[rartv]/Marvel's.Agent.Carter.S02E05.The.Atomic.Job.1080p.WEB-DL.DD5.1.H.264-Coo7.mkv" +: title: Marvel's Agent Carter + season: 2 + episode: 5 + episode_title: The Atomic Job + release_group: Coo7 + type: episode + +? My.Name.Is.Earl.S01-S04.DVDRip.XviD-AR +: title: My Name Is Earl + season: [1, 2, 3, 4] + source: DVD + other: Rip + video_codec: Xvid + release_group: AR + type: episode + +? American.Dad.S01E01.Pilot.DVDRip.x264-CS +: title: American Dad + season: 1 + episode: 1 + episode_details: Pilot + source: DVD + other: Rip + video_codec: H.264 + release_group: CS + type: episode + +? Black.Sails.S01E01.HDTV.XviD.HebSubs-DR +: title: Black Sails + season: 1 + episode: 1 + source: HDTV + video_codec: Xvid + subtitle_language: he + release_group: DR + type: episode + +? The.West.Wing.S04E06.Game.On.720p.WEB-DL.AAC2.0.H.264-MC +: title: The West Wing + season: 4 + episode: 6 + episode_title: Game On + screen_size: 720p + source: Web + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: MC + type: episode + +? 12.Monkeys.S02E05.1080p.WEB-DL.DD5.1.H.264-NA +: title: 12 Monkeys + season: 2 + episode: 5 + screen_size: 1080p + source: Web + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: NA + type: episode + +? Fear.the.Walking.Dead.S03E07.1080p.AMZN.WEBRip.DD5.1.x264-VLAD[rarbg]/Fear.the.Walking.Dead.S03E07.1080p.AMZN.WEB-DL.DD+5.1.H.264-VLAD.mkv +: title: Fear the Walking Dead + season: 3 + episode: 7 + screen_size: 1080p + source: Web + audio_codec: Dolby Digital Plus + audio_channels: '5.1' + video_codec: H.264 + release_group: VLAD + container: mkv + type: episode + +? American.Crime.S01E02.1080p.WEB-DL.DD5.1.H.264-NL +: title: American Crime + season: 1 + episode: 2 + screen_size: 1080p + source: Web + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: NL + type: episode + +? Better.Call.Saul.S02.720p.HDTV.x264-TL +: title: Better Call Saul + season: 2 + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: TL + type: episode + +? 60.Minutes.2008.12.14.HDTV.XviD-YT +: options: -T '60 Minutes' + title: 60 Minutes + date: 2008-12-14 + source: HDTV + video_codec: Xvid + release_group: YT + type: episode + +? Storm.Chasers.Season.1 +: title: Storm Chasers + season: 1 + type: episode + +? Faking.It.2014.S03E08.720p.HDTV.x264-AVS +: title: Faking It + year: 2014 + season: 3 + episode: 8 + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: AVS + type: episode + +? /series/Marvel's Agents of S.H.I.E.L.D/Season 4/Marvels.Agents.of.S.H.I.E.L.D.S04E01.The.Ghost.1080p.WEB-DL.DD5.1.H.264-AG.mkv +: title: Marvels Agents of S.H.I.E.L.D. + season: 4 + episode: 1 + episode_title: The Ghost + screen_size: 1080p + source: Web + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: AG + container: mkv + type: episode + +? "[FASubs & TTF] Inuyasha - 099 [DVD] [B15AA1AC].mkv" +: release_group: FASubs & TTF + title: Inuyasha + episode: 99 + source: DVD + crc32: B15AA1AC + container: mkv + type: episode + +? Show.Name.S01E03.PL.SUBBED.480p.WEBRiP.x264 +: title: Show Name + season: 1 + episode: 3 + subtitle_language: pl + screen_size: 480p + source: Web + other: Rip + video_codec: H.264 + type: episode + +? Show.Name.s10e15(233).480p.BDRip-AVC.Ukr.hurtom +: title: Show Name + season: 10 + episode: 15 + screen_size: 480p + source: Blu-ray + other: Rip + video_codec: H.264 + language: uk + release_group: hurtom + type: episode + +? Goof.Troop.1x24.Waste.Makes.Haste.720p.HDTV.x264.CZ-SDTV +: title: Goof Troop + season: 1 + episode: 24 + episode_title: Waste Makes Haste + screen_size: 720p + source: HDTV + video_codec: H.264 + language: cs + release_group: SDTV + type: episode + +? Marvels.Daredevil.S02E11.German.DL.DUBBED.2160p.WebUHD.x264-UHDTV +: title: Marvels Daredevil + season: 2 + episode: 11 + language: [de, mul] + screen_size: 2160p + source: Web + video_codec: H.264 + release_group: UHDTV + type: episode + +? BBC The Story of China 1 of 6 - Ancestors CC HDTV x264 AC3 2.0 720p mkv +: title: BBC The Story of China + episode: 1 + episode_count: 6 + episode_title: Ancestors + source: HDTV + video_codec: H.264 + audio_codec: Dolby Digital + audio_channels: '2.0' + screen_size: 720p + container: mkv + type: episode + +? Duck.Dynasty.S09E04.Drone.Survivor.720p.AE.WEBRip.AAC2.0.H264-BTW[rartv] +: title: Duck Dynasty + season: 9 + episode: 4 + episode_title: Drone Survivor + screen_size: 720p + streaming_service: A&E + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: BTW[rartv] + type: episode + +? Mr.Selfridge.S04E03.720p.WEB-DL.AAC2.0.H264-MS[rartv] +: title: Mr Selfridge + season: 4 + episode: 3 + screen_size: 720p + source: Web + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: MS[rartv] + type: episode + +? Second.Chance.S01E02.One.More.Notch.1080p.WEB-DL.DD5.1.H264-SC[rartv] +: title: Second Chance + season: 1 + episode: 2 + episode_title: One More Notch + screen_size: 1080p + source: Web + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: rartv + type: episode + +? Total.Divas.S05E01.720p.HDTV.AAC2.0.H.264-SC-SDH +: title: Total Divas + season: 5 + episode: 1 + screen_size: 720p + source: HDTV + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + video_profile: Scalable Video Coding + release_group: SDH + type: episode + +? Marvel's Jessica Jones (2015) s01e09 - AKA Sin Bin.mkv +: title: Marvel's Jessica Jones + season: 1 + episode: 9 + episode_title: AKA Sin Bin + container: mkv + type: episode + +? Hotel.Hell.S01E01.720p.DD5.1.448kbps-ALANiS +: title: Hotel Hell + season: 1 + episode: 1 + screen_size: 720p + audio_codec: Dolby Digital + audio_channels: '5.1' + audio_bit_rate: 448Kbps + release_group: ALANiS + type: episode + +? Greys.Anatomy.S07D1.NTSC.DVDR-ToF +: title: Greys Anatomy + season: 7 + disc: 1 + other: NTSC + source: DVD + release_group: ToF + type: episode + +? Greys.Anatomy.S07D1.NTSC.DVDR-ToF +: title: Greys Anatomy + season: 7 + disc: 1 + other: NTSC + source: DVD + release_group: ToF + type: episode + +? Greys.Anatomy.S07D1-3&5.NTSC.DVDR-ToF +: title: Greys Anatomy + season: 7 + disc: [1, 2, 3, 5] + other: NTSC + source: DVD + release_group: ToF + type: episode + +? El.Principe.2014.S01D01.SPANiSH.COMPLETE.BLURAY-COJONUDO +: title: El Principe + year: 2014 + season: 1 + disc: 1 + language: spa + other: Complete + source: Blu-ray + release_group: COJONUDO + type: episode + +? The Simpsons - Season 2 Complete [DVDRIP VP7 KEGGERMAN +: title: The Simpsons + season: 2 + other: [Complete, Rip] + source: DVD + video_codec: VP7 + release_group: KEGGERMAN + type: episode + +? Barney & Friends_ Easy as ABC (Season 9_ Episode 15)_VP8_Vorbis_360p.webm +: title: Barney & Friends Easy as ABC + season: 9 + episode: 15 + video_codec: VP8 + audio_codec: Vorbis + screen_size: 360p + container: webm + type: episode + +? Victoria.S01.1080p.BluRay.HEVC.DTSMA.LPCM.PGS-OZM +: title: Victoria + season: 1 + screen_size: 1080p + source: Blu-ray + video_codec: H.265 + audio_codec: [DTS-HD, LPCM] + audio_profile: Master Audio + # Does it worth to add subtitle_format? Such rare case + # subtitle_format: PGS + # release_group: OZM + type: episode + +? The.Prisoners.S01E03.1080p.DM.AAC2.0.x264-BTN +: title: The Prisoners + season: 1 + episode: 3 + screen_size: 1080p + source: Digital Master + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: BTN + type: episode + +? Panorama.S2013E25.Broken.by.Battle.1080p.DM.AAC2.0.x264-BTN +: title: Panorama + season: 2013 + episode: 25 + episode_title: Broken by Battle + screen_size: 1080p + source: Digital Master + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: BTN + type: episode + +? Our.World.S2014E11.Chinas.Model.Army.720p.DM.AAC2.0.x264-BTN +: title: Our World + season: 2014 + episode: 11 + episode_title: Chinas Model Army + screen_size: 720p + source: Digital Master + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: BTN + type: episode + +? Storyville.S2016E08.My.Nazi.Legacy.1080p.DM.x264-BTN +: title: Storyville + season: 2016 + episode: 8 + episode_title: My Nazi Legacy + screen_size: 1080p + source: Digital Master + video_codec: H.264 + release_group: BTN + type: episode + +? Comedians.in.Cars.Getting.Coffee.S07E01.1080p.DM.FLAC2.0.x264-NTb +: title: Comedians in Cars Getting Coffee + season: 7 + episode: 1 + screen_size: 1080p + source: Digital Master + audio_codec: FLAC + audio_channels: '2.0' + video_codec: H.264 + release_group: NTb + type: episode + +? "[SomeGroup-Fansub]_Show_Name_727_[VOSTFR][HD_1280x720]" +: release_group: SomeGroup-Fansub + title: Show Name + episode: 727 + subtitle_language: fr + other: HD + screen_size: 720p + type: episode + +? "[GROUP]Show_Name_726_[VOSTFR]_[V1]_[8bit]_[720p]_[2F7B3FA2]" +: release_group: GROUP + title: Show Name + episode: 726 + subtitle_language: fr + version: 1 + color_depth: 8-bit + screen_size: 720p + crc32: 2F7B3FA2 + type: episode + +? Show Name 445 VOSTFR par Fansub-Resistance (1280*720) - version MQ +: title: Show Name + episode: 445 + subtitle_language: fr + screen_size: 720p + type: episode + +? Anime Show Episode 159 v2 [VOSTFR][720p][AAC].mp4 +: title: Anime Show + episode: 159 + version: 2 + subtitle_language: fr + screen_size: 720p + audio_codec: AAC + container: mp4 + type: episode + +? "[Group] Anime Super Episode 161 [VOSTFR][720p].mp4" +: release_group: Group + title: Anime Super + episode: 161 + subtitle_language: fr + screen_size: 720p + container: mp4 + type: episode + +? Anime Show Episode 59 v2 [VOSTFR][720p][AAC].mp4 +: title: Anime Show + episode: 59 + version: 2 + subtitle_language: fr + screen_size: 720p + audio_codec: AAC + container: mp4 + type: episode + +? Show.Name.-.476-479.(2007).[HorribleSubs][WEBRip]..[HD.720p] +: title: Show Name + episode: [476, 477, 478, 479] + year: 2007 + release_group: HorribleSubs + source: Web + other: [Rip, HD] + screen_size: 720p + type: episode + +? Show Name - 722 [HD_1280x720].mp4 +: title: Show Name + episode: 722 + other: HD + screen_size: 720p + container: mp4 + type: episode + +? Show!.Name.2.-.10.(2016).[HorribleSubs][WEBRip]..[HD.720p] +: title: Show! Name 2 + episode: 10 + year: 2016 + release_group: HorribleSubs + source: Web + other: [Rip, HD] + screen_size: 720p + type: episode + +? 'C:\folder\[GROUP]_An_Anime_Show_100_-_10_[1080p]_mkv' +: options: -T 'An Anime Show 100' + release_group: GROUP + title: An Anime Show 100 + episode: 10 + screen_size: 1080p + container: mkv + type: episode + +? "[Group].Show.Name!.Super!!.-.05.[720p][AAC].mp4" +: release_group: Group + title: Show Name! Super!! + episode: 5 + screen_size: 720p + audio_codec: AAC + container: mp4 + type: episode + +? "[GROUP].Mobile.Suit.Gundam.Unicorn.RE.0096.-.14.[720p].mkv" +: options: -T 'Mobile Suit Gundam Unicorn RE 0096' + release_group: GROUP + title: Mobile Suit Gundam Unicorn RE 0096 + episode: 14 + screen_size: 720p + container: mkv + type: episode + +? Show.Name.-.Other Name.-.02.(1280x720.HEVC.AAC) +: title: Show Name + alternative_title: Other Name + episode: 2 + screen_size: 720p + video_codec: H.265 + audio_codec: AAC + type: episode + +? "[GroupName].Show.Name.-.02.5.(Special).[BD.1080p]" +: release_group: GroupName + title: Show Name + episode: 2 + episode_details: Special + screen_size: 1080p + source: Blu-ray + type: episode + +? "[Group].Show.Name.2.The.Big.Show.-.11.[1080p]" +: title: Show Name 2 The Big Show + episode: 11 + screen_size: 1080p + type: episode + +? "[SuperGroup].Show.Name.-.Still.Name.-.11.[1080p]" +: release_group: SuperGroup + title: Show Name + alternative_title: Still Name + episode: 11 + screen_size: 1080p + type: episode + +? "[SuperGroup].Show.Name.-.462" +: release_group: SuperGroup + title: Show Name + episode: 462 + type: episode + +? Show.Name.10.720p +: title: Show Name + episode: 10 + screen_size: 720p + type: episode + +? "[Group].Show.Name.G2.-.19.[1080p]" +: release_group: Group + title: Show Name G2 + episode: 19 + screen_size: 1080p + type: episode + +? "[Group].Show.Name.S2.-.19.[1080p]" +? /Show.Name.S2/[Group].Show.Name.S2.-.19.[1080p] +? /Show Name S2/[Group].Show.Name.S2.-.19.[1080p] +: options: -T 'Show Name S2' + release_group: Group + title: Show Name S2 + episode: 19 + screen_size: 1080p + type: episode + +? "[ABC]_Show_Name_001.mkv" +: release_group: ABC + title: Show Name + episode: 1 + container: mkv + type: episode + +? 003-005. Show Name - Ep Name.mkv +: episode: [3, 4, 5] + title: Show Name + episode_title: Ep Name + container: mkv + type: episode + +? 003. Show Name - Ep Name.mkv +: episode: 3 + title: Show Name + episode_title: Ep Name + container: mkv + type: episode + +? 165.Show Name.s08e014 +: absolute_episode: 165 + title: Show Name + season: 8 + episode: 14 + type: episode + +? Show Name - 16x03-05 - 313-315 +? Show.Name.16x03-05.313-315-GROUP +? Show Name 16x03-05 313-315 +? Show Name - 313-315 - s16e03-05 +? Show.Name.313-315.s16e03-05 +? Show Name 313-315 s16e03-05 +: title: Show Name + absolute_episode: [313, 314, 315] + season: 16 + episode: [3, 4, 5] + type: episode + +? Show Name 13-16 +: title: Show Name + episode: [13, 14, 15, 16] + type: episode + +? Show Name 804 vostfr HD +: options: --episode-prefer-number + title: Show Name + episode: 804 + subtitle_language: fr + other: HD + type: episode + +? "[Doki] Re Zero kara Hajimeru Isekai Seikatsu - 01 1920x1080 Hi10P BD FLAC [7F64383D].mkv" +: release_group: Doki + title: Re Zero kara Hajimeru Isekai Seikatsu + episode: 1 + screen_size: 1080p + aspect_ratio: 1.778 + video_profile: High 10 + color_depth: 10-bit + source: Blu-ray + audio_codec: FLAC + crc32: 7F64383D + container: mkv + type: episode + +? Shark Tank (AU) - S02E01 - HDTV-720p.mkv +: title: Shark Tank + country: AU + season: 2 + episode: 1 + source: HDTV + screen_size: 720p + container: mkv + type: episode + +? "[HorribleSubs] Garo - Vanishing Line - 01 [1080p].mkv" +: release_group: HorribleSubs + title: Garo + alternative_title: Vanishing Line + episode: 1 + screen_size: 1080p + container: mkv + type: episode + +? "[HorribleSubs] Yowamushi Pedal - Glory Line - 01 [1080p].mkv" +: release_group: HorribleSubs + title: Yowamushi Pedal + alternative_title: Glory Line + episode: 1 + screen_size: 1080p + container: mkv + type: episode + +? c:\Temp\autosubliminal\completed\2 Broke Girls\Season 01\2 Broke Girls - S01E01 - HDTV-720p Proper - x264 AC3 - IMMERSE - [2011-09-19].mkv +: title: 2 Broke Girls + season: 1 + episode: 1 + source: HDTV + screen_size: 720p + other: Proper + video_codec: H.264 + audio_codec: Dolby Digital + release_group: IMMERSE + date: 2011-09-19 + container: mkv + type: episode + +? c:\Temp\postprocessing\Marvels.Agents.of.S.H.I.E.L.D.s01e02.0.8.4.720p.WEB.DL.mkv +: title: Marvels Agents of S.H.I.E.L.D. + season: 1 + episode: 2 + episode_title: 0.8.4. + screen_size: 720p + source: Web + container: mkv + type: episode + +? Mind.Field.S02E06.The.Power.of.Suggestion.1440p.H264.WEBDL.Subtitles +: title: Mind Field + season: 2 + episode: 6 + episode_title: The Power of Suggestion + screen_size: 1440p + video_codec: H.264 + source: Web + subtitle_language: und + type: episode + +? The Power of Suggestion - Mind Field S2 (Ep 6) (1440p_24fps_H264-384kbit_AAC 6Ch).mp4 +: title: The Power of Suggestion + alternative_title: Mind Field + season: 2 + episode: 6 + screen_size: 1440p + frame_rate: 24fps + video_codec: H.264 + audio_bit_rate: 384Kbps + audio_codec: AAC + audio_channels: '5.1' + container: mp4 + type: episode + +? Mind.Field.S02E06.The.Power.of.Suggestion.1440p.H264.WEBDL.Subtitles/The Power of Suggestion - Mind Field S2 (Ep 6) (1440p_24fps_H264-384kbit_AAC 6Ch).mp4 +: season: 2 + episode: 6 + title: The Power of Suggestion + alternative_title: Mind Field + screen_size: 1440p + frame_rate: 24fps + video_codec: H.264 + source: Web + subtitle_language: und + audio_bit_rate: 384Kbps + audio_codec: AAC + audio_channels: '5.1' + container: mp4 + type: episode + +? Mind.Field.S02E06.The.Power.of.Suggestion.1440p.H264.WEBDL.Subtitles/The Power of Suggestion - Mind Field S2 (Ep 6) (English).srt +: title: Mind Field + season: 2 + episode: 6 + episode_title: The Power of Suggestion + screen_size: 1440p + video_codec: H.264 + source: Web + subtitle_language: en + container: srt + type: episode + +? Mind.Field.S02E06.The.Power.of.Suggestion.1440p.H264.WEBDL.Subtitles/The Power of Suggestion - Mind Field S2 (Ep 6) (Korean).srt +: title: Mind Field + season: 2 + episode: 6 + episode_title: The Power of Suggestion + screen_size: 1440p + video_codec: H.264 + source: Web + subtitle_language: ko + container: srt + type: episode + +? '[HorribleSubs] Overlord II - 01 [1080p] 19.1mbits - 120fps.mkv' +: release_group: HorribleSubs + title: Overlord II + episode: 1 + screen_size: 1080p + video_bit_rate: 19.1Mbps + frame_rate: 120fps + container: mkv + type: episode + +? One Piece - 720 +: title: One Piece + season: 7 + episode: 20 + type: episode + +? foobar.213.avi +: options: -E + title: foobar + episode: 213 + container: avi + type: episode + +? FooBar - 360 368p-Grp +: options: -E + title: FooBar + episode: 360 + screen_size: 368p + release_group: Grp + type: episode + +? wwiis.most.daring.raids.s01e04.storming.mussolinis.island.1080p.web.h.264-edhd-sample.mkv +: title: wwiis most daring raids + season: 1 + episode: 4 + episode_title: storming mussolinis island + screen_size: 1080p + source: Web + video_codec: H.264 + release_group: edhd + other: Sample + container: mkv + type: episode + +? WWIIs.Most.Daring.Raids.S01E04.Storming.Mussolinis.Island.1080p.WEB.h264-EDHD/wwiis.most.daring.raids.s01e04.storming.mussolinis.island.1080p.web.h.264-edhd-sample.mkv +: title: wwiis most daring raids + season: 1 + episode: 4 + episode_title: Storming Mussolinis Island + screen_size: 1080p + source: Web + video_codec: H.264 + release_group: edhd + other: Sample + container: mkv + type: episode + +? dcs.legends.of.tomorrow.s02e01.1080p.bluray.x264-rovers.proof +: title: dcs legends of tomorrow + season: 2 + episode: 1 + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + release_group: rovers + other: Proof + type: episode + +? dcs.legends.of.tomorrow.s02e01.720p.bluray.x264-demand.sample.mkv +: title: dcs legends of tomorrow + season: 2 + episode: 1 + screen_size: 720p + source: Blu-ray + video_codec: H.264 + release_group: demand + other: Sample + container: mkv + type: episode + +? Season 06/e01.1080p.bluray.x264-wavey-obfuscated.mkv +: season: 6 + episode: 1 + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + title: wavey + other: Obfuscated + container: mkv + type: episode + +? Hells.Kitchen.US.S17E08.1080p.HEVC.x265-MeGusta-Obfuscated/c48db7d2aeb040e8a920a9fd6effcbf4.mkv +: title: Hells Kitchen + country: US + season: 17 + episode: 8 + screen_size: 1080p + video_codec: H.265 + release_group: MeGusta + other: Obfuscated + uuid: c48db7d2aeb040e8a920a9fd6effcbf4 + container: mkv + type: episode + +? Blue.Bloods.S08E09.1080p.HEVC.x265-MeGusta-Obfuscated/afaae96ae7a140e0981ced2a79221751.mkv +: title: Blue Bloods + season: 8 + episode: 9 + screen_size: 1080p + video_codec: H.265 + release_group: MeGusta + other: Obfuscated + container: mkv + type: episode + +? MacGyver.2016.S02E09.CD-ROM.and.Hoagie.Foil.1080p.AMZN.WEBRip.DDP5.1.x264-NTb-Scrambled/c329b27187d44a94b4a25b21502db552.mkv +: title: MacGyver + year: 2016 + season: 2 + episode: 9 + screen_size: 1080p + streaming_service: Amazon Prime + source: Web + other: [Rip, Obfuscated] + audio_codec: Dolby Digital Plus + audio_channels: '5.1' + video_codec: H.264 + release_group: NTb + uuid: c329b27187d44a94b4a25b21502db552 + container: mkv + type: episode + +? The.Late.Late.Show.with.James.Corden.2017.11.27.Armie.Hammer.Juno.Temple.Charlie.Puth.1080p.AMZN.WEB-DL.DDP2.0.H.264-monkee-Scrambled/42e7e8a48eb7454aaebebcf49705ce41.mkv +: title: The Late Late Show with James Corden + date: 2017-11-27 + episode_title: Armie Hammer Juno Temple Charlie Puth + screen_size: 1080p + streaming_service: Amazon Prime + source: Web + audio_codec: Dolby Digital Plus + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + other: Obfuscated + uuid: 42e7e8a48eb7454aaebebcf49705ce41 + container: mkv + type: episode + +? Educating Greater Manchester S01E07 720p HDTV x264-PLUTONiUM-AsRequested +: title: Educating Greater Manchester + season: 1 + episode: 7 + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: PLUTONiUM + other: Repost + type: episode + +? Im A Celebrity Get Me Out Of Here S17E14 HDTV x264-PLUTONiUM-xpost +: title: Im A Celebrity Get Me Out Of Here + season: 17 + episode: 14 + source: HDTV + video_codec: H.264 + release_group: PLUTONiUM + other: Repost + type: episode + +? Tales S01E08 All I Need Method Man Featuring Mary J Blige 720p BET WEBRip AAC2 0 x264-RTN-xpost +: title: Tales + season: 1 + episode: 8 + episode_title: All I Need Method Man Featuring Mary J Blige + screen_size: 720p + source: Web + other: [Rip, Repost] + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: RTN + type: episode + +? This is Us S01E11 Herzensangelegenheiten German DL WS DVDRip x264-CDP-xpost +: options: --exclude country + title: This is Us + season: 1 + episode: 11 + episode_title: Herzensangelegenheiten + language: + - de + - mul + other: + - Widescreen + - Rip + - Repost + source: DVD + video_codec: H.264 + release_group: CDP + type: episode + +? The Girlfriend Experience S02E10 1080p WEB H264-STRiFE-postbot +: title: The Girlfriend Experience + season: 2 + episode: 10 + screen_size: 1080p + source: Web + video_codec: H.264 + release_group: STRiFE + other: Repost + type: episode + +? The.Girlfriend.Experience.S02E10.1080p.WEB.H264-STRiFE-postbot/90550c1adaf44c47b60d24f59603bb98.mkv +: title: The Girlfriend Experience + season: 2 + episode: 10 + screen_size: 1080p + source: Web + video_codec: H.264 + release_group: STRiFE + other: Repost + uuid: 90550c1adaf44c47b60d24f59603bb98 + container: mkv + type: episode + +? 24.S01E02.1080p.BluRay.REMUX.AVC.DD.2.0-EPSiLON-xpost/eb518eaf33f641a1a8c6e0973a67aec2.mkv +: title: '24' + season: 1 + episode: 2 + screen_size: 1080p + source: Blu-ray + other: [Remux, Repost] + video_codec: H.264 + audio_codec: Dolby Digital + audio_channels: '2.0' + release_group: EPSiLON + uuid: eb518eaf33f641a1a8c6e0973a67aec2 + container: mkv + type: episode + +? Educating.Greater.Manchester.S01E02.720p.HDTV.x264-PLUTONiUM-AsRequested/47fbcb2393aa4b5cbbb340d3173ca1a9.mkv +: title: Educating Greater Manchester + season: 1 + episode: 2 + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: PLUTONiUM + other: Repost + uuid: 47fbcb2393aa4b5cbbb340d3173ca1a9 + container: mkv + type: episode + +? Stranger.Things.S02E05.Chapter.Five.Dig.Dug.720p.NF.WEBRip.DD5.1.x264-PSYPHER-AsRequested-Obfuscated +: title: Stranger Things + season: 2 + episode: 5 + episode_title: Chapter Five Dig Dug + screen_size: 720p + streaming_service: Netflix + source: Web + other: [Rip, Repost, Obfuscated] + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: PSYPHER + type: episode + +? Show.Name.-.Season.1.3.4-.Mp4.1080p +: title: Show Name + season: [1, 3, 4] + container: mp4 + screen_size: 1080p + type: episode + +? Bones.S03.720p.HDTV.x264-SCENE +: title: Bones + season: 3 + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: SCENE + type: episode + +? shes.gotta.have.it.s01e08.720p.web.x264-strife.mkv +: title: shes gotta have it + season: 1 + episode: 8 + screen_size: 720p + source: Web + video_codec: H.264 + release_group: strife + type: episode + +? DuckTales.2017.S01E10.The.Missing.Links.of.Moorshire.PDTV.H.264.MP2-KIDKAT +: title: DuckTales + year: 2017 + season: 1 + episode: 10 + episode_title: The Missing Links of Moorshire + source: Digital TV + video_codec: H.264 + audio_codec: MP2 + release_group: KIDKAT + type: episode + +? Por Trece Razones - Temporada 2 [HDTV 720p][Cap.201][AC3 5.1 Castellano]/Por Trece Razones 2x01 [des202].mkv +: title: Por Trece Razones + season: 2 + source: HDTV + screen_size: 720p + episode: 1 + audio_codec: Dolby Digital + audio_channels: '5.1' + language: Catalan + release_group: des202 + container: mkv + type: episode + +? Cuerpo de Elite - Temporada 1 [HDTV 720p][Cap.113][AC3 5.1 Esp Castellano]\CuerpoDeElite720p_113_desca202.mkv +: title: Cuerpo de Elite + season: 1 + source: HDTV + screen_size: 720p + episode: 13 + audio_codec: Dolby Digital + audio_channels: '5.1' + language: + - Spanish + - Catalan + container: mkv + type: episode + +? Show.Name.S01E01.St.Patricks.Day.1080p.mkv +: title: Show Name + season: 1 + episode: 1 + episode_title: St Patricks Day + screen_size: 1080p + container: mkv + type: episode + +? Show.Name.S01E01.St.Patricks.Day.1080p-grp.mkv +: title: Show Name + season: 1 + episode: 1 + episode_title: St Patricks Day + screen_size: 1080p + release_group: grp + container: mkv + type: episode + +? Titans.2018.S01E09.Hank.And.Dawn.720p.DCU.WEB-DL.AAC2.0.H264-NTb +: title: Titans + year: 2018 + season: 1 + episode: 9 + episode_title: Hank And Dawn + screen_size: 720p + streaming_service: DC Universe + source: Web + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: NTb + type: episode + +? S.W.A.T.2017.S01E21.Treibjagd.German.Dubbed.DL.AmazonHD.x264-TVS +: title: S.W.A.T. + year: 2017 + season: 1 + episode: 21 + episode_title: Treibjagd + language: + - German + - Multi + streaming_service: Amazon Prime + other: HD + video_codec: H.264 + release_group: TVS + type: episode + +? S.W.A.T.2017.S01E16.READNFO.720p.HDTV.x264-KILLERS +: title: S.W.A.T. + year: 2017 + season: 1 + episode: 16 + other: Read NFO + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: KILLERS + type: episode + +? /mnt/NAS/NoSubsTVShows/Babylon 5/Season 01/Ep. 02 - Soul Hunter +: title: Babylon 5 + season: 1 + episode: 2 + episode_title: Soul Hunter + type: episode + +? This.is.Us.S01E01.HDTV.x264-KILLERS.mkv +: title: This is Us + season: 1 + episode: 1 + source: HDTV + video_codec: H.264 + release_group: KILLERS + container: mkv + type: episode + +? Videos/Office1080/The Office (US) (2005) Season 2 S02 + Extras (1080p AMZN WEB-DL x265 HEVC 10bit AAC 2.0 LION)/The Office (US) (2005) - S02E12 - The Injury (1080p AMZN WEB-DL x265 LION).mkv +: title: The Office + country: US + year: 2005 + season: 2 + other: Extras + screen_size: 1080p + streaming_service: Amazon Prime + source: Web + video_codec: H.265 + video_profile: High Efficiency Video Coding + color_depth: 10-bit + audio_codec: AAC + audio_channels: '2.0' + release_group: LION + episode: 12 + episode_title: The Injury + container: mkv + type: episode + +? Thumping.Spike.2.E01.DF.WEBRip.720p-DRAMATV.mp4 +: title: Thumping Spike 2 + episode: 1 + source: Web + other: Rip + screen_size: 720p + streaming_service: DramaFever + release_group: DRAMATV + container: mp4 + mimetype: video/mp4 + type: episode + +? About.Time.E01.1080p.VIKI.WEB-DL-BLUEBERRY.mp4 +: title: About Time + episode: 1 + screen_size: 1080p + streaming_service: Viki + source: Web + release_group: BLUEBERRY + container: mp4 + mimetype: video/mp4 + type: episode + +? Eyes.Of.Dawn.1991.E01.480p.MBCVOD.AAC.x264-NOGPR.mp4 +: title: Eyes Of Dawn + year: 1991 + season: 1991 + episode: 1 + screen_size: 480p + streaming_service: MBC + audio_codec: AAC + video_codec: H.264 + release_group: NOGPR + container: mp4 + mimetype: video/mp4 + type: episode \ No newline at end of file diff --git a/lib/guessit/test/movies.yml b/lib/guessit/test/movies.yml new file mode 100644 index 00000000..a534ca0f --- /dev/null +++ b/lib/guessit/test/movies.yml @@ -0,0 +1,1786 @@ +? __default__ +: type: movie + +? Movies/Fear and Loathing in Las Vegas (1998)/Fear.and.Loathing.in.Las.Vegas.720p.HDDVD.DTS.x264-ESiR.mkv +: title: Fear and Loathing in Las Vegas + year: 1998 + screen_size: 720p + source: HD-DVD + audio_codec: DTS + video_codec: H.264 + container: mkv + release_group: ESiR + +? Movies/El Dia de la Bestia (1995)/El.dia.de.la.bestia.DVDrip.Spanish.DivX.by.Artik[SEDG].avi +: title: El Dia de la Bestia + year: 1995 + source: DVD + other: Rip + language: spanish + video_codec: DivX + release_group: Artik[SEDG] + container: avi + +? Movies/Dark City (1998)/Dark.City.(1998).DC.BDRip.720p.DTS.X264-CHD.mkv +: title: Dark City + year: 1998 + source: Blu-ray + other: Rip + screen_size: 720p + audio_codec: DTS + video_codec: H.264 + release_group: CHD + +? Movies/Sin City (BluRay) (2005)/Sin.City.2005.BDRip.720p.x264.AC3-SEPTiC.mkv +: title: Sin City + year: 2005 + source: Blu-ray + other: Rip + screen_size: 720p + video_codec: H.264 + audio_codec: Dolby Digital + release_group: SEPTiC + +? Movies/Borat (2006)/Borat.(2006).R5.PROPER.REPACK.DVDRip.XviD-PUKKA.avi +: title: Borat + year: 2006 + proper_count: 2 + source: DVD + other: [ Region 5, Proper, Rip ] + video_codec: Xvid + release_group: PUKKA + +? "[XCT].Le.Prestige.(The.Prestige).DVDRip.[x264.HP.He-Aac.{Fr-Eng}.St{Fr-Eng}.Chaps].mkv" +: title: Le Prestige + source: DVD + other: Rip + video_codec: H.264 + video_profile: High + audio_codec: AAC + audio_profile: High Efficiency + language: [ french, english ] + subtitle_language: [ french, english ] + release_group: Chaps + +? Battle Royale (2000)/Battle.Royale.(Batoru.Rowaiaru).(2000).(Special.Edition).CD1of2.DVDRiP.XviD-[ZeaL].avi +: title: Battle Royale + year: 2000 + edition: Special + cd: 1 + cd_count: 2 + source: DVD + other: Rip + video_codec: Xvid + release_group: ZeaL + +? Movies/Brazil (1985)/Brazil_Criterion_Edition_(1985).CD2.avi +: title: Brazil + edition: Criterion + year: 1985 + cd: 2 + +? Movies/Persepolis (2007)/[XCT] Persepolis [H264+Aac-128(Fr-Eng)+ST(Fr-Eng)+Ind].mkv +: title: Persepolis + year: 2007 + video_codec: H.264 + audio_codec: AAC + language: [ French, English ] + subtitle_language: [ French, English ] + release_group: Ind + +? Movies/Toy Story (1995)/Toy Story [HDTV 720p English-Spanish].mkv +: title: Toy Story + year: 1995 + source: HDTV + screen_size: 720p + language: [ english, spanish ] + +? Movies/Office Space (1999)/Office.Space.[Dual-DVDRip].[Spanish-English].[XviD-AC3-AC3].[by.Oswald].avi +: title: Office Space + year: 1999 + other: [Dual Audio, Rip] + source: DVD + language: [ english, spanish ] + video_codec: Xvid + audio_codec: Dolby Digital + +? Movies/Wild Zero (2000)/Wild.Zero.DVDivX-EPiC.avi +: title: Wild Zero + year: 2000 + video_codec: DivX + release_group: EPiC + +? movies/Baraka_Edition_Collector.avi +: title: Baraka + edition: Collector + +? Movies/Blade Runner (1982)/Blade.Runner.(1982).(Director's.Cut).CD1.DVDRip.XviD.AC3-WAF.avi +: title: Blade Runner + year: 1982 + edition: Director's Cut + cd: 1 + source: DVD + other: Rip + video_codec: Xvid + audio_codec: Dolby Digital + release_group: WAF + +? movies/American.The.Bill.Hicks.Story.2009.DVDRip.XviD-EPiSODE.[UsaBit.com]/UsaBit.com_esd-americanbh.avi +: title: American The Bill Hicks Story + year: 2009 + source: DVD + other: Rip + video_codec: Xvid + release_group: EPiSODE + website: UsaBit.com + +? movies/Charlie.And.Boots.DVDRip.XviD-TheWretched/wthd-cab.avi +: title: Charlie And Boots + source: DVD + other: Rip + video_codec: Xvid + release_group: TheWretched + +? movies/Steig Larsson Millenium Trilogy (2009) BRrip 720 AAC x264/(1)The Girl With The Dragon Tattoo (2009) BRrip 720 AAC x264.mkv +: title: The Girl With The Dragon Tattoo + #film_title: Steig Larsson Millenium Trilogy + #film: 1 + year: 2009 + source: Blu-ray + other: [Reencoded, Rip] + audio_codec: AAC + video_codec: H.264 + screen_size: 720p + +? movies/Greenberg.REPACK.LiMiTED.DVDRip.XviD-ARROW/arw-repack-greenberg.dvdrip.xvid.avi +: title: Greenberg + source: DVD + video_codec: Xvid + release_group: ARROW + other: [Proper, Rip] + edition: Limited + proper_count: 1 + +? Movies/Fr - Paris 2054, Renaissance (2005) - De Christian Volckman - (Film Divx Science Fiction Fantastique Thriller Policier N&B).avi +: title: Paris 2054, Renaissance + year: 2005 + language: french + video_codec: DivX + +? Movies/[阿维达].Avida.2006.FRENCH.DVDRiP.XViD-PROD.avi +: title: Avida + year: 2006 + language: french + source: DVD + other: Rip + video_codec: Xvid + release_group: PROD + +? Movies/Alice in Wonderland DVDRip.XviD-DiAMOND/dmd-aw.avi +: title: Alice in Wonderland + source: DVD + other: Rip + video_codec: Xvid + release_group: DiAMOND + +? Movies/Ne.Le.Dis.A.Personne.Fr 2 cd/personnea_mp.avi +: title: Ne Le Dis A Personne + language: french + cd_count: 2 + +? Movies/Bunker Palace Hôtel (Enki Bilal) (1989)/Enki Bilal - Bunker Palace Hotel (Fr Vhs Rip).avi +: title: Bunker Palace Hôtel + year: 1989 + language: french + source: VHS + other: Rip + +? Movies/21 (2008)/21.(2008).DVDRip.x264.AC3-FtS.[sharethefiles.com].mkv +: title: "21" + year: 2008 + source: DVD + other: Rip + video_codec: H.264 + audio_codec: Dolby Digital + release_group: FtS + website: sharethefiles.com + +? Movies/9 (2009)/9.2009.Blu-ray.DTS.720p.x264.HDBRiSe.[sharethefiles.com].mkv +: title: "9" + year: 2009 + source: Blu-ray + audio_codec: DTS + screen_size: 720p + video_codec: H.264 + release_group: HDBRiSe + website: sharethefiles.com + +? Movies/Mamma.Mia.2008.DVDRip.AC3.XviD-CrazyTeam/Mamma.Mia.2008.DVDRip.AC3.XviD-CrazyTeam.avi +: title: Mamma Mia + year: 2008 + source: DVD + other: Rip + audio_codec: Dolby Digital + video_codec: Xvid + release_group: CrazyTeam + +? Movies/M.A.S.H. (1970)/MASH.(1970).[Divx.5.02][Dual-Subtitulos][DVDRip].ogm +: title: MASH + year: 1970 + video_codec: DivX + source: DVD + other: [Dual Audio, Rip] + +? Movies/The Doors (1991)/09.03.08.The.Doors.(1991).BDRip.720p.AC3.X264-HiS@SiLUHD-English.[sharethefiles.com].mkv +: title: The Doors + year: 1991 + date: 2008-03-09 + source: Blu-ray + other: Rip + screen_size: 720p + audio_codec: Dolby Digital + video_codec: H.264 + release_group: HiS@SiLUHD + language: english + website: sharethefiles.com + +? Movies/The Doors (1991)/08.03.09.The.Doors.(1991).BDRip.720p.AC3.X264-HiS@SiLUHD-English.[sharethefiles.com].mkv +: options: --date-year-first + title: The Doors + year: 1991 + date: 2008-03-09 + source: Blu-ray + other: Rip + screen_size: 720p + audio_codec: Dolby Digital + video_codec: H.264 + release_group: HiS@SiLUHD + language: english + website: sharethefiles.com + +? Movies/Ratatouille/video_ts-ratatouille.srt +: title: Ratatouille + source: DVD + +# Removing this one because 001 is guessed as an episode number. +# ? Movies/001 __ A classer/Fantomas se déchaine - Louis de Funès.avi +# : title: Fantomas se déchaine + +? Movies/Comme une Image (2004)/Comme.Une.Image.FRENCH.DVDRiP.XViD-NTK.par-www.divx-overnet.com.avi +: title: Comme une Image + year: 2004 + language: french + source: DVD + other: Rip + video_codec: Xvid + release_group: NTK + website: www.divx-overnet.com + +? Movies/Fantastic Mr Fox/Fantastic.Mr.Fox.2009.DVDRip.{x264+LC-AAC.5.1}{Fr-Eng}{Sub.Fr-Eng}-™.[sharethefiles.com].mkv +: title: Fantastic Mr Fox + year: 2009 + source: DVD + other: Rip + video_codec: H.264 + audio_codec: AAC + audio_profile: Low Complexity + audio_channels: "5.1" + language: [ french, english ] + subtitle_language: [ french, english ] + website: sharethefiles.com + +? Movies/Somewhere.2010.DVDRip.XviD-iLG/i-smwhr.avi +: title: Somewhere + year: 2010 + source: DVD + other: Rip + video_codec: Xvid + release_group: iLG + +? Movies/Moon_(2009).mkv +: title: Moon + year: 2009 + +? Movies/Moon_(2009)-x02-Making_Of.mkv +: title: Moon + year: 2009 + bonus: 2 + bonus_title: Making Of + +? movies/James_Bond-f17-Goldeneye.mkv +: title: Goldeneye + film_title: James Bond + film: 17 + + +? /movies/James_Bond-f21-Casino_Royale.mkv +: title: Casino Royale + film_title: James Bond + film: 21 + +? /movies/James_Bond-f21-Casino_Royale-x01-Becoming_Bond.mkv +: title: Casino Royale + film_title: James Bond + film: 21 + bonus: 1 + bonus_title: Becoming Bond + +? /movies/James_Bond-f21-Casino_Royale-x02-Stunts.mkv +: title: Casino Royale + film_title: James Bond + film: 21 + bonus: 2 + bonus_title: Stunts + +? OSS_117--Cairo,_Nest_of_Spies.mkv +: title: OSS 117 +# TODO: Implement subTitle for movies. + +? The Godfather Part 3.mkv +? The Godfather Part III.mkv +: title: The Godfather + part: 3 + +? Foobar Part VI.mkv +: title: Foobar + part: 6 + +? The_Insider-(1999)-x02-60_Minutes_Interview-1996.mp4 +: title: The Insider + year: 1999 + bonus: 2 + bonus_title: 60 Minutes Interview-1996 + +? Rush.._Beyond_The_Lighted_Stage-x09-Between_Sun_and_Moon-2002_Hartford.mkv +: title: Rush Beyond The Lighted Stage + bonus: 9 + bonus_title: Between Sun and Moon + year: 2002 + +? /public/uTorrent/Downloads Finished/Movies/Indiana.Jones.and.the.Temple.of.Doom.1984.HDTV.720p.x264.AC3.5.1-REDµX/Indiana.Jones.and.the.Temple.of.Doom.1984.HDTV.720p.x264.AC3.5.1-REDµX.mkv +: title: Indiana Jones and the Temple of Doom + year: 1984 + source: HDTV + screen_size: 720p + video_codec: H.264 + audio_codec: Dolby Digital + audio_channels: "5.1" + release_group: REDµX + +? The.Director’s.Notebook.2006.Blu-Ray.x264.DXVA.720p.AC3-de[42].mkv +: title: The Director’s Notebook + year: 2006 + source: Blu-ray + video_codec: H.264 + video_api: DXVA + screen_size: 720p + audio_codec: Dolby Digital + release_group: de[42] + + +? Movies/Cosmopolis.2012.LiMiTED.720p.BluRay.x264-AN0NYM0US[bb]/ano-cosmo.720p.mkv +: title: Cosmopolis + year: 2012 + screen_size: 720p + video_codec: H.264 + release_group: AN0NYM0US[bb] + source: Blu-ray + edition: Limited + +? movies/La Science des Rêves (2006)/La.Science.Des.Reves.FRENCH.DVDRip.XviD-MP-AceBot.avi +: title: La Science des Rêves + year: 2006 + source: DVD + other: Rip + video_codec: Xvid + video_profile: Main + release_group: AceBot + language: French + +? The_Italian_Job.mkv +: title: The Italian Job + +? The.Rum.Diary.2011.1080p.BluRay.DTS.x264.D-Z0N3.mkv +: title: The Rum Diary + year: 2011 + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + audio_codec: DTS + release_group: D-Z0N3 + +? Life.Of.Pi.2012.1080p.BluRay.DTS.x264.D-Z0N3.mkv +: title: Life Of Pi + year: 2012 + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + audio_codec: DTS + release_group: D-Z0N3 + +? The.Kings.Speech.2010.1080p.BluRay.DTS.x264.D Z0N3.mkv +: title: The Kings Speech + year: 2010 + screen_size: 1080p + source: Blu-ray + audio_codec: DTS + video_codec: H.264 + release_group: D Z0N3 + +? Street.Kings.2008.BluRay.1080p.DTS.x264.dxva EuReKA.mkv +: title: Street Kings + year: 2008 + source: Blu-ray + screen_size: 1080p + audio_codec: DTS + video_codec: H.264 + video_api: DXVA + release_group: EuReKA + +? 2001.A.Space.Odyssey.1968.HDDVD.1080p.DTS.x264.dxva EuReKA.mkv +: title: 2001 A Space Odyssey + year: 1968 + source: HD-DVD + screen_size: 1080p + audio_codec: DTS + video_codec: H.264 + video_api: DXVA + release_group: EuReKA + +? 2012.2009.720p.BluRay.x264.DTS WiKi.mkv +: title: "2012" + year: 2009 + screen_size: 720p + source: Blu-ray + video_codec: H.264 + audio_codec: DTS + release_group: WiKi + +? /share/Download/movie/Dead Man Down (2013) BRRiP XViD DD5_1 Custom NLSubs =-_lt Q_o_Q gt-=_/XD607ebb-BRc59935-5155473f-1c5f49/XD607ebb-BRc59935-5155473f-1c5f49.avi +: title: Dead Man Down + year: 2013 + source: Blu-ray + other: [Reencoded, Rip] + video_codec: Xvid + audio_channels: "5.1" + audio_codec: Dolby Digital + uuid: XD607ebb-BRc59935-5155473f-1c5f49 + +? Pacific.Rim.3D.2013.COMPLETE.BLURAY-PCH.avi +: title: Pacific Rim + year: 2013 + source: Blu-ray + other: + - Complete + - 3D + release_group: PCH + +? Immersion.French.2011.STV.READNFO.QC.FRENCH.ENGLISH.NTSC.DVDR.nfo +: title: Immersion French + year: 2011 + language: + - French + - English + source: DVD + other: [Straight to Video, Read NFO, NTSC] + +? Immersion.French.2011.STV.READNFO.QC.FRENCH.NTSC.DVDR.nfo +: title: Immersion French + year: 2011 + language: French + source: DVD + other: [Straight to Video, Read NFO, NTSC] + +? Immersion.French.2011.STV.READNFO.QC.NTSC.DVDR.nfo +: title: Immersion + language: French + year: 2011 + source: DVD + other: [Straight to Video, Read NFO, NTSC] + +? French.Immersion.2011.STV.READNFO.QC.ENGLISH.NTSC.DVDR.nfo +: title: French Immersion + year: 2011 + language: ENGLISH + source: DVD + other: [Straight to Video, Read NFO, NTSC] + +? Howl's_Moving_Castle_(2004)_[720p,HDTV,x264,DTS]-FlexGet.avi +: video_codec: H.264 + source: HDTV + title: Howl's Moving Castle + screen_size: 720p + year: 2004 + audio_codec: DTS + release_group: FlexGet + +? Pirates de langkasuka.2008.FRENCH.1920X1080.h264.AVC.AsiaRa.mkv +: screen_size: 1080p + year: 2008 + language: French + video_codec: H.264 + title: Pirates de langkasuka + release_group: AsiaRa + +? Masala (2013) Telugu Movie HD DVDScr XviD - Exclusive.avi +: year: 2013 + video_codec: Xvid + title: Masala + source: HD-DVD + other: Screener + release_group: Exclusive + +? Django Unchained 2012 DVDSCR X264 AAC-P2P.nfo +: year: 2012 + other: Screener + video_codec: H.264 + title: Django Unchained + audio_codec: AAC + source: DVD + release_group: P2P + +? Ejecutiva.En.Apuros(2009).BLURAY.SCR.Xvid.Spanish.LanzamientosD.nfo +: year: 2009 + other: Screener + source: Blu-ray + video_codec: Xvid + language: Spanish + title: Ejecutiva En Apuros + +? Die.Schluempfe.2.German.DL.1080p.BluRay.x264-EXQUiSiTE.mkv +: title: Die Schluempfe 2 + source: Blu-ray + language: + - Multiple languages + - German + video_codec: H.264 + release_group: EXQUiSiTE + screen_size: 1080p + +? Rocky 1976 French SubForced BRRip x264 AC3-FUNKY.mkv +: title: Rocky + year: 1976 + subtitle_language: French + source: Blu-ray + other: [Reencoded, Rip] + video_codec: H.264 + audio_codec: Dolby Digital + release_group: FUNKY + +? REDLINE (BD 1080p H264 10bit FLAC) [3xR].mkv +: title: REDLINE + source: Blu-ray + video_codec: H.264 + color_depth: 10-bit + audio_codec: FLAC + screen_size: 1080p + +? The.Lizzie.McGuire.Movie.(2003).HR.DVDRiP.avi +: title: The Lizzie McGuire Movie + year: 2003 + source: DVD + other: [High Resolution, Rip] + +? Hua.Mulan.BRRIP.MP4.x264.720p-HR.avi +: title: Hua Mulan + video_codec: H.264 + source: Blu-ray + screen_size: 720p + other: [Reencoded, Rip] + release_group: HR + +? Dr.Seuss.The.Lorax.2012.DVDRip.LiNE.XviD.AC3.HQ.Hive-CM8.mp4 +: video_codec: Xvid + title: Dr Seuss The Lorax + source: DVD + other: [Rip, Line Audio] + year: 2012 + audio_codec: Dolby Digital + audio_profile: High Quality + release_group: Hive-CM8 + +? "Star Wars: Episode IV - A New Hope (2004) Special Edition.MKV" +: title: "Star Wars: Episode IV" + alternative_title: A New Hope + year: 2004 + edition: Special + +? Dr.LiNE.The.Lorax.2012.DVDRip.LiNE.XviD.AC3.HQ.Hive-CM8.mp4 +: video_codec: Xvid + title: Dr LiNE The Lorax + source: DVD + other: [Rip, Line Audio] + year: 2012 + audio_codec: Dolby Digital + audio_profile: High Quality + release_group: Hive-CM8 + +? Dr.LiNE.The.Lorax.2012.DVDRip.XviD.AC3.HQ.Hive-CM8.mp4 +: video_codec: Xvid + title: Dr LiNE The Lorax + source: DVD + other: Rip + year: 2012 + audio_codec: Dolby Digital + audio_profile: High Quality + release_group: Hive-CM8 + +? Perfect Child-2007-TRUEFRENCH-TVRip.Xvid-h@mster.avi +: release_group: h@mster + title: Perfect Child + video_codec: Xvid + language: French + source: TV + other: Rip + year: 2007 + +? entre.ciel.et.terre.(1994).dvdrip.h264.aac-psypeon.avi +: audio_codec: AAC + source: DVD + other: Rip + release_group: psypeon + title: entre ciel et terre + video_codec: H.264 + year: 1994 + +? Yves.Saint.Laurent.2013.FRENCH.DVDSCR.MD.XviD-ViVARiUM.avi +: source: DVD + language: French + other: [Screener, Mic Dubbed] + release_group: ViVARiUM + title: Yves Saint Laurent + video_codec: Xvid + year: 2013 + +? Echec et Mort - Hard to Kill - Steven Seagal Multi 1080p BluRay x264 CCATS.avi +: source: Blu-ray + language: Multiple languages + release_group: CCATS + screen_size: 1080p + title: Echec et Mort + alternative_title: + - Hard to Kill + - Steven Seagal + video_codec: H.264 + +? Paparazzi - Timsit/Lindon (MKV 1080p tvripHD) +: options: -n + title: Paparazzi + alternative_title: + - Timsit + - Lindon + screen_size: 1080p + container: mkv + source: HDTV + other: Rip + +? some.movie.720p.bluray.x264-mind +: title: some movie + screen_size: 720p + video_codec: H.264 + release_group: mind + source: Blu-ray + +? Dr LiNE The Lorax 720p h264 BluRay +: title: Dr LiNE The Lorax + screen_size: 720p + video_codec: H.264 + source: Blu-ray + +#TODO: Camelcase implementation +#? BeatdownFrenchDVDRip.mkv +#: options: -c +# title: Beatdown +# language: French +# source: DVD + +#? YvesSaintLaurent2013FrenchDVDScrXvid.avi +#: options: -c +# source: DVD +# language: French +# other: Screener +# title: Yves saint laurent +# video_codec: Xvid +# year: 2013 + + +? Elle.s.en.va.720p.mkv +: screen_size: 720p + title: Elle s en va + +? FooBar.7.PDTV-FlexGet +: source: Digital TV + release_group: FlexGet + title: FooBar 7 + +? h265 - HEVC Riddick Unrated Director Cut French 1080p DTS.mkv +: audio_codec: DTS + edition: [Unrated, Director's Cut] + language: fr + screen_size: 1080p + title: Riddick + video_codec: H.265 + +? "[h265 - HEVC] Riddick Unrated Director Cut French [1080p DTS].mkv" +: audio_codec: DTS + edition: [Unrated, Director's Cut] + language: fr + screen_size: 1080p + title: Riddick + video_codec: H.265 + +? Barbecue-2014-French-mHD-1080p +: language: fr + other: Micro HD + screen_size: 1080p + title: Barbecue + year: 2014 + +? Underworld Quadrilogie VO+VFF+VFQ 1080p HDlight.x264~Tonyk~Monde Infernal +: language: fr + other: [Original Video, Micro HD] + screen_size: 1080p + title: Underworld Quadrilogie + video_codec: H.264 + +? A Bout Portant (The Killers).PAL.Multi.DVD-R-KZ +: source: DVD + language: mul + release_group: KZ + title: A Bout Portant + +? "Mise à Sac (Alain Cavalier, 1967) [Vhs.Rip.Vff]" +: source: VHS + language: fr + title: "Mise à Sac" + year: 1967 + +? A Bout Portant (The Killers).PAL.Multi.DVD-R-KZ +: source: DVD + other: PAL + language: mul + release_group: KZ + title: A Bout Portant + +? Youth.In.Revolt.(Be.Bad).2009.MULTI.1080p.LAME3*92-MEDIOZZ +: audio_codec: MP3 + language: mul + release_group: MEDIOZZ + screen_size: 1080p + title: Youth In Revolt + year: 2009 + +? La Defense Lincoln (The Lincoln Lawyer) 2011 [DVDRIP][Vostfr] +: source: DVD + other: Rip + subtitle_language: fr + title: La Defense Lincoln + year: 2011 + +? '[h265 - HEVC] Fight Club French 1080p DTS.' +: audio_codec: DTS + language: fr + screen_size: 1080p + title: Fight Club + video_codec: H.265 + +? Love Gourou (Mike Myers) - FR +: language: fr + title: Love Gourou + +? '[h265 - hevc] transformers 2 1080p french ac3 6ch.' +: audio_channels: '5.1' + audio_codec: Dolby Digital + language: fr + screen_size: 1080p + title: transformers 2 + video_codec: H.265 + +? 1.Angry.Man.1957.mkv +: title: 1 Angry Man + year: 1957 + +? 12.Angry.Men.1957.mkv +: title: 12 Angry Men + year: 1957 + +? 123.Angry.Men.1957.mkv +: title: 123 Angry Men + year: 1957 + +? "Looney Tunes 1444x866 Porky's Last Stand.mkv" +: screen_size: 1444x866 + title: Looney Tunes + +? Das.Appartement.German.AC3D.DL.720p.BluRay.x264-TVP +: audio_codec: Dolby Digital + source: Blu-ray + language: + - German + - Multi + release_group: TVP + screen_size: 720p + title: Das Appartement + type: movie + video_codec: H.264 + +? Das.Appartement.GERMAN.AC3D.DL.720p.BluRay.x264-TVP +: audio_codec: Dolby Digital + source: Blu-ray + language: + - de + - mul + release_group: TVP + screen_size: 720p + title: Das Appartement + video_codec: H.264 + +? Hyena.Road.2015.German.1080p.DL.DTSHD.Bluray.x264-pmHD +: audio_codec: DTS-HD + source: Blu-ray + language: + - de + - mul + release_group: pmHD + screen_size: 1080p + title: Hyena Road + type: movie + video_codec: H.264 + year: 2015 + +? Hyena.Road.2015.German.1080p.DL.DTSHD.Bluray.x264-pmHD +: audio_codec: DTS-HD + source: Blu-ray + language: + - de + - mul + release_group: pmHD + screen_size: 1080p + title: Hyena Road + type: movie + video_codec: H.264 + year: 2015 + +? Name.BDMux.720p +: title: Name + source: Blu-ray + other: Mux + screen_size: 720p + type: movie + +? Name.BRMux.720p +: title: Name + source: Blu-ray + other: [Reencoded, Mux] + screen_size: 720p + type: movie + +? Name.BDRipMux.720p +: title: Name + source: Blu-ray + other: [Rip, Mux] + screen_size: 720p + type: movie + +? Name.BRRipMux.720p +: title: Name + source: Blu-ray + other: [Reencoded, Rip, Mux] + screen_size: 720p + type: movie + +? Secondary Education (2013).mkv +: options: -T Second + title: Secondary Education + year: 2013 + type: movie + +? Mad Max Beyond Thunderdome () +: title: Mad Max Beyond Thunderdome + type: movie + +? Hacksaw Ridge 2016 Multi 2160p UHD BluRay Hevc10 HDR10 DTSHD & ATMOS 7.1 -DDR.mkv +: title: Hacksaw Ridge + year: 2016 + language: mul + screen_size: 2160p + source: Ultra HD Blu-ray + video_codec: H.265 + color_depth: 10-bit + audio_codec: [DTS-HD, Dolby Atmos] + audio_channels: '7.1' + release_group: DDR + container: mkv + type: movie + +? Special.Correspondents.2016.iTA.ENG.4K.2160p.NetflixUHD.TeamPremium.mp4 +: title: Special Correspondents + year: 2016 + language: [it, en] + screen_size: 2160p + streaming_service: Netflix + other: Ultra HD + release_group: TeamPremium + container: mp4 + type: movie + +? -Special.Correspondents.2016.iTA.ENG.4K.2160p.NetflixUHD.TeamPremium.mp4 +: alternative_title: 4K + +? -Special.Correspondents.2016.iTA.ENG.4K.2160p.NetflixUHD.TeamPremium.mp4 +: alternative_title: 2160p + +? Suicide Squad EXTENDED (2016) 2160p 4K UltraHD Blu-Ray x265 (HEVC 10bit BT709) Dolby Atmos 7.1 -DDR +: title: Suicide Squad + edition: Extended + year: 2016 + screen_size: 2160p + source: Ultra HD Blu-ray + video_codec: H.265 + color_depth: 10-bit + audio_codec: Dolby Atmos + audio_channels: '7.1' + release_group: DDR + type: movie + +? Queen - A Kind of Magic (Alternative Extended Version) 2CD 2014 +: title: Queen + alternative_title: A Kind of Magic + edition: [Alternative Cut, Extended] + cd_count: 2 + year: 2014 + type: movie + +? Jour.de.Fete.1949.ALTERNATiVE.CUT.1080p.BluRay.x264-SADPANDA[rarbg] +: title: Jour de Fete + year: 1949 + edition: Alternative Cut + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + release_group: SADPANDA[rarbg] + +? The.Movie.CONVERT.720p.HDTV.x264-C4TV +: title: The Movie + other: Converted + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: C4TV + type: movie + +? Its.A.Wonderful.Life.1946.Colorized.720p.BRRip.999MB.MkvCage.com +: title: Its A Wonderful Life + year: 1946 + other: [Colorized, Reencoded, Rip] + screen_size: 720p + source: Blu-ray + size: 999MB + website: MkvCage.com + type: movie + +? Alien DC (1979) [1080p] +: title: Alien + edition: Director's Cut + year: 1979 + screen_size: 1080p + type: movie + +? Requiem.For.A.Dream.2000.DC.1080p.BluRay.x264.anoXmous +: title: Requiem For A Dream + year: 2000 + edition: Director's Cut + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + release_group: anoXmous + type: movie + +? Before.the.Flood.2016.DOCU.1080p.WEBRip.x264.DD5.1-FGT +: title: Before the Flood + year: 2016 + other: [Documentary, Rip] + screen_size: 1080p + source: Web + video_codec: H.264 + audio_codec: Dolby Digital + audio_channels: '5.1' + release_group: FGT + type: movie + +? Zootopia.2016.HDRip.1.46Gb.Dub.MegaPeer +: title: Zootopia + year: 2016 + other: [HD, Rip] + size: 1.46GB + language: und + release_group: MegaPeer + type: movie + +? Suntan.2016.FESTiVAL.DVDRip.x264-IcHoR +: title: Suntan + year: 2016 + edition: Festival + source: DVD + other: Rip + video_codec: H.264 + release_group: IcHoR + type: movie + +? Hardwired.STV.NFOFiX.FRENCH.DVDRiP.XviD-SURViVAL +: title: Hardwired + other: [Straight to Video, Fix, Rip] + language: french + source: DVD + video_codec: Xvid + release_group: SURViVAL + -proper_count: 1 + type: movie + +? Maze.Runner.The.Scorch.Trials.OM.2015.WEB-DLRip.by.Seven +: title: Maze Runner The Scorch Trials + other: [Open Matte, Rip] + year: 2015 + source: Web + release_group: Seven + type: movie + +? Kampen Om Tungtvannet aka The Heavy Water War COMPLETE 720p x265 HEVC-Lund +: title: Kampen Om Tungtvannet aka The Heavy Water War + other: Complete + screen_size: 720p + video_codec: H.265 + release_group: Lund + type: movie + +? All.Fall.Down.x264.PROOFFIX-OUTLAWS +: title: All Fall Down + video_codec: H.264 + other: Fix + release_group: OUTLAWS + -proper_count: 1 + type: movie + +? The.Last.Survivors.2014.PROOF.SAMPLE.FiX.BDRip.x264-TOPCAT +: title: The Last Survivors + year: 2014 + other: [Fix, Rip] + source: Blu-ray + video_codec: H.264 + release_group: TOPCAT + type: movie + +? Bad Santa 2 2016 THEATRiCAL FRENCH BDRip XviD-EXTREME +: title: Bad Santa 2 + year: 2016 + edition: Theatrical + language: french + source: Blu-ray + other: Rip + video_codec: Xvid + release_group: EXTREME + type: movie + +? The Lord of the Rings The Fellowship of the Ring THEATRICAL EDITION (2001) [1080p] +: title: The Lord of the Rings The Fellowship of the Ring + edition: Theatrical + year: 2001 + screen_size: 1080p + type: movie + +? World War Z (2013) Theatrical Cut 720p BluRay x264 +: title: World War Z + year: 2013 + edition: Theatrical + screen_size: 720p + source: Blu-ray + video_codec: H.264 + type: movie + +? The Heartbreak Kid (1993) UNCUT 720p WEBRip x264 +: title: The Heartbreak Kid + year: 1993 + edition: Uncut + other: Rip + screen_size: 720p + source: Web + video_codec: H.264 + type: movie + +? Mrs.Doubtfire.1993.720p.OAR.Bluray.DTS.x264-CtrlHD +: title: Mrs Doubtfire + year: 1993 + screen_size: 720p + other: Original Aspect Ratio + source: Blu-ray + audio_codec: DTS + video_codec: H.264 + release_group: CtrlHD + type: movie + +? Aliens.SE.1986.BDRip.1080p +: title: Aliens + edition: Special + year: 1986 + source: Blu-ray + other: Rip + screen_size: 1080p + type: movie + +? 10 Cloverfield Lane.[Blu-Ray 1080p].[MULTI] +: options: --type movie + title: 10 Cloverfield Lane + source: Blu-ray + screen_size: 1080p + language: Multiple languages + type: movie + +? 007.Spectre.[HDTC.MD].[TRUEFRENCH] +: options: --type movie + title: 007 Spectre + source: HD Telecine + language: French + type: movie + +? We.Are.X.2016.LIMITED.BDRip.x264-BiPOLAR +: title: We Are X + year: 2016 + edition: Limited + source: Blu-ray + other: Rip + video_codec: H.264 + release_group: BiPOLAR + type: movie + +? The Rack (VHS) [1956] Paul Newman +: title: The Rack + source: VHS + year: 1956 + type: movie + +? Les.Magiciens.1976.VHSRip.XViD.MKO +: title: Les Magiciens + year: 1976 + source: VHS + other: Rip + video_codec: Xvid + release_group: MKO + type: movie + +? The Boss Baby 2017 720p CAM x264 AC3 TiTAN +: title: The Boss Baby + year: 2017 + screen_size: 720p + source: Camera + video_codec: H.264 + audio_codec: Dolby Digital + release_group: TiTAN + type: movie + +? The.Boss.Baby.2017.HDCAM.XviD-MrGrey +: title: The Boss Baby + year: 2017 + source: HD Camera + video_codec: Xvid + release_group: MrGrey + type: movie + +? The Martian 2015 Multi 2160p 4K UHD Bluray HEVC10 SDR DTSHD 7.1 -Zeus +: title: The Martian + year: 2015 + language: mul + screen_size: 2160p + source: Ultra HD Blu-ray + video_codec: H.265 + color_depth: 10-bit + other: Standard Dynamic Range + audio_codec: DTS-HD + audio_channels: '7.1' + release_group: Zeus + type: movie + +? Fantastic Beasts and Where to Find Them 2016 Multi 2160p UHD BluRay HEVC HDR Atmos7.1-DDR +: title: Fantastic Beasts and Where to Find Them + year: 2016 + language: mul + screen_size: 2160p + source: Ultra HD Blu-ray + video_codec: H.265 + other: HDR10 + audio_codec: Dolby Atmos + audio_channels: '7.1' + release_group: DDR + type: movie + +? Life of Pi 2012 2160p 4K BluRay HDR10 HEVC BT2020 DTSHD 7.1 subs -DDR +: title: Life of Pi + year: 2012 + screen_size: 2160p + source: Ultra HD Blu-ray + other: [HDR10, BT.2020] + subtitle_language: und + release_group: DDR + +? Captain.America.Civil.War.HDR.1080p.HEVC.10bit.BT.2020.DTS-HD.MA.7.1-VISIONPLUSHDR +: title: Captain America Civil War + other: [HDR10, BT.2020] + screen_size: 1080p + video_codec: H.265 + color_depth: 10-bit + audio_codec: DTS-HD + audio_profile: Master Audio + audio_channels: '7.1' + release_group: VISIONPLUSHDR + type: movie + +? Deadpool.2016.4K.2160p.UHD.HQ.8bit.BluRay.8CH.x265.HEVC-MZABI.mkv +: title: Deadpool + year: 2016 + screen_size: 2160p + source: Ultra HD Blu-ray + other: High Quality + color_depth: 8-bit + audio_channels: '7.1' + video_codec: H.265 + release_group: MZABI + type: movie + +? Fantastic.Beasts.and.Where.to.Find.Them.2016.2160p.4K.UHD.10bit.HDR.BluRay.7.1.x265.HEVC-MZABI.mkv +: title: Fantastic Beasts and Where to Find Them + year: 2016 + screen_size: 2160p + source: Ultra HD Blu-ray + color_depth: 10-bit + other: HDR10 + audio_channels: '7.1' + video_codec: H.265 + release_group: MZABI + container: mkv + type: movie + +? The.Arrival.4K.HDR.HEVC.10bit.BT2020.DTS.HD-MA-MadVR.HDR10.Dolby.Vision-VISIONPLUSHDR1000 +: title: The Arrival + screen_size: 2160p + other: [HDR10, BT.2020, Dolby Vision] + video_codec: H.265 + color_depth: 10-bit + audio_codec: DTS-HD + audio_profile: Master Audio + release_group: VISIONPLUSHDR1000 + type: movie + +? How To Steal A Dog.2014.BluRay.1080p.12bit.HEVC.OPUS 5.1-Hn1Dr2.mkv +: title: How To Steal A Dog + year: 2014 + source: Blu-ray + screen_size: 1080p + color_depth: 12-bit + video_codec: H.265 + audio_codec: Opus + audio_channels: '5.1' + release_group: Hn1Dr2 + container: mkv + type: movie + +? Interstelar.2014.IMAX.RUS.BDRip.x264.-HELLYWOOD.mkv +: title: Interstelar + year: 2014 + edition: IMAX + language: ru + source: Blu-ray + other: Rip + video_codec: H.264 + release_group: HELLYWOOD + container: mkv + type: movie + +? The.Dark.Knight.IMAX.EDITION.HQ.BluRay.1080p.x264.AC3.Hindi.Eng.ETRG +: title: The Dark Knight + edition: IMAX + other: High Quality + source: Blu-ray + screen_size: 1080p + video_codec: H.264 + audio_codec: Dolby Digital + language: [hindi, english] + release_group: ETRG + type: movie + +? The.Martian.2015.4K.UHD.UPSCALED-ETRG +: title: The Martian + year: 2015 + screen_size: 2160p + other: [Ultra HD, Upscaled] + release_group: ETRG + type: movie + +? Delibal 2015 720p Upscale DVDRip x264 DD5.1 AC3 +: title: Delibal + year: 2015 + screen_size: 720p + other: [Upscaled, Rip] + source: DVD + video_codec: H.264 + audio_codec: Dolby Digital + audio_channels: '5.1' + type: movie + +? Casablanca [Ultimate Collector's Edition].1942.BRRip.XviD-VLiS +: title: Casablanca + edition: [Ultimate, Collector] + year: 1942 + source: Blu-ray + other: [Reencoded, Rip] + video_codec: Xvid + release_group: VLiS + type: movie + +? Batman V Superman Dawn of Justice 2016 Extended Cut Ultimate Edition HDRip x264 AC3-DaDDy +: title: Batman V Superman Dawn of Justice + year: 2016 + edition: [Extended, Ultimate] + other: [HD, Rip] + video_codec: H.264 + audio_codec: Dolby Digital + release_group: DaDDy + type: movie + +? Stargate SG1 Ultimate Fan Collection +: title: Stargate SG1 + edition: [Ultimate, Fan] + +? The.Jungle.Book.2016.MULTi.1080p.BluRay.x264.DTS-HD.MA.7.1.DTS-HD.HRA.5.1-LeRalou +: title: The Jungle Book + year: 2016 + language: mul + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + audio_codec: DTS-HD + audio_profile: [Master Audio, High Resolution Audio] + audio_channels: ['7.1', '5.1'] + release_group: LeRalou + type: movie + +? Terminus.2015.BluRay.1080p.x264.DTS-HD.HRA.5.1-LTT +: title: Terminus + year: 2015 + source: Blu-ray + screen_size: 1080p + video_codec: H.264 + audio_codec: DTS-HD + audio_profile: High Resolution Audio + audio_channels: '5.1' + release_group: LTT + type: movie + +? Ghost.in.the.Shell.1995.1080p.Bluray.DTSES.x264-SHiTSoNy +: title: Ghost in the Shell + year: 1995 + screen_size: 1080p + source: Blu-ray + audio_codec: DTS + audio_profile: Extended Surround + +? The.Boss.Baby.2017.BluRay.1080p.DTS-ES.x264-PRoDJi +: title: The Boss Baby + year: 2017 + source: Blu-ray + screen_size: 1080p + audio_codec: DTS + audio_profile: Extended Surround + video_codec: H.264 + release_group: PRoDJi + type: movie + +? Title.2000.720p.BluRay.DDEX.x264-HDClub.mkv +: title: Title + year: 2000 + screen_size: 720p + source: Blu-ray + audio_codec: Dolby Digital + audio_profile: EX + video_codec: H.264 + release_group: HDClub + container: mkv + type: movie + +? Jack Reacher Never Go Back 2016 720p Bluray DD-EX x264-BluPanther +: title: Jack Reacher Never Go Back + year: 2016 + screen_size: 720p + source: Blu-ray + audio_codec: Dolby Digital + audio_profile: EX + video_codec: H.264 + release_group: BluPanther + type: movie + +? How To Steal A Dog.2014.BluRay.1080p.12bit.HEVC.OPUS 5.1-Hn1Dr2.mkv +: title: How To Steal A Dog + year: 2014 + source: Blu-ray + screen_size: 1080p + color_depth: 12-bit + video_codec: H.265 + audio_codec: Opus + audio_channels: '5.1' + release_group: Hn1Dr2 + container: mkv + type: movie + +? How.To.Be.Single.2016.1080p.BluRay.x264-BLOW/blow-how.to.be.single.2016.1080p.bluray.x264.mkv +: title: How To Be Single + year: 2016 + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + release_group: BLOW + container: mkv + type: movie + +? After.the.Storm.2016.720p.YIFY +: title: After the Storm + year: 2016 + screen_size: 720p + release_group: YIFY + type: movie + +? Battle Royale 2000 DC (1080p Bluray x265 HEVC 10bit AAC 7.1 Japanese Tigole) +: title: Battle Royale + year: 2000 + edition: Director's Cut + screen_size: 1080p + source: Blu-ray + video_codec: H.265 + color_depth: 10-bit + audio_codec: AAC + audio_channels: '7.1' + language: jp + release_group: Tigole + +? Congo.The.Grand.Inga.Project.2013.1080p.BluRay.x264-OBiTS +: title: Congo The Grand Inga Project + year: 2013 + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + release_group: OBiTS + type: movie + +? Congo.The.Grand.Inga.Project.2013.BRRip.XviD.MP3-RARBG +: title: Congo The Grand Inga Project + year: 2013 + source: Blu-ray + other: [Reencoded, Rip] + video_codec: Xvid + audio_codec: MP3 + release_group: RARBG + type: movie + +? Congo.The.Grand.Inga.Project.2013.720p.BluRay.H264.AAC-RARBG +: title: Congo The Grand Inga Project + year: 2013 + screen_size: 720p + source: Blu-ray + video_codec: H.264 + audio_codec: AAC + release_group: RARBG + type: movie + +? Mit.dem.Bauch.durch.die.Wand.SWiSSGERMAN.DOKU.DVDRiP.x264-DEFLOW +: title: Mit dem Bauch durch die Wand + language: de-CH + other: [Documentary, Rip] + source: DVD + video_codec: H.264 + release_group: DEFLOW + type: movie + +? InDefinitely.Maybe.2008.1080p.EUR.BluRay.VC-1.DTS-HD.MA.5.1-FGT +: title: InDefinitely Maybe + year: 2008 + screen_size: 1080p + source: Blu-ray + video_codec: VC-1 + audio_codec: DTS-HD + audio_profile: Master Audio + audio_channels: '5.1' + release_group: FGT + type: movie + +? Bjyukujyo Kyoushi Kan XXX 720P WEBRIP MP4-GUSH +: title: Bjyukujyo Kyoushi Kan + other: [XXX, Rip] + screen_size: 720p + source: Web + container: mp4 + release_group: GUSH + type: movie + +? The.Man.With.The.Golden.Arm.1955.1080p.BluRay.x264.DTS-FGT +: title: The Man With The Golden Arm + year: 1955 + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + audio_codec: DTS + release_group: FGT + type: movie + +? blow-how.to.be.single.2016.1080p.bluray.x264.mkv +: release_group: blow + title: how to be single + year: 2016 + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + container: mkv + type: movie + +? ulshd-the.right.stuff.1983.multi.1080p.bluray.x264.mkv +: release_group: ulshd + title: the right stuff + year: 1983 + language: mul + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + container: mkv + type: movie + +? FROZEN [2010] LiMiTED DVDRip H262 AAC[ ENG SUBS]-MANTESH +: title: FROZEN + year: 2010 + edition: Limited + source: DVD + other: Rip + video_codec: MPEG-2 + audio_codec: AAC + subtitle_language: english + release_group: MANTESH + type: movie + +? Family.Katta.2016.1080p.WEB-DL.H263.DD5.1.ESub-DDR +: title: Family Katta + year: 2016 + screen_size: 1080p + source: Web + video_codec: H.263 + audio_codec: Dolby Digital + audio_channels: '5.1' + subtitle_language: und + release_group: DDR + type: movie + +? Bad Boys 2 1080i.mpg2.rus.eng.ts +: title: Bad Boys 2 + screen_size: 1080i + video_codec: MPEG-2 + language: [russian, english] + container: ts + type: movie + +? Alien.Director.Cut.Ita.Eng.VP9.Opus.AlphaBot.webm +: title: Alien + edition: Director's Cut + language: [english, italian] + video_codec: VP9 + audio_codec: Opus + release_group: AlphaBot + container: webm + type: movie + +? The.Stranger.1946.US.(Kino.Classics).Bluray.1080p.LPCM.DD-2.0.x264-Grym@BTNET +: title: The Stranger + year: 1946 + country: US + source: Blu-ray + screen_size: 1080p + audio_codec: [LPCM, Dolby Digital] + audio_channels: '2.0' + video_codec: H.264 + release_group: Grym@BTNET + type: movie + +? X-Men.Apocalypse.2016.complete.hdts.pcm.TrueFrench-Scarface45.avi +: title: X-Men Apocalypse + year: 2016 + other: Complete + source: HD Telesync + audio_codec: PCM + language: french + release_group: Scarface45 + container: avi + type: movie + +? Tears.of.Steel.2012.2160p.DMRip.Eng.HDCLUB.mkv +: title: Tears of Steel + year: 2012 + screen_size: 2160p + source: Digital Master + other: Rip + language: english + release_group: HDCLUB + container: mkv + type: movie + +? "/Movies/Open Season 2 (2008)/Open Season 2 (2008) - Bluray-1080p.x264.DTS.mkv" +: options: --type movie + title: Open Season 2 + year: 2008 + source: Blu-ray + screen_size: 1080p + video_codec: H.264 + audio_codec: DTS + container: mkv + type: movie + +? Re-Animator.1985.INTEGRAL VERSION LIMITED EDITION.1080p.BluRay.REMUX.AVC.DTS-HD MA 5.1-LAZY +: title: Re-Animator + year: 1985 + edition: Limited + screen_size: 1080p + source: Blu-ray + other: Remux + video_codec: H.264 + audio_codec: DTS-HD + audio_profile: Master Audio + audio_channels: '5.1' + release_group: LAZY + type: movie + +? Test (2013) [WEBDL-1080p] [x264 AC3] [ENG+RU+PT] [NTb].mkv +: title: Test + year: 2013 + source: Web + screen_size: 1080p + video_codec: H.264 + audio_codec: Dolby Digital + language: [en, ru, pt] + release_group: NTb + container: mkv + type: movie + +? "[nextorrent.org] Bienvenue.Au.Gondwana.2016.FRENCH.DVDRiP.XViD-AViTECH.avi" +: website: nextorrent.org + title: Bienvenue Au Gondwana + year: 2016 + language: french + source: DVD + other: Rip + video_codec: Xvid + release_group: AViTECH + container: avi + type: movie + +? Star Trek First Contact (1996) Blu-Ray 1080p24 H.264 TrueHD 5.1 CtrlHD +: title: Star Trek First Contact + year: 1996 + source: Blu-ray + screen_size: 1080p + frame_rate: 24fps + video_codec: H.264 + audio_codec: Dolby TrueHD + audio_channels: '5.1' + release_group: CtrlHD + type: movie + +? The.Hobbit.The.Desolation.of.Smaug.Extended.HFR.48fps.ITA.ENG.AC3.BDRip.1080p.x264_ZMachine.mkv +: title: The Hobbit The Desolation of Smaug + edition: Extended + other: [High Frame Rate, Rip] + frame_rate: 48fps + language: [it, en] + audio_codec: Dolby Digital + source: Blu-ray + screen_size: 1080p + video_codec: H.264 + release_group: ZMachine + container: mkv + type: movie + +? Test (2013) [WEBDL-1080p] [x264 AC3] [ENG+PT+DE] [STANDARD] +: title: Test + year: 2013 + source: Web + screen_size: 1080p + video_codec: H.264 + audio_codec: Dolby Digital + language: [en, pt, de] + release_group: STANDARD + type: movie + +? Test (2013) [WEBDL-1080p] [x264 AC3] [ENG+DE+IT] [STANDARD] +: title: Test + year: 2013 + source: Web + screen_size: 1080p + video_codec: H.264 + audio_codec: Dolby Digital + language: [en, de, it] + release_group: STANDARD + type: movie + +? Ant-Man.and.the.Wasp.2018.Digital.Extras.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv +: title: Ant-Man and the Wasp + year: 2018 + other: Extras + screen_size: 1080p + streaming_service: Amazon Prime + source: Web + audio_codec: Dolby Digital Plus + audio_channels: '5.1' + video_codec: H.264 + release_group: NTG + type: movie + +? Ant-Man.and.the.Wasp.2018.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv +: title: Ant-Man and the Wasp + year: 2018 + screen_size: 1080p + streaming_service: Amazon Prime + source: Web + audio_codec: Dolby Digital Plus + audio_channels: '5.1' + video_codec: H.264 + release_group: NTG + type: movie + +? Avengers.Infinity.War.2018.3D.Hybrid.REPACK.1080p.BluRay.REMUX.AVC.Atmos-EPSiLON.mk3d +: title: Avengers Infinity War + year: 2018 + other: + - 3D + - Proper + - Remux + proper_count: 1 + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + audio_codec: Dolby Atmos + release_group: EPSiLON + container: mk3d + type: movie + +? Ouija.Seance.The.Final.Game.2018.1080p.WEB-DL.DD5.1.H264-CMRG +: title: Ouija Seance The Final Game + year: 2018 + screen_size: 1080p + source: Web + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: CMRG + type: movie + +? The.Girl.in.the.Spiders.Web.2019.1080p.WEB-DL.x264.AC3-EVO.mkv +: title: The Girl in the Spiders Web + year: 2019 + screen_size: 1080p + source: Web + video_codec: H.264 + audio_codec: Dolby Digital + release_group: EVO + container: mkv + type: movie diff --git a/lib/guessit/test/rules/__init__.py b/lib/guessit/test/rules/__init__.py new file mode 100644 index 00000000..e5be370e --- /dev/null +++ b/lib/guessit/test/rules/__init__.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name diff --git a/lib/guessit/test/rules/audio_codec.yml b/lib/guessit/test/rules/audio_codec.yml new file mode 100644 index 00000000..9e381c34 --- /dev/null +++ b/lib/guessit/test/rules/audio_codec.yml @@ -0,0 +1,134 @@ +# Multiple input strings having same expected results can be chained. +# Use $ marker to check inputs that should not match results. + + +? +MP3 +? +lame +? +lame3.12 +? +lame3.100 +: audio_codec: MP3 + +? +MP2 +: audio_codec: MP2 + +? +DolbyDigital +? +DD +? +Dolby Digital +? +AC3 +: audio_codec: Dolby Digital + +? +DDP +? +DD+ +? +EAC3 +: audio_codec: Dolby Digital Plus + +? +DolbyAtmos +? +Dolby Atmos +? +Atmos +? -Atmosphere +: audio_codec: Dolby Atmos + +? +AAC +: audio_codec: AAC + +? +Flac +: audio_codec: FLAC + +? +DTS +: audio_codec: DTS + +? +True-HD +? +trueHD +: audio_codec: Dolby TrueHD + +? +True-HD51 +? +trueHD51 +: audio_codec: Dolby TrueHD + audio_channels: '5.1' + +? +DTSHD +? +DTS HD +? +DTS-HD +: audio_codec: DTS-HD + +? +DTS-HDma +? +DTSMA +: audio_codec: DTS-HD + audio_profile: Master Audio + +? +AC3-hq +: audio_codec: Dolby Digital + audio_profile: High Quality + +? +AAC-HE +: audio_codec: AAC + audio_profile: High Efficiency + +? +AAC-LC +: audio_codec: AAC + audio_profile: Low Complexity + +? +AAC2.0 +? +AAC20 +: audio_codec: AAC + audio_channels: '2.0' + +? +7.1 +? +7ch +? +8ch +: audio_channels: '7.1' + +? +5.1 +? +5ch +? +6ch +: audio_channels: '5.1' + +? +2ch +? +2.0 +? +stereo +: audio_channels: '2.0' + +? +1ch +? +mono +: audio_channels: '1.0' + +? DD5.1 +? DD51 +: audio_codec: Dolby Digital + audio_channels: '5.1' + +? -51 +: audio_channels: '5.1' + +? DTS-HD.HRA +? DTSHD.HRA +? DTS-HD.HR +? DTSHD.HR +? -HRA +? -HR +: audio_codec: DTS-HD + audio_profile: High Resolution Audio + +? DTSES +? DTS-ES +? -ES +: audio_codec: DTS + audio_profile: Extended Surround + +? DD-EX +? DDEX +? -EX +: audio_codec: Dolby Digital + audio_profile: EX + +? OPUS +: audio_codec: Opus + +? Vorbis +: audio_codec: Vorbis + +? PCM +: audio_codec: PCM + +? LPCM +: audio_codec: LPCM diff --git a/lib/guessit/test/rules/bonus.yml b/lib/guessit/test/rules/bonus.yml new file mode 100644 index 00000000..6ef6f5b2 --- /dev/null +++ b/lib/guessit/test/rules/bonus.yml @@ -0,0 +1,9 @@ +# Multiple input strings having same expected results can be chained. +# Use - marker to check inputs that should not match results. +? Movie Title-x01-Other Title.mkv +? Movie Title-x01-Other Title +? directory/Movie Title-x01-Other Title/file.mkv +: title: Movie Title + bonus_title: Other Title + bonus: 1 + diff --git a/lib/guessit/test/rules/cds.yml b/lib/guessit/test/rules/cds.yml new file mode 100644 index 00000000..d76186c6 --- /dev/null +++ b/lib/guessit/test/rules/cds.yml @@ -0,0 +1,10 @@ +# Multiple input strings having same expected results can be chained. +# Use - marker to check inputs that should not match results. +? cd 1of3 +: cd: 1 + cd_count: 3 + +? Some.Title-DVDRIP-x264-CDP +: cd: !!null + release_group: CDP + video_codec: H.264 diff --git a/lib/guessit/test/rules/common_words.yml b/lib/guessit/test/rules/common_words.yml new file mode 100644 index 00000000..d403a457 --- /dev/null +++ b/lib/guessit/test/rules/common_words.yml @@ -0,0 +1,467 @@ +? is +: title: is + +? it +: title: it + +? am +: title: am + +? mad +: title: mad + +? men +: title: men + +? man +: title: man + +? run +: title: run + +? sin +: title: sin + +? st +: title: st + +? to +: title: to + +? 'no' +: title: 'no' + +? non +: title: non + +? war +: title: war + +? min +: title: min + +? new +: title: new + +? car +: title: car + +? day +: title: day + +? bad +: title: bad + +? bat +: title: bat + +? fan +: title: fan + +? fry +: title: fry + +? cop +: title: cop + +? zen +: title: zen + +? gay +: title: gay + +? fat +: title: fat + +? one +: title: one + +? cherokee +: title: cherokee + +? got +: title: got + +? an +: title: an + +? as +: title: as + +? cat +: title: cat + +? her +: title: her + +? be +: title: be + +? hat +: title: hat + +? sun +: title: sun + +? may +: title: may + +? my +: title: my + +? mr +: title: mr + +? rum +: title: rum + +? pi +: title: pi + +? bb +: title: bb + +? bt +: title: bt + +? tv +: title: tv + +? aw +: title: aw + +? by +: title: by + +? md +: other: Mic Dubbed + +? mp +: title: mp + +? cd +: title: cd + +? in +: title: in + +? ad +: title: ad + +? ice +: title: ice + +? ay +: title: ay + +? at +: title: at + +? star +: title: star + +? so +: title: so + +? he +: title: he + +? do +: title: do + +? ax +: title: ax + +? mx +: title: mx + +? bas +: title: bas + +? de +: title: de + +? le +: title: le + +? son +: title: son + +? ne +: title: ne + +? ca +: title: ca + +? ce +: title: ce + +? et +: title: et + +? que +: title: que + +? mal +: title: mal + +? est +: title: est + +? vol +: title: vol + +? or +: title: or + +? mon +: title: mon + +? se +: title: se + +? je +: title: je + +? tu +: title: tu + +? me +: title: me + +? ma +: title: ma + +? va +: title: va + +? au +: country: AU + +? lu +: title: lu + +? wa +: title: wa + +? ga +: title: ga + +? ao +: title: ao + +? la +: title: la + +? el +: title: el + +? del +: title: del + +? por +: title: por + +? mar +: title: mar + +? al +: title: al + +? un +: title: un + +? ind +: title: ind + +? arw +: title: arw + +? ts +: source: Telesync + +? ii +: title: ii + +? bin +: title: bin + +? chan +: title: chan + +? ss +: title: ss + +? san +: title: san + +? oss +: title: oss + +? iii +: title: iii + +? vi +: title: vi + +? ben +: title: ben + +? da +: title: da + +? lt +: title: lt + +? ch +: title: ch + +? sr +: title: sr + +? ps +: title: ps + +? cx +: title: cx + +? vo +: title: vo + +? mkv +: container: mkv + +? avi +: container: avi + +? dmd +: title: dmd + +? the +: title: the + +? dis +: title: dis + +? cut +: title: cut + +? stv +: title: stv + +? des +: title: des + +? dia +: title: dia + +? and +: title: and + +? cab +: title: cab + +? sub +: title: sub + +? mia +: title: mia + +? rim +: title: rim + +? las +: title: las + +? une +: title: une + +? par +: title: par + +? srt +: container: srt + +? ano +: title: ano + +? toy +: title: toy + +? job +: title: job + +? gag +: title: gag + +? reel +: title: reel + +? www +: title: www + +? for +: title: for + +? ayu +: title: ayu + +? csi +: title: csi + +? ren +: title: ren + +? moi +: title: moi + +? sur +: title: sur + +? fer +: title: fer + +? fun +: title: fun + +? two +: title: two + +? big +: title: big + +? psy +: title: psy + +? air +: title: air + +? brazil +: title: brazil + +? jordan +: title: jordan + +? bs +: title: bs + +? kz +: title: kz + +? gt +: title: gt + +? im +: title: im + +? pt +: language: pt + +? scr +: title: scr + +? sd +: title: sd + +? hr +: other: High Resolution diff --git a/lib/guessit/test/rules/country.yml b/lib/guessit/test/rules/country.yml new file mode 100644 index 00000000..b3d4d8f1 --- /dev/null +++ b/lib/guessit/test/rules/country.yml @@ -0,0 +1,13 @@ +# Multiple input strings having same expected results can be chained. +# Use $ marker to check inputs that should not match results. +? Us.this.is.title +? this.is.title.US +: country: US + title: this is title + +? This.is.Us +: title: This is Us + +? This.Is.Us +: options: --no-default-config + title: This Is Us diff --git a/lib/guessit/test/rules/date.yml b/lib/guessit/test/rules/date.yml new file mode 100644 index 00000000..d7379f03 --- /dev/null +++ b/lib/guessit/test/rules/date.yml @@ -0,0 +1,50 @@ +# Multiple input strings having same expected results can be chained. +# Use - marker to check inputs that should not match results. +? +09.03.08 +? +09.03.2008 +? +2008.03.09 +: date: 2008-03-09 + +? +31.01.15 +? +31.01.2015 +? +15.01.31 +? +2015.01.31 +: date: 2015-01-31 + +? +01.02.03 +: date: 2003-02-01 + +? +01.02.03 +: options: --date-year-first + date: 2001-02-03 + +? +01.02.03 +: options: --date-day-first + date: 2003-02-01 + +? 1919 +? 2030 +: !!map {} + +? 2029 +: year: 2029 + +? (1920) +: year: 1920 + +? 2012 +: year: 2012 + +? 2011 2013 (2012) (2015) # first marked year is guessed. +: title: "2011 2013" + year: 2012 + +? 2012 2009 S01E02 2015 # If no year is marked, the second one is guessed. +: title: "2012" + year: 2009 + episode_title: "2015" + +? Something 2 mar 2013) +: title: Something + date: 2013-03-02 + type: episode diff --git a/lib/guessit/test/rules/edition.yml b/lib/guessit/test/rules/edition.yml new file mode 100644 index 00000000..4b7fd986 --- /dev/null +++ b/lib/guessit/test/rules/edition.yml @@ -0,0 +1,63 @@ +# Multiple input strings having same expected results can be chained. +# Use - marker to check inputs that should not match results. +? Director's cut +? Edition Director's cut +: edition: Director's Cut + +? Collector +? Collector Edition +? Edition Collector +: edition: Collector + +? Special Edition +? Edition Special +? -Special +: edition: Special + +? Criterion Edition +? Edition Criterion +? CC +? -Criterion +: edition: Criterion + +? Deluxe +? Deluxe Edition +? Edition Deluxe +: edition: Deluxe + +? Super Movie Alternate XViD +? Super Movie Alternative XViD +? Super Movie Alternate Cut XViD +? Super Movie Alternative Cut XViD +: edition: Alternative Cut + +? ddc +: edition: Director's Definitive Cut + +? IMAX +? IMAX Edition +: edition: IMAX + +? ultimate edition +? -ultimate +: edition: Ultimate + +? ultimate collector edition +? ultimate collector's edition +? ultimate collectors edition +? -collectors edition +? -ultimate edition +: edition: [Ultimate, Collector] + +? ultimate collectors edition dc +: edition: [Ultimate, Collector, Director's Cut] + +? fan edit +? fan edition +? fan collection +: edition: Fan + +? ultimate fan edit +? ultimate fan edition +? ultimate fan collection +: edition: [Ultimate, Fan] diff --git a/lib/guessit/test/rules/episodes.yml b/lib/guessit/test/rules/episodes.yml new file mode 100644 index 00000000..44e06a3b --- /dev/null +++ b/lib/guessit/test/rules/episodes.yml @@ -0,0 +1,331 @@ +# Multiple input strings having same expected results can be chained. +# Use $ marker to check inputs that should not match results. +? +2x5 +? +2X5 +? +02x05 +? +2X05 +? +02x5 +? S02E05 +? s02e05 +? s02e5 +? s2e05 +? s02ep05 +? s2EP5 +? -s03e05 +? -s02e06 +? -3x05 +? -2x06 +: season: 2 + episode: 5 + +? "+0102" +? "+102" +: season: 1 + episode: 2 + +? "0102 S03E04" +? "S03E04 102" +: season: 3 + episode: 4 + +? +serie Saison 2 other +? +serie Season 2 other +? +serie Saisons 2 other +? +serie Seasons 2 other +? +serie Season Two other +? +serie Season II other +: season: 2 + +? Some Series.S02E01.Episode.title.mkv +? Some Series/Season 02/E01-Episode title.mkv +? Some Series/Season 02/Some Series-E01-Episode title.mkv +? Some Dummy Directory/Season 02/Some Series-E01-Episode title.mkv +? -Some Dummy Directory/Season 02/E01-Episode title.mkv +? Some Series/Unsafe Season 02/Some Series-E01-Episode title.mkv +? -Some Series/Unsafe Season 02/E01-Episode title.mkv +? Some Series/Season 02/E01-Episode title.mkv +? Some Series/ Season 02/E01-Episode title.mkv +? Some Dummy Directory/Some Series S02/E01-Episode title.mkv +? Some Dummy Directory/S02 Some Series/E01-Episode title.mkv +: title: Some Series + episode_title: Episode title + season: 2 + episode: 1 + +? Some Series.S02E01.mkv +? Some Series/Season 02/E01.mkv +? Some Series/Season 02/Some Series-E01.mkv +? Some Dummy Directory/Season 02/Some Series-E01.mkv +? -Some Dummy Directory/Season 02/E01.mkv +? Some Series/Unsafe Season 02/Some Series-E01.mkv +? -Some Series/Unsafe Season 02/E01.mkv +? Some Series/Season 02/E01.mkv +? Some Series/ Season 02/E01.mkv +? Some Dummy Directory/Some Series S02/E01-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.mkv +: title: Some Series + season: 2 + episode: 1 + +? Some Series S03E01E02 +: title: Some Series + season: 3 + episode: [1, 2] + +? Some Series S01S02S03 +? Some Series S01-02-03 +? Some Series S01 S02 S03 +? Some Series S01 02 03 +: title: Some Series + season: [1, 2, 3] + +? Some Series E01E02E03 +? Some Series E01-02-03 +? Some Series E01-03 +? Some Series E01 E02 E03 +? Some Series E01 02 03 +: title: Some Series + episode: [1, 2, 3] + +? Some Series E01E02E04 +? Some Series E01 E02 E04 +? Some Series E01 02 04 +: title: Some Series + episode: [1, 2, 4] + +? Some Series E01-02-04 +? Some Series E01-04 +? Some Series E01-04 +: title: Some Series + episode: [1, 2, 3, 4] + +? Some Series E01-02-E04 +: title: Some Series + episode: [1, 2, 3, 4] + +? Episode 3 +? -Episode III +: episode: 3 + +? Episode 3 +? Episode III +: options: -t episode + episode: 3 + +? -A very special movie +: episode_details: Special + +? -A very special episode +: options: -t episode + episode_details: Special + +? A very special episode s06 special +: options: -t episode + title: A very special episode + episode_details: Special + +? 12 Monkeys\Season 01\Episode 05\12 Monkeys - S01E05 - The Night Room.mkv +: container: mkv + title: 12 Monkeys + episode: 5 + season: 1 + +? S03E02.X.1080p +: episode: 2 + screen_size: 1080p + season: 3 + +? Something 1 x 2-FlexGet +: options: -t episode + title: Something + season: 1 + episode: 2 + episode_title: FlexGet + +? Show.Name.-.Season.1.to.3.-.Mp4.1080p +? Show.Name.-.Season.1~3.-.Mp4.1080p +? Show.Name.-.Saison.1.a.3.-.Mp4.1080p +: container: mp4 + screen_size: 1080p + season: + - 1 + - 2 + - 3 + title: Show Name + +? Show.Name.Season.1.3&5.HDTV.XviD-GoodGroup[SomeTrash] +? Show.Name.Season.1.3 and 5.HDTV.XviD-GoodGroup[SomeTrash] +: source: HDTV + release_group: GoodGroup[SomeTrash] + season: + - 1 + - 3 + - 5 + title: Show Name + type: episode + video_codec: Xvid + +? Show.Name.Season.1.2.3-5.HDTV.XviD-GoodGroup[SomeTrash] +? Show.Name.Season.1.2.3~5.HDTV.XviD-GoodGroup[SomeTrash] +? Show.Name.Season.1.2.3 to 5.HDTV.XviD-GoodGroup[SomeTrash] +: source: HDTV + release_group: GoodGroup[SomeTrash] + season: + - 1 + - 2 + - 3 + - 4 + - 5 + title: Show Name + type: episode + video_codec: Xvid + +? The.Get.Down.S01EP01.FRENCH.720p.WEBRIP.XVID-STR +: episode: 1 + source: Web + other: Rip + language: fr + release_group: STR + screen_size: 720p + season: 1 + title: The Get Down + type: episode + video_codec: Xvid + +? My.Name.Is.Earl.S01E01-S01E21.SWE-SUB +: episode: + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + - 9 + - 10 + - 11 + - 12 + - 13 + - 14 + - 15 + - 16 + - 17 + - 18 + - 19 + - 20 + - 21 + season: 1 + subtitle_language: sv + title: My Name Is Earl + type: episode + +? Show.Name.Season.4.Episodes.1-12 +: episode: + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + - 9 + - 10 + - 11 + - 12 + season: 4 + title: Show Name + type: episode + +? show name s01.to.s04 +: season: + - 1 + - 2 + - 3 + - 4 + title: show name + type: episode + +? epi +: options: -t episode + title: epi + +? Episode20 +? Episode 20 +: episode: 20 + +? Episode50 +? Episode 50 +: episode: 50 + +? Episode51 +? Episode 51 +: episode: 51 + +? Episode70 +? Episode 70 +: episode: 70 + +? Episode71 +? Episode 71 +: episode: 71 + +? S01D02.3-5-GROUP +: disc: [2, 3, 4, 5] + +? S01D02&4-6&8 +: disc: [2, 4, 5, 6, 8] + +? Something.4x05-06 +? Something - 4x05-06 +? Something:4x05-06 +? Something 4x05-06 +? Something-4x05-06 +: title: Something + season: 4 + episode: + - 5 + - 6 + +? Something.4x05-06 +? Something - 4x05-06 +? Something:4x05-06 +? Something 4x05-06 +? Something-4x05-06 +: options: -T something + title: something + season: 4 + episode: + - 5 + - 6 + +? Colony 23/S01E01.Some.title.mkv +: title: Colony 23 + season: 1 + episode: 1 + episode_title: Some title + +? Show.Name.E02.2010.mkv +: options: -t episode + title: Show Name + year: 2010 + episode: 2 + +? Show.Name.E02.S2010.mkv +: options: -t episode + title: Show Name + year: 2010 + season: 2010 + episode: 2 + + +? Show.Name.E02.2010.mkv +: title: Show Name + year: 2010 + episode: 2 + +? Show.Name.E02.S2010.mkv +: title: Show Name + year: 2010 + season: 2010 + episode: 2 diff --git a/lib/guessit/test/rules/film.yml b/lib/guessit/test/rules/film.yml new file mode 100644 index 00000000..1f774331 --- /dev/null +++ b/lib/guessit/test/rules/film.yml @@ -0,0 +1,9 @@ +# Multiple input strings having same expected results can be chained. +# Use - marker to check inputs that should not match results. +? Film Title-f01-Series Title.mkv +? Film Title-f01-Series Title +? directory/Film Title-f01-Series Title/file.mkv +: title: Series Title + film_title: Film Title + film: 1 + diff --git a/lib/guessit/test/rules/language.yml b/lib/guessit/test/rules/language.yml new file mode 100644 index 00000000..10e5b9c0 --- /dev/null +++ b/lib/guessit/test/rules/language.yml @@ -0,0 +1,47 @@ +# Multiple input strings having same expected results can be chained. +# Use - marker to check inputs that should not match results. +? +English +? .ENG. +: language: English + +? +French +: language: French + +? +SubFrench +? +SubFr +? +STFr +? ST.FR +: subtitle_language: French + +? +ENG.-.sub.FR +? ENG.-.FR Sub +? +ENG.-.SubFR +? +ENG.-.FRSUB +? +ENG.-.FRSUBS +? +ENG.-.FR-SUBS +: language: English + subtitle_language: French + +? "{Fr-Eng}.St{Fr-Eng}" +? "Le.Prestige[x264.{Fr-Eng}.St{Fr-Eng}.Chaps].mkv" +: language: [French, English] + subtitle_language: [French, English] + +? +ENG.-.sub.SWE +? ENG.-.SWE Sub +? +ENG.-.SubSWE +? +ENG.-.SWESUB +? +ENG.-.sub.SV +? ENG.-.SV Sub +? +ENG.-.SubSV +? +ENG.-.SVSUB +: language: English + subtitle_language: Swedish + +? The English Patient (1996) +: title: The English Patient + -language: english + +? French.Kiss.1995.1080p +: title: French Kiss + -language: french diff --git a/lib/guessit/test/rules/other.yml b/lib/guessit/test/rules/other.yml new file mode 100644 index 00000000..447f1787 --- /dev/null +++ b/lib/guessit/test/rules/other.yml @@ -0,0 +1,169 @@ +# Multiple input strings having same expected results can be chained. +# Use - marker to check inputs that should not match results. +? +DVDSCR +? +DVDScreener +? +DVD-SCR +? +DVD Screener +? +DVD AnythingElse Screener +? -DVD AnythingElse SCR +: other: Screener + +? +AudioFix +? +AudioFixed +? +Audio Fix +? +Audio Fixed +: other: Audio Fixed + +? +SyncFix +? +SyncFixed +? +Sync Fix +? +Sync Fixed +: other: Sync Fixed + +? +DualAudio +? +Dual Audio +: other: Dual Audio + +? +ws +? +WideScreen +? +Wide Screen +: other: Widescreen + +# Fix must be surround by others properties to be matched. +? DVD.fix.XViD +? -DVD.Fix +? -Fix.XViD +: other: Fix + -proper_count: 1 + +? -DVD.BlablaBla.Fix.Blablabla.XVID +? -DVD.BlablaBla.Fix.XVID +? -DVD.Fix.Blablabla.XVID +: other: Fix + -proper_count: 1 + + +? DVD.Real.PROPER.REPACK +: other: Proper + proper_count: 3 + + +? Proper.720p +? +Repack +? +Rerip +: other: Proper + proper_count: 1 + +? XViD.Fansub +: other: Fan Subtitled + +? XViD.Fastsub +: other: Fast Subtitled + +? +Season Complete +? -Complete +: other: Complete + +? R5 +: other: Region 5 + +? RC +: other: Region C + +? PreAir +? Pre Air +: other: Preair + +? Screener +: other: Screener + +? Remux +: other: Remux + +? 3D.2019 +: other: 3D + +? HD +: other: HD + +? FHD +? FullHD +? Full HD +: other: Full HD + +? UHD +? Ultra +? UltraHD +? Ultra HD +: other: Ultra HD + +? mHD # ?? +? HDLight +: other: Micro HD + +? HQ +: other: High Quality + +? hr +: other: High Resolution + +? PAL +: other: PAL + +? SECAM +: other: SECAM + +? NTSC +: other: NTSC + +? LDTV +: other: Low Definition + +? LD +: other: Line Dubbed + +? MD +: other: Mic Dubbed + +? -The complete movie +: other: Complete + +? +The complete movie +: title: The complete movie + +? +AC3-HQ +: audio_profile: High Quality + +? Other-HQ +: other: High Quality + +? reenc +? re-enc +? re-encoded +? reencoded +: other: Reencoded + +? CONVERT XViD +: other: Converted + +? +HDRIP # it's a Rip from non specified HD source +: other: [HD, Rip] + +? SDR +: other: Standard Dynamic Range + +? HDR +? HDR10 +? -HDR100 +: other: HDR10 + +? BT2020 +? BT.2020 +? -BT.20200 +? -BT.2021 +: other: BT.2020 + +? Upscaled +? Upscale +: other: Upscaled + diff --git a/lib/guessit/test/rules/part.yml b/lib/guessit/test/rules/part.yml new file mode 100644 index 00000000..72f3d98a --- /dev/null +++ b/lib/guessit/test/rules/part.yml @@ -0,0 +1,18 @@ +# Multiple input strings having same expected results can be chained. +# Use - marker to check inputs that should not match results. +? Filename Part 3.mkv +? Filename Part III.mkv +? Filename Part Three.mkv +? Filename Part Trois.mkv +: title: Filename + part: 3 + +? Part 3 +? Part III +? Part Three +? Part Trois +? Part3 +: part: 3 + +? -Something.Apt.1 +: part: 1 \ No newline at end of file diff --git a/lib/guessit/test/rules/processors.yml b/lib/guessit/test/rules/processors.yml new file mode 100644 index 00000000..ee906b2c --- /dev/null +++ b/lib/guessit/test/rules/processors.yml @@ -0,0 +1,8 @@ +# Multiple input strings having same expected results can be chained. +# Use $ marker to check inputs that should not match results. + +# Prefer information for last path. +? Some movie (2000)/Some movie (2001).mkv +? Some movie (2001)/Some movie.mkv +: year: 2001 + container: mkv diff --git a/lib/guessit/test/rules/processors_test.py b/lib/guessit/test/rules/processors_test.py new file mode 100644 index 00000000..c22e968c --- /dev/null +++ b/lib/guessit/test/rules/processors_test.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name, pointless-string-statement + +from rebulk.match import Matches, Match + +from ...rules.processors import StripSeparators + + +def test_strip_separators(): + strip_separators = StripSeparators() + + matches = Matches() + + m = Match(3, 11, input_string="pre.ABCDEF.post") + + assert m.raw == '.ABCDEF.' + matches.append(m) + + returned_matches = strip_separators.when(matches, None) + assert returned_matches == matches + + strip_separators.then(matches, returned_matches, None) + + assert m.raw == 'ABCDEF' + + +def test_strip_separators_keep_acronyms(): + strip_separators = StripSeparators() + + matches = Matches() + + m = Match(0, 13, input_string=".S.H.I.E.L.D.") + m2 = Match(0, 22, input_string=".Agent.Of.S.H.I.E.L.D.") + + assert m.raw == '.S.H.I.E.L.D.' + matches.append(m) + matches.append(m2) + + returned_matches = strip_separators.when(matches, None) + assert returned_matches == matches + + strip_separators.then(matches, returned_matches, None) + + assert m.raw == '.S.H.I.E.L.D.' + assert m2.raw == 'Agent.Of.S.H.I.E.L.D.' diff --git a/lib/guessit/test/rules/release_group.yml b/lib/guessit/test/rules/release_group.yml new file mode 100644 index 00000000..c96383e9 --- /dev/null +++ b/lib/guessit/test/rules/release_group.yml @@ -0,0 +1,71 @@ +# Multiple input strings having same expected results can be chained. +# Use - marker to check inputs that should not match results. +? Some.Title.XViD-ReleaseGroup +? Some.Title.XViD-ReleaseGroup.mkv +: release_group: ReleaseGroup + +? Some.Title.XViD-by.Artik[SEDG].avi +: release_group: Artik[SEDG] + +? "[ABC] Some.Title.avi" +? some/folder/[ABC]Some.Title.avi +: release_group: ABC + +? "[ABC] Some.Title.XViD-GRP.avi" +? some/folder/[ABC]Some.Title.XViD-GRP.avi +: release_group: GRP + +? "[ABC] Some.Title.S01E02.avi" +? some/folder/[ABC]Some.Title.S01E02.avi +: release_group: ABC + +? Some.Title.XViD-S2E02.NoReleaseGroup.avi +: release_group: !!null + +? Test.S01E01-FooBar-Group +: options: -G group -G xxxx + episode: 1 + episode_title: FooBar + release_group: Group + season: 1 + title: Test + type: episode + +? Test.S01E01-FooBar-Group +: options: -G re:gr.?up -G xxxx + episode: 1 + episode_title: FooBar + release_group: Group + season: 1 + title: Test + type: episode + +? Show.Name.x264-byEMP +: title: Show Name + video_codec: H.264 + release_group: byEMP + +? Show.Name.x264-NovaRip +: title: Show Name + video_codec: H.264 + release_group: NovaRip + +? Show.Name.x264-PARTiCLE +: title: Show Name + video_codec: H.264 + release_group: PARTiCLE + +? Show.Name.x264-POURMOi +: title: Show Name + video_codec: H.264 + release_group: POURMOi + +? Show.Name.x264-RipPourBox +: title: Show Name + video_codec: H.264 + release_group: RipPourBox + +? Show.Name.x264-RiPRG +: title: Show Name + video_codec: H.264 + release_group: RiPRG diff --git a/lib/guessit/test/rules/screen_size.yml b/lib/guessit/test/rules/screen_size.yml new file mode 100644 index 00000000..25d8374f --- /dev/null +++ b/lib/guessit/test/rules/screen_size.yml @@ -0,0 +1,280 @@ +# Multiple input strings having same expected results can be chained. +# Use - marker to check inputs that should not match results. +? +360p +? +360px +? -360 +? +500x360 +? -250x360 +: screen_size: 360p + +? +640x360 +? -640x360i +? -684x360i +: screen_size: 360p + aspect_ratio: 1.778 + +? +360i +: screen_size: 360i + +? +480x360i +? -480x360p +? -450x360 +: screen_size: 360i + aspect_ratio: 1.333 + +? +368p +? +368px +? -368i +? -368 +? +500x368 +: screen_size: 368p + +? -490x368 +? -700x368 +: screen_size: 368p + +? +492x368p +: screen_size: + aspect_ratio: 1.337 + +? +654x368 +: screen_size: 368p + aspect_ratio: 1.777 + +? +698x368 +: screen_size: 368p + aspect_ratio: 1.897 + +? +368i +: -screen_size: 368i + +? +480p +? +480px +? -480i +? -480 +? -500x480 +? -638x480 +? -920x480 +: screen_size: 480p + +? +640x480 +: screen_size: 480p + aspect_ratio: 1.333 + +? +852x480 +: screen_size: 480p + aspect_ratio: 1.775 + +? +910x480 +: screen_size: 480p + aspect_ratio: 1.896 + +? +500x480 +? +500 x 480 +? +500 * 480 +? +500x480p +? +500X480i +: screen_size: 500x480 + aspect_ratio: 1.042 + +? +480i +? +852x480i +: screen_size: 480i + +? +576p +? +576px +? -576i +? -576 +? -500x576 +? -766x576 +? -1094x576 +: screen_size: 576p + +? +768x576 +: screen_size: 576p + aspect_ratio: 1.333 + +? +1024x576 +: screen_size: 576p + aspect_ratio: 1.778 + +? +1092x576 +: screen_size: 576p + aspect_ratio: 1.896 + +? +500x576 +: screen_size: 500x576 + aspect_ratio: 0.868 + +? +576i +: screen_size: 576i + +? +720p +? +720px +? -720i +? 720hd +? 720pHD +? -720 +? -500x720 +? -950x720 +? -1368x720 +: screen_size: 720p + +? +960x720 +: screen_size: 720p + aspect_ratio: 1.333 + +? +1280x720 +: screen_size: 720p + aspect_ratio: 1.778 + +? +1366x720 +: screen_size: 720p + aspect_ratio: 1.897 + +? +500x720 +: screen_size: 500x720 + aspect_ratio: 0.694 + +? +900p +? +900px +? -900i +? -900 +? -500x900 +? -1198x900 +? -1710x900 +: screen_size: 900p + +? +1200x900 +: screen_size: 900p + aspect_ratio: 1.333 + +? +1600x900 +: screen_size: 900p + aspect_ratio: 1.778 + +? +1708x900 +: screen_size: 900p + aspect_ratio: 1.898 + +? +500x900 +? +500x900p +? +500x900i +: screen_size: 500x900 + aspect_ratio: 0.556 + +? +900i +: screen_size: 900i + +? +1080p +? +1080px +? +1080hd +? +1080pHD +? -1080i +? -1080 +? -500x1080 +? -1438x1080 +? -2050x1080 +: screen_size: 1080p + +? +1440x1080 +: screen_size: 1080p + aspect_ratio: 1.333 + +? +1920x1080 +: screen_size: 1080p + aspect_ratio: 1.778 + +? +2048x1080 +: screen_size: 1080p + aspect_ratio: 1.896 + +? +1080i +? -1080p +: screen_size: 1080i + +? 1440p +: screen_size: 1440p + +? +500x1080 +: screen_size: 500x1080 + aspect_ratio: 0.463 + +? +2160p +? +2160px +? -2160i +? -2160 +? +4096x2160 +? +4k +? -2878x2160 +? -4100x2160 +: screen_size: 2160p + +? +2880x2160 +: screen_size: 2160p + aspect_ratio: 1.333 + +? +3840x2160 +: screen_size: 2160p + aspect_ratio: 1.778 + +? +4098x2160 +: screen_size: 2160p + aspect_ratio: 1.897 + +? +500x2160 +: screen_size: 500x2160 + aspect_ratio: 0.231 + +? +4320p +? +4320px +? -4320i +? -4320 +? -5758x2160 +? -8198x2160 +: screen_size: 4320p + +? +5760x4320 +: screen_size: 4320p + aspect_ratio: 1.333 + +? +7680x4320 +: screen_size: 4320p + aspect_ratio: 1.778 + +? +8196x4320 +: screen_size: 4320p + aspect_ratio: 1.897 + +? +500x4320 +: screen_size: 500x4320 + aspect_ratio: 0.116 + +? Test.File.720hd.bluray +? Test.File.720p24 +? Test.File.720p30 +? Test.File.720p50 +? Test.File.720p60 +? Test.File.720p120 +: screen_size: 720p + +? Test.File.400p +: options: + advanced_config: + screen_size: + progressive: ["400"] + screen_size: 400p + +? Test.File2.400p +: options: + advanced_config: + screen_size: + progressive: ["400"] + screen_size: 400p + +? Test.File.720p +: options: + advanced_config: + screen_size: + progressive: ["400"] + screen_size: 720p diff --git a/lib/guessit/test/rules/size.yml b/lib/guessit/test/rules/size.yml new file mode 100644 index 00000000..18b3cd49 --- /dev/null +++ b/lib/guessit/test/rules/size.yml @@ -0,0 +1,8 @@ +? 1.1tb +: size: 1.1TB + +? 123mb +: size: 123MB + +? 4.3gb +: size: 4.3GB diff --git a/lib/guessit/test/rules/source.yml b/lib/guessit/test/rules/source.yml new file mode 100644 index 00000000..cda8f1ac --- /dev/null +++ b/lib/guessit/test/rules/source.yml @@ -0,0 +1,323 @@ +# Multiple input strings having same expected results can be chained. +# Use - marker to check inputs that should not match results. +? +VHS +? -VHSAnythingElse +? -SomeVHS stuff +? -VH +? -VHx +: source: VHS + -other: Rip + +? +VHSRip +? +VHS-Rip +? +VhS_rip +? +VHS.RIP +? -VHS +? -VHxRip +: source: VHS + other: Rip + +? +Cam +: source: Camera + -other: Rip + +? +CamRip +? +CaM Rip +? +Cam_Rip +? +cam.rip +? -Cam +: source: Camera + other: Rip + +? +HDCam +? +HD-Cam +: source: HD Camera + -other: Rip + +? +HDCamRip +? +HD-Cam.rip +? -HDCam +? -HD-Cam +: source: HD Camera + other: Rip + +? +Telesync +? +TS +: source: Telesync + -other: Rip + +? +TelesyncRip +? +TSRip +? -Telesync +? -TS +: source: Telesync + other: Rip + +? +HD TS +? -Hd.Ts # ts file extension +? -HD.TS # ts file extension +? +Hd-Ts +: source: HD Telesync + -other: Rip + +? +HD TS Rip +? +Hd-Ts-Rip +? -HD TS +? -Hd-Ts +: source: HD Telesync + other: Rip + +? +Workprint +? +workPrint +? +WorkPrint +? +WP +? -Work Print +: source: Workprint + -other: Rip + +? +Telecine +? +teleCine +? +TC +? -Tele Cine +: source: Telecine + -other: Rip + +? +Telecine Rip +? +teleCine-Rip +? +TC-Rip +? -Telecine +? -TC +: source: Telecine + other: Rip + +? +HD-TELECINE +? +HDTC +: source: HD Telecine + -other: Rip + +? +HD-TCRip +? +HD TELECINE RIP +? -HD-TELECINE +? -HDTC +: source: HD Telecine + other: Rip + +? +PPV +: source: Pay-per-view + -other: Rip + +? +ppv-rip +? -PPV +: source: Pay-per-view + other: Rip + +? -TV +? +SDTV +? +TV-Dub +: source: TV + -other: Rip + +? +SDTVRIP +? +Rip sd tv +? +TvRip +? +Rip TV +? -TV +? -SDTV +: source: TV + other: Rip + +? +DVB +? +pdTV +? +Pd Tv +: source: Digital TV + -other: Rip + +? +DVB-Rip +? +DvBRiP +? +pdtvRiP +? +pd tv RiP +? -DVB +? -pdTV +? -Pd Tv +: source: Digital TV + other: Rip + +? +DVD +? +video ts +? +DVDR +? +DVD 9 +? +dvd 5 +? -dvd ts +: source: DVD + -source: Telesync + -other: Rip + +? +DVD-RIP +? -video ts +? -DVD +? -DVDR +? -DVD 9 +? -dvd 5 +: source: DVD + other: Rip + +? +HDTV +: source: HDTV + -other: Rip + +? +tv rip hd +? +HDtv Rip +? -HdRip # it's a Rip from non specified HD source +? -HDTV +: source: HDTV + other: Rip + +? +VOD +: source: Video on Demand + -other: Rip + +? +VodRip +? +vod rip +? -VOD +: source: Video on Demand + other: Rip + +? +webrip +? +Web Rip +? +webdlrip +? +web dl rip +? +webcap +? +web cap +? +webcaprip +? +web cap rip +: source: Web + other: Rip + +? +webdl +? +Web DL +? +webHD +? +WEB hd +? +web +: source: Web + -other: Rip + +? +HDDVD +? +hd dvd +: source: HD-DVD + -other: Rip + +? +hdDvdRip +? -HDDVD +? -hd dvd +: source: HD-DVD + other: Rip + +? +BluRay +? +BD +? +BD5 +? +BD9 +? +BD25 +? +bd50 +: source: Blu-ray + -other: Rip + +? +BR-Scr +? +BR.Screener +: source: Blu-ray + other: [Reencoded, Screener] + -language: pt-BR + +? +BR-Rip +? +BRRip +: source: Blu-ray + other: [Reencoded, Rip] + -language: pt-BR + +? +BluRay rip +? +BDRip +? -BluRay +? -BD +? -BR +? -BR rip +? -BD5 +? -BD9 +? -BD25 +? -bd50 +: source: Blu-ray + other: Rip + +? XVID.NTSC.DVDR.nfo +: source: DVD + -other: Rip + +? +AHDTV +: source: Analog HDTV + -other: Rip + +? +dsr +? +dth +: source: Satellite + -other: Rip + +? +dsrip +? +ds rip +? +dsrrip +? +dsr rip +? +satrip +? +sat rip +? +dthrip +? +dth rip +? -dsr +? -dth +: source: Satellite + other: Rip + +? +UHDTV +: source: Ultra HDTV + -other: Rip + +? +UHDRip +? +UHDTV Rip +? -UHDTV +: source: Ultra HDTV + other: Rip + +? UHD Bluray +? UHD 2160p Bluray +? UHD 8bit Bluray +? UHD HQ 8bit Bluray +? Ultra Bluray +? Ultra HD Bluray +? Bluray ULTRA +? Bluray Ultra HD +? Bluray UHD +? 4K Bluray +? 2160p Bluray +? UHD 10bit HDR Bluray +? UHD HDR10 Bluray +? -HD Bluray +? -AMERICAN ULTRA (2015) 1080p Bluray +? -American.Ultra.2015.BRRip +? -BRRip XviD AC3-ULTRAS +? -UHD Proper Bluray +: source: Ultra HD Blu-ray + +? UHD.BRRip +? UHD.2160p.BRRip +? BRRip.2160p.UHD +? BRRip.[4K-2160p-UHD] +: source: Ultra HD Blu-ray + other: [Reencoded, Rip] + +? UHD.2160p.BDRip +? BDRip.[4K-2160p-UHD] +: source: Ultra HD Blu-ray + other: Rip + +? DM +: source: Digital Master + +? DMRIP +? DM-RIP +: source: Digital Master + other: Rip diff --git a/lib/guessit/test/rules/title.yml b/lib/guessit/test/rules/title.yml new file mode 100644 index 00000000..05c7f208 --- /dev/null +++ b/lib/guessit/test/rules/title.yml @@ -0,0 +1,43 @@ +# Multiple input strings having same expected results can be chained. +# Use - marker to check inputs that should not match results. +? Title Only +? -Title XViD 720p Only +? sub/folder/Title Only +? -sub/folder/Title XViD 720p Only +? Title Only.mkv +? Title Only.avi +: title: Title Only + +? Title Only/title_only.mkv +: title: Title Only + +? title_only.mkv +: title: title only + +? Some Title/some.title.mkv +? some.title/Some.Title.mkv +: title: Some Title + +? SOME TITLE/Some.title.mkv +? Some.title/SOME TITLE.mkv +: title: Some title + +? some title/Some.title.mkv +? Some.title/some title.mkv +: title: Some title + +? Some other title/Some.Other.title.mkv +? Some.Other title/Some other title.mkv +: title: Some Other title + +? This T.I.T.L.E. has dots +? This.T.I.T.L.E..has.dots +: title: This T.I.T.L.E has dots + +? This.T.I.T.L.E..has.dots.S01E02.This E.P.T.I.T.L.E.has.dots +: title: This T.I.T.L.E has dots + season: 1 + episode: 2 + episode_title: This E.P.T.I.T.L.E has dots + type: episode + diff --git a/lib/guessit/test/rules/video_codec.yml b/lib/guessit/test/rules/video_codec.yml new file mode 100644 index 00000000..ae43bc43 --- /dev/null +++ b/lib/guessit/test/rules/video_codec.yml @@ -0,0 +1,98 @@ +# Multiple input strings having same expected results can be chained. +# Use - marker to check inputs that should not match results. +? rv10 +? rv13 +? RV20 +? Rv30 +? rv40 +? -xrv40 +: video_codec: RealVideo + +? mpeg2 +? MPEG2 +? MPEG-2 +? mpg2 +? H262 +? H.262 +? x262 +? -mpeg +? -xmpeg2 +? -mpeg2x +: video_codec: MPEG-2 + +? DivX +? -div X +? divx +? dvdivx +? DVDivX +: video_codec: DivX + +? XviD +? xvid +? -x vid +: video_codec: Xvid + +? h263 +? x263 +? h.263 +: video_codec: H.263 + +? h264 +? x264 +? h.264 +? x.264 +? AVC +? AVCHD +? -MPEG-4 +? -mpeg4 +? -mpeg +? -h 265 +? -x265 +: video_codec: H.264 + +? h265 +? x265 +? h.265 +? x.265 +? hevc +? -h 264 +? -x264 +: video_codec: H.265 + +? hevc10 +? HEVC-YUV420P10 +: video_codec: H.265 + color_depth: 10-bit + +? h265-HP +: video_codec: H.265 + video_profile: High + +? H.264-SC +: video_codec: H.264 + video_profile: Scalable Video Coding + +? mpeg4-AVC +: video_codec: H.264 + video_profile: Advanced Video Codec High Definition + +? AVCHD-SC +? H.264-AVCHD-SC +: video_codec: H.264 + video_profile: + - Scalable Video Coding + - Advanced Video Codec High Definition + +? VC1 +? VC-1 +: video_codec: VC-1 + +? VP7 +: video_codec: VP7 + +? VP8 +? VP80 +: video_codec: VP8 + +? VP9 +: video_codec: VP9 diff --git a/lib/guessit/test/rules/website.yml b/lib/guessit/test/rules/website.yml new file mode 100644 index 00000000..11d434d2 --- /dev/null +++ b/lib/guessit/test/rules/website.yml @@ -0,0 +1,23 @@ +# Multiple input strings having same expected results can be chained. +# Use - marker to check inputs that should not match results. +? +tvu.org.ru +? -tvu.unsafe.ru +: website: tvu.org.ru + +? +www.nimp.na +? -somewww.nimp.na +? -www.nimp.nawouak +? -nimp.na +: website: www.nimp.na + +? +wawa.co.uk +? -wawa.uk +: website: wawa.co.uk + +? -Dark.Net.S01E06.720p.HDTV.x264-BATV + -Dark.Net.2015.720p.HDTV.x264-BATV +: website: Dark.Net + +? Dark.Net.S01E06.720p.HDTV.x264-BATV + Dark.Net.2015.720p.HDTV.x264-BATV +: title: Dark Net diff --git a/lib/guessit/test/streaming_services.yaml b/lib/guessit/test/streaming_services.yaml new file mode 100644 index 00000000..adf52e71 --- /dev/null +++ b/lib/guessit/test/streaming_services.yaml @@ -0,0 +1,1934 @@ +? House.of.Cards.2013.S02E03.1080p.NF.WEBRip.DD5.1.x264-NTb.mkv +? House.of.Cards.2013.S02E03.1080p.Netflix.WEBRip.DD5.1.x264-NTb.mkv +: title: House of Cards + year: 2013 + season: 2 + episode: 3 + screen_size: 1080p + streaming_service: Netflix + source: Web + other: Rip + audio_channels: "5.1" + audio_codec: Dolby Digital + video_codec: H.264 + release_group: NTb + +? The.Daily.Show.2015.07.01.Kirsten.Gillibrand.Extended.720p.CC.WEBRip.AAC2.0.x264-BTW.mkv +? The.Daily.Show.2015.07.01.Kirsten.Gillibrand.Extended.720p.ComedyCentral.WEBRip.AAC2.0.x264-BTW.mkv +? The.Daily.Show.2015.07.01.Kirsten.Gillibrand.Extended.720p.Comedy.Central.WEBRip.AAC2.0.x264-BTW.mkv +: audio_channels: '2.0' + audio_codec: AAC + date: 2015-07-01 + edition: Extended + source: Web + other: Rip + release_group: BTW + screen_size: 720p + streaming_service: Comedy Central + title: The Daily Show + episode_title: Kirsten Gillibrand + video_codec: H.264 + +? The.Daily.Show.2015.07.01.Kirsten.Gillibrand.Extended.Interview.720p.CC.WEBRip.AAC2.0.x264-BTW.mkv +: audio_channels: '2.0' + audio_codec: AAC + date: 2015-07-01 + source: Web + release_group: BTW + screen_size: 720p + streaming_service: Comedy Central + title: The Daily Show + episode_title: Kirsten Gillibrand Extended Interview + video_codec: H.264 + +? The.Daily.Show.2015.07.02.Sarah.Vowell.CC.WEBRip.AAC2.0.x264-BTW.mkv +: audio_channels: '2.0' + audio_codec: AAC + date: 2015-07-02 + source: Web + release_group: BTW + streaming_service: Comedy Central + title: The Daily Show + episode_title: Sarah Vowell + video_codec: H.264 + +# Streaming service: Amazon +? Show.Name.S07E04.Service.1080p.AMZN.WEBRip.DD+5.1.x264 +? Show.Name.S07E04.Service.1080p.AmazonPrime.WEBRip.DD+5.1.x264 +: title: Show Name + season: 7 + episode: 4 + episode_title: Service + screen_size: 1080p + streaming_service: Amazon Prime + source: Web + other: Rip + audio_codec: Dolby Digital Plus + audio_channels: '5.1' + video_codec: H.264 + type: episode + +# Streaming service: Comedy Central +? Show.Name.2016.09.28.Nice.Title.Extended.1080p.CC.WEBRip.AAC2.0.x264-monkee +: title: Show Name + date: 2016-09-28 + episode_title: Nice Title + edition: Extended + other: Rip + screen_size: 1080p + streaming_service: Comedy Central + source: Web + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: The CW +? Show.Name.US.S12E20.Nice.Title.720p.CW.WEBRip.AAC2.0.x264-monkee +? Show.Name.US.S12E20.Nice.Title.720p.TheCW.WEBRip.AAC2.0.x264-monkee +: title: Show Name + country: US + season: 12 + episode: 20 + episode_title: Nice Title + screen_size: 720p + streaming_service: The CW + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: AMBC +? Show.Name.2016.09.27.Nice.Title.720p.AMBC.WEBRip.AAC2.0.x264-monkee +: title: Show Name + date: 2016-09-27 + episode_title: Nice Title + screen_size: 720p + streaming_service: ABC + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: HIST +? Show.Name.720p.HIST.WEBRip.AAC2.0.H.264-monkee +? Show.Name.720p.History.WEBRip.AAC2.0.H.264-monkee +: options: -t episode + title: Show Name + screen_size: 720p + streaming_service: History + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: PBS +? Show.Name.2015.Nice.Title.1080p.PBS.WEBRip.AAC2.0.H264-monkee +: options: -t episode + title: Show Name + year: 2015 + episode_title: Nice Title + screen_size: 1080p + streaming_service: PBS + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: SeeSo +? Show.Name.2016.Nice.Title.1080p.SESO.WEBRip.AAC2.0.x264-monkee +: options: -t episode + title: Show Name + year: 2016 + episode_title: Nice Title + screen_size: 1080p + streaming_service: SeeSo + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: Discovery +? Show.Name.S01E03.Nice.Title.720p.DISC.WEBRip.AAC2.0.x264-NTb +? Show.Name.S01E03.Nice.Title.720p.Discovery.WEBRip.AAC2.0.x264-NTb +: title: Show Name + season: 1 + episode: 3 + episode_title: Nice Title + screen_size: 720p + streaming_service: Discovery + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: NTb + type: episode + +# Streaming service: BBC iPlayer +? Show.Name.2016.08.18.Nice.Title.720p.iP.WEBRip.AAC2.0.H.264-monkee +? Show.Name.2016.08.18.Nice.Title.720p.BBCiPlayer.WEBRip.AAC2.0.H.264-monkee +: title: Show Name + date: 2016-08-18 + episode_title: Nice Title + streaming_service: BBC iPlayer + screen_size: 720p + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: A&E +? Show.Name.S15E18.Nice.Title.720p.AE.WEBRip.AAC2.0.H.264-monkee +? Show.Name.S15E18.Nice.Title.720p.A&E.WEBRip.AAC2.0.H.264-monkee +: title: Show Name + season: 15 + episode: 18 + episode_title: Nice Title + screen_size: 720p + streaming_service: A&E + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: Adult Swim +? Show.Name.S04E01.Nice.Title.1080p.AS.WEBRip.AAC2.0.H.264-monkee +? Show.Name.S04E01.Nice.Title.1080p.AdultSwim.WEBRip.AAC2.0.H.264-monkee +: title: Show Name + season: 4 + episode: 1 + episode_title: Nice Title + screen_size: 1080p + streaming_service: Adult Swim + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: Netflix +? Show.Name.2013.S02E03.1080p.NF.WEBRip.DD5.1.x264-NTb.mkv +: title: Show Name + year: 2013 + season: 2 + episode: 3 + screen_size: 1080p + streaming_service: Netflix + source: Web + other: Rip + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: NTb + container: mkv + type: episode + +# Streaming service: CBS +? Show.Name.2016.05.10.Nice.Title.720p.CBS.WEBRip.AAC2.0.x264-monkee +: title: Show Name + date: 2016-05-10 + episode_title: Nice Title + screen_size: 720p + streaming_service: CBS + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: NBA TV +? NBA.2016.02.27.Team.A.vs.Team.B.720p.NBA.WEBRip.AAC2.0.H.264-monkee +? NBA.2016.02.27.Team.A.vs.Team.B.720p.NBATV.WEBRip.AAC2.0.H.264-monkee +: title: NBA + date: 2016-02-27 + episode_title: Team A vs Team B + screen_size: 720p + streaming_service: NBA TV + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: ePix +? Show.Name.S05E04.Nice.Title.Part4.720p.EPIX.WEBRip.AAC2.0.H.264-monkee +? Show.Name.S05E04.Nice.Title.Part4.720p.ePix.WEBRip.AAC2.0.H.264-monkee +: title: Show Name + season: 5 + episode: 4 + episode_title: Nice Title + part: 4 + screen_size: 720p + streaming_service: ePix + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: NBC +? Show.Name.S41E03.Nice.Title.720p.NBC.WEBRip.AAC2.0.x264-monkee +: title: Show Name + season: 41 + episode: 3 + episode_title: Nice Title + screen_size: 720p + streaming_service: NBC + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: Syfy +? Show.Name.S01E02.Nice.Title.720p.SYFY.WEBRip.AAC2.0.x264-group +? Show.Name.S01E02.Nice.Title.720p.Syfy.WEBRip.AAC2.0.x264-group +: title: Show Name + season: 1 + episode: 2 + episode_title: Nice Title + screen_size: 720p + streaming_service: Syfy + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: group + type: episode + +# Streaming service: Spike TV +? Show.Name.S01E02.Nice.Title.720p.SPKE.WEBRip.AAC2.0.x264-group +? Show.Name.S01E02.Nice.Title.720p.Spike TV.WEBRip.AAC2.0.x264-group +? Show.Name.S01E02.Nice.Title.720p.SpikeTV.WEBRip.AAC2.0.x264-group +: title: Show Name + season: 1 + episode: 2 + episode_title: Nice Title + screen_size: 720p + streaming_service: Spike TV + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: group + type: episode + +# Streaming service: IFC +? Show.Name.S01E02.Nice.Title.720p.IFC.WEBRip.AAC2.0.x264-group +: title: Show Name + season: 1 + episode: 2 + episode_title: Nice Title + screen_size: 720p + streaming_service: IFC + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: group + type: episode + +# Streaming service: NATG +? Show.Name.S01E02.Nice.Title.720p.NATG.WEBRip.AAC2.0.x264-group +? Show.Name.S01E02.Nice.Title.720p.NationalGeographic.WEBRip.AAC2.0.x264-group +: title: Show Name + season: 1 + episode: 2 + episode_title: Nice Title + screen_size: 720p + streaming_service: National Geographic + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: group + type: episode + +# Streaming service: NFL +? Show.Name.S01E02.Nice.Title.720p.NFL.WEBRip.AAC2.0.x264-group +: title: Show Name + season: 1 + episode: 2 + episode_title: Nice Title + screen_size: 720p + streaming_service: NFL + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: group + type: episode + +# Streaming service: UFC +? Show.Name.S01E02.Nice.Title.720p.UFC.WEBRip.AAC2.0.x264-group +: title: Show Name + season: 1 + episode: 2 + episode_title: Nice Title + screen_size: 720p + streaming_service: UFC + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: group + type: episode + +# Streaming service: TV Land +? Show.Name.S01E02.Nice.Title.720p.TVL.WEBRip.AAC2.0.x264-group +? Show.Name.S01E02.Nice.Title.720p.TVLand.WEBRip.AAC2.0.x264-group +? Show.Name.S01E02.Nice.Title.720p.TV Land.WEBRip.AAC2.0.x264-group +: title: Show Name + season: 1 + episode: 2 + episode_title: Nice Title + screen_size: 720p + streaming_service: TV Land + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: group + type: episode + +# Streaming service: Crunchy Roll +? Show.Name.S01.1080p.CR.WEBRip.AAC.2.0.x264-monkee +: title: Show Name + season: 1 + screen_size: 1080p + streaming_service: Crunchy Roll + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: Disney +? Show.Name.S01.1080p.DSNY.WEBRip.AAC.2.0.x264-monkee +? Show.Name.S01.1080p.Disney.WEBRip.AAC.2.0.x264-monkee +: title: Show Name + season: 1 + screen_size: 1080p + streaming_service: Disney + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: Nickelodeon +? Show.Name.S01.1080p.NICK.WEBRip.AAC.2.0.x264-monkee +? Show.Name.S01.1080p.Nickelodeon.WEBRip.AAC.2.0.x264-monkee +: title: Show Name + season: 1 + screen_size: 1080p + streaming_service: Nickelodeon + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: TFou +? Show.Name.S01.1080p.TFOU.WEBRip.AAC.2.0.x264-monkee +? Show.Name.S01.1080p.TFou.WEBRip.AAC.2.0.x264-monkee +: title: Show Name + season: 1 + screen_size: 1080p + streaming_service: TFou + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: monkee + type: episode + +# Streaming service: DIY Network +? Show.Name.S01.720p.DIY.WEBRip.AAC2.0.H.264-BTN +: title: Show Name + season: 1 + screen_size: 720p + streaming_service: DIY Network + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: BTN + type: episode + +# Streaming service: USA Network +? Show.Name.S01E02.Exfil.1080p.USAN.WEBRip.AAC2.0.x264-AJP69 +: title: Show Name + season: 1 + episode: 2 + screen_size: 1080p + streaming_service: USA Network + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: AJP69 + type: episode + +# Streaming service: TV3 Ireland +? Show.Name.S01E08.576p.TV3.WEBRip.AAC2.0.x264-HARiKEN +: title: Show Name + season: 1 + episode: 8 + screen_size: 576p + streaming_service: TV3 Ireland + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: HARiKEN + type: episode + +# Streaming service: TV4 Sweeden +? Show.Name.S05.720p.TV4.WEBRip.AAC2.0.H.264-BTW +: title: Show Name + season: 5 + screen_size: 720p + streaming_service: TV4 Sweeden + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: BTW + type: episode + +# Streaming service: TLC +? Show.Name.S02.720p.TLC.WEBRip.AAC2.0.x264-BTW +: title: Show Name + season: 2 + screen_size: 720p + streaming_service: TLC + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: BTW + type: episode + +# Streaming service: Investigation Discovery +? Show.Name.S01E01.720p.ID.WEBRip.AAC2.0.x264-BTW +: title: Show Name + season: 1 + episode: 1 + screen_size: 720p + streaming_service: Investigation Discovery + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: BTW + type: episode + +# Streaming service: RTÉ One +? Show.Name.S10E01.576p.RTE.WEBRip.AAC2.0.H.264-RTN +: title: Show Name + season: 10 + episode: 1 + screen_size: 576p + streaming_service: RTÉ One + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: RTN + type: episode + +# Streaming service: AMC +? Show.Name.S01E01.1080p.AMC.WEBRip.H.264.AAC2.0-CasStudio +: title: Show Name + season: 1 + episode: 1 + screen_size: 1080p + streaming_service: AMC + source: Web + other: Rip + audio_codec: AAC + audio_channels: '2.0' + video_codec: H.264 + release_group: CasStudio + type: episode + +? Suits.S07E01.1080p.iT.WEB-DL.DD5.1.H.264-VLAD.mkv +? Suits.S07E01.1080p.iTunes.WEB-DL.DD5.1.H.264-VLAD.mkv +: title: Suits + season: 7 + episode: 1 + screen_size: 1080p + source: Web + streaming_service: iTunes + audio_codec: Dolby Digital + audio_channels: '5.1' + video_codec: H.264 + release_group: VLAD + container: mkv + type: episode + +? UpFront.S01.720p.AJAZ.WEBRip.AAC2.0.x264-BTW +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTW + screen_size: 720p + season: 1 + source: Web + streaming_service: Al Jazeera English + title: UpFront + type: episode + video_codec: H.264 + +? Smack.The.Pony.S01.4OD.WEBRip.AAC2.0.x264-BTW +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTW + season: 1 + source: Web + streaming_service: Channel 4 + title: Smack The Pony + type: episode + video_codec: H.264 + +? The.Toy.Box.S01E01.720p.AMBC.WEBRip.AAC2.0.x264-BTN +: audio_channels: '2.0' + audio_codec: AAC + episode: 1 + other: Rip + release_group: BTN + screen_size: 720p + season: 1 + source: Web + streaming_service: ABC + title: The Toy Box + type: episode + video_codec: H.264 + +? Gundam.Reconguista.in.G.S01.720p.ANLB.WEBRip.AAC2.0.x264-HorribleSubs +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: HorribleSubs + screen_size: 720p + season: 1 + source: Web + streaming_service: AnimeLab + title: Gundam Reconguista in G + type: episode + video_codec: H.264 + +? Animal.Nation.with.Anthony.Anderson.S01E01.1080p.ANPL.WEBRip.AAC2.0.x264-RTN +: audio_channels: '2.0' + audio_codec: AAC + episode: 1 + other: Rip + release_group: RTN + screen_size: 1080p + season: 1 + source: Web + streaming_service: Animal Planet + title: Animal Nation with Anthony Anderson + type: episode + video_codec: H.264 + +? Park.Bench.S01.1080p.AOL.WEBRip.AAC2.0.H.264-BTW +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTW + screen_size: 1080p + season: 1 + source: Web + streaming_service: AOL + title: Park Bench + type: episode + video_codec: H.264 + +? Crime.Scene.Cleaner.S05.720p.ARD.WEBRip.AAC2.0.H.264-BTN +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTN + screen_size: 720p + season: 5 + source: Web + streaming_service: ARD + title: Crime Scene Cleaner + type: episode + video_codec: H.264 + +? Decker.S03.720p.AS.WEB-DL.AAC2.0.H.264-RTN +: audio_channels: '2.0' + audio_codec: AAC + release_group: RTN + screen_size: 720p + season: 3 + source: Web + streaming_service: Adult Swim + title: Decker + type: episode + video_codec: H.264 + +? Southern.Charm.Savannah.S01E04.Hurricane.On.The.Horizon.1080p.BRAV.WEBRip.AAC2.0.x264-BTW +: audio_channels: '2.0' + audio_codec: AAC + episode: 4 + episode_title: Hurricane On The Horizon + other: Rip + release_group: BTW + screen_size: 1080p + season: 1 + source: Web + streaming_service: BravoTV + title: Southern Charm Savannah + type: episode + video_codec: H.264 + +? Four.in.the.Morning.S01E01.Pig.RERip.720p.CBC.WEBRip.AAC2.0.H.264-RTN +: audio_channels: '2.0' + audio_codec: AAC + episode: 1 + episode_title: Pig + other: + - Proper + - Rip + proper_count: 1 + release_group: RTN + screen_size: 720p + season: 1 + source: Web + streaming_service: CBC + title: Four in the Morning + type: episode + video_codec: H.264 + +? Rio.Olympics.2016.08.07.Mens.Football.Group.C.Germany.vs.South.Korea.720p.CBC.WEBRip.AAC2.0.H.264-BTW +: audio_channels: '2.0' + audio_codec: AAC + date: 2016-08-07 + episode_title: Mens Football Group C Germany vs South Korea + other: Rip + release_group: BTW + screen_size: 720p + source: Web + streaming_service: CBC + title: Rio Olympics + type: episode + video_codec: H.264 + +? Comedians.In.Cars.Getting.Coffee.S01.720p.CCGC.WEBRip.AAC2.0.x264-monkee +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: monkee + screen_size: 720p + season: 1 + source: Web + streaming_service: Comedians in Cars Getting Coffee + title: Comedians In Cars Getting Coffee + type: episode + video_codec: H.264 + +? Life.on.Top.S02.720p.CMAX.WEBRip.AAC2.0.x264-CMAX +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: CMAX + screen_size: 720p + season: 2 + source: Web + streaming_service: Cinemax + title: Life on Top + type: episode + video_codec: H.264 + +? Sun.Records.S01.720p.CMT.WEBRip.AAC2.0.x264-BTW +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTW + screen_size: 720p + season: 1 + source: Web + streaming_service: Country Music Television + title: Sun Records + type: episode + video_codec: H.264 + +? Infinity.Train.S01E00.Pilot.REPACK.720p.CN.WEBRip.AAC2.0.H.264-monkee +: audio_channels: '2.0' + audio_codec: AAC + episode: 0 + episode_details: Pilot + episode_title: Pilot + language: zh + other: + - Proper + - Rip + proper_count: 1 + release_group: monkee + screen_size: 720p + season: 1 + source: Web + streaming_service: Cartoon Network + title: Infinity Train + type: episode + video_codec: H.264 + +? Jay.Lenos.Garage.2015.S03E02.1080p.CNBC.WEB-DL.x264-TOPKEK +: episode: 2 + release_group: TOPKEK + screen_size: 1080p + season: 3 + source: Web + streaming_service: CNBC + title: Jay Lenos Garage + type: episode + video_codec: H.264 + year: 2015 + +? US.Presidential.Debates.2015.10.28.Third.Republican.Debate.720p.CNBC.WEBRip.AAC2.0.H.264-monkee +: audio_channels: '2.0' + audio_codec: AAC + country: US + date: 2015-10-28 + episode_title: Third Republican Debate + other: Rip + release_group: monkee + screen_size: 720p + source: Web + streaming_service: CNBC + title: Presidential Debates + type: episode + video_codec: H.264 + +? What.The.Fuck.France.S01E01.Le.doublage.CNLP.WEBRip.AAC2.0.x264-TURTLE +: audio_channels: '2.0' + audio_codec: AAC + country: FR + episode: 1 + episode_title: Le doublage + other: Rip + release_group: TURTLE + season: 1 + source: Web + streaming_service: Canal+ + title: What The Fuck + type: episode + video_codec: H.264 + +? SuperMansion.S02.720p.CRKL.WEBRip.AAC2.0.x264-VLAD +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: VLAD + screen_size: 720p + season: 2 + source: Web + streaming_service: Crackle + title: SuperMansion + type: episode + video_codec: H.264 + +? Chosen.S02.1080p.CRKL.WEBRip.AAC2.0.x264-AJP69 +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: AJP69 + screen_size: 1080p + season: 2 + source: Web + streaming_service: Crackle + title: Chosen + type: episode + video_codec: H.264 + +? Chosen.S03.1080p.CRKL.WEBRip.AAC2.0.x264-AJP69 +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: AJP69 + screen_size: 1080p + season: 3 + source: Web + streaming_service: Crackle + title: Chosen + type: episode + video_codec: H.264 + +? Snatch.S01.1080p.CRKL.WEBRip.AAC2.0.x264-DEFLATE +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: DEFLATE + screen_size: 1080p + season: 1 + source: Web + streaming_service: Crackle + title: Snatch + type: episode + video_codec: H.264 + +? White.House.Correspondents.Dinner.2015.Complete.CSPN.WEBRip.AAC2.0.H.264-BTW +: audio_channels: '2.0' + audio_codec: AAC + other: + - Complete + - Rip + release_group: BTW + source: Web + streaming_service: CSpan + title: White House Correspondents Dinner + type: movie + video_codec: H.264 + year: 2015 + +? The.Amazing.Race.Canada.S03.720p.CTV.WEBRip.AAC2.0.H.264-BTW +: audio_channels: '2.0' + audio_codec: AAC + country: CA + other: Rip + release_group: BTW + screen_size: 720p + season: 3 + source: Web + streaming_service: CTV + title: The Amazing Race + type: episode + video_codec: H.264 + +? Miniverse.S01E01.Explore.the.Solar.System.2160p.CUR.WEB-DL.DDP2.0.x264-monkee +: audio_channels: '2.0' + audio_codec: Dolby Digital Plus + episode: 1 + episode_title: Explore the Solar System + release_group: monkee + screen_size: 2160p + season: 1 + source: Web + streaming_service: CuriosityStream + title: Miniverse + type: episode + video_codec: H.264 + +? Vixen.S02.720p.CWS.WEBRip.AAC2.0.x264-BMF +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BMF + screen_size: 720p + season: 2 + source: Web + streaming_service: CWSeed + title: Vixen + type: episode + video_codec: H.264 + +? Abidin.Dino.DDY.WEBRip.AAC2.0.H.264-BTN +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTN + source: Web + streaming_service: Digiturk Diledigin Yerde + title: Abidin Dino + type: movie + video_codec: H.264 + +? Fast.N.Loud.S08.1080p.DISC.WEBRip.AAC2.0.x264-RTN +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: RTN + screen_size: 1080p + season: 8 + source: Web + streaming_service: Discovery + title: Fast N Loud + type: episode + video_codec: H.264 + +? Bake.Off.Italia.S04.1080p.DPLY.WEBRip.AAC2.0.x264-Threshold +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: Threshold + screen_size: 1080p + season: 4 + source: Web + streaming_service: DPlay + title: Bake Off Italia + type: episode + video_codec: H.264 + +? Long.Riders.S01.DSKI.WEBRip.AAC2.0.x264-HorribleSubs +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: HorribleSubs + season: 1 + source: Web + streaming_service: Daisuki + title: Long Riders + type: episode + video_codec: H.264 + +? Milo.Murphys.Law.S01.720p.DSNY.WEB-DL.AAC2.0.x264-TVSmash +: audio_channels: '2.0' + audio_codec: AAC + release_group: TVSmash + screen_size: 720p + season: 1 + source: Web + streaming_service: Disney + title: Milo Murphys Law + type: episode + video_codec: H.264 + +? 30.for.30.S03E15.Doc.and.Darryl.720p.ESPN.WEBRip.AAC2.0.x264-BTW +: audio_channels: '2.0' + audio_codec: AAC + episode: 15 + episode_title: Doc and Darryl + other: Rip + release_group: BTW + screen_size: 720p + season: 3 + source: Web + streaming_service: ESPN + title: 30 for 30 + type: episode + video_codec: H.264 + +? Boundless.S03.720p.ESQ.WEBRip.AAC2.0.x264-RTN +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: RTN + screen_size: 720p + season: 3 + source: Web + streaming_service: Esquire + title: Boundless + type: episode + video_codec: H.264 + +? Periodismo.Para.Todos.S2016E01.720p.ETTV.WEBRip.AAC2.0.H.264-braggart74 +: audio_channels: '2.0' + audio_codec: AAC + episode: 1 + other: Rip + release_group: braggart74 + screen_size: 720p + season: 2016 + source: Web + streaming_service: El Trece + title: Periodismo Para Todos + type: episode + video_codec: H.264 + year: 2016 + +? Just.Jillian.S01E01.1080p.ETV.WEBRip.AAC2.0.x264-GoApe +: audio_channels: '2.0' + audio_codec: AAC + episode: 1 + other: Rip + release_group: GoApe + screen_size: 1080p + season: 1 + source: Web + streaming_service: E! + title: Just Jillian + type: episode + video_codec: H.264 + +? New.Money.S01.1080p.ETV.WEBRip.AAC2.0.x264-BTW +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTW + screen_size: 1080p + season: 1 + source: Web + streaming_service: E! + title: New Money + type: episode + video_codec: H.264 + +? Gaming.Show.In.My.Parents.Garage.S02E01.The.Power.Up1000.FAM.WEBRip.AAC2.0.x264-RTN +: audio_channels: '2.0' + audio_codec: AAC + episode: 1 + episode_title: The Power Up1000 + other: Rip + release_group: RTN + season: 2 + source: Web + streaming_service: Family + title: Gaming Show In My Parents Garage + type: episode + video_codec: H.264 + +? Little.People.2016.S01E03.Proud.to.Be.You.and.Me.720p.FJR.WEBRip.AAC2.0.x264-RTN +: audio_channels: '2.0' + audio_codec: AAC + episode: 3 + episode_title: Proud to Be You and Me + other: Rip + release_group: RTN + screen_size: 720p + season: 1 + source: Web + streaming_service: Family Jr + title: Little People + type: episode + video_codec: H.264 + year: 2016 + +? The.Pioneer.Woman.S00E08.Summer.Summer.Summer.720p.FOOD.WEB-DL.AAC2.0.x264-AJP69 +: audio_channels: '2.0' + audio_codec: AAC + episode: 8 + episode_title: Summer Summer Summer + release_group: AJP69 + screen_size: 720p + season: 0 + source: Web + streaming_service: Food Network + title: The Pioneer Woman + type: episode + video_codec: H.264 + +? Prata.da.Casa.S01E01.720p.FOX.WEBRip.AAC2.0.H.264-BARRY +: audio_channels: '2.0' + audio_codec: AAC + episode: 1 + other: Rip + release_group: BARRY + screen_size: 720p + season: 1 + source: Web + streaming_service: Fox + title: Prata da Casa + type: episode + video_codec: H.264 + +? Grandfathered.S01.720p.FOX.WEBRip.AAC2.0.H.264-BTW +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTW + screen_size: 720p + season: 1 + source: Web + streaming_service: Fox + title: Grandfathered + type: episode + video_codec: H.264 + +? Truth.and.Iliza.S01E01.FREE.WEBRip.AAC2.0.x264-BTN +: audio_channels: '2.0' + audio_codec: AAC + episode: 1 + other: Rip + release_group: BTN + season: 1 + source: Web + streaming_service: Freeform + title: Truth and Iliza + type: episode + video_codec: H.264 + +? Seven.Year.Switch.S01.720p.FYI.WEBRip.AAC2.0.x264-BTW +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTW + screen_size: 720p + season: 1 + source: Web + streaming_service: FYI Network + title: Seven Year Switch + type: episode + video_codec: H.264 + +? NHL.2015.10.09.Leafs.vs.Red.Wings.Condensed.Game.720p.Away.Feed.GC.WEBRip.AAC2.0.H.264-BTW +: audio_channels: '2.0' + audio_codec: AAC + date: 2015-10-09 + episode_title: Leafs vs Red Wings Condensed Game + other: Rip + release_group: BTW + screen_size: 720p + source: Web + streaming_service: NHL GameCenter + title: NHL + type: episode + video_codec: H.264 + +? NHL.2016.01.26.Maple.Leafs.vs.Panthers.720p.Home.Feed.GC.WEBRip.AAC2.0.H.264-BTW +: audio_channels: '2.0' + audio_codec: AAC + date: 2016-01-26 + episode_title: Maple Leafs vs Panthers + other: Rip + release_group: BTW + screen_size: 720p + source: Web + streaming_service: NHL GameCenter + title: NHL + type: episode + video_codec: H.264 + +? Big.Brother.Canada.S05.GLBL.WEBRip.AAC2.0.H.264-RTN +: audio_channels: '2.0' + audio_codec: AAC + country: CA + other: Rip + release_group: RTN + season: 5 + source: Web + streaming_service: Global + title: Big Brother + type: episode + video_codec: H.264 + +? Pornolandia.S01.720p.GLOB.WEBRip.AAC2.0.x264-GeneX +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: GeneX + screen_size: 720p + season: 1 + source: Web + streaming_service: GloboSat Play + title: Pornolandia + type: episode + video_codec: H.264 + +? Transando.com.Laerte.S01.720p.GLOB.WEBRip.AAC2.0.x264-GeneX +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: GeneX + screen_size: 720p + season: 1 + source: Web + streaming_service: GloboSat Play + title: Transando com Laerte + type: episode + video_codec: H.264 + +? Flip.or.Flop.S01.720p.HGTV.WEBRip.AAC2.0.H.264-AJP69 +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: AJP69 + screen_size: 720p + season: 1 + source: Web + streaming_service: HGTV + title: Flip or Flop + type: episode + video_codec: H.264 + +? Kitten.Bowl.2014.720p.HLMK.WEBRip.AAC2.0.x264-monkee +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: monkee + screen_size: 720p + source: Web + streaming_service: Hallmark + title: Kitten Bowl + type: movie + video_codec: H.264 + year: 2014 + +? Still.Star-Crossed.S01E05.720p.HULU.WEB-DL.AAC2.0.H.264-VLAD +: audio_channels: '2.0' + audio_codec: AAC + episode: 5 + release_group: VLAD + screen_size: 720p + season: 1 + source: Web + streaming_service: Hulu + title: Still Star-Crossed + type: episode + video_codec: H.264 + +? EastEnders.2017.07.17.720p.iP.WEB-DL.AAC2.0.H.264-BTN +: audio_channels: '2.0' + audio_codec: AAC + date: 2017-07-17 + release_group: BTN + screen_size: 720p + source: Web + streaming_service: BBC iPlayer + title: EastEnders + type: episode + video_codec: H.264 + +? Handmade.in.Japan.S01E01.720p.iP.WEBRip.AAC2.0.H.264-SUP +: audio_channels: '2.0' + audio_codec: AAC + country: JP + episode: 1 + other: Rip + release_group: SUP + screen_size: 720p + season: 1 + source: Web + streaming_service: BBC iPlayer + title: Handmade in + type: episode + video_codec: H.264 + +? The.Chillenden.Murders.S01.720p.iP.WEBRip.AAC2.0.H.264-HAX +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: HAX + screen_size: 720p + season: 1 + source: Web + streaming_service: BBC iPlayer + title: The Chillenden Murders + type: episode + video_codec: H.264 + +? The.Street.S01.ITV.WEB-DL.AAC2.0.x264-RTN +: audio_channels: '2.0' + audio_codec: AAC + release_group: RTN + season: 1 + source: Web + streaming_service: ITV + title: The Street + type: episode + video_codec: H.264 + +? Hope.for.Wildlife.S04.1080p.KNOW.WEBRip.AAC2.0.x264-BTW +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTW + screen_size: 1080p + season: 4 + source: Web + streaming_service: Knowledge Network + title: Hope for Wildlife + type: episode + video_codec: H.264 + +? Kim.of.Queens.S02.720p.LIFE.WEBRip.AAC2.0.H.264-RTN +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: RTN + screen_size: 720p + season: 2 + source: Web + streaming_service: Lifetime + title: Kim of Queens + type: episode + video_codec: H.264 + +? The.Rachel.Maddow.Show.2017.02.22.720p.MNBC.WEBRip.AAC2.0.x264-BTW +: audio_channels: '2.0' + audio_codec: AAC + date: 2017-02-22 + other: Rip + release_group: BTW + screen_size: 720p + source: Web + streaming_service: MSNBC + title: The Rachel Maddow Show + type: episode + video_codec: H.264 + +? Ignition.S06E12.720p.MTOD.WEB-DL.AAC2.0.x264-RTN +: audio_channels: '2.0' + audio_codec: AAC + episode: 12 + release_group: RTN + screen_size: 720p + season: 6 + source: Web + streaming_service: Motor Trend OnDemand + title: Ignition + type: episode + video_codec: H.264 + +? Teen.Mom.UK.S01E01.Life.as.a.Teen.Mum.1080p.MTV.WEB-DL.AAC2.0.x264-BTW +: audio_channels: '2.0' + audio_codec: AAC + country: GB + episode: 1 + episode_title: Life as a Teen Mum + release_group: BTW + screen_size: 1080p + season: 1 + source: Web + streaming_service: MTV + title: Teen Mom + type: episode + video_codec: H.264 + +? Undrafted.S01.720p.NFLN.WEBRip.AAC2.0.H.264-TTYL +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: TTYL + screen_size: 720p + season: 1 + source: Web + streaming_service: NFL Now + title: Undrafted + type: episode + video_codec: H.264 + +? NFL.2016.08.25.PreSeason.Cowboys.vs.Seahawks.720p.NFL.WEBRip.AAC2.0.H.264-BTW +: audio_channels: '2.0' + audio_codec: AAC + date: 2016-08-25 + episode_title: PreSeason Cowboys vs Seahawks + other: Rip + release_group: BTW + screen_size: 720p + source: Web + streaming_service: NFL + title: NFL + type: episode + video_codec: H.264 + +? Bunsen.is.a.Beast.S01E23.Guinea.Some.Lovin.1080p.NICK.WEBRip.AAC2.0.x264-TVSmash +: audio_channels: '2.0' + audio_codec: AAC + country: GN + episode: 23 + episode_title: Some Lovin + other: Rip + release_group: TVSmash + screen_size: 1080p + season: 1 + source: Web + streaming_service: Nickelodeon + title: Bunsen is a Beast + type: episode + video_codec: H.264 + +? Valkyrie.S01.720p.NRK.WEBRip.AAC2.0.x264-BTN +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTN + screen_size: 720p + season: 1 + source: Web + streaming_service: Norsk Rikskringkasting + title: Valkyrie + type: episode + video_codec: H.264 + +? Food.Forward.S01.720p.PBS.WEBRip.AAC2.0.x264-RTN +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: RTN + screen_size: 720p + season: 1 + source: Web + streaming_service: PBS + title: Food Forward + type: episode + video_codec: H.264 + +? SciGirls.S01E01.Turtle.Mania.720p.PBSK.WEBRip.AAC2.0.x264-RTN +: audio_channels: '2.0' + audio_codec: AAC + episode: 1 + episode_title: Turtle Mania + other: Rip + release_group: RTN + screen_size: 720p + season: 1 + source: Web + streaming_service: PBS Kids + title: SciGirls + type: episode + video_codec: H.264 + +? Powers.2015.S01.1080p.PSN.WEBRip.DD5.1.x264-NTb +: audio_channels: '5.1' + audio_codec: Dolby Digital + other: Rip + release_group: NTb + screen_size: 1080p + season: 1 + source: Web + streaming_service: Playstation Network + title: Powers + type: episode + video_codec: H.264 + year: 2015 + +? Escape.The.Night.S02E02.The.Masquerade.Part.II.1080p.RED.WEBRip.AAC5.1.VP9-BTW +: audio_channels: '5.1' + audio_codec: AAC + episode: 2 + episode_title: The Masquerade + other: Rip + part: 2 + release_group: VP9-BTW + screen_size: 1080p + season: 2 + source: Web + streaming_service: YouTube Red + title: Escape The Night + type: episode + +? Escape.The.Night.S02E02.The.Masquerade.Part.II.2160p.RED.WEBRip.AAC5.1.VP9-BTW +: audio_channels: '5.1' + audio_codec: AAC + episode: 2 + episode_title: The Masquerade + other: Rip + part: 2 + release_group: VP9-BTW + screen_size: 2160p + season: 2 + source: Web + streaming_service: YouTube Red + title: Escape The Night + type: episode + +? Escape.The.Night.S02E02.The.Masquerade.Part.II.720p.RED.WEBRip.AAC5.1.VP9-BTW +: audio_channels: '5.1' + audio_codec: AAC + episode: 2 + episode_title: The Masquerade + other: Rip + part: 2 + release_group: VP9-BTW + screen_size: 720p + season: 2 + source: Web + streaming_service: YouTube Red + title: Escape The Night + type: episode + +? The.Family.Law.S02E01.720p.SBS.WEB-DL.AAC2.0.H.264-BTN +: audio_channels: '2.0' + audio_codec: AAC + episode: 1 + release_group: BTN + screen_size: 720p + season: 2 + source: Web + streaming_service: SBS (AU) + title: The Family Law + type: episode + video_codec: H.264 + +? Theres.No.Joy.In.Beachville.The.True.Story.of.Baseballs.Origin.720p.SNET.WEBRip.AAC2.0.x264-BTW +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTW + screen_size: 720p + source: Web + streaming_service: Sportsnet + title: Theres No Joy In Beachville The True Story of Baseballs Origin + type: movie + video_codec: H.264 + +? One.Night.Only.Alec.Baldwin.720p.SPIK.WEB-DL.AAC2.0.x264-NOGRP +: audio_channels: '2.0' + audio_codec: AAC + release_group: NOGRP + screen_size: 720p + source: Web + streaming_service: Spike + title: One Night Only Alec Baldwin + type: movie + video_codec: H.264 + +? Ink.Master.S08.720p.SPIK.WEBRip.AAC2.0.x264-BTW +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTW + screen_size: 720p + season: 8 + source: Web + streaming_service: Spike + title: Ink Master + type: episode + video_codec: H.264 + +? Jungle.Bunch.S01E01.Deep.Chasm.1080p.SPRT.WEBRip.AAC2.0.x264-RTN +: audio_channels: '2.0' + audio_codec: AAC + episode: 1 + episode_title: Deep Chasm + other: Rip + release_group: RTN + screen_size: 1080p + season: 1 + source: Web + streaming_service: Sprout + title: Jungle Bunch + type: episode + video_codec: H.264 + +? Ash.vs.Evil.Dead.S01.720p.STZ.WEBRip.AAC2.0.x264-NTb +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: NTb + screen_size: 720p + season: 1 + source: Web + streaming_service: Starz + title: Ash vs Evil Dead + type: episode + video_codec: H.264 + +? WWE.Swerved.S01.720p.WWEN.WEBRip.AAC2.0.H.264-PPKORE +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: PPKORE + screen_size: 720p + season: 1 + source: Web + streaming_service: WWE Network + title: WWE Swerved + type: episode + video_codec: H.264 + +? Face.Off.S11.1080p.SYFY.WEBRip.AAC2.0.x264-BTW +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTW + screen_size: 1080p + season: 11 + source: Web + streaming_service: Syfy + title: Face Off + type: episode + video_codec: H.264 + +? Conan.2016.09.22.Jeff.Garlin.720p.TBS.WEBRip.AAC2.0.H.264-NOGRP +: audio_channels: '2.0' + audio_codec: AAC + date: 2016-09-22 + episode_title: Jeff Garlin + other: Rip + release_group: NOGRP + screen_size: 720p + source: Web + streaming_service: TBS + title: Conan + type: episode + video_codec: H.264 + +? Swans.Crossing.S01.TUBI.WEBRip.AAC2.0.x264-RTN +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: RTN + season: 1 + source: Web + streaming_service: TubiTV + title: Swans Crossing + type: episode + video_codec: H.264 + +? The.Joy.of.Techs.S01.UKTV.WEB-DL.AAC2.0.x264-RTN +: audio_channels: '2.0' + audio_codec: AAC + release_group: RTN + season: 1 + source: Web + streaming_service: UKTV + title: The Joy of Techs + type: episode + video_codec: H.264 + +? Rock.Icons.S01.720p.VH1.WEB-DL.AAC2.0.H.264-RTN +: audio_channels: '2.0' + audio_codec: AAC + release_group: RTN + screen_size: 720p + season: 1 + source: Web + streaming_service: VH1 + title: Rock Icons + type: episode + video_codec: H.264 + +? Desus.and.Mero.S01E130.2017.07.18.1080p.VICE.WEB-DL.AAC2.0.x264-RTN +: audio_channels: '2.0' + audio_codec: AAC + date: 2017-07-18 + episode: 130 + release_group: RTN + screen_size: 1080p + season: 1 + source: Web + streaming_service: Viceland + title: Desus and Mero + type: episode + video_codec: H.264 + +? Graveyard.Carz.S07.1080p.VLCT.WEBRip.AAC2.0.x264-RTN +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: RTN + screen_size: 1080p + season: 7 + source: Web + streaming_service: Velocity + title: Graveyard Carz + type: episode + video_codec: H.264 + +? Other.Space.S01E01.1080p.YHOO.WEBRip.AAC2.0.x264-BTW +: audio_channels: '2.0' + audio_codec: AAC + episode: 1 + other: Rip + release_group: BTW + screen_size: 1080p + season: 1 + source: Web + streaming_service: Yahoo + title: Other Space + type: episode + video_codec: H.264 + +? Americas.Test.Kitchen.S17.720p.ATK.WEB-DL.AAC2.0.x264-BTN +: audio_channels: '2.0' + audio_codec: AAC + release_group: BTN + screen_size: 720p + season: 17 + source: Web + streaming_service: America's Test Kitchen + title: Americas Test Kitchen + type: episode + video_codec: H.264 + +? Bushwhacked.Bugs.S01.AUBC.WEBRip.AAC2.0.H.264-DAWN +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: DAWN + season: 1 + source: Web + streaming_service: ABC Australia + title: Bushwhacked Bugs + type: episode + video_codec: H.264 + +? VICE.S05E12.1080p.HBO.WEB-DL.AAC2.0.H.264-monkee +? VICE.S05E12.1080p.HBO-Go.WEB-DL.AAC2.0.H.264-monkee +? VICE.S05E12.1080p.HBOGo.WEB-DL.AAC2.0.H.264-monkee +: audio_channels: '2.0' + audio_codec: AAC + episode: 12 + release_group: monkee + screen_size: 1080p + season: 5 + source: Web + streaming_service: HBO Go + title: VICE + type: episode + video_codec: H.264 + +? Dix.Pour.Cent.S02.PLUZ.WEBRip.AAC2.0.H.264-TURTLE +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: TURTLE + season: 2 + source: Web + streaming_service: Pluzz + title: Dix Pour Cent + type: episode + video_codec: H.264 + +? Ulveson.och.Herngren.S01.720p.SVT.WEBRip.AAC2.0.H.264-BTN +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTN + screen_size: 720p + season: 1 + source: Web + streaming_service: Sveriges Television + title: Ulveson och Herngren + type: episode + video_codec: H.264 + +? Bravest.Warriors.S03.1080p.VRV.WEBRip.AAC2.0.x264-BTN +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTN + screen_size: 1080p + season: 3 + source: Web + streaming_service: VRV + title: Bravest Warriors + type: episode + video_codec: H.264 + +? The.Late.Night.Big.Breakfast.S02.WME.WEBRip.AAC2.0.x264-BTN +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTN + season: 2 + source: Web + streaming_service: WatchMe + title: The Late Night Big Breakfast + type: episode + video_codec: H.264 + +? Hockey.Wives.S02.WNET.WEBRip.AAC2.0.H.264-BTW +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTW + season: 2 + source: Web + streaming_service: W Network + title: Hockey Wives + type: episode + video_codec: H.264 + +? Sin.City.Saints.S01.1080p.YHOO.WEBRip.AAC2.0.x264-NTb +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: NTb + screen_size: 1080p + season: 1 + source: Web + streaming_service: Yahoo + title: Sin City Saints + type: episode + video_codec: H.264 + +? 555.S01.1080p.VMEO.WEBRip.AAC2.0.x264-BTN +: audio_channels: '2.0' + audio_codec: AAC + other: Rip + release_group: BTN + screen_size: 1080p + season: 1 + source: Web + streaming_service: Vimeo + title: '555' + type: episode + video_codec: H.264 + +# All this below shouldn't match any streaming services +? London.2012.Olympics.CTV.Preview.Show.HDTV.x264-2HD +: alternative_title: Olympics CTV Preview Show + release_group: 2HD + source: HDTV + title: London + type: movie + video_codec: H.264 + year: 2012 + +? UFC.on.FOX.24.1080p.HDTV.x264-VERUM +: episode: 24 + release_group: VERUM + screen_size: 1080p + source: HDTV + title: UFC on FOX + type: episode + video_codec: H.264 + +? ESPN.E.60.2016.10.04.HDTV.x264-LoTV +: date: 2016-10-04 + episode: 60 + release_group: LoTV + source: HDTV + title: ESPN E + type: episode + video_codec: H.264 + +? GTTV.E3.All.Access.Live.Day.1.Xbox.Showcase.Preshow.HDTV.x264-SYS +: episode: 3 + episode_title: All Access Live Day 1 Xbox Showcase Preshow + release_group: SYS + source: HDTV + title: GTTV + type: episode + video_codec: H.264 diff --git a/lib/guessit/test/suggested.json b/lib/guessit/test/suggested.json new file mode 100644 index 00000000..dc838ad0 --- /dev/null +++ b/lib/guessit/test/suggested.json @@ -0,0 +1,21 @@ +{ + "titles": [ + "13 Reasons Why", + "Star Wars: Episode VII - The Force Awakens", + "3%", + "The 100", + "3 Percent", + "This is Us", + "Open Season 2", + "Game of Thrones", + "The X-Files", + "11.22.63" + ], + "suggested": [ + "13 Reasons Why", + "Star Wars: Episode VII - The Force Awakens", + "The 100", + "Open Season 2", + "11.22.63" + ] +} \ No newline at end of file diff --git a/lib/guessit/test/test-input-file.txt b/lib/guessit/test/test-input-file.txt new file mode 100644 index 00000000..656bc931 --- /dev/null +++ b/lib/guessit/test/test-input-file.txt @@ -0,0 +1,2 @@ +Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv +SecondFile.avi \ No newline at end of file diff --git a/lib/guessit/test/test_api.py b/lib/guessit/test/test_api.py new file mode 100644 index 00000000..391dbced --- /dev/null +++ b/lib/guessit/test/test_api.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name, pointless-string-statement +import json +import os +import sys + +import pytest +import six + +from ..api import guessit, properties, suggested_expected, GuessitException + +__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) + + +def test_default(): + ret = guessit('Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv') + assert ret and 'title' in ret + + +def test_forced_unicode(): + ret = guessit(u'Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv') + assert ret and 'title' in ret and isinstance(ret['title'], six.text_type) + + +def test_forced_binary(): + ret = guessit(b'Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv') + assert ret and 'title' in ret and isinstance(ret['title'], six.binary_type) + + +@pytest.mark.skipif(sys.version_info < (3, 4), reason="Path is not available") +def test_pathlike_object(): + try: + from pathlib import Path + + path = Path('Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv') + ret = guessit(path) + assert ret and 'title' in ret + except ImportError: # pragma: no-cover + pass + + +def test_unicode_japanese(): + ret = guessit('[阿维达].Avida.2006.FRENCH.DVDRiP.XViD-PROD.avi') + assert ret and 'title' in ret + + +def test_unicode_japanese_options(): + ret = guessit("[阿维达].Avida.2006.FRENCH.DVDRiP.XViD-PROD.avi", options={"expected_title": ["阿维达"]}) + assert ret and 'title' in ret and ret['title'] == "阿维达" + + +def test_forced_unicode_japanese_options(): + ret = guessit(u"[阿维达].Avida.2006.FRENCH.DVDRiP.XViD-PROD.avi", options={"expected_title": [u"阿维达"]}) + assert ret and 'title' in ret and ret['title'] == u"阿维达" + +# TODO: This doesn't compile on python 3, but should be tested on python 2. +""" +if six.PY2: + def test_forced_binary_japanese_options(): + ret = guessit(b"[阿维达].Avida.2006.FRENCH.DVDRiP.XViD-PROD.avi", options={"expected_title": [b"阿维达"]}) + assert ret and 'title' in ret and ret['title'] == b"阿维达" +""" + + +def test_properties(): + props = properties() + assert 'video_codec' in props.keys() + + +def test_exception(): + with pytest.raises(GuessitException) as excinfo: + guessit(object()) + assert "An internal error has occured in guessit" in str(excinfo.value) + assert "Guessit Exception Report" in str(excinfo.value) + assert "Please report at https://github.com/guessit-io/guessit/issues" in str(excinfo.value) + + +def test_suggested_expected(): + with open(os.path.join(__location__, 'suggested.json'), 'r') as f: + content = json.load(f) + actual = suggested_expected(content['titles']) + assert actual == content['suggested'] diff --git a/lib/guessit/test/test_api_unicode_literals.py b/lib/guessit/test/test_api_unicode_literals.py new file mode 100644 index 00000000..826f7cd1 --- /dev/null +++ b/lib/guessit/test/test_api_unicode_literals.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name, pointless-string-statement + + +from __future__ import unicode_literals + +import os + +import pytest +import six + +from ..api import guessit, properties, GuessitException + +__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) + + +def test_default(): + ret = guessit('Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv') + assert ret and 'title' in ret + + +def test_forced_unicode(): + ret = guessit(u'Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv') + assert ret and 'title' in ret and isinstance(ret['title'], six.text_type) + + +def test_forced_binary(): + ret = guessit(b'Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv') + assert ret and 'title' in ret and isinstance(ret['title'], six.binary_type) + + +def test_unicode_japanese(): + ret = guessit('[阿维达].Avida.2006.FRENCH.DVDRiP.XViD-PROD.avi') + assert ret and 'title' in ret + + +def test_unicode_japanese_options(): + ret = guessit("[阿维达].Avida.2006.FRENCH.DVDRiP.XViD-PROD.avi", options={"expected_title": ["阿维达"]}) + assert ret and 'title' in ret and ret['title'] == "阿维达" + + +def test_forced_unicode_japanese_options(): + ret = guessit(u"[阿维达].Avida.2006.FRENCH.DVDRiP.XViD-PROD.avi", options={"expected_title": [u"阿维达"]}) + assert ret and 'title' in ret and ret['title'] == u"阿维达" + +# TODO: This doesn't compile on python 3, but should be tested on python 2. +""" +if six.PY2: + def test_forced_binary_japanese_options(): + ret = guessit(b"[阿维达].Avida.2006.FRENCH.DVDRiP.XViD-PROD.avi", options={"expected_title": [b"阿维达"]}) + assert ret and 'title' in ret and ret['title'] == b"阿维达" +""" + + +def test_ensure_standard_string_class(): + class CustomStr(str): + pass + + ret = guessit(CustomStr('1080p'), options={'advanced': True}) + assert ret and 'screen_size' in ret and not isinstance(ret['screen_size'].input_string, CustomStr) + + +def test_properties(): + props = properties() + assert 'video_codec' in props.keys() + + +def test_exception(): + with pytest.raises(GuessitException) as excinfo: + guessit(object()) + assert "An internal error has occured in guessit" in str(excinfo.value) + assert "Guessit Exception Report" in str(excinfo.value) + assert "Please report at https://github.com/guessit-io/guessit/issues" in str(excinfo.value) diff --git a/lib/guessit/test/test_benchmark.py b/lib/guessit/test/test_benchmark.py new file mode 100644 index 00000000..34386e30 --- /dev/null +++ b/lib/guessit/test/test_benchmark.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# pylint: disable=no-self-use,pointless-statement,missing-docstring,invalid-name,line-too-long +import time + +import pytest + +from ..api import guessit + + +def case1(): + return guessit('Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv') + + +def case2(): + return guessit('Movies/Fantastic Mr Fox/Fantastic.Mr.Fox.2009.DVDRip.{x264+LC-AAC.5.1}{Fr-Eng}{Sub.Fr-Eng}-™.[sharethefiles.com].mkv') + + +def case3(): + return guessit('Series/dexter/Dexter.5x02.Hello,.Bandit.ENG.-.sub.FR.HDTV.XviD-AlFleNi-TeaM.[tvu.org.ru].avi') + + +def case4(): + return guessit('Movies/The Doors (1991)/09.03.08.The.Doors.(1991).BDRip.720p.AC3.X264-HiS@SiLUHD-English.[sharethefiles.com].mkv') + + +@pytest.mark.benchmark( + group="Performance Tests", + min_time=1, + max_time=2, + min_rounds=5, + timer=time.time, + disable_gc=True, + warmup=False +) +@pytest.mark.skipif(True, reason="Disabled") +class TestBenchmark(object): + def test_case1(self, benchmark): + ret = benchmark(case1) + assert ret + + def test_case2(self, benchmark): + ret = benchmark(case2) + assert ret + + def test_case3(self, benchmark): + ret = benchmark(case3) + assert ret + + def test_case4(self, benchmark): + ret = benchmark(case4) + assert ret diff --git a/lib/guessit/test/test_main.py b/lib/guessit/test/test_main.py new file mode 100644 index 00000000..cbdba7aa --- /dev/null +++ b/lib/guessit/test/test_main.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name + +import os + +import pytest + +from ..__main__ import main + +__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) + + +def test_main_no_args(): + main([]) + + +def test_main(): + main(['Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv']) + + +def test_main_unicode(): + main(['[阿维达].Avida.2006.FRENCH.DVDRiP.XViD-PROD.avi']) + + +def test_main_forced_unicode(): + main([u'Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv']) + + +def test_main_verbose(): + main(['Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv', '--verbose']) + + +def test_main_yaml(): + main(['Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv', '--yaml']) + + +def test_main_json(): + main(['Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv', '--json']) + + +def test_main_show_property(): + main(['Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv', '-P', 'title']) + + +def test_main_advanced(): + main(['Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv', '-a']) + + +def test_main_input(): + main(['--input', os.path.join(__location__, 'test-input-file.txt')]) + + +def test_main_properties(): + main(['-p']) + main(['-p', '--json']) + main(['-p', '--yaml']) + + +def test_main_values(): + main(['-V']) + main(['-V', '--json']) + main(['-V', '--yaml']) + + +def test_main_help(): + with pytest.raises(SystemExit): + main(['--help']) + + +def test_main_version(): + main(['--version']) diff --git a/lib/guessit/test/test_options.py b/lib/guessit/test/test_options.py new file mode 100644 index 00000000..4f019b34 --- /dev/null +++ b/lib/guessit/test/test_options.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name, pointless-string-statement +import os + +import pytest + +from ..options import get_options_file_locations, merge_options, load_config_file, ConfigurationException, \ + load_config + +__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) + + +def test_config_locations(): + homedir = '/root' + cwd = '/root/cwd' + + locations = get_options_file_locations(homedir, cwd, True) + assert len(locations) == 9 + + assert '/root/.guessit/options.json' in locations + assert '/root/.guessit/options.yml' in locations + assert '/root/.guessit/options.yaml' in locations + assert '/root/.config/guessit/options.json' in locations + assert '/root/.config/guessit/options.yml' in locations + assert '/root/.config/guessit/options.yaml' in locations + assert '/root/cwd/guessit.options.json' in locations + assert '/root/cwd/guessit.options.yml' in locations + assert '/root/cwd/guessit.options.yaml' in locations + + +def test_merge_configurations(): + c1 = {'param1': True, 'param2': True, 'param3': False} + c2 = {'param1': False, 'param2': True, 'param3': False} + c3 = {'param1': False, 'param2': True, 'param3': False} + + merged = merge_options(c1, c2, c3) + assert not merged['param1'] + assert merged['param2'] + assert not merged['param3'] + + merged = merge_options(c3, c2, c1) + assert merged['param1'] + assert merged['param2'] + assert not merged['param3'] + + +def test_merge_configurations_lists(): + c1 = {'param1': [1], 'param2': True, 'param3': False} + c2 = {'param1': [2], 'param2': True, 'param3': False} + c3 = {'param1': [3], 'param2': True, 'param3': False} + + merged = merge_options(c1, c2, c3) + assert merged['param1'] == [1, 2, 3] + assert merged['param2'] + assert not merged['param3'] + + merged = merge_options(c3, c2, c1) + assert merged['param1'] == [3, 2, 1] + assert merged['param2'] + assert not merged['param3'] + + +def test_merge_configurations_deep(): + c1 = {'param1': [1], 'param2': {'d1': [1]}, 'param3': False} + c2 = {'param1': [2], 'param2': {'d1': [2]}, 'param3': False} + c3 = {'param1': [3], 'param2': {'d3': [3]}, 'param3': False} + + merged = merge_options(c1, c2, c3) + assert merged['param1'] == [1, 2, 3] + assert merged['param2']['d1'] == [1, 2] + assert merged['param2']['d3'] == [3] + assert 'd2' not in merged['param2'] + assert not merged['param3'] + + merged = merge_options(c3, c2, c1) + assert merged['param1'] == [3, 2, 1] + assert merged['param2'] + assert merged['param2']['d1'] == [2, 1] + assert 'd2' not in merged['param2'] + assert merged['param2']['d3'] == [3] + assert not merged['param3'] + + +def test_merge_configurations_pristine_all(): + c1 = {'param1': [1], 'param2': True, 'param3': False} + c2 = {'param1': [2], 'param2': True, 'param3': False, 'pristine': True} + c3 = {'param1': [3], 'param2': True, 'param3': False} + + merged = merge_options(c1, c2, c3) + assert merged['param1'] == [2, 3] + assert merged['param2'] + assert not merged['param3'] + + merged = merge_options(c3, c2, c1) + assert merged['param1'] == [2, 1] + assert merged['param2'] + assert not merged['param3'] + + +def test_merge_configurations_pristine_properties(): + c1 = {'param1': [1], 'param2': False, 'param3': True} + c2 = {'param1': [2], 'param2': True, 'param3': False, 'pristine': ['param2', 'param3']} + c3 = {'param1': [3], 'param2': True, 'param3': False} + + merged = merge_options(c1, c2, c3) + assert merged['param1'] == [1, 2, 3] + assert merged['param2'] + assert not merged['param3'] + + +def test_merge_configurations_pristine_properties_deep(): + c1 = {'param1': [1], 'param2': {'d1': False}, 'param3': True} + c2 = {'param1': [2], 'param2': {'d1': True}, 'param3': False, 'pristine': ['param2', 'param3']} + c3 = {'param1': [3], 'param2': {'d1': True}, 'param3': False} + + merged = merge_options(c1, c2, c3) + assert merged['param1'] == [1, 2, 3] + assert merged['param2'] + assert not merged['param3'] + + +def test_merge_configurations_pristine_properties2(): + c1 = {'param1': [1], 'param2': False, 'param3': True} + c2 = {'param1': [2], 'param2': True, 'param3': False, 'pristine': ['param1', 'param2', 'param3']} + c3 = {'param1': [3], 'param2': True, 'param3': False} + + merged = merge_options(c1, c2, c3) + assert merged['param1'] == [2, 3] + assert merged['param2'] + assert not merged['param3'] + + +def test_load_config_file(): + json_config = load_config_file(os.path.join(__location__, 'config', 'test.json')) + yml_config = load_config_file(os.path.join(__location__, 'config', 'test.yml')) + yaml_config = load_config_file(os.path.join(__location__, 'config', 'test.yaml')) + + assert json_config['expected_title'] == ['The 100', 'OSS 117'] + assert yml_config['expected_title'] == ['The 100', 'OSS 117'] + assert yaml_config['expected_title'] == ['The 100', 'OSS 117'] + + assert json_config['yaml'] is False + assert yml_config['yaml'] is True + assert yaml_config['yaml'] is True + + with pytest.raises(ConfigurationException) as excinfo: + load_config_file(os.path.join(__location__, 'config', 'dummy.txt')) + + assert excinfo.match('Configuration file extension is not supported for ".*?dummy.txt" file\\.') + + +def test_load_config(): + config = load_config({'no_default_config': True, 'param1': 'test', + 'config': [os.path.join(__location__, 'config', 'test.yml')]}) + + assert not config.get('param1') + + assert config.get('advanced_config') # advanced_config is still loaded from default + assert config['expected_title'] == ['The 100', 'OSS 117'] + assert config['yaml'] is True + + config = load_config({'no_default_config': True, 'param1': 'test'}) + + assert not config.get('param1') + + assert 'expected_title' not in config + assert 'yaml' not in config + + config = load_config({'no_default_config': True, 'param1': 'test', 'config': ['false']}) + + assert not config.get('param1') + + assert 'expected_title' not in config + assert 'yaml' not in config diff --git a/lib/guessit/test/test_yml.py b/lib/guessit/test/test_yml.py new file mode 100644 index 00000000..040796de --- /dev/null +++ b/lib/guessit/test/test_yml.py @@ -0,0 +1,297 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name +import logging +import os +# io.open supports encoding= in python 2.7 +from io import open # pylint: disable=redefined-builtin + +import babelfish +import six # pylint:disable=wrong-import-order +import yaml # pylint:disable=wrong-import-order +from rebulk.remodule import re +from rebulk.utils import is_iterable + +from .. import guessit +from ..options import parse_options +from ..yamlutils import OrderedDictYAMLLoader + +logger = logging.getLogger(__name__) + +__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) + + +class EntryResult(object): + def __init__(self, string, negates=False): + self.string = string + self.negates = negates + self.valid = [] + self.missing = [] + self.different = [] + self.extra = [] + self.others = [] + + @property + def ok(self): + if self.negates: + return self.missing or self.different + return not self.missing and not self.different and not self.extra and not self.others + + @property + def warning(self): + if self.negates: + return False + return not self.missing and not self.different and self.extra + + @property + def error(self): + if self.negates: + return not self.missing and not self.different and not self.others + return self.missing or self.different or self.others + + def __repr__(self): + if self.ok: + return self.string + ': OK!' + if self.warning: + return '%s%s: WARNING! (valid=%i, extra=%i)' % ('-' if self.negates else '', self.string, len(self.valid), + len(self.extra)) + if self.error: + return '%s%s: ERROR! (valid=%i, missing=%i, different=%i, extra=%i, others=%i)' % \ + ('-' if self.negates else '', self.string, len(self.valid), len(self.missing), len(self.different), + len(self.extra), len(self.others)) + + return '%s%s: UNKOWN! (valid=%i, missing=%i, different=%i, extra=%i, others=%i)' % \ + ('-' if self.negates else '', self.string, len(self.valid), len(self.missing), len(self.different), + len(self.extra), len(self.others)) + + @property + def details(self): + ret = [] + if self.valid: + ret.append('valid=' + str(len(self.valid))) + for valid in self.valid: + ret.append(' ' * 4 + str(valid)) + if self.missing: + ret.append('missing=' + str(len(self.missing))) + for missing in self.missing: + ret.append(' ' * 4 + str(missing)) + if self.different: + ret.append('different=' + str(len(self.different))) + for different in self.different: + ret.append(' ' * 4 + str(different)) + if self.extra: + ret.append('extra=' + str(len(self.extra))) + for extra in self.extra: + ret.append(' ' * 4 + str(extra)) + if self.others: + ret.append('others=' + str(len(self.others))) + for other in self.others: + ret.append(' ' * 4 + str(other)) + return ret + + +class Results(list): + def assert_ok(self): + errors = [entry for entry in self if entry.error] + assert not errors + + +def files_and_ids(predicate=None): + files = [] + ids = [] + + for (dirpath, _, filenames) in os.walk(__location__): + if os.path.split(dirpath)[-1] == 'config': + continue + if dirpath == __location__: + dirpath_rel = '' + else: + dirpath_rel = os.path.relpath(dirpath, __location__) + for filename in filenames: + name, ext = os.path.splitext(filename) + filepath = os.path.join(dirpath_rel, filename) + if ext == '.yml' and (not predicate or predicate(filepath)): + files.append(filepath) + ids.append(os.path.join(dirpath_rel, name)) + + return files, ids + + +class TestYml(object): + """ + Run tests from yaml files. + Multiple input strings having same expected results can be chained. + Use $ marker to check inputs that should not match results. + """ + + options_re = re.compile(r'^([ +-]+)(.*)') + + def _get_unique_id(self, collection, base_id): + ret = base_id + i = 2 + while ret in collection: + suffix = "-" + str(i) + ret = base_id + suffix + i += 1 + return ret + + def pytest_generate_tests(self, metafunc): + if 'yml_test_case' in metafunc.fixturenames: + entries = [] + entry_ids = [] + entry_set = set() + + for filename, _ in zip(*files_and_ids()): + with open(os.path.join(__location__, filename), 'r', encoding='utf-8') as infile: + data = yaml.load(infile, OrderedDictYAMLLoader) + + last_expected = None + for string, expected in reversed(list(data.items())): + if expected is None: + data[string] = last_expected + else: + last_expected = expected + + default = None + try: + default = data['__default__'] + del data['__default__'] + except KeyError: + pass + + for string, expected in data.items(): + TestYml.set_default(expected, default) + string = TestYml.fix_encoding(string, expected) + + entries.append((filename, string, expected)) + unique_id = self._get_unique_id(entry_set, '[' + filename + '] ' + str(string)) + entry_set.add(unique_id) + entry_ids.append(unique_id) + + metafunc.parametrize('yml_test_case', entries, ids=entry_ids) + + @staticmethod + def set_default(expected, default): + if default: + for k, v in default.items(): + if k not in expected: + expected[k] = v + + @classmethod + def fix_encoding(cls, string, expected): + if six.PY2: + if isinstance(string, six.text_type): + string = string.encode('utf-8') + converts = [] + for k, v in expected.items(): + if isinstance(v, six.text_type): + v = v.encode('utf-8') + converts.append((k, v)) + for k, v in converts: + expected[k] = v + if not isinstance(string, str): + string = str(string) + return string + + def test_entry(self, yml_test_case): + filename, string, expected = yml_test_case + result = self.check_data(filename, string, expected) + assert not result.error + + def check_data(self, filename, string, expected): + entry = self.check(string, expected) + if entry.ok: + logger.debug('[%s] %s', filename, entry) + elif entry.warning: + logger.warning('[%s] %s', filename, entry) + elif entry.error: + logger.error('[%s] %s', filename, entry) + for line in entry.details: + logger.error('[%s] %s', filename, ' ' * 4 + line) + return entry + + def check(self, string, expected): + negates, global_, string = self.parse_token_options(string) + + options = expected.get('options') + if options is None: + options = {} + if not isinstance(options, dict): + options = parse_options(options) + try: + result = guessit(string, options) + except Exception as exc: + logger.error('[%s] Exception: %s', string, exc) + raise exc + + entry = EntryResult(string, negates) + + if global_: + self.check_global(string, result, entry) + + self.check_expected(result, expected, entry) + + return entry + + def parse_token_options(self, string): + matches = self.options_re.search(string) + negates = False + global_ = False + if matches: + string = matches.group(2) + for opt in matches.group(1): + if '-' in opt: + negates = True + if '+' in opt: + global_ = True + return negates, global_, string + + def check_global(self, string, result, entry): + global_span = [] + for result_matches in result.matches.values(): + for result_match in result_matches: + if not global_span: + global_span = list(result_match.span) + else: + if global_span[0] > result_match.span[0]: + global_span[0] = result_match.span[0] + if global_span[1] < result_match.span[1]: + global_span[1] = result_match.span[1] + if global_span and global_span[1] - global_span[0] < len(string): + entry.others.append("Match is not global") + + def is_same(self, value, expected): + values = set(value) if is_iterable(value) else set((value,)) + expecteds = set(expected) if is_iterable(expected) else set((expected,)) + if len(values) != len(expecteds): + return False + if isinstance(next(iter(values)), babelfish.Language): + # pylint: disable=no-member + expecteds = {babelfish.Language.fromguessit(expected) for expected in expecteds} + elif isinstance(next(iter(values)), babelfish.Country): + # pylint: disable=no-member + expecteds = {babelfish.Country.fromguessit(expected) for expected in expecteds} + return values == expecteds + + def check_expected(self, result, expected, entry): + if expected: + for expected_key, expected_value in expected.items(): + if expected_key and expected_key != 'options' and expected_value is not None: + negates_key, _, result_key = self.parse_token_options(expected_key) + if result_key in result.keys(): + if not self.is_same(result[result_key], expected_value): + if negates_key: + entry.valid.append((expected_key, expected_value)) + else: + entry.different.append((expected_key, expected_value, result[result_key])) + else: + if negates_key: + entry.different.append((expected_key, expected_value, result[result_key])) + else: + entry.valid.append((expected_key, expected_value)) + elif not negates_key: + entry.missing.append((expected_key, expected_value)) + + for result_key, result_value in result.items(): + if result_key not in expected.keys(): + entry.extra.append((result_key, result_value)) diff --git a/lib/guessit/test/various.yml b/lib/guessit/test/various.yml new file mode 100644 index 00000000..6fb58deb --- /dev/null +++ b/lib/guessit/test/various.yml @@ -0,0 +1,1199 @@ +? Movies/Fear and Loathing in Las Vegas (1998)/Fear.and.Loathing.in.Las.Vegas.720p.HDDVD.DTS.x264-ESiR.mkv +: type: movie + title: Fear and Loathing in Las Vegas + year: 1998 + screen_size: 720p + source: HD-DVD + audio_codec: DTS + video_codec: H.264 + release_group: ESiR + +? Series/Duckman/Duckman - 101 (01) - 20021107 - I, Duckman.avi +: type: episode + title: Duckman + season: 1 + episode: 1 + episode_title: I, Duckman + date: 2002-11-07 + +? Series/Neverwhere/Neverwhere.05.Down.Street.[tvu.org.ru].avi +: type: episode + title: Neverwhere + episode: 5 + episode_title: Down Street + website: tvu.org.ru + +? Neverwhere.05.Down.Street.[tvu.org.ru].avi +: type: episode + title: Neverwhere + episode: 5 + episode_title: Down Street + website: tvu.org.ru + +? Series/Breaking Bad/Minisodes/Breaking.Bad.(Minisodes).01.Good.Cop.Bad.Cop.WEBRip.XviD.avi +: type: episode + title: Breaking Bad + episode_format: Minisode + episode: 1 + episode_title: Good Cop Bad Cop + source: Web + other: Rip + video_codec: Xvid + +? Series/Kaamelott/Kaamelott - Livre V - Ep 23 - Le Forfait.avi +: type: episode + title: Kaamelott + episode: 23 + episode_title: Le Forfait + +? Movies/The Doors (1991)/09.03.08.The.Doors.(1991).BDRip.720p.AC3.X264-HiS@SiLUHD-English.[sharethefiles.com].mkv +: type: movie + title: The Doors + year: 1991 + date: 2008-03-09 + source: Blu-ray + screen_size: 720p + audio_codec: Dolby Digital + video_codec: H.264 + release_group: HiS@SiLUHD + language: english + website: sharethefiles.com + +? Movies/M.A.S.H. (1970)/MASH.(1970).[Divx.5.02][Dual-Subtitulos][DVDRip].ogm +: type: movie + title: MASH + year: 1970 + video_codec: DivX + source: DVD + other: [Dual Audio, Rip] + +? the.mentalist.501.hdtv-lol.mp4 +: type: episode + title: the mentalist + season: 5 + episode: 1 + source: HDTV + release_group: lol + +? the.simpsons.2401.hdtv-lol.mp4 +: type: episode + title: the simpsons + season: 24 + episode: 1 + source: HDTV + release_group: lol + +? Homeland.S02E01.HDTV.x264-EVOLVE.mp4 +: type: episode + title: Homeland + season: 2 + episode: 1 + source: HDTV + video_codec: H.264 + release_group: EVOLVE + +? /media/Band_of_Brothers-e01-Currahee.mkv +: type: episode + title: Band of Brothers + episode: 1 + episode_title: Currahee + +? /media/Band_of_Brothers-x02-We_Stand_Alone_Together.mkv +: type: episode + title: Band of Brothers + bonus: 2 + bonus_title: We Stand Alone Together + +? /movies/James_Bond-f21-Casino_Royale-x02-Stunts.mkv +: type: movie + title: Casino Royale + film_title: James Bond + film: 21 + bonus: 2 + bonus_title: Stunts + +? /TV Shows/new.girl.117.hdtv-lol.mp4 +: type: episode + title: new girl + season: 1 + episode: 17 + source: HDTV + release_group: lol + +? The.Office.(US).1x03.Health.Care.HDTV.XviD-LOL.avi +: type: episode + title: The Office + country: US + season: 1 + episode: 3 + episode_title: Health Care + source: HDTV + video_codec: Xvid + release_group: LOL + +? The_Insider-(1999)-x02-60_Minutes_Interview-1996.mp4 +: type: movie + title: The Insider + year: 1999 + bonus: 2 + bonus_title: 60 Minutes Interview-1996 + +? OSS_117--Cairo,_Nest_of_Spies.mkv +: type: movie + title: OSS 117 + alternative_title: Cairo, Nest of Spies + +? Rush.._Beyond_The_Lighted_Stage-x09-Between_Sun_and_Moon-2002_Hartford.mkv +: type: movie + title: Rush Beyond The Lighted Stage + bonus: 9 + bonus_title: Between Sun and Moon + year: 2002 + +? House.Hunters.International.S56E06.720p.hdtv.x264.mp4 +: type: episode + title: House Hunters International + season: 56 + episode: 6 + screen_size: 720p + source: HDTV + video_codec: H.264 + +? White.House.Down.2013.1080p.BluRay.DTS-HD.MA.5.1.x264-PublicHD.mkv +: type: movie + title: White House Down + year: 2013 + screen_size: 1080p + source: Blu-ray + audio_codec: DTS-HD + audio_profile: Master Audio + video_codec: H.264 + release_group: PublicHD + audio_channels: "5.1" + +? White.House.Down.2013.1080p.BluRay.DTSHD.MA.5.1.x264-PublicHD.mkv +: type: movie + title: White House Down + year: 2013 + screen_size: 1080p + source: Blu-ray + audio_codec: DTS-HD + audio_profile: Master Audio + video_codec: H.264 + release_group: PublicHD + audio_channels: "5.1" + +? Hostages.S01E01.Pilot.for.Air.720p.WEB-DL.DD5.1.H.264-NTb.nfo +: type: episode + title: Hostages + episode_title: Pilot for Air + season: 1 + episode: 1 + screen_size: 720p + source: Web + audio_channels: "5.1" + video_codec: H.264 + audio_codec: Dolby Digital + release_group: NTb + +? Despicable.Me.2.2013.1080p.BluRay.x264-VeDeTT.nfo +: type: movie + title: Despicable Me 2 + year: 2013 + screen_size: 1080p + source: Blu-ray + video_codec: H.264 + release_group: VeDeTT + +? Le Cinquieme Commando 1971 SUBFORCED FRENCH DVDRiP XViD AC3 Bandix.mkv +: type: movie + audio_codec: Dolby Digital + source: DVD + other: Rip + release_group: Bandix + subtitle_language: French + title: Le Cinquieme Commando + video_codec: Xvid + year: 1971 + +? Le Seigneur des Anneaux - La Communauté de l'Anneau - Version Longue - BDRip.mkv +: type: movie + title: Le Seigneur des Anneaux + source: Blu-ray + other: Rip + +? La petite bande (Michel Deville - 1983) VF PAL MP4 x264 AAC.mkv +: type: movie + audio_codec: AAC + language: French + title: La petite bande + video_codec: H.264 + year: 1983 + other: PAL + +? Retour de Flammes (Gregor Schnitzler 2003) FULL DVD.iso +: type: movie + source: DVD + title: Retour de Flammes + type: movie + year: 2003 + +? A.Common.Title.Special.2014.avi +: type: movie + year: 2014 + title: A Common Title Special + +? A.Common.Title.2014.Special.avi +: type: episode + year: 2014 + title: A Common Title + episode_title: Special + episode_details: Special + +? A.Common.Title.2014.Special.Edition.avi +: type: movie + year: 2014 + title: A Common Title + edition: Special + +? Downton.Abbey.2013.Christmas.Special.HDTV.x264-FoV.mp4 +: type: episode + year: 2013 + title: Downton Abbey + episode_title: Christmas Special + video_codec: H.264 + release_group: FoV + source: HDTV + episode_details: Special + +? Doctor_Who_2013_Christmas_Special.The_Time_of_The_Doctor.HD +: type: episode + title: Doctor Who + other: HD + episode_details: Special + episode_title: Christmas Special The Time of The Doctor + year: 2013 + +? Doctor Who 2005 50th Anniversary Special The Day of the Doctor 3.avi +: type: episode + title: Doctor Who + episode_details: Special + episode_title: 50th Anniversary Special The Day of the Doctor 3 + year: 2005 + +? Robot Chicken S06-Born Again Virgin Christmas Special HDTV x264.avi +: type: episode + title: Robot Chicken + source: HDTV + season: 6 + episode_title: Born Again Virgin Christmas Special + video_codec: H.264 + episode_details: Special + +? Wicked.Tuna.S03E00.Head.To.Tail.Special.HDTV.x264-YesTV +: type: episode + title: Wicked Tuna + episode_title: Head To Tail Special + release_group: YesTV + season: 3 + episode: 0 + video_codec: H.264 + source: HDTV + episode_details: Special + +? The.Voice.UK.S03E12.HDTV.x264-C4TV +: episode: 12 + video_codec: H.264 + source: HDTV + title: The Voice + release_group: C4TV + season: 3 + country: United Kingdom + type: episode + +? /tmp/star.trek.9/star.trek.9.mkv +: type: movie + title: star trek 9 + +? star.trek.9.mkv +: type: movie + title: star trek 9 + +? FlexGet.S01E02.TheName.HDTV.xvid +: episode: 2 + source: HDTV + season: 1 + title: FlexGet + episode_title: TheName + type: episode + video_codec: Xvid + +? FlexGet.S01E02.TheName.HDTV.xvid +: episode: 2 + source: HDTV + season: 1 + title: FlexGet + episode_title: TheName + type: episode + video_codec: Xvid + +? some.series.S03E14.Title.Here.720p +: episode: 14 + screen_size: 720p + season: 3 + title: some series + episode_title: Title Here + type: episode + +? '[the.group] Some.Series.S03E15.Title.Two.720p' +: episode: 15 + release_group: the.group + screen_size: 720p + season: 3 + title: Some Series + episode_title: Title Two + type: episode + +? 'HD 720p: Some series.S03E16.Title.Three' +: episode: 16 + other: HD + screen_size: 720p + season: 3 + title: Some series + episode_title: Title Three + type: episode + +? Something.Season.2.1of4.Ep.Title.HDTV.torrent +: episode_count: 4 + episode: 1 + source: HDTV + season: 2 + title: Something + episode_title: Title + type: episode + container: torrent + +? Show-A (US) - Episode Title S02E09 hdtv +: country: US + episode: 9 + source: HDTV + season: 2 + title: Show-A + type: episode + +? Jack's.Show.S03E01.blah.1080p +: episode: 1 + screen_size: 1080p + season: 3 + title: Jack's Show + episode_title: blah + type: episode + +? FlexGet.epic +: title: FlexGet epic + type: movie + +? FlexGet.Apt.1 +: title: FlexGet Apt 1 + type: movie + +? FlexGet.aptitude +: title: FlexGet aptitude + type: movie + +? FlexGet.Step1 +: title: FlexGet Step1 + type: movie + +? Movies/El Bosque Animado (1987)/El.Bosque.Animado.[Jose.Luis.Cuerda.1987].[Xvid-Dvdrip-720 * 432].avi +: source: DVD + other: Rip + screen_size: 720x432 + title: El Bosque Animado + video_codec: Xvid + year: 1987 + type: movie + +? Movies/El Bosque Animado (1987)/El.Bosque.Animado.[Jose.Luis.Cuerda.1987].[Xvid-Dvdrip-720x432].avi +: source: DVD + other: Rip + screen_size: 720x432 + title: El Bosque Animado + video_codec: Xvid + year: 1987 + type: movie + +? 2009.shoot.fruit.chan.multi.dvd9.pal +: source: DVD + language: mul + other: PAL + title: shoot fruit chan + type: movie + year: 2009 + +? 2009.shoot.fruit.chan.multi.dvd5.pal +: source: DVD + language: mul + other: PAL + title: shoot fruit chan + type: movie + year: 2009 + +? The.Flash.2014.S01E01.PREAIR.WEBRip.XviD-EVO.avi +: episode: 1 + source: Web + other: [Preair, Rip] + release_group: EVO + season: 1 + title: The Flash + type: episode + video_codec: Xvid + year: 2014 + +? Ice.Lake.Rebels.S01E06.Ice.Lake.Games.720p.HDTV.x264-DHD +: episode: 6 + source: HDTV + release_group: DHD + screen_size: 720p + season: 1 + title: Ice Lake Rebels + episode_title: Ice Lake Games + type: episode + video_codec: H.264 + +? The League - S06E10 - Epi Sexy.mkv +: episode: 10 + season: 6 + title: The League + episode_title: Epi Sexy + type: episode + +? Stay (2005) [1080p]/Stay.2005.1080p.BluRay.x264.YIFY.mp4 +: source: Blu-ray + release_group: YIFY + screen_size: 1080p + title: Stay + type: movie + video_codec: H.264 + year: 2005 + +? /media/live/A/Anger.Management.S02E82.720p.HDTV.X264-DIMENSION.mkv +: source: HDTV + release_group: DIMENSION + screen_size: 720p + title: Anger Management + type: episode + season: 2 + episode: 82 + video_codec: H.264 + +? "[Figmentos] Monster 34 - At the End of Darkness [781219F1].mkv" +: type: episode + release_group: Figmentos + title: Monster + episode: 34 + episode_title: At the End of Darkness + crc32: 781219F1 + +? Game.of.Thrones.S05E07.720p.HDTV-KILLERS.mkv +: type: episode + episode: 7 + source: HDTV + release_group: KILLERS + screen_size: 720p + season: 5 + title: Game of Thrones + +? Game.of.Thrones.S05E07.HDTV.720p-KILLERS.mkv +: type: episode + episode: 7 + source: HDTV + release_group: KILLERS + screen_size: 720p + season: 5 + title: Game of Thrones + +? Parks and Recreation - [04x12] - Ad Campaign.avi +: type: episode + title: Parks and Recreation + season: 4 + episode: 12 + episode_title: Ad Campaign + +? Star Trek Into Darkness (2013)/star.trek.into.darkness.2013.720p.web-dl.h264-publichd.mkv +: type: movie + title: Star Trek Into Darkness + year: 2013 + screen_size: 720p + source: Web + video_codec: H.264 + release_group: publichd + +? /var/medias/series/The Originals/Season 02/The.Originals.S02E15.720p.HDTV.X264-DIMENSION.mkv +: type: episode + title: The Originals + season: 2 + episode: 15 + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: DIMENSION + +? Test.S01E01E07-FooBar-Group.avi +: container: avi + episode: + - 1 + - 7 + episode_title: FooBar-Group # Make sure it doesn't conflict with uuid + season: 1 + title: Test + type: episode + +? TEST.S01E02.2160p.NF.WEBRip.x264.DD5.1-ABC +: audio_channels: '5.1' + audio_codec: Dolby Digital + episode: 2 + source: Web + other: Rip + release_group: ABC + screen_size: 2160p + season: 1 + streaming_service: Netflix + title: TEST + type: episode + video_codec: H.264 + +? TEST.2015.12.30.720p.WEBRip.h264-ABC +: date: 2015-12-30 + source: Web + other: Rip + release_group: ABC + screen_size: 720p + title: TEST + type: episode + video_codec: H.264 + +? TEST.S01E10.24.1080p.NF.WEBRip.AAC2.0.x264-ABC +: audio_channels: '2.0' + audio_codec: AAC + episode: 10 + episode_title: '24' + source: Web + other: Rip + release_group: ABC + screen_size: 1080p + season: 1 + streaming_service: Netflix + title: TEST + type: episode + video_codec: H.264 + +? TEST.S01E10.24.1080p.NF.WEBRip.AAC2.0.x264-ABC +: audio_channels: '2.0' + audio_codec: AAC + episode: 10 + episode_title: '24' + source: Web + other: Rip + release_group: ABC + screen_size: 1080p + season: 1 + streaming_service: Netflix + title: TEST + type: episode + video_codec: H.264 + +? TEST.S01E10.24.1080p.NF.WEBRip.AAC.2.0.x264-ABC +: audio_channels: '2.0' + audio_codec: AAC + episode: 10 + episode_title: '24' + source: Web + other: Rip + release_group: ABC + screen_size: 1080p + season: 1 + streaming_service: Netflix + title: TEST + type: episode + video_codec: H.264 + +? TEST.S05E02.720p.iP.WEBRip.AAC2.0.H264-ABC +: audio_channels: '2.0' + audio_codec: AAC + episode: 2 + source: Web + other: Rip + release_group: ABC + screen_size: 720p + season: 5 + title: TEST + type: episode + video_codec: H.264 + +? TEST.S03E07.720p.WEBRip.AAC2.0.x264-ABC +: audio_channels: '2.0' + audio_codec: AAC + episode: 7 + source: Web + other: Rip + release_group: ABC + screen_size: 720p + season: 3 + title: TEST + type: episode + video_codec: H.264 + +? TEST.S15E15.24.1080p.FREE.WEBRip.AAC2.0.x264-ABC +: audio_channels: '2.0' + audio_codec: AAC + episode: 15 + episode_title: '24' + source: Web + other: Rip + release_group: ABC + screen_size: 1080p + season: 15 + title: TEST + type: episode + video_codec: H.264 + +? TEST.S11E11.24.720p.ETV.WEBRip.AAC2.0.x264-ABC +: audio_channels: '2.0' + audio_codec: AAC + episode: 11 + episode_title: '24' + source: Web + other: Rip + release_group: ABC + screen_size: 720p + season: 11 + title: TEST + type: episode + video_codec: H.264 + +? TEST.2015.1080p.HC.WEBRip.x264.AAC2.0-ABC +: audio_channels: '2.0' + audio_codec: AAC + source: Web + other: Rip + release_group: ABC + screen_size: 1080p + title: TEST + type: movie + video_codec: H.264 + year: 2015 + +? TEST.2015.1080p.3D.BluRay.Half-SBS.x264.DTS-HD.MA.7.1-ABC +: audio_channels: '7.1' + audio_codec: DTS-HD + audio_profile: Master Audio + source: Blu-ray + other: 3D + release_group: ABC + screen_size: 1080p + title: TEST + type: movie + video_codec: H.264 + year: 2015 + +? TEST.2015.1080p.3D.BluRay.Half-OU.x264.DTS-HD.MA.7.1-ABC +: audio_channels: '7.1' + audio_codec: DTS-HD + audio_profile: Master Audio + source: Blu-ray + other: 3D + release_group: ABC + screen_size: 1080p + title: TEST + type: movie + video_codec: H.264 + year: 2015 + +? TEST.2015.1080p.3D.BluRay.Half-OU.x264.DTS-HD.MA.TrueHD.7.1.Atmos-ABC +: audio_channels: '7.1' + audio_codec: + - DTS-HD + - Dolby TrueHD + - Dolby Atmos + audio_profile: Master Audio + source: Blu-ray + other: 3D + release_group: ABC + screen_size: 1080p + title: TEST + type: movie + video_codec: H.264 + year: 2015 + +? TEST.2015.1080p.3D.BluRay.Half-SBS.x264.DTS-HD.MA.TrueHD.7.1.Atmos-ABC +: audio_channels: '7.1' + audio_codec: + - DTS-HD + - Dolby TrueHD + - Dolby Atmos + audio_profile: Master Audio + source: Blu-ray + other: 3D + release_group: ABC + screen_size: 1080p + title: TEST + type: movie + video_codec: H.264 + year: 2015 + +? TEST.2015.1080p.BluRay.REMUX.AVC.DTS-HD.MA.TrueHD.7.1.Atmos-ABC +: audio_channels: '7.1' + audio_codec: + - DTS-HD + - Dolby TrueHD + - Dolby Atmos + audio_profile: Master Audio + source: Blu-ray + other: Remux + release_group: ABC + screen_size: 1080p + title: TEST + type: movie + year: 2015 + +? Gangs of New York 2002 REMASTERED 1080p BluRay x264-AVCHD +: source: Blu-ray + edition: Remastered + screen_size: 1080p + title: Gangs of New York + type: movie + video_codec: H.264 + video_profile: Advanced Video Codec High Definition + year: 2002 + +? Peep.Show.S06E02.DVDrip.x264-faks86.mkv +: container: mkv + episode: 2 + source: DVD + other: Rip + release_group: faks86 + season: 6 + title: Peep Show + type: episode + video_codec: H.264 + +# Episode title is indeed 'October 8, 2014' +# https://thetvdb.com/?tab=episode&seriesid=82483&seasonid=569935&id=4997362&lid=7 +? The Soup - 11x41 - October 8, 2014.mp4 +: container: mp4 + episode: 41 + episode_title: October 8, 2014 + season: 11 + title: The Soup + type: episode + +? Red.Rock.S02E59.WEB-DLx264-JIVE +: episode: 59 + season: 2 + source: Web + release_group: JIVE + title: Red Rock + type: episode + video_codec: H.264 + +? Pawn.Stars.S12E31.Deals.On.Wheels.PDTVx264-JIVE +: episode: 31 + episode_title: Deals On Wheels + season: 12 + source: Digital TV + release_group: JIVE + title: Pawn Stars + type: episode + video_codec: H.264 + +? Duck.Dynasty.S09E09.Van.He-llsing.HDTVx264-JIVE +: episode: 9 + episode_title: Van He-llsing + season: 9 + source: HDTV + release_group: JIVE + title: Duck Dynasty + type: episode + video_codec: H.264 + +? ATKExotics.16.01.24.Ava.Alba.Watersports.XXX.1080p.MP4-KTR +: title: ATKExotics + episode_title: Ava Alba Watersports + other: XXX + screen_size: 1080p + container: mp4 + release_group: KTR + type: episode + +? PutaLocura.15.12.22.Spanish.Luzzy.XXX.720p.MP4-oRo +: title: PutaLocura + episode_title: Spanish Luzzy + other: XXX + screen_size: 720p + container: mp4 + release_group: oRo + type: episode + +? French Maid Services - Lola At Your Service WEB-DL SPLIT SCENES MP4-RARBG +: title: French Maid Services + alternative_title: Lola At Your Service + source: Web + container: mp4 + release_group: RARBG + type: movie + +? French Maid Services - Lola At Your Service - Marc Dorcel WEB-DL SPLIT SCENES MP4-RARBG +: title: French Maid Services + alternative_title: [Lola At Your Service, Marc Dorcel] + source: Web + container: mp4 + release_group: RARBG + type: movie + +? PlayboyPlus.com_16.01.23.Eleni.Corfiate.Playboy.Romania.XXX.iMAGESET-OHRLY +: episode_title: Eleni Corfiate Playboy Romania + other: XXX + type: episode + +? TeenPornoPass - Anna - Beautiful Ass Deep Penetrated 720p mp4 +: title: TeenPornoPass + alternative_title: + - Anna + - Beautiful Ass Deep Penetrated + screen_size: 720p + container: mp4 + type: movie + +? SexInJeans.Gina.Gerson.Super.Nasty.Asshole.Pounding.With.Gina.In.Jeans.A.Devil.In.Denim.The.Finest.Ass.Fuck.Frolicking.mp4 +: title: SexInJeans Gina Gerson Super Nasty Asshole Pounding With Gina In Jeans A Devil In Denim The Finest Ass Fuck Frolicking + container: mp4 + type: movie + +? TNA Impact Wrestling HDTV 2017-06-22 720p H264 AVCHD-SC-SDH +: title: TNA Impact Wrestling + source: HDTV + date: 2017-06-22 + screen_size: 720p + video_codec: H.264 + video_profile: + - Advanced Video Codec High Definition + - Scalable Video Coding + release_group: SDH + type: episode + +? Katy Perry - Pepsi & Billboard Summer Beats Concert Series 2012 1080i HDTV 20 Mbps DD2.0 MPEG2-TrollHD.ts +: title: Katy Perry + alternative_title: Pepsi & Billboard Summer Beats Concert Series + year: 2012 + screen_size: 1080i + source: HDTV + video_bit_rate: 20Mbps + audio_codec: Dolby Digital + audio_channels: '2.0' + video_codec: MPEG-2 + release_group: TrollHD + container: ts + +? Justin Timberlake - MTV Video Music Awards 2013 1080i 32 Mbps DTS-HD 5.1.ts +: title: Justin Timberlake + alternative_title: MTV Video Music Awards + year: 2013 + screen_size: 1080i + video_bit_rate: 32Mbps + audio_codec: DTS-HD + audio_channels: '5.1' + container: ts + type: movie + +? Chuck Berry The Very Best Of Chuck Berry(2010)[320 Kbps] +: title: Chuck Berry The Very Best Of Chuck Berry + year: 2010 + audio_bit_rate: 320Kbps + type: movie + +? Title Name [480p][1.5Mbps][.mp4] +: title: Title Name + screen_size: 480p + video_bit_rate: 1.5Mbps + container: mp4 + type: movie + +? This.is.Us +: options: --no-default-config + title: This is Us + type: movie + +? This.is.Us +: options: --excludes country + title: This is Us + type: movie + +? MotoGP.2016x03.USA.Race.BTSportHD.1080p25 +: title: MotoGP + season: 2016 + year: 2016 + episode: 3 + screen_size: 1080p + frame_rate: 25fps + type: episode + +? BBC.Earth.South.Pacific.2010.D2.1080p.24p.BD25.DTS-HD +: title: BBC Earth South Pacific + year: 2010 + screen_size: 1080p + frame_rate: 24fps + source: Blu-ray + audio_codec: DTS-HD + type: movie + +? Mr Robot - S03E01 - eps3 0 power-saver-mode h (1080p AMZN WEB-DL x265 HEVC 10bit EAC3 6.0 RCVR).mkv +: title: Mr Robot + season: 3 + episode: 1 + episode_title: eps3 0 power-saver-mode h + screen_size: 1080p + streaming_service: Amazon Prime + source: Web + video_codec: H.265 + video_profile: High Efficiency Video Coding + color_depth: 10-bit + audio_codec: Dolby Digital Plus + audio_channels: '5.1' + release_group: RCVR + container: mkv + type: episode + +? Panorama.15-05-2018.Web-DL.540p.H264.AAC.Subs.mp4 +: title: Panorama + date: 2018-05-15 + source: Web + screen_size: 540p + video_codec: H.264 + audio_codec: AAC + subtitle_language: und + container: mp4 + type: episode + +? Shaolin 2011.720p.BluRay.x264-x0r.mkv +: title: Shaolin + year: 2011 + screen_size: 720p + source: Blu-ray + video_codec: H.264 + release_group: x0r + container: mkv + type: movie + +? '[ Engineering Catastrophes S02E10 1080p AMZN WEB-DL DD+ 2.0 x264-TrollHD ]' +: title: Engineering Catastrophes + season: 2 + episode: 10 + screen_size: 1080p + streaming_service: Amazon Prime + source: Web + audio_codec: Dolby Digital Plus + audio_channels: '2.0' + video_codec: H.264 + release_group: TrollHD + type: episode + +? A Very Harold & Kumar 3D Christmas (2011).mkv +: title: A Very Harold & Kumar 3D Christmas + year: 2011 + container: mkv + type: movie + +? Cleveland.Hustles.S01E03.Downward.Dogs.and.Proper.Pigs.720p.HDTV.x264-W4F +: title: Cleveland Hustles + season: 1 + episode: 3 + episode_title: Downward Dogs and Proper Pigs + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: W4F + type: episode + +? Pawn.Stars.S12E20.The.Pawn.Awakens.REAL.READ.NFO.720p.HDTV.x264-DHD +: title: Pawn Stars + season: 12 + episode: 20 + episode_title: The Pawn Awakens + other: + - Proper + - Read NFO + proper_count: 2 + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: DHD + type: episode + +? Pawn.Stars.S12E22.Racing.Revolution.REAL.720p.HDTV.x264-DHD +: title: Pawn Stars + season: 12 + episode: 22 + episode_title: Racing Revolution + other: Proper + proper_count: 2 + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: DHD + type: episode + +? Luksusfellen.S18E02.REAL.NORWEGiAN.720p.WEB.h264-NORPiLT +: title: Luksusfellen + season: 18 + episode: 2 + other: Proper + proper_count: 2 + language: Norwegian + screen_size: 720p + source: Web + video_codec: H.264 + release_group: NORPiLT + type: episode + +? The.Exorcist.S02E07.REAL.FRENCH.720p.HDTV.x264-SH0W +: title: The Exorcist + season: 2 + episode: 7 + other: Proper + proper_count: 2 + language: fr + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: SH0W + type: episode + +? Outrageous.Acts.of.Science.S05E02.Is.This.for.Real.720p.HDTV.x264-DHD +: title: Outrageous Acts of Science + season: 5 + episode: 2 +# corner case +# episode_title: Is This for Real + screen_size: 720p + source: HDTV + video_codec: H.264 + release_group: DHD + type: episode + +? How.the.Universe.Works.S06E08.Strange.Lives.of.Dwarf.Planets.REAL.720p.WEB.x264-DHD +: title: How the Universe Works + season: 6 + episode: 8 + episode_title: Strange Lives of Dwarf Planets + other: Proper + proper_count: 2 + screen_size: 720p + source: Web + video_codec: H.264 + release_group: DHD + type: episode + +? Vampirina.S01E16.REAL.HDTV.x264-W4F +: title: Vampirina + season: 1 + episode: 16 + other: Proper + proper_count: 2 + source: HDTV + video_codec: H.264 + release_group: W4F + type: episode + +? Test.S01E16.Some Real Episode Title.HDTV.x264-W4F +: title: Test + season: 1 + episode: 16 + episode_title: Some Real Episode Title + source: HDTV + video_codec: H.264 + release_group: W4F + type: episode + +? NOS4A2.S01E01.The.Shorter.Way.REPACK.720p.AMZN.WEB-DL.DDP5.1.H.264-NTG.mkv +: title: NOS4A2 + season: 1 + episode: 1 + episode_title: The Shorter Way + other: Proper + proper_count: 1 + screen_size: 720p + streaming_service: Amazon Prime + source: Web + audio_codec: Dolby Digital Plus + audio_channels: '5.1' + video_codec: H.264 + release_group: NTG + container: mkv + type: episode + +? Star Trek DS9 Ep 2x03 The Siege (Part III) +: title: Star Trek DS9 + season: 2 + episode: 3 + episode_title: The Siege + part: 3 + type: episode + +? The.Red.Line.S01E01 +: title: The Red Line + season: 1 + episode: 1 + type: episode + +? Show.S01E01.WEB.x264-METCON.mkv +: title: Show + season: 1 + episode: 1 + source: Web + video_codec: H.264 + release_group: METCON + container: mkv + type: episode + +? Show.S01E01.WEB.x264-TCMEON.mkv +: title: Show + season: 1 + episode: 1 + source: Web + video_codec: H.264 + release_group: TCMEON + container: mkv + type: episode + +? Show.S01E01.WEB.x264-MEONTC.mkv +: title: Show + season: 1 + episode: 1 + source: Web + video_codec: H.264 + release_group: MEONTC + container: mkv + type: episode + +? '[TorrentCouch.com].Westworld.S02.Complete.720p.WEB-DL.x264.[MP4].[5.3GB].[Season.2.Full]/[TorrentCouch.com].Westworld.S02E03.720p.WEB-DL.x264.mp4' +: website: TorrentCouch.com + title: Westworld + season: 2 + other: Complete + screen_size: 720p + source: Web + video_codec: H.264 + container: mp4 + size: 5.3GB + episode: 3 + type: episode + +? Vita.&.Virginia.2018.720p.H.264.YTS.LT.mp4 +: title: Vita & Virginia + year: 2018 + screen_size: 720p + video_codec: H.264 + release_group: YTS.LT + container: mp4 + type: movie \ No newline at end of file diff --git a/lib/guessit/tlds-alpha-by-domain.txt b/lib/guessit/tlds-alpha-by-domain.txt new file mode 100644 index 00000000..280c794c --- /dev/null +++ b/lib/guessit/tlds-alpha-by-domain.txt @@ -0,0 +1,341 @@ +# Version 2013112900, Last Updated Fri Nov 29 07:07:01 2013 UTC +AC +AD +AE +AERO +AF +AG +AI +AL +AM +AN +AO +AQ +AR +ARPA +AS +ASIA +AT +AU +AW +AX +AZ +BA +BB +BD +BE +BF +BG +BH +BI +BIKE +BIZ +BJ +BM +BN +BO +BR +BS +BT +BV +BW +BY +BZ +CA +CAMERA +CAT +CC +CD +CF +CG +CH +CI +CK +CL +CLOTHING +CM +CN +CO +COM +CONSTRUCTION +CONTRACTORS +COOP +CR +CU +CV +CW +CX +CY +CZ +DE +DIAMONDS +DIRECTORY +DJ +DK +DM +DO +DZ +EC +EDU +EE +EG +ENTERPRISES +EQUIPMENT +ER +ES +ESTATE +ET +EU +FI +FJ +FK +FM +FO +FR +GA +GALLERY +GB +GD +GE +GF +GG +GH +GI +GL +GM +GN +GOV +GP +GQ +GR +GRAPHICS +GS +GT +GU +GURU +GW +GY +HK +HM +HN +HOLDINGS +HR +HT +HU +ID +IE +IL +IM +IN +INFO +INT +IO +IQ +IR +IS +IT +JE +JM +JO +JOBS +JP +KE +KG +KH +KI +KITCHEN +KM +KN +KP +KR +KW +KY +KZ +LA +LAND +LB +LC +LI +LIGHTING +LK +LR +LS +LT +LU +LV +LY +MA +MC +MD +ME +MG +MH +MIL +MK +ML +MM +MN +MO +MOBI +MP +MQ +MR +MS +MT +MU +MUSEUM +MV +MW +MX +MY +MZ +NA +NAME +NC +NE +NET +NF +NG +NI +NL +NO +NP +NR +NU +NZ +OM +ORG +PA +PE +PF +PG +PH +PHOTOGRAPHY +PK +PL +PLUMBING +PM +PN +POST +PR +PRO +PS +PT +PW +PY +QA +RE +RO +RS +RU +RW +SA +SB +SC +SD +SE +SEXY +SG +SH +SI +SINGLES +SJ +SK +SL +SM +SN +SO +SR +ST +SU +SV +SX +SY +SZ +TATTOO +TC +TD +TECHNOLOGY +TEL +TF +TG +TH +TIPS +TJ +TK +TL +TM +TN +TO +TODAY +TP +TR +TRAVEL +TT +TV +TW +TZ +UA +UG +UK +US +UY +UZ +VA +VC +VE +VENTURES +VG +VI +VN +VOYAGE +VU +WF +WS +XN--3E0B707E +XN--45BRJ9C +XN--80AO21A +XN--80ASEHDB +XN--80ASWG +XN--90A3AC +XN--CLCHC0EA0B2G2A9GCD +XN--FIQS8S +XN--FIQZ9S +XN--FPCRJ9C3D +XN--FZC2C9E2C +XN--GECRJ9C +XN--H2BRJ9C +XN--J1AMH +XN--J6W193G +XN--KPRW13D +XN--KPRY57D +XN--L1ACC +XN--LGBBAT1AD8J +XN--MGB9AWBF +XN--MGBA3A4F16A +XN--MGBAAM7A8H +XN--MGBAYH7GPA +XN--MGBBH1A71E +XN--MGBC0A9AZCG +XN--MGBERP4A5D4AR +XN--MGBX4CD0AB +XN--NGBC5AZD +XN--O3CW4H +XN--OGBPF8FL +XN--P1AI +XN--PGBS0DH +XN--Q9JYB4C +XN--S9BRJ9C +XN--UNUP4Y +XN--WGBH1C +XN--WGBL6A +XN--XKC2AL3HYE2A +XN--XKC2DL3A5EE0H +XN--YFRO4I67O +XN--YGBI2AMMX +XXX +YE +YT +ZA +ZM +ZW diff --git a/lib/guessit/yamlutils.py b/lib/guessit/yamlutils.py new file mode 100644 index 00000000..e6f9fc1d --- /dev/null +++ b/lib/guessit/yamlutils.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Options +""" + +try: + from collections import OrderedDict +except ImportError: # pragma: no-cover + from ordereddict import OrderedDict # pylint:disable=import-error +import babelfish + +import yaml # pylint:disable=wrong-import-order + +from .rules.common.quantity import BitRate, FrameRate, Size + + +class OrderedDictYAMLLoader(yaml.Loader): + """ + A YAML loader that loads mappings into ordered dictionaries. + From https://gist.github.com/enaeseth/844388 + """ + + def __init__(self, *args, **kwargs): + yaml.Loader.__init__(self, *args, **kwargs) + + self.add_constructor(u'tag:yaml.org,2002:map', type(self).construct_yaml_map) + self.add_constructor(u'tag:yaml.org,2002:omap', type(self).construct_yaml_map) + + def construct_yaml_map(self, node): + data = OrderedDict() + yield data + value = self.construct_mapping(node) + data.update(value) + + def construct_mapping(self, node, deep=False): + if isinstance(node, yaml.MappingNode): + self.flatten_mapping(node) + else: # pragma: no cover + raise yaml.constructor.ConstructorError(None, None, + 'expected a mapping node, but found %s' % node.id, node.start_mark) + + mapping = OrderedDict() + for key_node, value_node in node.value: + key = self.construct_object(key_node, deep=deep) + try: + hash(key) + except TypeError as exc: # pragma: no cover + raise yaml.constructor.ConstructorError('while constructing a mapping', + node.start_mark, 'found unacceptable key (%s)' + % exc, key_node.start_mark) + value = self.construct_object(value_node, deep=deep) + mapping[key] = value + return mapping + + +class CustomDumper(yaml.SafeDumper): + """ + Custom YAML Dumper. + """ + pass # pylint:disable=unnecessary-pass + + +def default_representer(dumper, data): + """Default representer""" + return dumper.represent_str(str(data)) + + +CustomDumper.add_representer(babelfish.Language, default_representer) +CustomDumper.add_representer(babelfish.Country, default_representer) +CustomDumper.add_representer(BitRate, default_representer) +CustomDumper.add_representer(FrameRate, default_representer) +CustomDumper.add_representer(Size, default_representer) + + +def ordered_dict_representer(dumper, data): + """OrderedDict representer""" + return dumper.represent_mapping('tag:yaml.org,2002:map', data.items()) + + +CustomDumper.add_representer(OrderedDict, ordered_dict_representer) diff --git a/lib/libtorrent.so b/lib/libtorrent.so new file mode 100644 index 00000000..bbfecbad Binary files /dev/null and b/lib/libtorrent.so differ diff --git a/lib/python_libtorrent/linux_x86_64/1.1.1/libtorrent.so b/lib/python_libtorrent/linux_x86_64/1.1.1/libtorrent.so new file mode 100644 index 00000000..bbfecbad Binary files /dev/null and b/lib/python_libtorrent/linux_x86_64/1.1.1/libtorrent.so differ diff --git a/lib/rebulk/__init__.py b/lib/rebulk/__init__.py new file mode 100644 index 00000000..93d5e477 --- /dev/null +++ b/lib/rebulk/__init__.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Define simple search patterns in bulk to perform advanced matching on any string. +""" +# pylint:disable=import-self +from .rebulk import Rebulk +from .rules import Rule, CustomRule, AppendMatch, RemoveMatch, RenameMatch, AppendTags, RemoveTags +from .processors import ConflictSolver, PrivateRemover, POST_PROCESS, PRE_PROCESS +from .pattern import REGEX_AVAILABLE diff --git a/lib/rebulk/__version__.py b/lib/rebulk/__version__.py new file mode 100644 index 00000000..5aa37ed6 --- /dev/null +++ b/lib/rebulk/__version__.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Version module +""" +# pragma: no cover +__version__ = '2.0.1.dev0' diff --git a/lib/rebulk/builder.py b/lib/rebulk/builder.py new file mode 100644 index 00000000..c91420aa --- /dev/null +++ b/lib/rebulk/builder.py @@ -0,0 +1,217 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Base builder class for Rebulk +""" +from abc import ABCMeta, abstractmethod +from copy import deepcopy +from logging import getLogger + +from six import add_metaclass + +from .loose import set_defaults +from .pattern import RePattern, StringPattern, FunctionalPattern + +log = getLogger(__name__).log + + +@add_metaclass(ABCMeta) +class Builder(object): + """ + Base builder class for patterns + """ + + def __init__(self): + self._defaults = {} + self._regex_defaults = {} + self._string_defaults = {} + self._functional_defaults = {} + self._chain_defaults = {} + + def reset(self): + """ + Reset all defaults. + + :return: + """ + self.__init__() + + def defaults(self, **kwargs): + """ + Define default keyword arguments for all patterns + :param kwargs: + :type kwargs: + :return: + :rtype: + """ + set_defaults(kwargs, self._defaults, override=True) + return self + + def regex_defaults(self, **kwargs): + """ + Define default keyword arguments for functional patterns. + :param kwargs: + :type kwargs: + :return: + :rtype: + """ + set_defaults(kwargs, self._regex_defaults, override=True) + return self + + def string_defaults(self, **kwargs): + """ + Define default keyword arguments for string patterns. + :param kwargs: + :type kwargs: + :return: + :rtype: + """ + set_defaults(kwargs, self._string_defaults, override=True) + return self + + def functional_defaults(self, **kwargs): + """ + Define default keyword arguments for functional patterns. + :param kwargs: + :type kwargs: + :return: + :rtype: + """ + set_defaults(kwargs, self._functional_defaults, override=True) + return self + + def chain_defaults(self, **kwargs): + """ + Define default keyword arguments for patterns chain. + :param kwargs: + :type kwargs: + :return: + :rtype: + """ + set_defaults(kwargs, self._chain_defaults, override=True) + return self + + def build_re(self, *pattern, **kwargs): + """ + Builds a new regular expression pattern + + :param pattern: + :type pattern: + :param kwargs: + :type kwargs: + :return: + :rtype: + """ + set_defaults(self._regex_defaults, kwargs) + set_defaults(self._defaults, kwargs) + return RePattern(*pattern, **kwargs) + + def build_string(self, *pattern, **kwargs): + """ + Builds a new string pattern + + :param pattern: + :type pattern: + :param kwargs: + :type kwargs: + :return: + :rtype: + """ + set_defaults(self._string_defaults, kwargs) + set_defaults(self._defaults, kwargs) + return StringPattern(*pattern, **kwargs) + + def build_functional(self, *pattern, **kwargs): + """ + Builds a new functional pattern + + :param pattern: + :type pattern: + :param kwargs: + :type kwargs: + :return: + :rtype: + """ + set_defaults(self._functional_defaults, kwargs) + set_defaults(self._defaults, kwargs) + return FunctionalPattern(*pattern, **kwargs) + + def build_chain(self, **kwargs): + """ + Builds a new patterns chain + + :param pattern: + :type pattern: + :param kwargs: + :type kwargs: + :return: + :rtype: + """ + from .chain import Chain + set_defaults(self._chain_defaults, kwargs) + set_defaults(self._defaults, kwargs) + chain = Chain(self, **kwargs) + chain._defaults = deepcopy(self._defaults) # pylint: disable=protected-access + chain._regex_defaults = deepcopy(self._regex_defaults) # pylint: disable=protected-access + chain._functional_defaults = deepcopy(self._functional_defaults) # pylint: disable=protected-access + chain._string_defaults = deepcopy(self._string_defaults) # pylint: disable=protected-access + chain._chain_defaults = deepcopy(self._chain_defaults) # pylint: disable=protected-access + return chain + + @abstractmethod + def pattern(self, *pattern): + """ + Register a list of Pattern instance + :param pattern: + :return: + """ + pass + + def regex(self, *pattern, **kwargs): + """ + Add re pattern + + :param pattern: + :type pattern: + :return: self + :rtype: Rebulk + """ + return self.pattern(self.build_re(*pattern, **kwargs)) + + def string(self, *pattern, **kwargs): + """ + Add string pattern + + :param pattern: + :type pattern: + :return: self + :rtype: Rebulk + """ + return self.pattern(self.build_string(*pattern, **kwargs)) + + def functional(self, *pattern, **kwargs): + """ + Add functional pattern + + :param pattern: + :type pattern: + :return: self + :rtype: Rebulk + """ + functional = self.build_functional(*pattern, **kwargs) + return self.pattern(functional) + + def chain(self, **kwargs): + """ + Add patterns chain, using configuration of this rebulk + + :param pattern: + :type pattern: + :param kwargs: + :type kwargs: + :return: + :rtype: + """ + chain = self.build_chain(**kwargs) + self.pattern(chain) + return chain diff --git a/lib/rebulk/chain.py b/lib/rebulk/chain.py new file mode 100644 index 00000000..ba31ec9a --- /dev/null +++ b/lib/rebulk/chain.py @@ -0,0 +1,380 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Chain patterns and handle repetiting capture group +""" +# pylint: disable=super-init-not-called +import itertools + +from .builder import Builder +from .loose import call +from .match import Match, Matches +from .pattern import Pattern, filter_match_kwargs, BasePattern +from .remodule import re + + +class _InvalidChainException(Exception): + """ + Internal exception raised when a chain is not valid + """ + pass + + +class Chain(Pattern, Builder): + """ + Definition of a pattern chain to search for. + """ + + def __init__(self, parent, chain_breaker=None, **kwargs): + Builder.__init__(self) + call(Pattern.__init__, self, **kwargs) + self._kwargs = kwargs + self._match_kwargs = filter_match_kwargs(kwargs) + if callable(chain_breaker): + self.chain_breaker = chain_breaker + else: + self.chain_breaker = None + self.parent = parent + self.parts = [] + + def pattern(self, *pattern): + """ + + :param pattern: + :return: + """ + if not pattern: + raise ValueError("One pattern should be given to the chain") + if len(pattern) > 1: + raise ValueError("Only one pattern can be given to the chain") + part = ChainPart(self, pattern[0]) + self.parts.append(part) + return part + + def close(self): + """ + Deeply close the chain + :return: Rebulk instance + """ + parent = self.parent + while isinstance(parent, Chain): + parent = parent.parent + return parent + + def _match(self, pattern, input_string, context=None): + # pylint: disable=too-many-locals,too-many-nested-blocks + chain_matches = [] + chain_input_string = input_string + offset = 0 + while offset < len(input_string): + chain_found = False + current_chain_matches = [] + valid_chain = True + for chain_part in self.parts: + try: + chain_part_matches, raw_chain_part_matches = chain_part.matches(chain_input_string, + context, + with_raw_matches=True) + + chain_found, chain_input_string, offset = \ + self._to_next_chain_part(chain_part, chain_part_matches, raw_chain_part_matches, chain_found, + input_string, chain_input_string, offset, current_chain_matches) + except _InvalidChainException: + valid_chain = False + if current_chain_matches: + offset = current_chain_matches[0].raw_end + break + if not chain_found: + break + if current_chain_matches and valid_chain: + match = self._build_chain_match(current_chain_matches, input_string) + chain_matches.append(match) + + return chain_matches + + def _to_next_chain_part(self, chain_part, chain_part_matches, raw_chain_part_matches, chain_found, + input_string, chain_input_string, offset, current_chain_matches): + Chain._fix_matches_offset(chain_part_matches, input_string, offset) + Chain._fix_matches_offset(raw_chain_part_matches, input_string, offset) + + if raw_chain_part_matches: + grouped_matches_dict = self._group_by_match_index(chain_part_matches) + grouped_raw_matches_dict = self._group_by_match_index(raw_chain_part_matches) + + for match_index, grouped_raw_matches in grouped_raw_matches_dict.items(): + chain_found = True + offset = grouped_raw_matches[-1].raw_end + chain_input_string = input_string[offset:] + + if not chain_part.is_hidden: + grouped_matches = grouped_matches_dict.get(match_index, []) + if self._chain_breaker_eval(current_chain_matches + grouped_matches): + current_chain_matches.extend(grouped_matches) + return chain_found, chain_input_string, offset + + def _process_match(self, match, match_index, child=False): + """ + Handle a match + :param match: + :type match: + :param match_index: + :type match_index: + :param child: + :type child: + :return: + :rtype: + """ + # pylint: disable=too-many-locals + ret = super(Chain, self)._process_match(match, match_index, child=child) + if ret: + return True + + if match.children: + last_pattern = match.children[-1].pattern + last_pattern_groups = self._group_by_match_index( + [child_ for child_ in match.children if child_.pattern == last_pattern] + ) + + if last_pattern_groups: + original_children = Matches(match.children) + original_end = match.end + + for index in reversed(list(last_pattern_groups)): + last_matches = last_pattern_groups[index] + for last_match in last_matches: + match.children.remove(last_match) + match.end = match.children[-1].end if match.children else match.start + ret = super(Chain, self)._process_match(match, match_index, child=child) + if ret: + return True + + match.children = original_children + match.end = original_end + + return False + + def _build_chain_match(self, current_chain_matches, input_string): + start = None + end = None + for match in current_chain_matches: + if start is None or start > match.start: + start = match.start + if end is None or end < match.end: + end = match.end + match = call(Match, start, end, pattern=self, input_string=input_string, **self._match_kwargs) + for chain_match in current_chain_matches: + if chain_match.children: + for child in chain_match.children: + match.children.append(child) + if chain_match not in match.children: + match.children.append(chain_match) + chain_match.parent = match + return match + + def _chain_breaker_eval(self, matches): + return not self.chain_breaker or not self.chain_breaker(Matches(matches)) + + @staticmethod + def _fix_matches_offset(chain_part_matches, input_string, offset): + for chain_part_match in chain_part_matches: + if chain_part_match.input_string != input_string: + chain_part_match.input_string = input_string + chain_part_match.end += offset + chain_part_match.start += offset + if chain_part_match.children: + Chain._fix_matches_offset(chain_part_match.children, input_string, offset) + + @staticmethod + def _group_by_match_index(matches): + grouped_matches_dict = dict() + for match_index, match in itertools.groupby(matches, lambda m: m.match_index): + grouped_matches_dict[match_index] = list(match) + return grouped_matches_dict + + @property + def match_options(self): + return {} + + @property + def patterns(self): + return [self] + + def __repr__(self): + defined = "" + if self.defined_at: + defined = "@%s" % (self.defined_at,) + return "<%s%s:%s>" % (self.__class__.__name__, defined, self.parts) + + +class ChainPart(BasePattern): + """ + Part of a pattern chain. + """ + + def __init__(self, chain, pattern): + self._chain = chain + self.pattern = pattern + self.repeater_start = 1 + self.repeater_end = 1 + self._hidden = False + + @property + def _is_chain_start(self): + return self._chain.parts[0] == self + + def matches(self, input_string, context=None, with_raw_matches=False): + matches, raw_matches = self.pattern.matches(input_string, context=context, with_raw_matches=True) + + matches = self._truncate_repeater(matches, input_string) + raw_matches = self._truncate_repeater(raw_matches, input_string) + + self._validate_repeater(raw_matches) + + if with_raw_matches: + return matches, raw_matches + + return matches + + def _truncate_repeater(self, matches, input_string): + if not matches: + return matches + + if not self._is_chain_start: + separator = input_string[0:matches[0].initiator.raw_start] + if separator: + return [] + + j = 1 + for i in range(0, len(matches) - 1): + separator = input_string[matches[i].initiator.raw_end: + matches[i + 1].initiator.raw_start] + if separator: + break + j += 1 + truncated = matches[:j] + if self.repeater_end is not None: + truncated = [m for m in truncated if m.match_index < self.repeater_end] + return truncated + + def _validate_repeater(self, matches): + max_match_index = -1 + if matches: + max_match_index = max([m.match_index for m in matches]) + if max_match_index + 1 < self.repeater_start: + raise _InvalidChainException + + def chain(self): + """ + Add patterns chain, using configuration from this chain + + :return: + :rtype: + """ + return self._chain.chain() + + def hidden(self, hidden=True): + """ + Hide chain part results from global chain result + + :param hidden: + :type hidden: + :return: + :rtype: + """ + self._hidden = hidden + return self + + @property + def is_hidden(self): + """ + Check if the chain part is hidden + :return: + :rtype: + """ + return self._hidden + + def regex(self, *pattern, **kwargs): + """ + Add re pattern + + :param pattern: + :type pattern: + :param kwargs: + :type kwargs: + :return: + :rtype: + """ + return self._chain.regex(*pattern, **kwargs) + + def functional(self, *pattern, **kwargs): + """ + Add functional pattern + + :param pattern: + :type pattern: + :param kwargs: + :type kwargs: + :return: + :rtype: + """ + return self._chain.functional(*pattern, **kwargs) + + def string(self, *pattern, **kwargs): + """ + Add string pattern + + :param pattern: + :type pattern: + :param kwargs: + :type kwargs: + :return: + :rtype: + """ + return self._chain.string(*pattern, **kwargs) + + def close(self): + """ + Close the chain builder to continue registering other patterns + + :return: + :rtype: + """ + return self._chain.close() + + def repeater(self, value): + """ + Define the repeater of the current chain part. + + :param value: + :type value: + :return: + :rtype: + """ + try: + value = int(value) + self.repeater_start = value + self.repeater_end = value + return self + except ValueError: + pass + if value == '+': + self.repeater_start = 1 + self.repeater_end = None + if value == '*': + self.repeater_start = 0 + self.repeater_end = None + elif value == '?': + self.repeater_start = 0 + self.repeater_end = 1 + else: + match = re.match(r'\{\s*(\d*)\s*,?\s*(\d*)\s*\}', value) + if match: + start = match.group(1) + end = match.group(2) + if start or end: + self.repeater_start = int(start) if start else 0 + self.repeater_end = int(end) if end else None + return self + + def __repr__(self): + return "%s({%s,%s})" % (self.pattern, self.repeater_start, self.repeater_end) diff --git a/lib/rebulk/debug.py b/lib/rebulk/debug.py new file mode 100644 index 00000000..2384b26e --- /dev/null +++ b/lib/rebulk/debug.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Debug tools. + +Can be configured by changing values of those variable. + +DEBUG = False +Enable this variable to activate debug features (like defined_at parameters). It can slow down Rebulk + +LOG_LEVEL = 0 +Default log level of generated rebulk logs. +""" + +import inspect +import logging +import os +from collections import namedtuple + + +DEBUG = False +LOG_LEVEL = logging.DEBUG + + +class Frame(namedtuple('Frame', ['lineno', 'package', 'name', 'filename'])): + """ + Stack frame representation. + """ + __slots__ = () + + def __repr__(self): + return "%s#L%s" % (os.path.basename(self.filename), self.lineno) + + +def defined_at(): + """ + Get definition location of a pattern or a match (outside of rebulk package). + :return: + :rtype: + """ + if DEBUG: + frame = inspect.currentframe() + while frame: + try: + if frame.f_globals['__package__'] != __package__: + break + except KeyError: # pragma:no cover + # If package is missing, consider we are in. Workaround for python 3.3. + break + frame = frame.f_back + ret = Frame(frame.f_lineno, + frame.f_globals.get('__package__'), + frame.f_globals.get('__name__'), + frame.f_code.co_filename) + del frame + return ret diff --git a/lib/rebulk/formatters.py b/lib/rebulk/formatters.py new file mode 100644 index 00000000..7175a54a --- /dev/null +++ b/lib/rebulk/formatters.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Formatter functions to use in patterns. + +All those function have last argument as match.value (str). +""" + + +def formatters(*chained_formatters): + """ + Chain formatter functions. + :param chained_formatters: + :type chained_formatters: + :return: + :rtype: + """ + + def formatters_chain(input_string): # pylint:disable=missing-docstring + for chained_formatter in chained_formatters: + input_string = chained_formatter(input_string) + return input_string + + return formatters_chain + + +def default_formatter(input_string): + """ + Default formatter + :param input_string: + :return: + """ + return input_string diff --git a/lib/rebulk/introspector.py b/lib/rebulk/introspector.py new file mode 100644 index 00000000..bfefcb75 --- /dev/null +++ b/lib/rebulk/introspector.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Introspect rebulk object to retrieve capabilities. +""" +from abc import ABCMeta, abstractmethod +from collections import defaultdict + +import six +from .pattern import StringPattern, RePattern, FunctionalPattern +from .utils import extend_safe + + +@six.add_metaclass(ABCMeta) +class Description(object): + """ + Abstract class for a description. + """ + @property + @abstractmethod + def properties(self): # pragma: no cover + """ + Properties of described object. + :return: all properties that described object can generate grouped by name. + :rtype: dict + """ + pass + + +class PatternDescription(Description): + """ + Description of a pattern. + """ + def __init__(self, pattern): # pylint:disable=too-many-branches + self.pattern = pattern + self._properties = defaultdict(list) + + if pattern.properties: + for key, values in pattern.properties.items(): + extend_safe(self._properties[key], values) + elif 'value' in pattern.match_options: + self._properties[pattern.name].append(pattern.match_options['value']) + elif isinstance(pattern, StringPattern): + extend_safe(self._properties[pattern.name], pattern.patterns) + elif isinstance(pattern, RePattern): + if pattern.name and pattern.name not in pattern.private_names: + extend_safe(self._properties[pattern.name], [None]) + if not pattern.private_children: + for regex_pattern in pattern.patterns: + for group_name, values in regex_pattern.groupindex.items(): + if group_name not in pattern.private_names: + extend_safe(self._properties[group_name], [None]) + elif isinstance(pattern, FunctionalPattern): + if pattern.name and pattern.name not in pattern.private_names: + extend_safe(self._properties[pattern.name], [None]) + + + @property + def properties(self): + """ + Properties for this rule. + :return: + :rtype: dict + """ + return self._properties + + +class RuleDescription(Description): + """ + Description of a rule. + """ + def __init__(self, rule): + self.rule = rule + + self._properties = defaultdict(list) + + if rule.properties: + for key, values in rule.properties.items(): + extend_safe(self._properties[key], values) + + @property + def properties(self): + """ + Properties for this rule. + :return: + :rtype: dict + """ + return self._properties + + +class Introspection(Description): + """ + Introspection results. + """ + def __init__(self, rebulk, context=None): + self.patterns = [PatternDescription(pattern) for pattern in rebulk.effective_patterns(context) + if not pattern.private and not pattern.marker] + self.rules = [RuleDescription(rule) for rule in rebulk.effective_rules(context)] + + @property + def properties(self): + """ + Properties for Introspection results. + :return: + :rtype: + """ + properties = defaultdict(list) + for pattern in self.patterns: + for key, values in pattern.properties.items(): + extend_safe(properties[key], values) + for rule in self.rules: + for key, values in rule.properties.items(): + extend_safe(properties[key], values) + return properties + + +def introspect(rebulk, context=None): + """ + Introspect a Rebulk instance to grab defined objects and properties that can be generated. + :param rebulk: + :type rebulk: Rebulk + :param context: + :type context: + :return: Introspection instance + :rtype: Introspection + """ + return Introspection(rebulk, context) diff --git a/lib/rebulk/loose.py b/lib/rebulk/loose.py new file mode 100644 index 00000000..5e747a88 --- /dev/null +++ b/lib/rebulk/loose.py @@ -0,0 +1,242 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Various utilities functions +""" + +import sys + +from inspect import isclass +try: + from inspect import getfullargspec as getargspec + + _fullargspec_supported = True +except ImportError: + _fullargspec_supported = False + from inspect import getargspec + +from .utils import is_iterable + +if sys.version_info < (3, 4, 0): # pragma: no cover + def _constructor(class_): + """ + Retrieves constructor from given class + + :param class_: + :type class_: class + :return: constructor from given class + :rtype: callable + """ + return class_.__init__ +else: # pragma: no cover + def _constructor(class_): + """ + Retrieves constructor from given class + + :param class_: + :type class_: class + :return: constructor from given class + :rtype: callable + """ + return class_ + + +def call(function, *args, **kwargs): + """ + Call a function or constructor with given args and kwargs after removing args and kwargs that doesn't match + function or constructor signature + + :param function: Function or constructor to call + :type function: callable + :param args: + :type args: + :param kwargs: + :type kwargs: + :return: sale vakye as default function call + :rtype: object + """ + func = constructor_args if isclass(function) else function_args + call_args, call_kwargs = func(function, *args, **kwargs) + return function(*call_args, **call_kwargs) + + +def function_args(callable_, *args, **kwargs): + """ + Return (args, kwargs) matching the function signature + + :param callable: callable to inspect + :type callable: callable + :param args: + :type args: + :param kwargs: + :type kwargs: + :return: (args, kwargs) matching the function signature + :rtype: tuple + """ + argspec = getargspec(callable_) # pylint:disable=deprecated-method + return argspec_args(argspec, False, *args, **kwargs) + + +def constructor_args(class_, *args, **kwargs): + """ + Return (args, kwargs) matching the function signature + + :param callable: callable to inspect + :type callable: Callable + :param args: + :type args: + :param kwargs: + :type kwargs: + :return: (args, kwargs) matching the function signature + :rtype: tuple + """ + argspec = getargspec(_constructor(class_)) # pylint:disable=deprecated-method + return argspec_args(argspec, True, *args, **kwargs) + + +def argspec_args(argspec, constructor, *args, **kwargs): + """ + Return (args, kwargs) matching the argspec object + + :param argspec: argspec to use + :type argspec: argspec + :param constructor: is it a constructor ? + :type constructor: bool + :param args: + :type args: + :param kwargs: + :type kwargs: + :return: (args, kwargs) matching the function signature + :rtype: tuple + """ + if argspec.varkw: + call_kwarg = kwargs + else: + call_kwarg = dict((k, kwargs[k]) for k in kwargs if k in argspec.args) # Python 2.6 dict comprehension + if argspec.varargs: + call_args = args + else: + call_args = args[:len(argspec.args) - (1 if constructor else 0)] + return call_args, call_kwarg + + +if not _fullargspec_supported: + def argspec_args_legacy(argspec, constructor, *args, **kwargs): + """ + Return (args, kwargs) matching the argspec object + + :param argspec: argspec to use + :type argspec: argspec + :param constructor: is it a constructor ? + :type constructor: bool + :param args: + :type args: + :param kwargs: + :type kwargs: + :return: (args, kwargs) matching the function signature + :rtype: tuple + """ + if argspec.keywords: + call_kwarg = kwargs + else: + call_kwarg = dict((k, kwargs[k]) for k in kwargs if k in argspec.args) # Python 2.6 dict comprehension + if argspec.varargs: + call_args = args + else: + call_args = args[:len(argspec.args) - (1 if constructor else 0)] + return call_args, call_kwarg + + + argspec_args = argspec_args_legacy + + +def ensure_list(param): + """ + Retrieves a list from given parameter. + + :param param: + :type param: + :return: + :rtype: + """ + if not param: + param = [] + elif not is_iterable(param): + param = [param] + return param + + +def ensure_dict(param, default_value, default_key=None): + """ + Retrieves a dict and a default value from given parameter. + + if parameter is not a dict, it will be promoted as the default value. + + :param param: + :type param: + :param default_value: + :type default_value: + :param default_key: + :type default_key: + :return: + :rtype: + """ + if not param: + param = default_value + if not isinstance(param, dict): + if param: + default_value = param + return {default_key: param}, default_value + return param, default_value + + +def filter_index(collection, predicate=None, index=None): + """ + Filter collection with predicate function and index. + + If index is not found, returns None. + :param collection: + :type collection: collection supporting iteration and slicing + :param predicate: function to filter the collection with + :type predicate: function + :param index: position of a single element to retrieve + :type index: int + :return: filtered list, or single element of filtered list if index is defined + :rtype: list or object + """ + if index is None and isinstance(predicate, int): + index = predicate + predicate = None + if predicate: + collection = collection.__class__(filter(predicate, collection)) + if index is not None: + try: + collection = collection[index] + except IndexError: + collection = None + return collection + + +def set_defaults(defaults, kwargs, override=False): + """ + Set defaults from defaults dict to kwargs dict + + :param override: + :type override: + :param defaults: + :type defaults: + :param kwargs: + :type kwargs: + :return: + :rtype: + """ + if 'clear' in defaults.keys() and defaults.pop('clear'): + kwargs.clear() + for key, value in defaults.items(): + if key in kwargs: + if isinstance(value, list) and isinstance(kwargs[key], list): + kwargs[key] = list(value) + kwargs[key] + elif isinstance(value, dict) and isinstance(kwargs[key], dict): + set_defaults(value, kwargs[key]) + if key not in kwargs or override: + kwargs[key] = value diff --git a/lib/rebulk/match.py b/lib/rebulk/match.py new file mode 100644 index 00000000..d8e72df4 --- /dev/null +++ b/lib/rebulk/match.py @@ -0,0 +1,890 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Classes and functions related to matches +""" +import copy +import itertools +from collections import defaultdict +try: + from collections.abc import MutableSequence +except ImportError: + from collections import MutableSequence + +try: + from collections import OrderedDict # pylint:disable=ungrouped-imports +except ImportError: # pragma: no cover + from ordereddict import OrderedDict # pylint:disable=import-error +import six + +from .loose import ensure_list, filter_index +from .utils import is_iterable +from .debug import defined_at + + +class MatchesDict(OrderedDict): + """ + A custom dict with matches property. + """ + + def __init__(self): + super(MatchesDict, self).__init__() + self.matches = defaultdict(list) + self.values_list = defaultdict(list) + + +class _BaseMatches(MutableSequence): + """ + A custom list[Match] that automatically maintains name, tag, start and end lookup structures. + """ + _base = list + _base_add = _base.append + _base_remove = _base.remove + _base_extend = _base.extend + + def __init__(self, matches=None, input_string=None): # pylint: disable=super-init-not-called + self.input_string = input_string + self._max_end = 0 + self._delegate = [] + self.__name_dict = None + self.__tag_dict = None + self.__start_dict = None + self.__end_dict = None + self.__index_dict = None + if matches: + self.extend(matches) + + @property + def _name_dict(self): + if self.__name_dict is None: + self.__name_dict = defaultdict(_BaseMatches._base) + for name, values in itertools.groupby([m for m in self._delegate if m.name], lambda item: item.name): + _BaseMatches._base_extend(self.__name_dict[name], values) + + return self.__name_dict + + @property + def _start_dict(self): + if self.__start_dict is None: + self.__start_dict = defaultdict(_BaseMatches._base) + for start, values in itertools.groupby([m for m in self._delegate], lambda item: item.start): + _BaseMatches._base_extend(self.__start_dict[start], values) + + return self.__start_dict + + @property + def _end_dict(self): + if self.__end_dict is None: + self.__end_dict = defaultdict(_BaseMatches._base) + for start, values in itertools.groupby([m for m in self._delegate], lambda item: item.end): + _BaseMatches._base_extend(self.__end_dict[start], values) + + return self.__end_dict + + @property + def _tag_dict(self): + if self.__tag_dict is None: + self.__tag_dict = defaultdict(_BaseMatches._base) + for match in self._delegate: + for tag in match.tags: + _BaseMatches._base_add(self.__tag_dict[tag], match) + + return self.__tag_dict + + @property + def _index_dict(self): + if self.__index_dict is None: + self.__index_dict = defaultdict(_BaseMatches._base) + for match in self._delegate: + for index in range(*match.span): + _BaseMatches._base_add(self.__index_dict[index], match) + + return self.__index_dict + + def _add_match(self, match): + """ + Add a match + :param match: + :type match: Match + """ + if self.__name_dict is not None: + if match.name: + _BaseMatches._base_add(self._name_dict[match.name], (match)) + if self.__tag_dict is not None: + for tag in match.tags: + _BaseMatches._base_add(self._tag_dict[tag], match) + if self.__start_dict is not None: + _BaseMatches._base_add(self._start_dict[match.start], match) + if self.__end_dict is not None: + _BaseMatches._base_add(self._end_dict[match.end], match) + if self.__index_dict is not None: + for index in range(*match.span): + _BaseMatches._base_add(self._index_dict[index], match) + if match.end > self._max_end: + self._max_end = match.end + + def _remove_match(self, match): + """ + Remove a match + :param match: + :type match: Match + """ + if self.__name_dict is not None: + if match.name: + _BaseMatches._base_remove(self._name_dict[match.name], match) + if self.__tag_dict is not None: + for tag in match.tags: + _BaseMatches._base_remove(self._tag_dict[tag], match) + if self.__start_dict is not None: + _BaseMatches._base_remove(self._start_dict[match.start], match) + if self.__end_dict is not None: + _BaseMatches._base_remove(self._end_dict[match.end], match) + if self.__index_dict is not None: + for index in range(*match.span): + _BaseMatches._base_remove(self._index_dict[index], match) + if match.end >= self._max_end and not self._end_dict[match.end]: + self._max_end = max(self._end_dict.keys()) + + def previous(self, match, predicate=None, index=None): + """ + Retrieves the nearest previous matches. + :param match: + :type match: + :param predicate: + :type predicate: + :param index: + :type index: int + :return: + :rtype: + """ + current = match.start + while current > -1: + previous_matches = self.ending(current) + if previous_matches: + return filter_index(previous_matches, predicate, index) + current -= 1 + return filter_index(_BaseMatches._base(), predicate, index) + + def next(self, match, predicate=None, index=None): + """ + Retrieves the nearest next matches. + :param match: + :type match: + :param predicate: + :type predicate: + :param index: + :type index: int + :return: + :rtype: + """ + current = match.start + 1 + while current <= self._max_end: + next_matches = self.starting(current) + if next_matches: + return filter_index(next_matches, predicate, index) + current += 1 + return filter_index(_BaseMatches._base(), predicate, index) + + def named(self, name, predicate=None, index=None): + """ + Retrieves a set of Match objects that have the given name. + :param name: + :type name: str + :param predicate: + :type predicate: + :param index: + :type index: int + :return: set of matches + :rtype: set[Match] + """ + return filter_index(_BaseMatches._base(self._name_dict[name]), predicate, index) + + def tagged(self, tag, predicate=None, index=None): + """ + Retrieves a set of Match objects that have the given tag defined. + :param tag: + :type tag: str + :param predicate: + :type predicate: + :param index: + :type index: int + :return: set of matches + :rtype: set[Match] + """ + return filter_index(_BaseMatches._base(self._tag_dict[tag]), predicate, index) + + def starting(self, start, predicate=None, index=None): + """ + Retrieves a set of Match objects that starts at given index. + :param start: the starting index + :type start: int + :param predicate: + :type predicate: + :param index: + :type index: int + :return: set of matches + :rtype: set[Match] + """ + return filter_index(_BaseMatches._base(self._start_dict[start]), predicate, index) + + def ending(self, end, predicate=None, index=None): + """ + Retrieves a set of Match objects that ends at given index. + :param end: the ending index + :type end: int + :param predicate: + :type predicate: + :return: set of matches + :rtype: set[Match] + """ + return filter_index(_BaseMatches._base(self._end_dict[end]), predicate, index) + + def range(self, start=0, end=None, predicate=None, index=None): + """ + Retrieves a set of Match objects that are available in given range, sorted from start to end. + :param start: the starting index + :type start: int + :param end: the ending index + :type end: int + :param predicate: + :type predicate: + :param index: + :type index: int + :return: set of matches + :rtype: set[Match] + """ + if end is None: + end = self.max_end + else: + end = min(self.max_end, end) + ret = _BaseMatches._base() + for match in sorted(self): + if match.start < end and match.end > start: + ret.append(match) + return filter_index(ret, predicate, index) + + def chain_before(self, position, seps, start=0, predicate=None, index=None): + """ + Retrieves a list of chained matches, before position, matching predicate and separated by characters from seps + only. + :param position: + :type position: + :param seps: + :type seps: + :param start: + :type start: + :param predicate: + :type predicate: + :param index: + :type index: + :return: + :rtype: + """ + if hasattr(position, 'start'): + position = position.start + + chain = _BaseMatches._base() + position = min(self.max_end, position) + + for i in reversed(range(start, position)): + index_matches = self.at_index(i) + filtered_matches = [index_match for index_match in index_matches if not predicate or predicate(index_match)] + if filtered_matches: + for chain_match in filtered_matches: + if chain_match not in chain: + chain.append(chain_match) + elif self.input_string[i] not in seps: + break + + return filter_index(chain, predicate, index) + + def chain_after(self, position, seps, end=None, predicate=None, index=None): + """ + Retrieves a list of chained matches, after position, matching predicate and separated by characters from seps + only. + :param position: + :type position: + :param seps: + :type seps: + :param end: + :type end: + :param predicate: + :type predicate: + :param index: + :type index: + :return: + :rtype: + """ + if hasattr(position, 'end'): + position = position.end + chain = _BaseMatches._base() + + if end is None: + end = self.max_end + else: + end = min(self.max_end, end) + + for i in range(position, end): + index_matches = self.at_index(i) + filtered_matches = [index_match for index_match in index_matches if not predicate or predicate(index_match)] + if filtered_matches: + for chain_match in filtered_matches: + if chain_match not in chain: + chain.append(chain_match) + elif self.input_string[i] not in seps: + break + + return filter_index(chain, predicate, index) + + @property + def max_end(self): + """ + Retrieves the maximum index. + :return: + """ + return max(len(self.input_string), self._max_end) if self.input_string else self._max_end + + def _hole_start(self, position, ignore=None): + """ + Retrieves the start of hole index from position. + :param position: + :type position: + :param ignore: + :type ignore: + :return: + :rtype: + """ + for lindex in reversed(range(0, position)): + for starting in self.starting(lindex): + if not ignore or not ignore(starting): + return lindex + return 0 + + def _hole_end(self, position, ignore=None): + """ + Retrieves the end of hole index from position. + :param position: + :type position: + :param ignore: + :type ignore: + :return: + :rtype: + """ + for rindex in range(position, self.max_end): + for starting in self.starting(rindex): + if not ignore or not ignore(starting): + return rindex + return self.max_end + + def holes(self, start=0, end=None, formatter=None, ignore=None, seps=None, predicate=None, + index=None): # pylint: disable=too-many-branches,too-many-locals + """ + Retrieves a set of Match objects that are not defined in given range. + :param start: + :type start: + :param end: + :type end: + :param formatter: + :type formatter: + :param ignore: + :type ignore: + :param seps: + :type seps: + :param predicate: + :type predicate: + :param index: + :type index: + :return: + :rtype: + """ + assert self.input_string if seps else True, "input_string must be defined when using seps parameter" + if end is None: + end = self.max_end + else: + end = min(self.max_end, end) + ret = _BaseMatches._base() + hole = False + rindex = start + + loop_start = self._hole_start(start, ignore) + + for rindex in range(loop_start, end): + current = [] + for at_index in self.at_index(rindex): + if not ignore or not ignore(at_index): + current.append(at_index) + + if seps and hole and self.input_string and self.input_string[rindex] in seps: + hole = False + ret[-1].end = rindex + else: + if not current and not hole: + # Open a new hole match + hole = True + ret.append(Match(max(rindex, start), None, input_string=self.input_string, formatter=formatter)) + elif current and hole: + # Close current hole match + hole = False + ret[-1].end = rindex + + if ret and hole: + # go the the next starting element ... + ret[-1].end = min(self._hole_end(rindex, ignore), end) + return filter_index(ret, predicate, index) + + def conflicting(self, match, predicate=None, index=None): + """ + Retrieves a list of ``Match`` objects that conflicts with given match. + :param match: + :type match: + :param predicate: + :type predicate: + :param index: + :type index: + :return: + :rtype: + """ + ret = _BaseMatches._base() + + for i in range(*match.span): + for at_match in self.at_index(i): + if at_match not in ret: + ret.append(at_match) + + ret.remove(match) + + return filter_index(ret, predicate, index) + + def at_match(self, match, predicate=None, index=None): + """ + Retrieves a list of matches from given match. + """ + return self.at_span(match.span, predicate, index) + + def at_span(self, span, predicate=None, index=None): + """ + Retrieves a list of matches from given (start, end) tuple. + """ + starting = self._index_dict[span[0]] + ending = self._index_dict[span[1] - 1] + + merged = list(starting) + for marker in ending: + if marker not in merged: + merged.append(marker) + + return filter_index(merged, predicate, index) + + def at_index(self, pos, predicate=None, index=None): + """ + Retrieves a list of matches from given position + """ + return filter_index(self._index_dict[pos], predicate, index) + + @property + def names(self): + """ + Retrieve all names. + :return: + """ + return self._name_dict.keys() + + @property + def tags(self): + """ + Retrieve all tags. + :return: + """ + return self._tag_dict.keys() + + def to_dict(self, details=False, first_value=False, enforce_list=False): + """ + Converts matches to a dict object. + :param details if True, values will be complete Match object, else it will be only string Match.value property + :type details: bool + :param first_value if True, only the first value will be kept. Else, multiple values will be set as a list in + the dict. + :type first_value: bool + :param enforce_list: if True, value is wrapped in a list even when a single value is found. Else, list values + are available under `values_list` property of the returned dict object. + :type enforce_list: bool + :return: + :rtype: dict + """ + ret = MatchesDict() + for match in sorted(self): + value = match if details else match.value + ret.matches[match.name].append(match) + if not enforce_list and value not in ret.values_list[match.name]: + ret.values_list[match.name].append(value) + if match.name in ret.keys(): + if not first_value: + if not isinstance(ret[match.name], list): + if ret[match.name] == value: + continue + ret[match.name] = [ret[match.name]] + else: + if value in ret[match.name]: + continue + ret[match.name].append(value) + else: + if enforce_list and not isinstance(value, list): + ret[match.name] = [value] + else: + ret[match.name] = value + return ret + + if six.PY2: # pragma: no cover + def clear(self): + """ + Python 3 backport + """ + del self[:] + + def __len__(self): + return len(self._delegate) + + def __getitem__(self, index): + ret = self._delegate[index] + if isinstance(ret, list): + return Matches(ret) + return ret + + def __setitem__(self, index, match): + self._delegate[index] = match + if isinstance(index, slice): + for match_item in match: + self._add_match(match_item) + return + self._add_match(match) + + def __delitem__(self, index): + match = self._delegate[index] + del self._delegate[index] + if isinstance(match, list): + # if index is a slice, we has a match list + for match_item in match: + self._remove_match(match_item) + else: + self._remove_match(match) + + def __repr__(self): + return self._delegate.__repr__() + + def insert(self, index, value): + self._delegate.insert(index, value) + self._add_match(value) + + +class Matches(_BaseMatches): + """ + A custom list[Match] contains matches list. + """ + + def __init__(self, matches=None, input_string=None): + self.markers = Markers(input_string=input_string) + super(Matches, self).__init__(matches=matches, input_string=input_string) + + def _add_match(self, match): + assert not match.marker, "A marker match should not be added to <Matches> object" + super(Matches, self)._add_match(match) + + +class Markers(_BaseMatches): + """ + A custom list[Match] containing markers list. + """ + + def __init__(self, matches=None, input_string=None): + super(Markers, self).__init__(matches=None, input_string=input_string) + + def _add_match(self, match): + assert match.marker, "A non-marker match should not be added to <Markers> object" + super(Markers, self)._add_match(match) + + +class Match(object): + """ + Object storing values related to a single match + """ + + def __init__(self, start, end, value=None, name=None, tags=None, marker=None, parent=None, private=None, + pattern=None, input_string=None, formatter=None, conflict_solver=None, **kwargs): + # pylint: disable=unused-argument + self.start = start + self.end = end + self.name = name + self._value = value + self.tags = ensure_list(tags) + self.marker = marker + self.parent = parent + self.input_string = input_string + self.formatter = formatter + self.pattern = pattern + self.private = private + self.conflict_solver = conflict_solver + self._children = None + self._raw_start = None + self._raw_end = None + self.defined_at = pattern.defined_at if pattern else defined_at() + + @property + def span(self): + """ + 2-tuple with start and end indices of the match + """ + return self.start, self.end + + @property + def children(self): + """ + Children matches. + """ + if self._children is None: + self._children = Matches(None, self.input_string) + return self._children + + @children.setter + def children(self, value): + self._children = value + + @property + def value(self): + """ + Get the value of the match, using formatter if defined. + :return: + :rtype: + """ + if self._value: + return self._value + if self.formatter: + return self.formatter(self.raw) + return self.raw + + @value.setter + def value(self, value): + """ + Set the value (hardcode) + :param value: + :type value: + :return: + :rtype: + """ + self._value = value # pylint: disable=attribute-defined-outside-init + + @property + def names(self): + """ + Get all names of children + :return: + :rtype: + """ + if not self.children: + return set([self.name]) + ret = set() + for child in self.children: + for name in child.names: + ret.add(name) + return ret + + @property + def raw_start(self): + """ + start index of raw value + :return: + :rtype: + """ + if self._raw_start is None: + return self.start + return self._raw_start + + @raw_start.setter + def raw_start(self, value): + """ + Set start index of raw value + :return: + :rtype: + """ + self._raw_start = value + + @property + def raw_end(self): + """ + end index of raw value + :return: + :rtype: + """ + if self._raw_end is None: + return self.end + return self._raw_end + + @raw_end.setter + def raw_end(self, value): + """ + Set end index of raw value + :return: + :rtype: + """ + self._raw_end = value + + @property + def raw(self): + """ + Get the raw value of the match, without using hardcoded value nor formatter. + :return: + :rtype: + """ + if self.input_string: + return self.input_string[self.raw_start:self.raw_end] + return None + + @property + def initiator(self): + """ + Retrieve the initiator parent of a match + :param match: + :type match: + :return: + :rtype: + """ + match = self + while match.parent: + match = match.parent + return match + + def crop(self, crops, predicate=None, index=None): + """ + crop the match with given Match objects or spans tuples + :param crops: + :type crops: list or object + :return: a list of Match objects + :rtype: list[Match] + """ + if not is_iterable(crops) or len(crops) == 2 and isinstance(crops[0], int): + crops = [crops] + initial = copy.deepcopy(self) + ret = [initial] + for crop in crops: + if hasattr(crop, 'span'): + start, end = crop.span + else: + start, end = crop + for current in list(ret): + if start <= current.start and end >= current.end: + # self is included in crop, remove current ... + ret.remove(current) + elif start >= current.start and end <= current.end: + # crop is included in self, split current ... + right = copy.deepcopy(current) + current.end = start + if not current: + ret.remove(current) + right.start = end + if right: + ret.append(right) + elif current.end >= end > current.start: + current.start = end + elif current.start <= start < current.end: + current.end = start + return filter_index(ret, predicate, index) + + def split(self, seps, predicate=None, index=None): + """ + Split this match in multiple matches using given separators. + :param seps: + :type seps: string containing separator characters + :return: list of new Match objects + :rtype: list + """ + split_match = copy.deepcopy(self) + current_match = split_match + ret = [] + + for i in range(0, len(self.raw)): + if self.raw[i] in seps: + if not split_match: + split_match = copy.deepcopy(current_match) + current_match.end = self.start + i + + else: + if split_match: + split_match.start = self.start + i + current_match = split_match + ret.append(split_match) + split_match = None + + return filter_index(ret, predicate, index) + + def tagged(self, *tags): + """ + Check if this match has at least one of the provided tags + + :param tags: + :return: True if at least one tag is defined, False otherwise. + """ + return any(tag in self.tags for tag in tags) + + def named(self, *names): + """ + Check if one of the children match has one of the provided name + + :param names: + :return: True if at least one child is named with a given name is defined, False otherwise. + """ + return any(name in self.names for name in names) + + def __len__(self): + return self.end - self.start + + def __hash__(self): + return hash(Match) + hash(self.start) + hash(self.end) + hash(self.value) + + def __eq__(self, other): + if isinstance(other, Match): + return self.span == other.span and self.value == other.value and self.name == other.name and \ + self.parent == other.parent + return NotImplemented + + def __ne__(self, other): + if isinstance(other, Match): + return self.span != other.span or self.value != other.value or self.name != other.name or \ + self.parent != other.parent + return NotImplemented + + def __lt__(self, other): + if isinstance(other, Match): + return self.span < other.span + return NotImplemented + + def __gt__(self, other): + if isinstance(other, Match): + return self.span > other.span + return NotImplemented + + def __le__(self, other): + if isinstance(other, Match): + return self.span <= other.span + return NotImplemented + + def __ge__(self, other): + if isinstance(other, Match): + return self.span >= other.span + return NotImplemented + + def __repr__(self): + flags = "" + name = "" + tags = "" + defined = "" + initiator = "" + if self.initiator.value != self.value: + initiator = "+initiator=" + self.initiator.value + if self.private: + flags += '+private' + if self.name: + name = "+name=%s" % (self.name,) + if self.tags: + tags = "+tags=%s" % (self.tags,) + if self.defined_at: + defined += "@%s" % (self.defined_at,) + return "<%s:%s%s%s%s%s%s>" % (self.value, self.span, flags, name, tags, initiator, defined) diff --git a/lib/rebulk/pattern.py b/lib/rebulk/pattern.py new file mode 100644 index 00000000..beb8b273 --- /dev/null +++ b/lib/rebulk/pattern.py @@ -0,0 +1,559 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Abstract pattern class definition along with various implementations (regexp, string, functional) +""" +# pylint: disable=super-init-not-called,wrong-import-position + +from abc import ABCMeta, abstractmethod, abstractproperty + +import six + +from . import debug +from .formatters import default_formatter +from .loose import call, ensure_list, ensure_dict +from .match import Match +from .remodule import re, REGEX_AVAILABLE +from .utils import find_all, is_iterable, get_first_defined +from .validators import allways_true + + +@six.add_metaclass(ABCMeta) +class BasePattern(object): + """ + Base class for Pattern like objects + """ + + @abstractmethod + def matches(self, input_string, context=None, with_raw_matches=False): + """ + Computes all matches for a given input + + :param input_string: the string to parse + :type input_string: str + :param context: the context + :type context: dict + :param with_raw_matches: should return details + :type with_raw_matches: dict + :return: matches based on input_string for this pattern + :rtype: iterator[Match] + """ + pass + + +@six.add_metaclass(ABCMeta) +class Pattern(BasePattern): + """ + Definition of a particular pattern to search for. + """ + + def __init__(self, name=None, tags=None, formatter=None, value=None, validator=None, children=False, every=False, + private_parent=False, private_children=False, private=False, private_names=None, ignore_names=None, + marker=False, format_all=False, validate_all=False, disabled=lambda context: False, log_level=None, + properties=None, post_processor=None, pre_match_processor=None, post_match_processor=None, **kwargs): + """ + :param name: Name of this pattern + :type name: str + :param tags: List of tags related to this pattern + :type tags: list[str] + :param formatter: dict (name, func) of formatter to use with this pattern. name is the match name to support, + and func a function(input_string) that returns the formatted string. A single formatter function can also be + passed as a shortcut for {None: formatter}. The returned formatted string with be set in Match.value property. + :type formatter: dict[str, func] || func + :param value: dict (name, value) of value to use with this pattern. name is the match name to support, + and value an object for the match value. A single object value can also be + passed as a shortcut for {None: value}. The value with be set in Match.value property. + :type value: dict[str, object] || object + :param validator: dict (name, func) of validator to use with this pattern. name is the match name to support, + and func a function(match) that returns the a boolean. A single validator function can also be + passed as a shortcut for {None: validator}. If return value is False, match will be ignored. + :param children: generates children instead of parent + :type children: bool + :param every: generates both parent and children. + :type every: bool + :param private: flag this pattern as beeing private. + :type private: bool + :param private_parent: force return of parent and flag parent matches as private. + :type private_parent: bool + :param private_children: force return of children and flag children matches as private. + :type private_children: bool + :param private_names: force return of named matches as private. + :type private_names: bool + :param ignore_names: drop some named matches after validation. + :type ignore_names: bool + :param marker: flag this pattern as beeing a marker. + :type private: bool + :param format_all if True, pattern will format every match in the hierarchy (even match not yield). + :type format_all: bool + :param validate_all if True, pattern will validate every match in the hierarchy (even match not yield). + :type validate_all: bool + :param disabled: if True, this pattern is disabled. Can also be a function(context). + :type disabled: bool|function + :param log_lvl: Log level associated to this pattern + :type log_lvl: int + :param post_processor: Post processing function + :type post_processor: func + :param pre_match_processor: Pre match processing function + :type pre_match_processor: func + :param post_match_processor: Post match processing function + :type post_match_processor: func + """ + # pylint:disable=too-many-locals,unused-argument + self.name = name + self.tags = ensure_list(tags) + self.formatters, self._default_formatter = ensure_dict(formatter, default_formatter) + self.values, self._default_value = ensure_dict(value, None) + self.validators, self._default_validator = ensure_dict(validator, allways_true) + self.every = every + self.children = children + self.private = private + self.private_names = private_names if private_names else [] + self.ignore_names = ignore_names if ignore_names else [] + self.private_parent = private_parent + self.private_children = private_children + self.marker = marker + self.format_all = format_all + self.validate_all = validate_all + if not callable(disabled): + self.disabled = lambda context: disabled + else: + self.disabled = disabled + self._log_level = log_level + self._properties = properties + self.defined_at = debug.defined_at() + if not callable(post_processor): + self.post_processor = None + else: + self.post_processor = post_processor + if not callable(pre_match_processor): + self.pre_match_processor = None + else: + self.pre_match_processor = pre_match_processor + if not callable(post_match_processor): + self.post_match_processor = None + else: + self.post_match_processor = post_match_processor + + @property + def log_level(self): + """ + Log level for this pattern. + :return: + :rtype: + """ + return self._log_level if self._log_level is not None else debug.LOG_LEVEL + + def matches(self, input_string, context=None, with_raw_matches=False): + """ + Computes all matches for a given input + + :param input_string: the string to parse + :type input_string: str + :param context: the context + :type context: dict + :param with_raw_matches: should return details + :type with_raw_matches: dict + :return: matches based on input_string for this pattern + :rtype: iterator[Match] + """ + # pylint: disable=too-many-branches + + matches = [] + raw_matches = [] + + for pattern in self.patterns: + match_index = 0 + for match in self._match(pattern, input_string, context): + raw_matches.append(match) + matches.extend(self._process_matches(match, match_index)) + match_index += 1 + + matches = self._post_process_matches(matches) + + if with_raw_matches: + return matches, raw_matches + return matches + + @property + def _should_include_children(self): + """ + Check if children matches from this pattern should be included in matches results. + :param match: + :type match: + :return: + :rtype: + """ + return self.children or self.every + + @property + def _should_include_parent(self): + """ + Check is a match from this pattern should be included in matches results. + :param match: + :type match: + :return: + :rtype: + """ + return not self.children or self.every + + @staticmethod + def _match_config_property_keys(match, child=False): + if match.name: + yield match.name + if child: + yield '__children__' + else: + yield '__parent__' + yield None + + @staticmethod + def _process_match_index(match, match_index): + """ + Process match index from this pattern process state. + + :param match: + :return: + """ + match.match_index = match_index + + def _process_match_private(self, match, child=False): + """ + Process match privacy from this pattern configuration. + + :param match: + :param child: + :return: + """ + + if match.name and match.name in self.private_names or \ + not child and self.private_parent or \ + child and self.private_children: + match.private = True + + def _process_match_value(self, match, child=False): + """ + Process match value from this pattern configuration. + :param match: + :return: + """ + keys = self._match_config_property_keys(match, child=child) + pattern_value = get_first_defined(self.values, keys, self._default_value) + if pattern_value: + match.value = pattern_value + + def _process_match_formatter(self, match, child=False): + """ + Process match formatter from this pattern configuration. + + :param match: + :return: + """ + included = self._should_include_children if child else self._should_include_parent + if included or self.format_all: + keys = self._match_config_property_keys(match, child=child) + match.formatter = get_first_defined(self.formatters, keys, self._default_formatter) + + def _process_match_validator(self, match, child=False): + """ + Process match validation from this pattern configuration. + + :param match: + :return: True if match is validated by the configured validator, False otherwise. + """ + included = self._should_include_children if child else self._should_include_parent + if included or self.validate_all: + keys = self._match_config_property_keys(match, child=child) + validator = get_first_defined(self.validators, keys, self._default_validator) + if validator and not validator(match): + return False + return True + + def _process_match(self, match, match_index, child=False): + """ + Process match from this pattern by setting all properties from defined configuration + (index, private, value, formatter, validator, ...). + + :param match: + :type match: + :return: True if match is validated by the configured validator, False otherwise. + :rtype: + """ + self._process_match_index(match, match_index) + self._process_match_private(match, child) + self._process_match_value(match, child) + self._process_match_formatter(match, child) + return self._process_match_validator(match, child) + + @staticmethod + def _process_match_processor(match, processor): + if processor: + ret = processor(match) + if ret is not None: + return ret + return match + + def _process_matches(self, match, match_index): + """ + Process and generate all matches for the given unprocessed match. + :param match: + :param match_index: + :return: Process and dispatched matches. + """ + match = self._process_match_processor(match, self.pre_match_processor) + if not match: + return + + if not self._process_match(match, match_index): + return + + for child in match.children: + if not self._process_match(child, match_index, child=True): + return + + match = self._process_match_processor(match, self.post_match_processor) + if not match: + return + + if (self._should_include_parent or self.private_parent) and match.name not in self.ignore_names: + yield match + if self._should_include_children or self.private_children: + children = [x for x in match.children if x.name not in self.ignore_names] + for child in children: + yield child + + def _post_process_matches(self, matches): + """ + Post process matches with user defined function + :param matches: + :type matches: + :return: + :rtype: + """ + if self.post_processor: + return self.post_processor(matches, self) + return matches + + @abstractproperty + def patterns(self): # pragma: no cover + """ + List of base patterns defined + + :return: A list of base patterns + :rtype: list + """ + pass + + @property + def properties(self): + """ + Properties names and values that can ben retrieved by this pattern. + :return: + :rtype: + """ + if self._properties: + return self._properties + return {} + + @abstractproperty + def match_options(self): # pragma: no cover + """ + dict of default options for generated Match objects + + :return: **options to pass to Match constructor + :rtype: dict + """ + pass + + @abstractmethod + def _match(self, pattern, input_string, context=None): # pragma: no cover + """ + Computes all unprocess matches for a given pattern and input. + + :param pattern: the pattern to use + :param input_string: the string to parse + :type input_string: str + :param context: the context + :type context: dict + :return: matches based on input_string for this pattern + :rtype: iterator[Match] + """ + pass + + def __repr__(self): + defined = "" + if self.defined_at: + defined = "@%s" % (self.defined_at,) + return "<%s%s:%s>" % (self.__class__.__name__, defined, self.__repr__patterns__) + + @property + def __repr__patterns__(self): + return self.patterns + + +class StringPattern(Pattern): + """ + Definition of one or many strings to search for. + """ + + def __init__(self, *patterns, **kwargs): + super(StringPattern, self).__init__(**kwargs) + self._patterns = patterns + self._kwargs = kwargs + self._match_kwargs = filter_match_kwargs(kwargs) + + @property + def patterns(self): + return self._patterns + + @property + def match_options(self): + return self._match_kwargs + + def _match(self, pattern, input_string, context=None): + for index in find_all(input_string, pattern, **self._kwargs): + match = Match(index, index + len(pattern), pattern=self, input_string=input_string, **self._match_kwargs) + if match: + yield match + + +class RePattern(Pattern): + """ + Definition of one or many regular expression pattern to search for. + """ + + def __init__(self, *patterns, **kwargs): + super(RePattern, self).__init__(**kwargs) + self.repeated_captures = REGEX_AVAILABLE + if 'repeated_captures' in kwargs: + self.repeated_captures = kwargs.get('repeated_captures') + if self.repeated_captures and not REGEX_AVAILABLE: # pragma: no cover + raise NotImplementedError("repeated_capture is available only with regex module.") + self.abbreviations = kwargs.get('abbreviations', []) + self._kwargs = kwargs + self._match_kwargs = filter_match_kwargs(kwargs) + self._children_match_kwargs = filter_match_kwargs(kwargs, children=True) + self._patterns = [] + for pattern in patterns: + if isinstance(pattern, six.string_types): + if self.abbreviations and pattern: + for key, replacement in self.abbreviations: + pattern = pattern.replace(key, replacement) + pattern = call(re.compile, pattern, **self._kwargs) + elif isinstance(pattern, dict): + if self.abbreviations and 'pattern' in pattern: + for key, replacement in self.abbreviations: + pattern['pattern'] = pattern['pattern'].replace(key, replacement) + pattern = re.compile(**pattern) + elif hasattr(pattern, '__iter__'): + pattern = re.compile(*pattern) + self._patterns.append(pattern) + + @property + def patterns(self): + return self._patterns + + @property + def __repr__patterns__(self): + return [pattern.pattern for pattern in self.patterns] + + @property + def match_options(self): + return self._match_kwargs + + def _match(self, pattern, input_string, context=None): + names = dict((v, k) for k, v in pattern.groupindex.items()) + for match_object in pattern.finditer(input_string): + start = match_object.start() + end = match_object.end() + main_match = Match(start, end, pattern=self, input_string=input_string, **self._match_kwargs) + + if pattern.groups: + for i in range(1, pattern.groups + 1): + name = names.get(i, main_match.name) + if self.repeated_captures: + for start, end in match_object.spans(i): + child_match = Match(start, end, name=name, parent=main_match, pattern=self, + input_string=input_string, **self._children_match_kwargs) + if child_match: + main_match.children.append(child_match) + else: + start, end = match_object.span(i) + if start > -1 and end > -1: + child_match = Match(start, end, name=name, parent=main_match, pattern=self, + input_string=input_string, **self._children_match_kwargs) + if child_match: + main_match.children.append(child_match) + + if main_match: + yield main_match + + +class FunctionalPattern(Pattern): + """ + Definition of one or many functional pattern to search for. + """ + + def __init__(self, *patterns, **kwargs): + super(FunctionalPattern, self).__init__(**kwargs) + self._patterns = patterns + self._kwargs = kwargs + self._match_kwargs = filter_match_kwargs(kwargs) + + @property + def patterns(self): + return self._patterns + + @property + def match_options(self): + return self._match_kwargs + + def _match(self, pattern, input_string, context=None): + ret = call(pattern, input_string, context, **self._kwargs) + if ret: + if not is_iterable(ret) or isinstance(ret, dict) \ + or (is_iterable(ret) and hasattr(ret, '__getitem__') and isinstance(ret[0], int)): + args_iterable = [ret] + else: + args_iterable = ret + for args in args_iterable: + if isinstance(args, dict): + options = args + options.pop('input_string', None) + options.pop('pattern', None) + if self._match_kwargs: + options = self._match_kwargs.copy() + options.update(args) + match = Match(pattern=self, input_string=input_string, **options) + if match: + yield match + else: + kwargs = self._match_kwargs + if isinstance(args[-1], dict): + kwargs = dict(kwargs) + kwargs.update(args[-1]) + args = args[:-1] + match = Match(*args, pattern=self, input_string=input_string, **kwargs) + if match: + yield match + + +def filter_match_kwargs(kwargs, children=False): + """ + Filters out kwargs for Match construction + + :param kwargs: + :type kwargs: dict + :param children: + :type children: Flag to filter children matches + :return: A filtered dict + :rtype: dict + """ + kwargs = kwargs.copy() + for key in ('pattern', 'start', 'end', 'parent', 'formatter', 'value'): + if key in kwargs: + del kwargs[key] + if children: + for key in ('name',): + if key in kwargs: + del kwargs[key] + return kwargs diff --git a/lib/rebulk/processors.py b/lib/rebulk/processors.py new file mode 100644 index 00000000..6a4f0bab --- /dev/null +++ b/lib/rebulk/processors.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Processor functions +""" +from logging import getLogger + +from .utils import IdentitySet + +from .rules import Rule, RemoveMatch + +log = getLogger(__name__).log + +DEFAULT = '__default__' + +POST_PROCESS = -2048 +PRE_PROCESS = 2048 + + +def _default_conflict_solver(match, conflicting_match): + """ + Default conflict solver for matches, shorter matches if they conflicts with longer ones + + :param conflicting_match: + :type conflicting_match: + :param match: + :type match: + :return: + :rtype: + """ + if len(conflicting_match.initiator) < len(match.initiator): + return conflicting_match + if len(match.initiator) < len(conflicting_match.initiator): + return match + return None + + +class ConflictSolver(Rule): + """ + Remove conflicting matches. + """ + priority = PRE_PROCESS + + consequence = RemoveMatch + + @property + def default_conflict_solver(self): # pylint:disable=no-self-use + """ + Default conflict solver to use. + """ + return _default_conflict_solver + + def when(self, matches, context): + # pylint:disable=too-many-nested-blocks + to_remove_matches = IdentitySet() + + public_matches = [match for match in matches if not match.private] + public_matches.sort(key=len) + + for match in public_matches: + conflicting_matches = matches.conflicting(match) + + if conflicting_matches: + # keep the match only if it's the longest + conflicting_matches = [conflicting_match for conflicting_match in conflicting_matches if + not conflicting_match.private] + conflicting_matches.sort(key=len) + + for conflicting_match in conflicting_matches: + conflict_solvers = [(self.default_conflict_solver, False)] + + if match.conflict_solver: + conflict_solvers.append((match.conflict_solver, False)) + if conflicting_match.conflict_solver: + conflict_solvers.append((conflicting_match.conflict_solver, True)) + + for conflict_solver, reverse in reversed(conflict_solvers): + if reverse: + to_remove = conflict_solver(conflicting_match, match) + else: + to_remove = conflict_solver(match, conflicting_match) + if to_remove == DEFAULT: + continue + if to_remove and to_remove not in to_remove_matches: + both_matches = [match, conflicting_match] + both_matches.remove(to_remove) + to_keep = both_matches[0] + + if to_keep not in to_remove_matches: + log(self.log_level, "Conflicting match %s will be removed in favor of match %s", + to_remove, to_keep) + + to_remove_matches.add(to_remove) + break + return to_remove_matches + + +class PrivateRemover(Rule): + """ + Removes private matches rule. + """ + priority = POST_PROCESS + + consequence = RemoveMatch + + def when(self, matches, context): + return [match for match in matches if match.private] diff --git a/lib/rebulk/rebulk.py b/lib/rebulk/rebulk.py new file mode 100644 index 00000000..a6a0fd2f --- /dev/null +++ b/lib/rebulk/rebulk.py @@ -0,0 +1,190 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Entry point functions and classes for Rebulk +""" +from logging import getLogger + +from .builder import Builder +from .match import Matches +from .processors import ConflictSolver, PrivateRemover +from .rules import Rules +from .utils import extend_safe + +log = getLogger(__name__).log + + +class Rebulk(Builder): + r""" + Regular expression, string and function based patterns are declared in a ``Rebulk`` object. It use a fluent API to + chain ``string``, ``regex``, and ``functional`` methods to define various patterns types. + + .. code-block:: python + + >>> from rebulk import Rebulk + >>> bulk = Rebulk().string('brown').regex(r'qu\w+').functional(lambda s: (20, 25)) + + When ``Rebulk`` object is fully configured, you can call ``matches`` method with an input string to retrieve all + ``Match`` objects found by registered pattern. + + .. code-block:: python + + >>> bulk.matches("The quick brown fox jumps over the lazy dog") + [<brown:(10, 15)>, <quick:(4, 9)>, <jumps:(20, 25)>] + + If multiple ``Match`` objects are found at the same position, only the longer one is kept. + + .. code-block:: python + + >>> bulk = Rebulk().string('lakers').string('la') + >>> bulk.matches("the lakers are from la") + [<lakers:(4, 10)>, <la:(20, 22)>] + """ + + # pylint:disable=protected-access + + def __init__(self, disabled=lambda context: False, default_rules=True): + """ + Creates a new Rebulk object. + :param disabled: if True, this pattern is disabled. Can also be a function(context). + :type disabled: bool|function + :param default_rules: use default rules + :type default_rules: + :return: + :rtype: + """ + super(Rebulk, self).__init__() + if not callable(disabled): + self.disabled = lambda context: disabled + else: + self.disabled = disabled + self._patterns = [] + self._rules = Rules() + if default_rules: + self.rules(ConflictSolver, PrivateRemover) + self._rebulks = [] + + def pattern(self, *pattern): + """ + Add patterns objects + + :param pattern: + :type pattern: rebulk.pattern.Pattern + :return: self + :rtype: Rebulk + """ + self._patterns.extend(pattern) + return self + + def rules(self, *rules): + """ + Add rules as a module, class or instance. + :param rules: + :type rules: list[Rule] + :return: + """ + self._rules.load(*rules) + return self + + def rebulk(self, *rebulks): + """ + Add a children rebulk object + :param rebulks: + :type rebulks: Rebulk + :return: + """ + self._rebulks.extend(rebulks) + return self + + def matches(self, string, context=None): + """ + Search for all matches with current configuration against input_string + :param string: string to search into + :type string: str + :param context: context to use + :type context: dict + :return: A custom list of matches + :rtype: Matches + """ + matches = Matches(input_string=string) + if context is None: + context = {} + + self._matches_patterns(matches, context) + + self._execute_rules(matches, context) + + return matches + + def effective_rules(self, context=None): + """ + Get effective rules for this rebulk object and its children. + :param context: + :type context: + :return: + :rtype: + """ + rules = Rules() + rules.extend(self._rules) + for rebulk in self._rebulks: + if not rebulk.disabled(context): + extend_safe(rules, rebulk._rules) + return rules + + def _execute_rules(self, matches, context): + """ + Execute rules for this rebulk and children. + :param matches: + :type matches: + :param context: + :type context: + :return: + :rtype: + """ + if not self.disabled(context): + rules = self.effective_rules(context) + rules.execute_all_rules(matches, context) + + def effective_patterns(self, context=None): + """ + Get effective patterns for this rebulk object and its children. + :param context: + :type context: + :return: + :rtype: + """ + patterns = list(self._patterns) + for rebulk in self._rebulks: + if not rebulk.disabled(context): + extend_safe(patterns, rebulk._patterns) + return patterns + + def _matches_patterns(self, matches, context): + """ + Search for all matches with current paterns agains input_string + :param matches: matches list + :type matches: Matches + :param context: context to use + :type context: dict + :return: + :rtype: + """ + if not self.disabled(context): + patterns = self.effective_patterns(context) + for pattern in patterns: + if not pattern.disabled(context): + pattern_matches = pattern.matches(matches.input_string, context) + if pattern_matches: + log(pattern.log_level, "Pattern has %s match(es). (%s)", len(pattern_matches), pattern) + else: + pass + # log(pattern.log_level, "Pattern doesn't match. (%s)" % (pattern,)) + for match in pattern_matches: + if match.marker: + log(pattern.log_level, "Marker found. (%s)", match) + matches.markers.append(match) + else: + log(pattern.log_level, "Match found. (%s)", match) + matches.append(match) + else: + log(pattern.log_level, "Pattern is disabled. (%s)", pattern) diff --git a/lib/rebulk/remodule.py b/lib/rebulk/remodule.py new file mode 100644 index 00000000..d1d68d19 --- /dev/null +++ b/lib/rebulk/remodule.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Uniform re module +""" +# pylint: disable-all +import os + +REGEX_AVAILABLE = False +if os.environ.get('REGEX_DISABLED') in ["1", "true", "True", "Y"]: + import re +else: + try: + import regex as re + REGEX_AVAILABLE = True + except ImportError: + import re diff --git a/lib/rebulk/rules.py b/lib/rebulk/rules.py new file mode 100644 index 00000000..2514904f --- /dev/null +++ b/lib/rebulk/rules.py @@ -0,0 +1,373 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Abstract rule class definition and rule engine implementation +""" +from abc import ABCMeta, abstractmethod +import inspect +from itertools import groupby +from logging import getLogger + +import six +from .utils import is_iterable + +from .toposort import toposort + +from . import debug + +log = getLogger(__name__).log + + +@six.add_metaclass(ABCMeta) +class Consequence(object): + """ + Definition of a consequence to apply. + """ + @abstractmethod + def then(self, matches, when_response, context): # pragma: no cover + """ + Action implementation. + + :param matches: + :type matches: rebulk.match.Matches + :param context: + :type context: + :param when_response: return object from when call. + :type when_response: object + :return: True if the action was runned, False if it wasn't. + :rtype: bool + """ + pass + + +@six.add_metaclass(ABCMeta) +class Condition(object): + """ + Definition of a condition to check. + """ + @abstractmethod + def when(self, matches, context): # pragma: no cover + """ + Condition implementation. + + :param matches: + :type matches: rebulk.match.Matches + :param context: + :type context: + :return: truthy if rule should be triggered and execute then action, falsy if it should not. + :rtype: object + """ + pass + + +@six.add_metaclass(ABCMeta) +class CustomRule(Condition, Consequence): + """ + Definition of a rule to apply + """ + # pylint: disable=no-self-use, unused-argument, abstract-method + priority = 0 + name = None + dependency = None + properties = {} + + def __init__(self, log_level=None): + self.defined_at = debug.defined_at() + if log_level is None and not hasattr(self, 'log_level'): + self.log_level = debug.LOG_LEVEL + + def enabled(self, context): + """ + Disable rule. + + :param context: + :type context: + :return: True if rule is enabled, False if disabled + :rtype: bool + """ + return True + + def __lt__(self, other): + return self.priority > other.priority + + def __repr__(self): + defined = "" + if self.defined_at: + defined = "@%s" % (self.defined_at,) + return "<%s%s>" % (self.name if self.name else self.__class__.__name__, defined) + + def __eq__(self, other): + return self.__class__ == other.__class__ + + def __hash__(self): + return hash(self.__class__) + + +class Rule(CustomRule): + """ + Definition of a rule to apply + """ + # pylint:disable=abstract-method + consequence = None + + def then(self, matches, when_response, context): + assert self.consequence + if is_iterable(self.consequence): + if not is_iterable(when_response): + when_response = [when_response] + iterator = iter(when_response) + for cons in self.consequence: #pylint: disable=not-an-iterable + if inspect.isclass(cons): + cons = cons() + cons.then(matches, next(iterator), context) + else: + cons = self.consequence + if inspect.isclass(cons): + cons = cons() # pylint:disable=not-callable + cons.then(matches, when_response, context) + + +class RemoveMatch(Consequence): # pylint: disable=abstract-method + """ + Remove matches returned by then + """ + def then(self, matches, when_response, context): + if is_iterable(when_response): + ret = [] + when_response = list(when_response) + for match in when_response: + if match in matches: + matches.remove(match) + ret.append(match) + return ret + if when_response in matches: + matches.remove(when_response) + return when_response + + +class AppendMatch(Consequence): # pylint: disable=abstract-method + """ + Append matches returned by then + """ + def __init__(self, match_name=None): + self.match_name = match_name + + def then(self, matches, when_response, context): + if is_iterable(when_response): + ret = [] + when_response = list(when_response) + for match in when_response: + if match not in matches: + if self.match_name: + match.name = self.match_name + matches.append(match) + ret.append(match) + return ret + if self.match_name: + when_response.name = self.match_name + if when_response not in matches: + matches.append(when_response) + return when_response + + +class RenameMatch(Consequence): # pylint: disable=abstract-method + """ + Rename matches returned by then + """ + def __init__(self, match_name): + self.match_name = match_name + self.remove = RemoveMatch() + self.append = AppendMatch() + + def then(self, matches, when_response, context): + removed = self.remove.then(matches, when_response, context) + if is_iterable(removed): + removed = list(removed) + for match in removed: + match.name = self.match_name + elif removed: + removed.name = self.match_name + if removed: + self.append.then(matches, removed, context) + + +class AppendTags(Consequence): # pylint: disable=abstract-method + """ + Add tags to returned matches + """ + def __init__(self, tags): + self.tags = tags + self.remove = RemoveMatch() + self.append = AppendMatch() + + def then(self, matches, when_response, context): + removed = self.remove.then(matches, when_response, context) + if is_iterable(removed): + removed = list(removed) + for match in removed: + match.tags.extend(self.tags) + elif removed: + removed.tags.extend(self.tags) # pylint: disable=no-member + if removed: + self.append.then(matches, removed, context) + + +class RemoveTags(Consequence): # pylint: disable=abstract-method + """ + Remove tags from returned matches + """ + def __init__(self, tags): + self.tags = tags + self.remove = RemoveMatch() + self.append = AppendMatch() + + def then(self, matches, when_response, context): + removed = self.remove.then(matches, when_response, context) + if is_iterable(removed): + removed = list(removed) + for match in removed: + for tag in self.tags: + if tag in match.tags: + match.tags.remove(tag) + elif removed: + for tag in self.tags: + if tag in removed.tags: # pylint: disable=no-member + removed.tags.remove(tag) # pylint: disable=no-member + if removed: + self.append.then(matches, removed, context) + + +class Rules(list): + """ + list of rules ready to execute. + """ + + def __init__(self, *rules): + super(Rules, self).__init__() + self.load(*rules) + + def load(self, *rules): + """ + Load rules from a Rule module, class or instance + + :param rules: + :type rules: + :return: + :rtype: + """ + for rule in rules: + if inspect.ismodule(rule): + self.load_module(rule) + elif inspect.isclass(rule): + self.load_class(rule) + else: + self.append(rule) + + def load_module(self, module): + """ + Load a rules module + + :param module: + :type module: + :return: + :rtype: + """ + # pylint: disable=unused-variable + for name, obj in inspect.getmembers(module, + lambda member: hasattr(member, '__module__') + and member.__module__ == module.__name__ + and inspect.isclass): + self.load_class(obj) + + def load_class(self, class_): + """ + Load a Rule class. + + :param class_: + :type class_: + :return: + :rtype: + """ + self.append(class_()) + + def execute_all_rules(self, matches, context): + """ + Execute all rules from this rules list. All when condition with same priority will be performed before + calling then actions. + + :param matches: + :type matches: + :param context: + :type context: + :return: + :rtype: + """ + ret = [] + for priority, priority_rules in groupby(sorted(self), lambda rule: rule.priority): + sorted_rules = toposort_rules(list(priority_rules)) # Group by dependency graph toposort + for rules_group in sorted_rules: + rules_group = list(sorted(rules_group, key=self.index)) # Sort rules group based on initial ordering. + group_log_level = None + for rule in rules_group: + if group_log_level is None or group_log_level < rule.log_level: + group_log_level = rule.log_level + log(group_log_level, "%s independent rule(s) at priority %s.", len(rules_group), priority) + for rule in rules_group: + when_response = execute_rule(rule, matches, context) + if when_response is not None: + ret.append((rule, when_response)) + + return ret + + +def execute_rule(rule, matches, context): + """ + Execute the given rule. + :param rule: + :type rule: + :param matches: + :type matches: + :param context: + :type context: + :return: + :rtype: + """ + if rule.enabled(context): + log(rule.log_level, "Checking rule condition: %s", rule) + when_response = rule.when(matches, context) + if when_response: + log(rule.log_level, "Rule was triggered: %s", when_response) + log(rule.log_level, "Running rule consequence: %s %s", rule, when_response) + rule.then(matches, when_response, context) + return when_response + else: + log(rule.log_level, "Rule is disabled: %s", rule) + +def toposort_rules(rules): + """ + Sort given rules using toposort with dependency parameter. + :param rules: + :type rules: + :return: + :rtype: + """ + graph = {} + class_dict = {} + for rule in rules: + if rule.__class__ in class_dict: + raise ValueError("Duplicate class rules are not allowed: %s" % rule.__class__) + class_dict[rule.__class__] = rule + for rule in rules: + if not is_iterable(rule.dependency) and rule.dependency: + rule_dependencies = [rule.dependency] + else: + rule_dependencies = rule.dependency + dependencies = set() + if rule_dependencies: + for dependency in rule_dependencies: + if inspect.isclass(dependency): + dependency = class_dict.get(dependency) + if dependency: + dependencies.add(dependency) + graph[rule] = dependencies + return toposort(graph) diff --git a/lib/rebulk/toposort.py b/lib/rebulk/toposort.py new file mode 100644 index 00000000..2bcba9ae --- /dev/null +++ b/lib/rebulk/toposort.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright 2014 True Blade Systems, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Original: +# - https://bitbucket.org/ericvsmith/toposort (1.4) +# Modifications: +# - merged Pull request #2 for CyclicDependency error +# - import reduce as original name +# - support python 2.6 dict comprehension + +# pylint: skip-file +from functools import reduce + + +class CyclicDependency(ValueError): + def __init__(self, cyclic): + s = 'Cyclic dependencies exist among these items: {0}'.format(', '.join(repr(x) for x in cyclic.items())) + super(CyclicDependency, self).__init__(s) + self.cyclic = cyclic + + +def toposort(data): + """ + Dependencies are expressed as a dictionary whose keys are items + and whose values are a set of dependent items. Output is a list of + sets in topological order. The first set consists of items with no + dependences, each subsequent set consists of items that depend upon + items in the preceeding sets. + :param data: + :type data: + :return: + :rtype: + """ + + # Special case empty input. + if len(data) == 0: + return + + # Copy the input so as to leave it unmodified. + data = data.copy() + + # Ignore self dependencies. + for k, v in data.items(): + v.discard(k) + # Find all items that don't depend on anything. + extra_items_in_deps = reduce(set.union, data.values()) - set(data.keys()) + # Add empty dependences where needed. + data.update(dict((item, set()) for item in extra_items_in_deps)) + while True: + ordered = set(item for item, dep in data.items() if len(dep) == 0) + if not ordered: + break + yield ordered + data = dict((item, (dep - ordered)) + for item, dep in data.items() + if item not in ordered) + if len(data) != 0: + raise CyclicDependency(data) + + +def toposort_flatten(data, sort=True): + """ + Returns a single list of dependencies. For any set returned by + toposort(), those items are sorted and appended to the result (just to + make the results deterministic). + :param data: + :type data: + :param sort: + :type sort: + :return: Single list of dependencies. + :rtype: list + """ + + result = [] + for d in toposort(data): + result.extend((sorted if sort else list)(d)) + return result diff --git a/lib/rebulk/utils.py b/lib/rebulk/utils.py new file mode 100644 index 00000000..85ddd41e --- /dev/null +++ b/lib/rebulk/utils.py @@ -0,0 +1,156 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Various utilities functions +""" +try: + from collections.abc import MutableSet +except ImportError: + from collections import MutableSet + +from types import GeneratorType + + +def find_all(string, sub, start=None, end=None, ignore_case=False, **kwargs): + """ + Return all indices in string s where substring sub is + found, such that sub is contained in the slice s[start:end]. + + >>> list(find_all('The quick brown fox jumps over the lazy dog', 'fox')) + [16] + + >>> list(find_all('The quick brown fox jumps over the lazy dog', 'mountain')) + [] + + >>> list(find_all('The quick brown fox jumps over the lazy dog', 'The')) + [0] + + >>> list(find_all( + ... 'Carved symbols in a mountain hollow on the bank of an inlet irritated an eccentric person', + ... 'an')) + [44, 51, 70] + + >>> list(find_all( + ... 'Carved symbols in a mountain hollow on the bank of an inlet irritated an eccentric person', + ... 'an', + ... 50, + ... 60)) + [51] + + :param string: the input string + :type string: str + :param sub: the substring + :type sub: str + :return: all indices in the input string + :rtype: __generator[str] + """ + #pylint: disable=unused-argument + if ignore_case: + sub = sub.lower() + string = string.lower() + while True: + start = string.find(sub, start, end) + if start == -1: + return + yield start + start += len(sub) + + +def get_first_defined(data, keys, default_value=None): + """ + Get the first defined key in data. + :param data: + :type data: + :param keys: + :type keys: + :param default_value: + :type default_value: + :return: + :rtype: + """ + for key in keys: + if key in data: + return data[key] + return default_value + + +def is_iterable(obj): + """ + Are we being asked to look up a list of things, instead of a single thing? + We check for the `__iter__` attribute so that this can cover types that + don't have to be known by this module, such as NumPy arrays. + + Strings, however, should be considered as atomic values to look up, not + iterables. + + We don't need to check for the Python 2 `unicode` type, because it doesn't + have an `__iter__` attribute anyway. + """ + # pylint: disable=consider-using-ternary + return hasattr(obj, '__iter__') and not isinstance(obj, str) or isinstance(obj, GeneratorType) + + +def extend_safe(target, source): + """ + Extends source list to target list only if elements doesn't exists in target list. + :param target: + :type target: list + :param source: + :type source: list + """ + for elt in source: + if elt not in target: + target.append(elt) + + +class _Ref(object): + """ + Reference for IdentitySet + """ + def __init__(self, value): + self.value = value + + def __eq__(self, other): + return self.value is other.value + + def __hash__(self): + return id(self.value) + + +class IdentitySet(MutableSet): # pragma: no cover + """ + Set based on identity + """ + def __init__(self, items=None): # pylint: disable=super-init-not-called + if items is None: + items = [] + self.refs = set(map(_Ref, items)) + + def __contains__(self, elem): + return _Ref(elem) in self.refs + + def __iter__(self): + return (ref.value for ref in self.refs) + + def __len__(self): + return len(self.refs) + + def add(self, value): + self.refs.add(_Ref(value)) + + def discard(self, value): + self.refs.discard(_Ref(value)) + + def update(self, iterable): + """ + Update set with iterable + :param iterable: + :type iterable: + :return: + :rtype: + """ + for elem in iterable: + self.add(elem) + + def __repr__(self): # pragma: no cover + return "%s(%s)" % (type(self).__name__, list(self)) diff --git a/lib/rebulk/validators.py b/lib/rebulk/validators.py new file mode 100644 index 00000000..b8959c54 --- /dev/null +++ b/lib/rebulk/validators.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Validator functions to use in patterns. + +All those function have last argument as match, so it's possible to use functools.partial to bind previous arguments. +""" + + +def chars_before(chars, match): + """ + Validate the match if left character is in a given sequence. + + :param chars: + :type chars: + :param match: + :type match: + :return: + :rtype: + """ + if match.start <= 0: + return True + return match.input_string[match.start - 1] in chars + + +def chars_after(chars, match): + """ + Validate the match if right character is in a given sequence. + + :param chars: + :type chars: + :param match: + :type match: + :return: + :rtype: + """ + if match.end >= len(match.input_string): + return True + return match.input_string[match.end] in chars + + +def chars_surround(chars, match): + """ + Validate the match if surrounding characters are in a given sequence. + + :param chars: + :type chars: + :param match: + :type match: + :return: + :rtype: + """ + return chars_before(chars, match) and chars_after(chars, match) + + +def validators(*chained_validators): + """ + Creates a validator chain from several validator functions. + + :param chained_validators: + :type chained_validators: + :return: + :rtype: + """ + + def validator_chain(match): # pylint:disable=missing-docstring + for chained_validator in chained_validators: + if not chained_validator(match): + return False + return True + + return validator_chain + + +def allways_true(match): # pylint:disable=unused-argument + """ + A validator which is allways true + :param match: + :return: + """ + return True