forked from openlp/openlp
Now we do not read several GB video files entirely into memory when opening service, this also fixes #257 in tracker.
This commit is contained in:
parent
bdde2a4fb4
commit
a3ddb50479
@ -584,8 +584,8 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
fileTo = None
|
fileTo = None
|
||||||
try:
|
try:
|
||||||
zip = zipfile.ZipFile(fileName)
|
zip = zipfile.ZipFile(fileName)
|
||||||
for file in zip.namelist():
|
for zipinfo in zip.infolist():
|
||||||
ucsfile = file_is_unicode(file)
|
ucsfile = file_is_unicode(zipinfo.filename)
|
||||||
if not ucsfile:
|
if not ucsfile:
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
message=translate('OpenLP.ServiceManager',
|
message=translate('OpenLP.ServiceManager',
|
||||||
@ -593,14 +593,11 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
'The content encoding is not UTF-8.'))
|
'The content encoding is not UTF-8.'))
|
||||||
continue
|
continue
|
||||||
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
|
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
|
||||||
filePath = os.path.join(self.servicePath,
|
filename_only = os.path.split(osfile)[1]
|
||||||
os.path.split(osfile)[1])
|
zipinfo.filename = filename_only
|
||||||
fileTo = open(filePath, u'wb')
|
zip.extract(zipinfo, self.servicePath)
|
||||||
fileTo.write(zip.read(file))
|
if filename_only.endswith(u'osd'):
|
||||||
fileTo.flush()
|
p_file = os.path.join(self.servicePath, filename_only)
|
||||||
fileTo.close()
|
|
||||||
if filePath.endswith(u'osd'):
|
|
||||||
p_file = filePath
|
|
||||||
if 'p_file' in locals():
|
if 'p_file' in locals():
|
||||||
Receiver.send_message(u'cursor_busy')
|
Receiver.send_message(u'cursor_busy')
|
||||||
fileTo = open(p_file, u'r')
|
fileTo = open(p_file, u'r')
|
||||||
|
Loading…
Reference in New Issue
Block a user