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/45074 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/45074 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 2010-12-31 02:17:41 +0000 +++ openlp/plugins/songs/songsplugin.py 2011-01-03 21:20:13 +0000 @@ -32,7 +32,7 @@ from openlp.core.lib import Plugin, StringContent, build_icon, translate from openlp.core.lib.db import Manager from openlp.plugins.songs.lib import SongMediaItem, SongsTab, SongXMLParser -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__) @@ -146,6 +146,15 @@ 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')) + author = self.manager.get_object_filtered(Author, + Author.display_name == name) + if author is None: + author = Author.populate(first_name=name.rsplit(u' ', 1)[0], + last_name=name.rsplit(u' ', 1)[1], display_name=name) + song.authors.append(author) if song.title is None: song.title = u'' if song.alternate_title is None:
_______________________________________________ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp