From c0c8edc04bcd20ebbc71cf8050eee90bb4249457 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Fri, 22 May 2015 17:36:48 +0200 Subject: [PATCH] add collection related media --- .../management/commands/telemeta-import-corpus-from-dir.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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: -- 2.39.5