forked from openlp/openlp
Try to fix songbeamer chord imports
This commit is contained in:
parent
7f64106acb
commit
d60ea23de6
@ -112,6 +112,7 @@ class SongBeamerImport(SongImport):
|
|||||||
self.current_verse = ''
|
self.current_verse = ''
|
||||||
self.current_verse_type = VerseType.tags[VerseType.Verse]
|
self.current_verse_type = VerseType.tags[VerseType.Verse]
|
||||||
self.chord_table = None
|
self.chord_table = None
|
||||||
|
self.editor_version = 0
|
||||||
file_name = os.path.split(import_file)[1]
|
file_name = os.path.split(import_file)[1]
|
||||||
if os.path.isfile(import_file):
|
if os.path.isfile(import_file):
|
||||||
# Detect the encoding
|
# Detect the encoding
|
||||||
@ -143,7 +144,7 @@ class SongBeamerImport(SongImport):
|
|||||||
self.current_verse_type = VerseType.tags[VerseType.Verse]
|
self.current_verse_type = VerseType.tags[VerseType.Verse]
|
||||||
read_verses = True
|
read_verses = True
|
||||||
verse_start = True
|
verse_start = True
|
||||||
# Songbeamer allows chord on line "-1"
|
# Songbeamer allows chord on line "-1", meaning the first line has only chords
|
||||||
if line_number == -1:
|
if line_number == -1:
|
||||||
first_line = self.insert_chords(line_number, '')
|
first_line = self.insert_chords(line_number, '')
|
||||||
if first_line:
|
if first_line:
|
||||||
@ -160,6 +161,8 @@ class SongBeamerImport(SongImport):
|
|||||||
line = self.insert_chords(line_number, line)
|
line = self.insert_chords(line_number, line)
|
||||||
self.current_verse += line.strip() + '\n'
|
self.current_verse += line.strip() + '\n'
|
||||||
line_number += 1
|
line_number += 1
|
||||||
|
elif self.editor_version < 4:
|
||||||
|
line_number += 1
|
||||||
else:
|
else:
|
||||||
line = self.insert_chords(line_number, line)
|
line = self.insert_chords(line_number, line)
|
||||||
self.current_verse += line.strip() + '\n'
|
self.current_verse += line.strip() + '\n'
|
||||||
@ -241,7 +244,10 @@ class SongBeamerImport(SongImport):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
self.comments = tag_val[1]
|
self.comments = tag_val[1]
|
||||||
elif tag_val[0] == '#Editor':
|
elif tag_val[0] == '#Editor':
|
||||||
pass
|
try:
|
||||||
|
self.editor_version = float(re.sub('[a-zA-Z ]', '', tag_val[1]))
|
||||||
|
except ValueError:
|
||||||
|
self.editor_version = 0
|
||||||
elif tag_val[0] == '#Font':
|
elif tag_val[0] == '#Font':
|
||||||
pass
|
pass
|
||||||
elif tag_val[0] == '#FontLang2':
|
elif tag_val[0] == '#FontLang2':
|
||||||
|
Loading…
Reference in New Issue
Block a user