forked from openlp/openlp
- fixed bug #789143
bzr-revno: 1592 Fixes: https://launchpad.net/bugs/789143
This commit is contained in:
commit
fd4d316097
@ -265,17 +265,20 @@ def clean_song(manager, song):
|
|||||||
whitespace = re.compile(r'\W+', re.UNICODE)
|
whitespace = re.compile(r'\W+', re.UNICODE)
|
||||||
song.search_title = (whitespace.sub(u' ', song.title).strip() + u'@' +
|
song.search_title = (whitespace.sub(u' ', song.title).strip() + u'@' +
|
||||||
whitespace.sub(u' ', song.alternate_title).strip()).strip().lower()
|
whitespace.sub(u' ', song.alternate_title).strip()).strip().lower()
|
||||||
# Remove the old "language" attribute from lyrics tag (prior to 1.9.5). This
|
# Only do this, if we the song is a 1.9.4 song (or older).
|
||||||
# is not very important, but this keeps the database clean. This can be
|
if song.lyrics.find(u'<lyrics language="en">') != -1:
|
||||||
# removed when everybody has cleaned his songs.
|
# Remove the old "language" attribute from lyrics tag (prior to 1.9.5).
|
||||||
song.lyrics = song.lyrics.replace(u'<lyrics language="en">', u'<lyrics>')
|
# 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'<lyrics language="en">', u'<lyrics>')
|
||||||
verses = SongXML().get_verses(song.lyrics)
|
verses = SongXML().get_verses(song.lyrics)
|
||||||
lyrics = u' '.join([whitespace.sub(u' ', verse[1]) for verse in verses])
|
lyrics = u' '.join([whitespace.sub(u' ', verse[1]) for verse in verses])
|
||||||
song.search_lyrics = lyrics.lower()
|
song.search_lyrics = lyrics.lower()
|
||||||
# We need a new and clean SongXML instance.
|
# We need a new and clean SongXML instance.
|
||||||
sxml = SongXML()
|
sxml = SongXML()
|
||||||
# Rebuild the song's verses, to remove any wrong verse names (for example
|
# Rebuild the song's verses, to remove any wrong verse names (for
|
||||||
# translated ones), which might have been added prior to 1.9.5.
|
# example translated ones), which might have been added prior to 1.9.5.
|
||||||
# List for later comparison.
|
# List for later comparison.
|
||||||
compare_order = []
|
compare_order = []
|
||||||
for verse in verses:
|
for verse in verses:
|
||||||
@ -300,9 +303,11 @@ def clean_song(manager, song):
|
|||||||
order = []
|
order = []
|
||||||
new_order = []
|
new_order = []
|
||||||
for verse_def in order:
|
for verse_def in order:
|
||||||
verse_type = VerseType.Tags[VerseType.from_loose_input(verse_def[0])]
|
verse_type = VerseType.Tags[
|
||||||
|
VerseType.from_loose_input(verse_def[0])]
|
||||||
if len(verse_def) > 1:
|
if len(verse_def) > 1:
|
||||||
new_order.append((u'%s%s' % (verse_type, verse_def[1:])).upper())
|
new_order.append(
|
||||||
|
(u'%s%s' % (verse_type, verse_def[1:])).upper())
|
||||||
else:
|
else:
|
||||||
new_order.append(verse_type.upper())
|
new_order.append(verse_type.upper())
|
||||||
song.verse_order = u' '.join(new_order)
|
song.verse_order = u' '.join(new_order)
|
||||||
|
Loading…
Reference in New Issue
Block a user