~suutari-olli/openlp/escape-fixes-1294111-1497637

« back to all changes in this revision

Viewing changes to openlp/plugins/songs/lib/openlyricsxml.py

  • Committer: suutari-olli
  • Date: 2016-01-07 02:53:59 UTC
  • mfrom: (2557.2.31 openlp)
  • Revision ID: suutari.olli@gmail.com-20160107025359-q2feybbwxaoihqxr
Merge to trunk on 1/7/2015.

I noticed this branch also seems to be fixing this bug:
https://bugs.launchpad.net/openlp/+bug/1531691

However, escape item still remains buggy with problems related to resuming
video and presentations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
###############################################################################
5
5
# OpenLP - Open Source Lyrics Projection                                      #
6
6
# --------------------------------------------------------------------------- #
7
 
# Copyright (c) 2008-2015 OpenLP Developers                                   #
 
7
# Copyright (c) 2008-2016 OpenLP Developers                                   #
8
8
# --------------------------------------------------------------------------- #
9
9
# This program is free software; you can redistribute it and/or modify it     #
10
10
# under the terms of the GNU General Public License as published by the Free  #
121
121
        """
122
122
        self.song_xml = None
123
123
        verse_list = []
124
 
        if not xml.startswith('<?xml') and not xml.startswith('<song'):
125
 
            # This is an old style song, without XML. Let's handle it correctly by iterating through the verses, and
126
 
            # then recreating the internal xml object as well.
127
 
            self.song_xml = objectify.fromstring('<song version="1.0" />')
128
 
            self.lyrics = etree.SubElement(self.song_xml, 'lyrics')
129
 
            verses = xml.split('\n\n')
130
 
            for count, verse in enumerate(verses):
131
 
                verse_list.append([{'type': 'v', 'label': str(count)}, str(verse)])
132
 
                self.add_verse_to_lyrics('v', str(count), verse)
133
 
            return verse_list
134
 
        elif xml.startswith('<?xml'):
 
124
        if xml.startswith('<?xml'):
135
125
            xml = xml[38:]
136
126
        try:
137
127
            self.song_xml = objectify.fromstring(xml)