add the special author

This commit is contained in:
Andreas Preikschat 2011-02-19 19:37:01 +01:00
commit 810db5ca55

View File

@ -35,6 +35,7 @@ from openlp.core.lib.ui import UiStrings
from openlp.plugins.songs.lib import SongMediaItem, SongsTab, SongXML from openlp.plugins.songs.lib import SongMediaItem, SongsTab, SongXML
from openlp.plugins.songs.lib.db import Author, init_schema, Song from openlp.plugins.songs.lib.db import Author, init_schema, Song
from openlp.plugins.songs.lib.importer import SongFormat from openlp.plugins.songs.lib.importer import SongFormat
from openlp.plugins.songs.lib.ui import SongStrings
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -147,13 +148,12 @@ class SongsPlugin(Plugin):
counter += 1 counter += 1
# The song does not have any author, add one. # The song does not have any author, add one.
if not song.authors: if not song.authors:
name = unicode(translate('SongsPlugin', 'Author unknown', name = unicode(SongStrings.AuthorUnknownUnT)
'Translation must contain a blank character!'))
author = self.manager.get_object_filtered(Author, author = self.manager.get_object_filtered(Author,
Author.display_name == name) Author.display_name == name)
if author is None: if author is None:
author = Author.populate( author = Author.populate(
first_name=name.split(u' ', 1)[:-1], first_name=u' '.join(name.split(u' ', 1)[:-1]),
last_name=name.split(u' ', 1)[-1], display_name=name) last_name=name.split(u' ', 1)[-1], display_name=name)
song.authors.append(author) song.authors.append(author)
if song.title is None: if song.title is None: