forked from openlp/openlp
Added support for ALL DreamBeam file formats.
This commit is contained in:
parent
4ce95e9d56
commit
9c11494364
@ -108,30 +108,52 @@ class DreamBeamImport(SongImport):
|
|||||||
('Invalid DreamBeam song file. Missing '
|
('Invalid DreamBeam song file. Missing '
|
||||||
'DreamSong tag.'))))
|
'DreamSong tag.'))))
|
||||||
continue
|
continue
|
||||||
if hasattr(song_xml, u'Title'):
|
if hasattr(song_xml, u'Version'):
|
||||||
self.title = unicode(song_xml.Title.text)
|
self.version = float(song_xml.Version.text)
|
||||||
if hasattr(song_xml, u'Author'):
|
# Version numbers found in DreamBeam Source /FileTypes/Song.cs
|
||||||
# DreamBeam does not have a copyright field, instead it
|
if self.version <= 0.49:
|
||||||
# sometimes uses the author field
|
if hasattr(song_xml.Text0, u'Text'):
|
||||||
self.addCopyright(unicode(song_xml.Author.text))
|
self.title = unicode(song_xml.Text0.Text.text)
|
||||||
self.parseAuthor(unicode(song_xml.Author.text))
|
if hasattr(song_xml.Text1, u'Text'):
|
||||||
if hasattr(song_xml, u'SongLyrics'):
|
self.lyrics = unicode(song_xml.Text1.Text.text)
|
||||||
for lyrics_item in song_xml.SongLyrics.iterchildren():
|
for verse in self.lyrics.split(u'\n\n\n'):
|
||||||
verse_type = lyrics_item.get(u'Type')
|
self.addVerse(verse)
|
||||||
verse_number = lyrics_item.get(u'Number')
|
if hasattr(song_xml.Text2, u'Text'):
|
||||||
verse_text = unicode(lyrics_item.text)
|
# DreamBeam does not have a copyright field, instead it
|
||||||
self.addVerse(verse_text,
|
# sometimes uses the author field
|
||||||
(u'%s%s' % (verse_type[:1], verse_number)))
|
self.addCopyright(unicode(song_xml.Text2.Text.text))
|
||||||
if hasattr(song_xml, u'Collection'):
|
self.parseAuthor(unicode(song_xml.Text2.Text.text))
|
||||||
self.songBookName = unicode(song_xml.Collection.text)
|
elif self.version >= 0.5:
|
||||||
if hasattr(song_xml, u'Number'):
|
if hasattr(song_xml, u'Title'):
|
||||||
self.songNumber = unicode(song_xml.Number.text)
|
self.title = unicode(song_xml.Title.text)
|
||||||
if hasattr(song_xml, u'Sequence'):
|
if hasattr(song_xml, u'Author'):
|
||||||
for LyricsSequenceItem in song_xml.Sequence.iterchildren():
|
# DreamBeam does not have a copyright field, instead it
|
||||||
self.verseOrderList.append(
|
# sometimes uses the author field
|
||||||
"%s%s" % (LyricsSequenceItem.get(u'Type')[:1],
|
self.addCopyright(unicode(song_xml.Author.text))
|
||||||
LyricsSequenceItem.get(u'Number')))
|
self.parseAuthor(unicode(song_xml.Author.text))
|
||||||
if hasattr(song_xml, u'Notes'):
|
if hasattr(song_xml, u'SongLyrics'):
|
||||||
self.comments = unicode(song_xml.Notes.text)
|
for lyrics_item in song_xml.SongLyrics.iterchildren():
|
||||||
|
verse_type = lyrics_item.get(u'Type')
|
||||||
|
verse_number = lyrics_item.get(u'Number')
|
||||||
|
verse_text = unicode(lyrics_item.text)
|
||||||
|
self.addVerse(verse_text,
|
||||||
|
(u'%s%s' % (verse_type[:1], verse_number)))
|
||||||
|
if hasattr(song_xml, u'Collection'):
|
||||||
|
self.songBookName = unicode(song_xml.Collection.text)
|
||||||
|
if hasattr(song_xml, u'Number'):
|
||||||
|
self.songNumber = unicode(song_xml.Number.text)
|
||||||
|
if hasattr(song_xml, u'Sequence'):
|
||||||
|
for LyricsSequenceItem in (
|
||||||
|
song_xml.Sequence.iterchildren()):
|
||||||
|
self.verseOrderList.append(
|
||||||
|
"%s%s" % (LyricsSequenceItem.get(u'Type')[:1],
|
||||||
|
LyricsSequenceItem.get(u'Number')))
|
||||||
|
if hasattr(song_xml, u'Notes'):
|
||||||
|
self.comments = unicode(song_xml.Notes.text)
|
||||||
|
else:
|
||||||
|
log.exception(u'No valid version information.'
|
||||||
|
'Invalid file %s' % file)
|
||||||
|
self.logError(file, SongStrings.XMLSyntaxError)
|
||||||
|
continue
|
||||||
if not self.finish():
|
if not self.finish():
|
||||||
self.logError(file)
|
self.logError(file)
|
||||||
|
Loading…
Reference in New Issue
Block a user