Fix easislides import when xml elements are missing

This commit is contained in:
Jonathan Corwin 2011-06-20 23:11:05 +01:00
parent 59280d10b7
commit 6c3190528d

View File

@ -73,15 +73,21 @@ class EasiSlidesImport(SongImport):
def _parse_song(self, song):
self._success = True
self._add_unicode_attribute(u'title', song.Title1, True)
self._add_unicode_attribute(u'alternate_title', song.Title2)
self._add_unicode_attribute(u'song_number', song.SongNumber)
if hasattr(song, u'Title2'):
self._add_unicode_attribute(u'alternate_title', song.Title2)
if hasattr(song, u'SongNumber'):
self._add_unicode_attribute(u'song_number', song.SongNumber)
if self.song_number == u'0':
self.song_number = u''
self._add_authors(song)
self._add_copyright(song.Copyright)
self._add_copyright(song.LicenceAdmin1)
self._add_copyright(song.LicenceAdmin2)
self._add_unicode_attribute(u'song_book_name', song.BookReference)
if hasattr(song, u'Copyright'):
self._add_copyright(song.Copyright)
if hasattr(song, u'LicenceAdmin1'):
self._add_copyright(song.LicenceAdmin1)
if hasattr(song, u'LicenceAdmin2'):
self._add_copyright(song.LicenceAdmin2)
if hasattr(song, u'BookReference'):
self._add_unicode_attribute(u'song_book_name', song.BookReference)
self._parse_and_add_lyrics(song)
if self._success:
if not self.finish():