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

Added output to log file on every verification.

parent f5a02552
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ from PyQt4 import QtCore
from dcp import DCP
import ui
import sys
import os
class verifyThread(QtCore.QThread):
'''A seperate thread to verify the DCP (IO intensive).
......@@ -18,10 +19,14 @@ class verifyThread(QtCore.QThread):
result = dcp.verify()
try:
result = dcp.verify()
logfile = open (os.path.expanduser ('~') + '/dcpman.log', 'a')
if result:
window.verifyLine.setText('OK')
print ('DCP verification succeeded for ' + dcp.name, file = logfile)
else:
window.verifyLine.setText('Corrupted!')
print ('DCP verification failed for ' + dcp.name, file = logfile)
logfile.f ()
except BaseException as exception:
window.verifyLine.setText(str(exception))
......@@ -38,6 +43,7 @@ def verify_in_thread():
if __name__ == '__main__':
logfile = open (os.path.expanduser ('~') + '/dcpman.log', 'a')
app = QtGui.QApplication(sys.argv)
icon = QtGui.QIcon('/usr/share/icons/oxygen/16x16/apps/kmplayer.png')
app.setWindowIcon(icon)
......@@ -49,10 +55,17 @@ if __name__ == '__main__':
thread = verifyThread()
try:
dcp = DCP(directory)
print ('Opened DCP in directory ' + directory, file = logfile)
try:
window.nameLine.setText(dcp.name)
print ('DCP name is ' + dcp.name, file = logfile)
except AttributeError:
window.nameLine.setText(directory.split('/')[-1])
if dcp.signed:
print ('DCP is signed', file = logfile)
else:
print ('DCP is not signed', file = logfile)
print ('DCP duration is ' + dcp.duration, file = logfile)
if dcp.signed and dcp.duration == 0:
window.encryptedLine.setText('Most likely')
elif dcp.signed or dcp.duration == 0:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment