forked from openlp/openlp
fixed service save
This commit is contained in:
parent
53b0825a18
commit
765a10d2ea
@ -522,11 +522,11 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||||||
self.main_window.increment_progress_bar()
|
self.main_window.increment_progress_bar()
|
||||||
try:
|
try:
|
||||||
zip_file = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED, allow_zip_64)
|
zip_file = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED, allow_zip_64)
|
||||||
# First we add service contents. We save ALL file_names into ZIP using UTF-8.
|
# First we add service contents..
|
||||||
zip_file.writestr(service_file_name.encode(u'utf-8'), service_content)
|
zip_file.writestr(service_file_name, service_content)
|
||||||
# Finally add all the listed media files.
|
# Finally add all the listed media files.
|
||||||
for write_from in write_list:
|
for write_from in write_list:
|
||||||
zip_file.write(write_from, write_from.encode(u'utf-8'))
|
zip_file.write(write_from, write_from)
|
||||||
for audio_from, audio_to in audio_files:
|
for audio_from, audio_to in audio_files:
|
||||||
if audio_from.startswith(u'audio'):
|
if audio_from.startswith(u'audio'):
|
||||||
# When items are saved, they get new unique_identifier. Let's copy the file to the new location.
|
# When items are saved, they get new unique_identifier. Let's copy the file to the new location.
|
||||||
@ -537,7 +537,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||||||
check_directory_exists(save_path)
|
check_directory_exists(save_path)
|
||||||
if not os.path.exists(save_file):
|
if not os.path.exists(save_file):
|
||||||
shutil.copy(audio_from, save_file)
|
shutil.copy(audio_from, save_file)
|
||||||
zip_file.write(audio_from, audio_to.encode(u'utf-8'))
|
zip_file.write(audio_from, audio_to)
|
||||||
except IOError:
|
except IOError:
|
||||||
log.exception(u'Failed to save service to disk: %s', temp_file_name)
|
log.exception(u'Failed to save service to disk: %s', temp_file_name)
|
||||||
self.main_window.error_message(translate(u'OpenLP.ServiceManager', u'Error Saving File'),
|
self.main_window.error_message(translate(u'OpenLP.ServiceManager', u'Error Saving File'),
|
||||||
|
Loading…
Reference in New Issue
Block a user