From 8d83ec760d47c54dc0a427e545bf52557a1c3258 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 24 Sep 2015 19:11:56 +0100 Subject: [PATCH] title parsing for documents --- pandora_client/__init__.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index 3168187..a11351c 100755 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -92,13 +92,17 @@ def parse_path(client, path): return: return None if file will not be used, dict with parsed item information otherwise ''' - parts = path.split('/') - if len(parts) != client.folderdepth and (len(parts) < client.folderdepth or \ - parts[client.folderdepth-1] != 'Documents'): - return None if not isinstance(path, unicode): path = path.decode('utf-8') - info = ox.movie.parse_path(path) + parts = path.split('/') + if len(parts) >= client.folderdepth and parts[client.folderdepth-1] == 'Documents': + info = ox.movie.parse_path(u''.join( + parts[:client.folderdepth-1] + [parts[client.folderdepth-2]] + )) + else: + if len(parts) != client.folderdepth: + return None + info = ox.movie.parse_path(path) if client.folderdepth == 3: info['director'] = [] info['directorSort'] = []