forked from openlp/openlp
changes for SongBeamer import
This commit is contained in:
parent
91544f5db1
commit
d249b2a326
@ -28,12 +28,34 @@ The :mod:`songbeamerimport` module provides the functionality for importing
|
|||||||
SongBeamer songs into the OpenLP database.
|
SongBeamer songs into the OpenLP database.
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.songimport import SongImport
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
class SongBeamerTypes(object):
|
||||||
|
MarkTypes = {
|
||||||
|
u'Refrain': u'C',
|
||||||
|
u'Chorus': u'C',
|
||||||
|
u'Vers': u'V',
|
||||||
|
u'Verse': u'V',
|
||||||
|
u'Strophe': u'V',
|
||||||
|
u'Intro': u'I',
|
||||||
|
u'Coda': u'E',
|
||||||
|
u'Ending': u'E',
|
||||||
|
u'Bridge': u'B',
|
||||||
|
u'Interlude': u'B',
|
||||||
|
u'Zwischenspiel': u'B',
|
||||||
|
u'Pre-Chorus': u'P',
|
||||||
|
u'Pre-Refrain': u'P',
|
||||||
|
u'Pre-Bridge': u'O',
|
||||||
|
u'Pre-Coda': u'O',
|
||||||
|
u'Unbekannt': u'O',
|
||||||
|
u'Unknown': u'O'
|
||||||
|
}
|
||||||
|
|
||||||
class SongBeamerImport(SongImport):
|
class SongBeamerImport(SongImport):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
@ -117,7 +139,7 @@ class SongBeamerImport(SongImport):
|
|||||||
elif tag_val[0] == '#Categories':
|
elif tag_val[0] == '#Categories':
|
||||||
pass
|
pass
|
||||||
elif tag_val[0] == '#CCLI':
|
elif tag_val[0] == '#CCLI':
|
||||||
pass
|
self.ccli_number = tag_val[1]
|
||||||
elif tag_val[0] == '#Chords':
|
elif tag_val[0] == '#Chords':
|
||||||
pass
|
pass
|
||||||
elif tag_val[0] == '#ChurchSongID':
|
elif tag_val[0] == '#ChurchSongID':
|
||||||
@ -125,7 +147,7 @@ class SongBeamerImport(SongImport):
|
|||||||
elif tag_val[0] == '#ColorChords':
|
elif tag_val[0] == '#ColorChords':
|
||||||
pass
|
pass
|
||||||
elif tag_val[0] == '#Comments':
|
elif tag_val[0] == '#Comments':
|
||||||
pass
|
self.comments = tag_val[1]
|
||||||
elif tag_val[0] == '#Editor':
|
elif tag_val[0] == '#Editor':
|
||||||
pass
|
pass
|
||||||
elif tag_val[0] == '#Font':
|
elif tag_val[0] == '#Font':
|
||||||
@ -162,9 +184,12 @@ class SongBeamerImport(SongImport):
|
|||||||
elif tag_val[0] == '#QuickFind':
|
elif tag_val[0] == '#QuickFind':
|
||||||
pass
|
pass
|
||||||
elif tag_val[0] == '#Rights':
|
elif tag_val[0] == '#Rights':
|
||||||
pass
|
song_book_pub = tag_val[1]
|
||||||
elif tag_val[0] == '#Songbook':
|
elif tag_val[0] == '#Songbook':
|
||||||
pass
|
book_num = tag_val[1].split(' / ')
|
||||||
|
self.song_book_name = book_num[0]
|
||||||
|
if len(book_num) == book_num[1]:
|
||||||
|
self.song_number = u''
|
||||||
elif tag_val[0] == '#Speed':
|
elif tag_val[0] == '#Speed':
|
||||||
pass
|
pass
|
||||||
elif tag_val[0] == '#TextAlign':
|
elif tag_val[0] == '#TextAlign':
|
||||||
@ -195,34 +220,10 @@ class SongBeamerImport(SongImport):
|
|||||||
|
|
||||||
|
|
||||||
def check_verse_marks(self, line):
|
def check_verse_marks(self, line):
|
||||||
if line.startswith('Refrain') or \
|
marks = line.split(' ')
|
||||||
line.startswith('Chorus'):
|
if len(marks) <= 2 and \
|
||||||
self.current_verse_type = u'V'
|
marks[0] in SongBeamerTypes.MarkTypes:
|
||||||
elif line.startswith('Vers') or \
|
self.current_verse_type = SongBeamerTypes.MarkTypes[marks[0]]
|
||||||
line.startswith('Verse') or \
|
if len(marks) == 2:
|
||||||
line.startswith('Strophe'):
|
#TODO: may check, because of only digits are allowed
|
||||||
self.current_verse_type = u'V'
|
self.current_verse_type += marks[1]
|
||||||
elif line.startswith('Intro'):
|
|
||||||
pass
|
|
||||||
elif line.startswith('Coda'):
|
|
||||||
pass
|
|
||||||
elif line.startswith('Ending'):
|
|
||||||
pass
|
|
||||||
elif line.startswith('Bridge'):
|
|
||||||
pass
|
|
||||||
elif line.startswith('Interlude'):
|
|
||||||
pass
|
|
||||||
elif line.startswith('Zwischenspiel'):
|
|
||||||
pass
|
|
||||||
elif line.startswith('Pre-Chorus'):
|
|
||||||
pass
|
|
||||||
elif line.startswith('Pre-Refrain'):
|
|
||||||
pass
|
|
||||||
elif line.startswith('Pre-Bridge'):
|
|
||||||
pass
|
|
||||||
elif line.startswith('Pre-Coda'):
|
|
||||||
pass
|
|
||||||
elif line.startswith('Unbekannt'):
|
|
||||||
pass
|
|
||||||
elif line.startswith('Unknown'):
|
|
||||||
pass
|
|
||||||
|
Loading…
Reference in New Issue
Block a user