Removed extension checking in wow import as this is handled by the filters in the open dialouge box. Instead, check the the header to ensure that the file is a wow song file regardless of ext.

Corrected open song import extension.
This commit is contained in:
Philip Ridout 2010-10-05 20:41:54 +01:00
parent 881cb4e3c3
commit e81efb84f6
2 changed files with 4 additions and 8 deletions

View File

@ -322,7 +322,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'Select Open Song Files'), 'Select Open Song Files'),
self.openSongFileListWidget, self.openSongFileListWidget,
'%s (*.html);;%s (*)' '%s (*.xml);;%s (*)'
% (translate('SongsPlugin.ImportWizardForm', % (translate('SongsPlugin.ImportWizardForm',
'OpenSong html Files'), 'OpenSong html Files'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',

View File

@ -116,20 +116,16 @@ class WowImport(SongImport):
self.import_wizard.importProgressBar.setMaximum( self.import_wizard.importProgressBar.setMaximum(
len(self.import_source)) len(self.import_source))
for file in self.import_source: for file in self.import_source:
# TODO: check that it is a valid words of worship file (could
# check header for WoW File Song Word)
os.path.splitext( file )
self.ext = os.path.splitext(file)[1]
if self.ext != u'.wsg' and self.ext != u'.wow-song':
continue
self.author = u'' self.author = u''
self.copyright = u'' self.copyright = u''
# Get the song title
self.file_name = os.path.split(file)[1] self.file_name = os.path.split(file)[1]
self.import_wizard.incrementProgressBar( self.import_wizard.incrementProgressBar(
"Importing %s" % (self.file_name), 0) "Importing %s" % (self.file_name), 0)
# Get the song title
self.title = self.file_name.rpartition(u'.')[0] self.title = self.file_name.rpartition(u'.')[0]
self.songData = open(file, 'rb') self.songData = open(file, 'rb')
if self.songData.read(19) != u'WoW File\nSong Words':
continue
# Seek to byte which stores number of blocks in the song # Seek to byte which stores number of blocks in the song
self.songData.seek(56) self.songData.seek(56)
self.no_of_blocks = ord(self.songData.read(1)) self.no_of_blocks = ord(self.songData.read(1))