forked from openlp/openlp
removed old hack, updated comment, typo
This commit is contained in:
parent
044f0c88e7
commit
f2cf1304ef
@ -247,7 +247,7 @@ def retrieve_windows_encoding(recommendation=None):
|
|||||||
|
|
||||||
def clean_song(manager, song):
|
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
|
if the song does not have one and other clean ups. This should always
|
||||||
called when a new song is added or changed.
|
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)
|
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 "language" attribute from lyrics tag. This is not very
|
# Remove the old "language" attribute from lyrics tag (prior to 1.9.5). This
|
||||||
# important, but this keeps the database clean. This can be removed
|
# is not very important, but this keeps the database clean. This can be
|
||||||
# when everybody has cleaned his songs.
|
# removed when everybody has cleaned his songs.
|
||||||
song.lyrics = song.lyrics.replace(u'<lyrics language="en">', u'<lyrics>')
|
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])
|
||||||
|
@ -417,10 +417,10 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
if self.plugin.status != PluginStatus.Active or not item.data_string:
|
if self.plugin.status != PluginStatus.Active or not item.data_string:
|
||||||
return
|
return
|
||||||
if item.data_string[u'title'].find(u'@') == -1:
|
if item.data_string[u'title'].find(u'@') == -1:
|
||||||
# This file seems to be an old one, which means, that the search
|
# This file seems to be an old one (prior to 1.9.5), which means,
|
||||||
# title (data_string[u'title']) is probably wrong. We add "@" to
|
# that the search title (data_string[u'title']) is probably wrong.
|
||||||
# search title and hope that we do not add any duplicate. This
|
# We add "@" to search title and hope that we do not add any
|
||||||
# should work for songs without alternate title.
|
# duplicate. This should work for songs without alternate title.
|
||||||
search_results = self.parent.manager.get_all_objects(Song,
|
search_results = self.parent.manager.get_all_objects(Song,
|
||||||
Song.search_title == (re.compile(r'\W+', re.UNICODE).sub(u' ',
|
Song.search_title == (re.compile(r'\W+', re.UNICODE).sub(u' ',
|
||||||
item.data_string[u'title'].strip()) + u'@').strip().lower(),
|
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 == item.data_string[u'title'],
|
||||||
Song.search_title.asc())
|
Song.search_title.asc())
|
||||||
author_list = item.data_string[u'authors'].split(u', ')
|
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
|
editId = 0
|
||||||
add_song = True
|
add_song = True
|
||||||
if search_results:
|
if search_results:
|
||||||
|
Loading…
Reference in New Issue
Block a user