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['title'] = title[:-len(match.group(0))] if match else title
|
||||||
data['year'] = match.group(0)[2:-1] if match else None
|
data['year'] = match.group(0)[2:-1] if match else None
|
||||||
file_title = re.sub('[/:]', '_', data['title'])
|
file_title = re.sub('[/:]', '_', data['title'])
|
||||||
file = re.sub('^' + re.escape(file_title) + '(?=.*\.)', '', file).strip()
|
# (remove title from beginning of filename if the rest contains a dot)
|
||||||
parts = re.split('(?<!\s)\.(?=\w)', file)
|
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 = [
|
title, parts, extension = [
|
||||||
parts[0],
|
parts[0],
|
||||||
parts[1:-1],
|
parts[1:-1],
|
||||||
|
|
Loading…
Reference in a new issue