Merge branch 'issue-1216' into 'master'

Fix file hash not being generated

Closes #1216

See merge request openlp/openlp!513
This commit is contained in:
Raoul Snyman 2022-11-30 14:37:43 +00:00
commit 82ef139a2d
2 changed files with 4 additions and 0 deletions

View File

@ -628,6 +628,8 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
continue
write_list.append(path_from_tuple)
for (audio_path, audio_file_hash) in item['service_item'].background_audio:
if not audio_file_hash:
audio_file_hash = sha256_file_hash(audio_path)
service_path = audio_file_hash + audio_path.suffix
audio_path_tuple = (audio_path, service_path)
if audio_path_tuple in write_list:

View File

@ -28,6 +28,7 @@ from shutil import copyfile
from PyQt5 import QtCore, QtWidgets, QtGui
from openlp.core.common import sha256_file_hash
from openlp.core.common.applocation import AppLocation
from openlp.core.common.i18n import UiStrings, get_natural_key, translate
from openlp.core.common.mixins import RegistryProperties
@ -1095,6 +1096,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
file_paths.append(file_path)
media_file = MediaFile()
media_file.file_path = file_path
media_file.file_hash = sha256_file_hash(file_path)
media_file.type = 'audio'
media_file.weight = row
self.song.media_files.append(media_file)