Restore setting a default author

This commit is contained in:
Samuel Mehrbrodt 2014-04-02 09:03:53 +02:00
parent 31b220c972
commit dffee7fbc1
1 changed files with 7 additions and 0 deletions

View File

@ -389,6 +389,13 @@ def clean_song(manager, song):
song.lyrics = str(song.lyrics, encoding='utf8')
verses = SongXML().get_verses(song.lyrics)
song.search_lyrics = ' '.join([clean_string(verse[1]) for verse in verses])
# The song does not have any author, add one.
if not song.authors and not song.authors_songs: # Need to check both relations
name = SongStrings.AuthorUnknown
author = manager.get_object_filtered(Author, Author.display_name == name)
if author is None:
author = Author.populate(display_name=name, last_name='', first_name='')
song.authors.append(author)
if song.copyright:
song.copyright = CONTROL_CHARS.sub('', song.copyright).strip()