forked from openlp/openlp
More fixes
This commit is contained in:
parent
5caca527e1
commit
b5b510b2ed
@ -822,7 +822,7 @@ class ThemeManager(QtWidgets.QWidget, RegistryBase, Ui_ThemeManager, LogMixin, R
|
||||
plugin_usage = "{plug}{text}".format(plug=plugin_usage,
|
||||
text=(translate('OpenLP.ThemeManager',
|
||||
'{count} time(s) by {plugin}'
|
||||
).format(name=used_count,
|
||||
).format(count=used_count,
|
||||
plugin=plugin.name)))
|
||||
plugin_usage = "{text}\n".format(text=plugin_usage)
|
||||
if plugin_usage:
|
||||
|
@ -23,6 +23,7 @@ The :mod:`openlp` module provides the functionality for importing OpenLP
|
||||
song databases into the current installation database.
|
||||
"""
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
from sqlalchemy import MetaData, Table, create_engine
|
||||
from sqlalchemy.orm import class_mapper, mapper, relation, scoped_session, sessionmaker
|
||||
@ -271,12 +272,18 @@ class OpenLPSongImport(SongImport):
|
||||
# Find or create all the media files and add them to the new song object
|
||||
if has_media_files and song.media_files:
|
||||
for media_file in song.media_files:
|
||||
# Database now uses paths rather than strings for media files, and the key name has
|
||||
# changed appropriately. This catches any databases using the old key name.
|
||||
try:
|
||||
media_path = media_file.file_path
|
||||
except Exception:
|
||||
media_path = Path(media_file.file_name)
|
||||
existing_media_file = self.manager.get_object_filtered(
|
||||
MediaFile, MediaFile.file_path == media_file.file_path)
|
||||
MediaFile, MediaFile.file_path == media_path)
|
||||
if existing_media_file:
|
||||
new_song.media_files.append(existing_media_file)
|
||||
else:
|
||||
new_song.media_files.append(MediaFile.populate(file_name=media_file.file_name))
|
||||
new_song.media_files.append(MediaFile.populate(file_path=media_path))
|
||||
clean_song(self.manager, new_song)
|
||||
self.manager.save_object(new_song)
|
||||
if progress_dialog:
|
||||
|
Loading…
Reference in New Issue
Block a user