From f2cf1304ef92c39726e33479763062a18d2ac87c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 16 Mar 2011 18:21:03 +0100 Subject: [PATCH] removed old hack, updated comment, typo --- openlp/plugins/songs/lib/__init__.py | 8 ++++---- openlp/plugins/songs/lib/mediaitem.py | 13 ++++--------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/openlp/plugins/songs/lib/__init__.py b/openlp/plugins/songs/lib/__init__.py index 69e491a20..61e6abb8a 100644 --- a/openlp/plugins/songs/lib/__init__.py +++ b/openlp/plugins/songs/lib/__init__.py @@ -247,7 +247,7 @@ def retrieve_windows_encoding(recommendation=None): def clean_song(manager, song): """ - Cleans the search title, rebuilds the serach lyrics, adds a default author + Cleans the search title, rebuilds the search lyrics, adds a default author if the song does not have one and other clean ups. This should always called when a new song is added or changed. @@ -264,9 +264,9 @@ def clean_song(manager, song): whitespace = re.compile(r'\W+', re.UNICODE) song.search_title = (whitespace.sub(u' ', song.title).strip() + u'@' + whitespace.sub(u' ', song.alternate_title).strip()).strip().lower() - # Remove the "language" attribute from lyrics tag. This is not very - # important, but this keeps the database clean. This can be removed - # when everybody has cleaned his songs. + # Remove the old "language" attribute from lyrics tag (prior to 1.9.5). This + # is not very important, but this keeps the database clean. This can be + # removed when everybody has cleaned his songs. song.lyrics = song.lyrics.replace(u'', u'') verses = SongXML().get_verses(song.lyrics) lyrics = u' '.join([whitespace.sub(u' ', verse[1]) for verse in verses]) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 862754886..57e56aaf6 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -417,10 +417,10 @@ class SongMediaItem(MediaManagerItem): if self.plugin.status != PluginStatus.Active or not item.data_string: return if item.data_string[u'title'].find(u'@') == -1: - # This file seems to be an old one, which means, that the search - # title (data_string[u'title']) is probably wrong. We add "@" to - # search title and hope that we do not add any duplicate. This - # should work for songs without alternate title. + # This file seems to be an old one (prior to 1.9.5), which means, + # that the search title (data_string[u'title']) is probably wrong. + # We add "@" to search title and hope that we do not add any + # duplicate. This should work for songs without alternate title. search_results = self.parent.manager.get_all_objects(Song, Song.search_title == (re.compile(r'\W+', re.UNICODE).sub(u' ', item.data_string[u'title'].strip()) + u'@').strip().lower(), @@ -430,11 +430,6 @@ class SongMediaItem(MediaManagerItem): Song.search_title == item.data_string[u'title'], Song.search_title.asc()) author_list = item.data_string[u'authors'].split(u', ') - # The service item always has an author (at least it has u'' as - # author). However, songs saved in the database do not have to have - # an author. - if u'' in author_list: - author_list.remove(u'') editId = 0 add_song = True if search_results: