forked from openlp/openlp
Some minor syntactic sugar.
This commit is contained in:
parent
364940c547
commit
dfe8bbae9c
@ -75,18 +75,18 @@ class OpenLPSongImport(SongImport):
|
||||
The :class:`OpenLPSongImport` class provides OpenLP with the ability to
|
||||
import song databases from other installations of OpenLP.
|
||||
"""
|
||||
def __init__(self, master_manager, **kwargs):
|
||||
def __init__(self, manager, **kwargs):
|
||||
"""
|
||||
Initialise the import.
|
||||
|
||||
``master_manager``
|
||||
``manager``
|
||||
The song manager for the running OpenLP installation.
|
||||
|
||||
``source_db``
|
||||
The database providing the data to import.
|
||||
"""
|
||||
SongImport.__init__(self, master_manager)
|
||||
self.master_manager = master_manager
|
||||
SongImport.__init__(self, manager)
|
||||
#self.master_manager = master_manager
|
||||
self.import_source = u'sqlite:///%s' % kwargs[u'filename']
|
||||
log.debug(self.import_source)
|
||||
self.source_session = None
|
||||
@ -167,7 +167,7 @@ class OpenLPSongImport(SongImport):
|
||||
new_song.ccli_number = song.ccli_number
|
||||
if song.authors:
|
||||
for author in song.authors:
|
||||
existing_author = self.master_manager.get_object_filtered(
|
||||
existing_author = self.manager.get_object_filtered(
|
||||
Author, Author.display_name == author.display_name)
|
||||
if existing_author:
|
||||
new_song.authors.append(existing_author)
|
||||
@ -177,7 +177,7 @@ class OpenLPSongImport(SongImport):
|
||||
last_name=author.last_name,
|
||||
display_name=author.display_name))
|
||||
else:
|
||||
au = self.master_manager.get_object_filtered(Author,
|
||||
au = self.manager.get_object_filtered(Author,
|
||||
Author.display_name == u'Author Unknown')
|
||||
if au:
|
||||
new_song.authors.append(au)
|
||||
@ -185,7 +185,7 @@ class OpenLPSongImport(SongImport):
|
||||
new_song.authors.append(Author.populate(
|
||||
display_name=u'Author Unknown'))
|
||||
if song.book:
|
||||
existing_song_book = self.master_manager.get_object_filtered(
|
||||
existing_song_book = self.manager.get_object_filtered(
|
||||
Book, Book.name == song.book.name)
|
||||
if existing_song_book:
|
||||
new_song.book = existing_song_book
|
||||
@ -194,7 +194,7 @@ class OpenLPSongImport(SongImport):
|
||||
publisher=song.book.publisher)
|
||||
if song.topics:
|
||||
for topic in song.topics:
|
||||
existing_topic = self.master_manager.get_object_filtered(
|
||||
existing_topic = self.manager.get_object_filtered(
|
||||
Topic, Topic.name == topic.name)
|
||||
if existing_topic:
|
||||
new_song.topics.append(existing_topic)
|
||||
@ -204,12 +204,12 @@ class OpenLPSongImport(SongImport):
|
||||
# if song.media_files:
|
||||
# for media_file in song.media_files:
|
||||
# existing_media_file = \
|
||||
# self.master_manager.get_object_filtered(MediaFile,
|
||||
# self.manager.get_object_filtered(MediaFile,
|
||||
# MediaFile.file_name == media_file.file_name)
|
||||
# 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))
|
||||
self.master_manager.save_object(new_song)
|
||||
self.manager.save_object(new_song)
|
||||
engine.dispose()
|
||||
|
Loading…
Reference in New Issue
Block a user