movie.py: remove spaces preceding extension
This commit is contained in:
parent
87032a2a5e
commit
332e6051c4
1 changed files with 4 additions and 2 deletions
|
@ -123,8 +123,10 @@ def parse_path(path):
|
|||
data['title'] = title[:-len(match.group(0))] if match else title
|
||||
data['year'] = match.group(0)[2:-1] if match else None
|
||||
file_title = re.sub('[/:]', '_', data['title'])
|
||||
file = re.sub('^' + re.escape(file_title) + '(?=.*\.)', '', file).strip()
|
||||
parts = re.split('(?<!\s)\.(?=\w)', file)
|
||||
# (remove title from beginning of filename if the rest contains a dot)
|
||||
file = re.sub('^' + re.escape(file_title) + '(?=.*\.)', '', file)
|
||||
# (split by nospace+dot+word, but remove spaces before extension)
|
||||
parts = re.split('(?<!\s)\.(?=\w)', re.sub('\s+(?=.\w+$)', '', file))
|
||||
title, parts, extension = [
|
||||
parts[0],
|
||||
parts[1:-1],
|
||||
|
|
Loading…
Reference in a new issue