mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-30 19:40:03 -07:00
updated libs to fix guessit and subliminal. Fixes #1080
This commit is contained in:
parent
319d418af8
commit
0625f7f3c0
263 changed files with 28711 additions and 12615 deletions
43
libs/guessit/rules/markers/path.py
Normal file
43
libs/guessit/rules/markers/path.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Path markers
|
||||
"""
|
||||
from rebulk import Rebulk
|
||||
|
||||
from rebulk.utils import find_all
|
||||
|
||||
|
||||
def path():
|
||||
"""
|
||||
Builder for rebulk object.
|
||||
: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:
|
||||
: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
|
Loading…
Add table
Add a link
Reference in a new issue