Skip to content

Commit

Permalink
Support titles with year in name
Browse files Browse the repository at this point in the history
  • Loading branch information
dchevell committed May 17, 2020
1 parent bf96472 commit 3de5edf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions PTN/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def parse(self, name):
if key not in ('season', 'episode', 'website', 'year'):
pattern = r'\b%s\b' % pattern

if key == 'year':
pattern = r'.%s' % pattern

clean_name = re.sub('_', ' ', self.torrent['name'])
match = re.findall(pattern, clean_name, re.I)
if len(match) == 0:
Expand Down
4 changes: 3 additions & 1 deletion tests/files/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,7 @@
"Ben Hur 2016 TELESYNC x264 AC3 MAXPRO",
"The.Secret.Life.of.Pets.2016.HDRiP.AAC-LC.x264-LEGi0N",
"Onward (2020) [1080p] [WEBRip] [5.1] [YTS.MX]",
"2001: A Space Odyssey (1968) [BluRay] [1080p] [YTS.AM]"
"2001: A Space Odyssey (1968) [BluRay] [1080p] [YTS.AM]",
"2012.2009.BluRay.1080p.x264.YIFY.mp4",
"Death Race 2000 (1975) [1080p] [BluRay] [YTS.MX]"
]
8 changes: 8 additions & 0 deletions tests/files/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -519,5 +519,13 @@
{
"year": 1968,
"title": "2001: A Space Odyssey"
},
{
"year": 2009,
"title": "2012"
},
{
"year": 1975,
"title": "Death Race 2000"
}
]

0 comments on commit 3de5edf

Please sign in to comment.