Skip to content
Snippets Groups Projects
Commit c8df97f6 authored by nimrod's avatar nimrod
Browse files

Try to import vlc module and use if successfuly imported.

parent 7916d4bb
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,10 @@ from os.path import isdir, basename, exists ...@@ -6,7 +6,10 @@ from os.path import isdir, basename, exists
from shutil import copyfile from shutil import copyfile
from xml.dom.minidom import parse from xml.dom.minidom import parse
import sys import sys
try:
import vlc import vlc
except ImportError:
pass
class Asset(object): class Asset(object):
...@@ -63,7 +66,7 @@ class Asset(object): ...@@ -63,7 +66,7 @@ class Asset(object):
return(self.hash == b64encode(hash.digest()).decode()) return(self.hash == b64encode(hash.digest()).decode())
def add_duration(self): 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() instance = vlc.Instance()
media = instance.media_new('file://' + self.fullpath) media = instance.media_new('file://' + self.fullpath)
media.parse() media.parse()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment