From: Guillaume Pellerin Date: Fri, 22 May 2015 15:36:48 +0000 (+0200) Subject: add collection related media X-Git-Tag: 1.6a~4^2~58 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=c0c8edc04bcd20ebbc71cf8050eee90bb4249457;p=telemeta.git add collection related media --- diff --git a/telemeta/management/commands/telemeta-import-corpus-from-dir.py b/telemeta/management/commands/telemeta-import-corpus-from-dir.py index c6322eb5..9625fa8f 100644 --- a/telemeta/management/commands/telemeta-import-corpus-from-dir.py +++ b/telemeta/management/commands/telemeta-import-corpus-from-dir.py @@ -114,7 +114,11 @@ class Command(BaseCommand): metadata[data[0]] = data[1:] i += 1 print metadata - break + + if os.path.isfile(path) and '.jpg' == os.path.splitext(filename)[1]: + related_path = path.replace(self.media_root, '') + related, c = MediaCollectionRelated.objects.get_or_create(collection=collection, + file=related_path) for root, dirs, files in os.walk(chapter_dir): for media_file in files: