removed old hack, updated comment, typo

This commit is contained in:
Andreas Preikschat 2011-03-16 18:21:03 +01:00
parent 044f0c88e7
commit f2cf1304ef
2 changed files with 8 additions and 13 deletions

View File

@ -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'<lyrics language="en">', u'<lyrics>')
verses = SongXML().get_verses(song.lyrics)
lyrics = u' '.join([whitespace.sub(u' ', verse[1]) for verse in verses])

View File

@ -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: