movie.py: when replacing title in file name, strip leading whitespace

This commit is contained in:
rolux 2012-08-18 22:11:19 +02:00
parent 1040878a0f
commit 87032a2a5e

View file

@ -123,7 +123,7 @@ 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) file = re.sub('^' + re.escape(file_title) + '(?=.*\.)', '', file).strip()
parts = re.split('(?<!\s)\.(?=\w)', file) parts = re.split('(?<!\s)\.(?=\w)', file)
title, parts, extension = [ title, parts, extension = [
parts[0], parts[0],