From a8c15366146e026b14a2fd8f81ae3422970fff0b Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Wed, 30 Nov 2022 14:37:42 +0000 Subject: [PATCH] Fix file hash not being generated --- openlp/core/ui/servicemanager.py | 2 ++ openlp/plugins/songs/forms/editsongform.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 8add11989..2ebbf5c79 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -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: diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index ffee14013..805739b18 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -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)