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

View File

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