From c8df97f623c458bcc9860abc940d4f3ba045511b Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sun, 11 Oct 2015 08:49:11 +0300
Subject: [PATCH] Try to import vlc module and use if successfuly imported.

---
 dcp.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dcp.py b/dcp.py
index 516c524..d6b213b 100755
--- a/dcp.py
+++ b/dcp.py
@@ -6,7 +6,10 @@ from os.path import isdir, basename, exists
 from shutil import copyfile
 from xml.dom.minidom import parse
 import sys
-import vlc
+try:
+    import vlc
+except ImportError:
+    pass
 
 
 class Asset(object):
@@ -63,7 +66,7 @@ class Asset(object):
         return(self.hash == b64encode(hash.digest()).decode())
 
     def add_duration(self):
-        if hasattr(self, 'type') and self.type.find('mxf') > -1:
+        if 'vlc' in dir() and hasattr(self, 'type') and self.type.find('mxf') > -1:
             instance = vlc.Instance()
             media = instance.media_new('file://' + self.fullpath)
             media.parse()
-- 
GitLab