From 654bd0da0e27f9e834f24cbdffafc4e5148d12e8 Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 11 Sep 2012 19:58:30 +0200 Subject: [PATCH] movie.py: update format_underscores --- ox/movie.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ox/movie.py b/ox/movie.py index 1b0b9d7..5e564a2 100644 --- a/ox/movie.py +++ b/ox/movie.py @@ -201,11 +201,17 @@ def parse_path(path, directory_key='director'): return type return None def parse_underscores(string): + # '^_' or '_$' is '.' string = re.sub('^_', '.', string) string = re.sub('_$', '.', string) + # '_.foo$' or '_ (' is '?' + string = re.sub('_(?=(\.\w+$| \())', '?', string) + # ' _..._ ' is '<...>' string = re.sub('(?<= )_(.+)_(?= )', '<\g<1>>', string) + # 'foo_bar' or 'foo _ bar' is '/' string = re.sub('(?<=\w)_(?=\w)', '/', string) string = re.sub(' _ ', ' / ', string) + # 'foo_ ' is ':' string = re.sub('(?<=\w)_ ', ': ', string) return string data = {}