openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #06151
[Merge] lp:~googol-hush/openlp/trivial into lp:openlp
Andreas Preikschat has proposed merging lp:~googol-hush/openlp/trivial into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~googol-hush/openlp/trivial/+merge/49257
Hello!
The re-index tool adds 'Author unknown' (or translated) if songs do not have any author.
Cheers
--
https://code.launchpad.net/~googol-hush/openlp/trivial/+merge/49257
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/trivial into lp:openlp.
=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py 2011-02-09 17:30:38 +0000
+++ openlp/plugins/songs/songsplugin.py 2011-02-10 17:32:55 +0000
@@ -33,7 +33,7 @@
from openlp.core.lib.db import Manager
from openlp.core.lib.ui import UiStrings
from openlp.plugins.songs.lib import SongMediaItem, SongsTab, SongXML
-from openlp.plugins.songs.lib.db import init_schema, Song
+from openlp.plugins.songs.lib.db import Author, init_schema, Song
from openlp.plugins.songs.lib.importer import SongFormat
log = logging.getLogger(__name__)
@@ -147,6 +147,17 @@
counter = 0
for song in songs:
counter += 1
+ # The song does not have any author, add one.
+ if not song.authors:
+ name = unicode(translate('SongsPlugin', 'Author unknown',
+ 'Translation must contain a blank character!'))
+ author = self.manager.get_object_filtered(Author,
+ Author.display_name == name)
+ if author is None:
+ author = Author.populate(
+ first_name=name.split(u' ', 1)[:-1],
+ last_name=name.split(u' ', 1)[-1], display_name=name)
+ song.authors.append(author)
if song.title is None:
song.title = u''
if song.alternate_title is None:
Follow ups