forked from openlp/openlp
Merge branch 'more_fixes' into 'master'
More fixes Closes #818 and #812 See merge request openlp/openlp!320
This commit is contained in:
commit
93a51371ab
@ -822,7 +822,7 @@ class ThemeManager(QtWidgets.QWidget, RegistryBase, Ui_ThemeManager, LogMixin, R
|
|||||||
plugin_usage = "{plug}{text}".format(plug=plugin_usage,
|
plugin_usage = "{plug}{text}".format(plug=plugin_usage,
|
||||||
text=(translate('OpenLP.ThemeManager',
|
text=(translate('OpenLP.ThemeManager',
|
||||||
'{count} time(s) by {plugin}'
|
'{count} time(s) by {plugin}'
|
||||||
).format(name=used_count,
|
).format(count=used_count,
|
||||||
plugin=plugin.name)))
|
plugin=plugin.name)))
|
||||||
plugin_usage = "{text}\n".format(text=plugin_usage)
|
plugin_usage = "{text}\n".format(text=plugin_usage)
|
||||||
if 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.
|
song databases into the current installation database.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from sqlalchemy import MetaData, Table, create_engine
|
from sqlalchemy import MetaData, Table, create_engine
|
||||||
from sqlalchemy.orm import class_mapper, mapper, relation, scoped_session, sessionmaker
|
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
|
# Find or create all the media files and add them to the new song object
|
||||||
if has_media_files and song.media_files:
|
if has_media_files and song.media_files:
|
||||||
for media_file in 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(
|
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:
|
if existing_media_file:
|
||||||
new_song.media_files.append(existing_media_file)
|
new_song.media_files.append(existing_media_file)
|
||||||
else:
|
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)
|
clean_song(self.manager, new_song)
|
||||||
self.manager.save_object(new_song)
|
self.manager.save_object(new_song)
|
||||||
if progress_dialog:
|
if progress_dialog:
|
||||||
|
Loading…
Reference in New Issue
Block a user