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

Changed folder structure.

Automated build, publish and clean using Fabric.
Added dependency python3-vlc, another packages I publish from VLC source (python3 binding to libvlc).
parent 9cd26106
No related branches found
No related tags found
No related merge requests found
...@@ -5,5 +5,5 @@ debian/dcpman.links ...@@ -5,5 +5,5 @@ debian/dcpman.links
debian/dcpman.postinst.debhelper debian/dcpman.postinst.debhelper
debian/dcpman.prerm.debhelper debian/dcpman.prerm.debhelper
debian/dcpman.substvars debian/dcpman.substvars
dcpman/__pycache__ source/__pycache__
dcpman/ui.py source/ui.py
dcpman (0.1.1) UNRELEASED; urgency=medium
* Adding better detection of encrypted DCPs by using avprobe to try and read the mxf files (still not 100% correct).
-- Nimrod Adar <nimrod@nimrod.private> Mon, 14 Jul 2014 13:11:42 +0300
dcpman (0.1) UNRELEASED; urgency=medium dcpman (0.1) UNRELEASED; urgency=medium
* Initial release. * Initial release.
-- Nimrod Adar <nimrod@shore.co.il> Sun, 29 Jun 2014 16:19:53 +0300 -- Nimrod Adar <nimrod@shore.co.il> Sun, 29 Jun 2014 16:19:53 +0300
...@@ -7,7 +7,7 @@ X-Python3-Version: >= 3.2 ...@@ -7,7 +7,7 @@ X-Python3-Version: >= 3.2
Standards-Version: 3.9.5.0 Standards-Version: 3.9.5.0
Package: dcpman Package: dcpman
Depends: python3 (>= 3.2), python3-pyqt4 | python3-pyqt5, oxygen-icon-theme Depends: python3 (>= 3.2), python3-pyqt4 | python3-pyqt5, oxygen-icon-theme, python3-vlc
Architecture: all Architecture: all
Description: Management tool for Digital Cinema Packages. Description: Management tool for Digital Cinema Packages.
A tool to manage DCPs (Digital Cinema Packages), although currently it only A tool to manage DCPs (Digital Cinema Packages), although currently it only
......
dcpman_0.1_all.deb video optional dcpman_0.1.1_all.deb video optional
dcpman/* usr/lib/python3/dist-packages/dcpman source/*.py usr/lib/python3/dist-packages/dcpman
dcpman.desktop usr/share/applications source/dcpman.desktop usr/share/applications
#!/usr/bin/make -f #!/usr/bin/make -f
%: %:
pyuic4 dcpman.ui > dcpman/ui.py pyuic4 source/dcpman.ui > source/ui.py
dh $@ --with python3 dh $@ --with python3
#!/usr/bin/env python
from fabric.api import task, local
@task
def publish ():
build ()
for dist in ['wheezy', 'jessie', 'sid']:
local ('''reprepro includedeb ''' + dist + ''' ../dcpman_*.deb''')
@task
def build ():
local ('''dpkg-buildpackage''')
@task
def clean ()
local ('''rm ../dcpman_*''')
File moved
...@@ -4,6 +4,7 @@ from base64 import b64encode ...@@ -4,6 +4,7 @@ from base64 import b64encode
from os import stat, listdir from os import stat, listdir
from xml.dom.minidom import parse from xml.dom.minidom import parse
import sys import sys
import vlc
class Asset(object): class Asset(object):
'''A simple asset that's part of whole DCP package.''' '''A simple asset that's part of whole DCP package.'''
...@@ -32,7 +33,14 @@ class Asset(object): ...@@ -32,7 +33,14 @@ class Asset(object):
buffer = fh.read(buffersize) buffer = fh.read(buffersize)
return(self.hash == b64encode (hash.digest()).decode()) return(self.hash == b64encode (hash.digest()).decode())
def __init__(self, rootpath, filename, id=None, hash=None, size=None, packinglist=False): def add_duration (self):
if hasattr (self, 'type') and self.type.find ('mxf') > -1:
instance = vlc.Instance ()
media = instance.media_new ('file://' + self.fullpath)
media.parse ()
self.duration = media.get_duration ()
def __init__(self, rootpath, filename, id=None, hash=None, size=None, packinglist=False, type=None):
'''Initialize an asset, has to have a filename and path.''' '''Initialize an asset, has to have a filename and path.'''
self.rootpath = rootpath self.rootpath = rootpath
if filename[0:8] == 'file:///': if filename[0:8] == 'file:///':
...@@ -45,6 +53,8 @@ class Asset(object): ...@@ -45,6 +53,8 @@ class Asset(object):
self.hash = hash self.hash = hash
if size != None: if size != None:
self.size = size self.size = size
if type != None:
self.type = type
self.packinglist = packinglist self.packinglist = packinglist
...@@ -76,35 +86,44 @@ class DCP: ...@@ -76,35 +86,44 @@ class DCP:
asset.filename) from e asset.filename) from e
return True return True
def __init__(self, directory): def _parse_assetmap (self):
'''Parses the DCP in the directory specified.''' '''Adds the asset map file to the list of assets and parses it.'''
self.root = directory if 'ASSETMAP.xml' in listdir(self.directory):
if 'ASSETMAP.xml' in listdir(directory):
filename = 'ASSETMAP.xml' filename = 'ASSETMAP.xml'
elif 'ASSETMAP' in listdir(directory): elif 'ASSETMAP' in listdir(self.directory):
filename = 'ASSETMAP' filename = 'ASSETMAP'
else: else:
raise RuntimeError ('Couldn\'t find assetmap file') raise RuntimeError ('Couldn\'t find assetmap file')
self.assets = [Asset(directory, filename)] self.assets = [Asset(self.directory, filename, type='text/xml')]
assetmap = self.assets[0].fullpath assetmap = self.assets[0].fullpath
if 'VOLINDEX.xml' in listdir(directory):
filename = 'VOLINDEX.xml'
elif 'VOLINDEX' in listdir(directory):
filename = 'VOLINDEX'
#else:
#raise RuntimeError ('Couldn\'t find volindex file')
self.assets.append(Asset(directory, filename))
try: try:
assetmap = parse(assetmap).getElementsByTagName('Asset') assetmap = parse(assetmap).getElementsByTagName('Asset')
self.assets.append(Asset(directory, filename)) self.assets.append(Asset(self.directory, filename))
for element in assetmap: for element in assetmap:
id = element.getElementsByTagName('Id')[0].firstChild.data id = element.getElementsByTagName('Id')[0].firstChild.data
id = id.split(':')[-1] id = id.split(':')[-1]
filename = element.getElementsByTagName('Path')[0].firstChild.data filename = element.getElementsByTagName('Path')[0].firstChild.data
packinglist = len(element.getElementsByTagName('PackingList')) > 0 packinglist = len(element.getElementsByTagName('PackingList')) > 0
self.assets.append(Asset(directory, filename, id=id, packinglist=packinglist)) if packinglist:
self.assets.append(Asset(self.directory, filename, id=id, packinglist=packinglist, type='text/xml'))
else:
self.assets.append(Asset(self.directory, filename, id=id, packinglist=packinglist))
except BaseException as e: except BaseException as e:
raise RuntimeError ('Failed to parse assetmap file') from e raise RuntimeError ('Failed to parse assetmap file') from e
def _add_volindex (self):
'''Adds the volume index file to the list of assets.'''
if 'VOLINDEX.xml' in listdir(self.directory):
filename = 'VOLINDEX.xml'
elif 'VOLINDEX' in listdir(self.directory):
filename = 'VOLINDEX'
else:
#raise RuntimeError ('Couldn\'t find volindex file')
return
self.assets.append(Asset(self.directory, filename, type='text/xml'))
def _parse_packinglist (self):
'''Parses the packing list.'''
try: try:
pkls = (parse(x.fullpath) for x in self.assets if x.packinglist) pkls = (parse(x.fullpath) for x in self.assets if x.packinglist)
for pkl in pkls: for pkl in pkls:
...@@ -119,13 +138,27 @@ class DCP: ...@@ -119,13 +138,27 @@ class DCP:
id = element.getElementsByTagName('Id')[0].firstChild.data id = element.getElementsByTagName('Id')[0].firstChild.data
id = id.split(':')[-1] id = id.split(':')[-1]
hash = element.getElementsByTagName('Hash')[0].firstChild.data hash = element.getElementsByTagName('Hash')[0].firstChild.data
type = element.getElementsByTagName('Type')[0].firstChild.data
size = int(element.getElementsByTagName('Size')[0].firstChild.data) size = int(element.getElementsByTagName('Size')[0].firstChild.data)
asset = [x for x in self.assets if hasattr(x, 'id') and x.id == id][0] asset = [x for x in self.assets if hasattr(x, 'id') and x.id == id][0]
asset.hash = hash asset.hash = hash
asset.size = size asset.size = size
asset.type = type
asset.add_duration ()
except BaseException as e: except BaseException as e:
raise RuntimeError ('Failed to parse packinglist file') from e raise RuntimeError ('Failed to parse packinglist file') from e
def __init__(self, directory):
'''Parses the DCP in the directory specified.'''
self.directory = directory
self._parse_assetmap ()
self._add_volindex ()
self._parse_packinglist ()
try:
self.duration = max ([x.duration for x in self.assets if hasattr (x, 'duration')])
except:
pass
if __name__ == '__main__': if __name__ == '__main__':
if (len(sys.argv) == 2): if (len(sys.argv) == 2):
...@@ -140,6 +173,7 @@ if __name__ == '__main__': ...@@ -140,6 +173,7 @@ if __name__ == '__main__':
print ('DCP is signed') print ('DCP is signed')
else: else:
print ('DCP is unsigned') print ('DCP is unsigned')
print ('Duration:', dcp.duration)
if (dcp.verify()): if (dcp.verify()):
print ('Verification succeeded.') print ('Verification succeeded.')
else: else:
......
File moved
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<rect> <rect>
<x>11</x> <x>11</x>
<y>11</y> <y>11</y>
<width>491</width> <width>501</width>
<height>131</height> <height>131</height>
</rect> </rect>
</property> </property>
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<widget class="QLabel" name="nameLabel"> <widget class="QLabel" name="nameLabel">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>45</width> <width>65</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
...@@ -54,20 +54,20 @@ ...@@ -54,20 +54,20 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QLabel" name="signedLabel"> <widget class="QLabel" name="encryptedLabel">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>45</width> <width>65</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>Signed</string> <string>Encrypted</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="signedLine"> <widget class="QLineEdit" name="encryptedLine">
<property name="frame"> <property name="frame">
<bool>true</bool> <bool>true</bool>
</property> </property>
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
<widget class="QLabel" name="verifyLabel"> <widget class="QLabel" name="verifyLabel">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>45</width> <width>65</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
......
#!/usr/bin/env python3 #!/usr/bin/env python3
from PyQt4 import QtGui from PyQt4 import QtGui
from PyQt4 import QtCore from PyQt4 import QtCore
from dcpman.dcp import DCP #from dcpman.dcp import DCP
from dcpman import ui #autogenerated file from Qt Designer to setup the window #from dcpman import ui #autogenerated file from Qt Designer to setup the window
from dcp import DCP
import ui
import sys import sys
class verifyThread(QtCore.QThread): class verifyThread(QtCore.QThread):
...@@ -51,10 +53,12 @@ if __name__ == '__main__': ...@@ -51,10 +53,12 @@ if __name__ == '__main__':
window.nameLine.setText(dcp.name) window.nameLine.setText(dcp.name)
except AttributeError: except AttributeError:
window.nameLine.setText(directory.split('/')[-1]) window.nameLine.setText(directory.split('/')[-1])
if dcp.signed: if dcp.signed and dcp.duration == 0:
window.signedLine.setText('Signed') window.encryptedLine.setText('Most likely')
elif dcp.signed or dcp.duration == 0:
window.encryptedLine.setText ('Probably')
else: else:
window.signedLine.setText('Not signed') window.encryptedLine.setText('Probably not')
window.verifyLine.setText('Click button to start verification') window.verifyLine.setText('Click button to start verification')
window.verifyButton.clicked.connect(verify_in_thread) window.verifyButton.clicked.connect(verify_in_thread)
except BaseException as exception: except BaseException as exception:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment