Skip to content

Commit

Permalink
fix: update french language. tweak test
Browse files Browse the repository at this point in the history
  • Loading branch information
Spoked authored and Spoked committed Jul 2, 2024
1 parent 27f6b1b commit fa4c2fa
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 123 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ lint:
@poetry run isort --check-only $(SRC_DIR)

# Format code
format:
sort:
@poetry run isort $(SRC_DIR)

# Type checking
Expand Down
2 changes: 1 addition & 1 deletion PTT/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .parse import Parser
from .handlers import add_defaults
from .parse import Parser

__all__ = [
"Parser",
Expand Down
15 changes: 13 additions & 2 deletions PTT/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

from PTT.parse import Parser
from PTT.transformers import (
none, value, integer, boolean, lowercase, uppercase, date,
range_func, year_range, array, uniq_concat
array,
boolean,
date,
integer,
lowercase,
none,
range_func,
uniq_concat,
uppercase,
value,
year_range,
)


Expand Down Expand Up @@ -284,6 +293,8 @@ def handle_episodes(context):
parser.add_handler("languages", regex.compile(r"\bCH[IT]\b", regex.IGNORECASE), uniq_concat(value("chinese")), {"skipFromTitle": True, "skipIfAlreadyFound": False})
parser.add_handler("languages", regex.compile(r"\b(chinese|chin[eê]s|chi)\b", regex.IGNORECASE), uniq_concat(value("chinese")), {"skipIfFirst": True, "skipIfAlreadyFound": False})
parser.add_handler("languages", regex.compile(r"\bzh-hans\b", regex.IGNORECASE), uniq_concat(value("chinese")), {"skipIfAlreadyFound": False})
parser.add_handler("languages", regex.compile(r"\bFR(?:ench|a|e|anc[eê]s)?\b", regex.IGNORECASE), uniq_concat(value("french")), {"skipIfAlreadyFound": False})
parser.add_handler("languages", regex.compile(r"\b(VOST(?:FR?|A)?)\b", regex.IGNORECASE), uniq_concat(value("french")), {"skipIfAlreadyFound": False})
parser.add_handler("languages", regex.compile(r"\b(VF[FQIB2]?|(TRUE|SUB)?.?FRENCH|(VOST)?FR2?)\b", regex.IGNORECASE), uniq_concat(value("french")), {"skipIfAlreadyFound": False})
parser.add_handler("languages", regex.compile(r"\bspanish\W?latin|american\W*(?:spa|esp?)", regex.IGNORECASE), uniq_concat(value("latino")), { "skipFromTitle": True, "skipIfAlreadyFound": False, "remove": True })
parser.add_handler("languages", regex.compile(r"\b(?:audio.)?lat(?:i|ino)?\b", regex.IGNORECASE), uniq_concat(value("latino")), { "skipIfAlreadyFound": False })
Expand Down
1 change: 1 addition & 0 deletions PTT/parse.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import inspect
from typing import Any

import regex

from .transformers import none
Expand Down
216 changes: 99 additions & 117 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "parsett"
version = "0.2.3"
version = "0.2.4"
description = "PTT"
authors = ["Dreu LaVelle <[email protected]>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_language.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def parser():
("After Earth 2013 VFF BDrip x264 YJ", ["french"]),
("127.Heures.FRENCH.DVDRip.AC3.XViD-DVDFR", ["french"]),
("Color.Of.Night.Unrated.DC.VostFR.BRrip.x264", ["french"]),
("Le Labyrinthe 2014 Multi-VF2 1080p BluRay x264-PopHD", ["multi audio"]),
("Le Labyrinthe 2014 Multi-VF2 1080p BluRay x264-PopHD", ["multi audio", "french"]),
("Maman, j'ai raté l'avion 1990 VFI 1080p BluRay DTS x265-HTG", ["french"]),
("South.Park.S21E10.iTALiAN.FiNAL.AHDTV.x264-NTROPiC", ["italian"]),
("2- English- {SDH}.srt", ["english"]),
Expand Down

0 comments on commit fa4c2fa

Please sign in to comment.