Made the EWS import a seperate point. Also some small updates to comments.

This commit is contained in:
Tomas Groth 2014-04-20 21:03:35 +02:00
parent 4560d39ad9
commit 54ed6aeea0
2 changed files with 27 additions and 29 deletions

View File

@ -78,8 +78,6 @@ class EasyWorshipSongImport(SongImport):
def do_import(self):
"""
Determines the type of file to import and calls the appropiate method
:return:
"""
if self.import_source.lower().endswith('ews'):
self.import_ews()
@ -92,8 +90,6 @@ class EasyWorshipSongImport(SongImport):
The full spec of the ews files can be found here:
https://github.com/meinders/lithium-ews/blob/master/docs/ews%20file%20format.md
or here: http://wiki.openlp.org/Development:EasyWorship_EWS_Format
:return:
"""
# Open ews file if it exists
if not os.path.isfile(self.import_source):
@ -196,8 +192,6 @@ class EasyWorshipSongImport(SongImport):
def import_db(self):
"""
Import the songs from the database
:return:
"""
# Open the DB and MB files if they exist
import_source_mb = self.import_source.replace('.DB', '.MB')
@ -322,7 +316,6 @@ class EasyWorshipSongImport(SongImport):
:param authors: String with authons
:param words: Bytes with rtf-encoding
:return:
"""
if authors:
# Split up the authors
@ -380,7 +373,6 @@ class EasyWorshipSongImport(SongImport):
Find a field in the descriptions
:param field_name: field to find
:return:
"""
return [i for i, x in enumerate(self.field_descriptions) if x.name == field_name][0]
@ -417,7 +409,7 @@ class EasyWorshipSongImport(SongImport):
Extract the field
:param field_desc_index: Field index value
:return:
:return: The field value
"""
field = self.fields[field_desc_index]
field_desc = self.field_descriptions[field_desc_index]

View File

@ -153,19 +153,20 @@ class SongFormat(object):
CCLI = 3
DreamBeam = 4
EasySlides = 5
EasyWorship = 6
FoilPresenter = 7
MediaShout = 8
OpenSong = 9
PowerSong = 10
SongBeamer = 11
SongPro = 12
SongShowPlus = 13
SongsOfFellowship = 14
SundayPlus = 15
WordsOfWorship = 16
WorshipCenterPro = 17
ZionWorx = 18
EasyWorshipDB = 6
EasyWorshipService = 7
FoilPresenter = 8
MediaShout = 9
OpenSong = 10
PowerSong = 11
SongBeamer = 12
SongPro = 13
SongShowPlus = 14
SongsOfFellowship = 15
SundayPlus = 16
WordsOfWorship = 17
WorshipCenterPro = 18
ZionWorx = 19
# Set optional attribute defaults
__defaults__ = {
@ -224,15 +225,19 @@ class SongFormat(object):
'selectMode': SongFormatSelect.SingleFile,
'filter': '%s (*.xml)' % translate('SongsPlugin.ImportWizardForm', 'EasySlides XML File')
},
EasyWorship: {
EasyWorshipDB: {
'class': EasyWorshipSongImport,
'name': 'EasyWorship',
'name': 'EasyWorship Song Database',
'prefix': 'ew',
'selectMode': SongFormatSelect.SingleFile,
'filter': '%s (*.db);; %s (*.ews)' % (translate('SongsPlugin.ImportWizardForm',
'EasyWorship Song Database'),
translate('SongsPlugin.ImportWizardForm',
'EasyWorship Service File'))
'filter': '%s (*.db)' % translate('SongsPlugin.ImportWizardForm', 'EasyWorship Song Database')
},
EasyWorshipService: {
'class': EasyWorshipSongImport,
'name': 'EasyWorship Service File',
'prefix': 'ew',
'selectMode': SongFormatSelect.SingleFile,
'filter': '%s (*.ews)' % translate('SongsPlugin.ImportWizardForm', 'EasyWorship Service File')
},
FoilPresenter: {
'class': FoilPresenterImport,
@ -344,7 +349,8 @@ class SongFormat(object):
SongFormat.CCLI,
SongFormat.DreamBeam,
SongFormat.EasySlides,
SongFormat.EasyWorship,
SongFormat.EasyWorshipDB,
SongFormat.EasyWorshipService,
SongFormat.FoilPresenter,
SongFormat.MediaShout,
SongFormat.OpenSong,