Merge lp://qastaging/~gtalent/openlp/easyworship6 into lp://qastaging/openlp

Proposed by Gary Talent
Status: Merged
Merged at revision: 2741
Proposed branch: lp://qastaging/~gtalent/openlp/easyworship6
Merge into: lp://qastaging/openlp
Diff against target: 513 lines (+177/-78)
4 files modified
openlp/plugins/songs/lib/__init__.py (+6/-3)
openlp/plugins/songs/lib/importer.py (+31/-21)
openlp/plugins/songs/lib/importers/easyworship.py (+116/-37)
tests/functional/openlp_plugins/songs/test_ewimport.py (+24/-17)
To merge this branch: bzr merge lp://qastaging/~gtalent/openlp/easyworship6
Reviewer Review Type Date Requested Status
Raoul Snyman Approve
Tomas Groth Approve
Review via email: mp+321504@code.qastaging.launchpad.net

This proposal supersedes a proposal from 2017-03-29.

Description of the change

To post a comment you must log in.
Revision history for this message
Tomas Groth (tomasgroth) wrote : Posted in a previous version of this proposal

Generally I think it looks good! Just a few minor fixes.

review: Approve
Revision history for this message
Tomas Groth (tomasgroth) : Posted in a previous version of this proposal
review: Needs Fixing
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

I agree with Tomas, this is great. I used it the other evening to convert a user's EW6 database, and it seemed to work perfectly. Again, just a few issues, and then we can merge this.

review: Needs Fixing
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Hey Gary, there's an easier way to do your _find_files method. Use the os.walk() function. Also, if may be president to have a maximum depth just in case the user selected an incorrect directory.

review: Needs Fixing
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

I mean, it may be prudent. Don't you just love autocarrot...

Revision history for this message
Gary Talent (gtalent) wrote :

I don't think the os.walk() option is quite the same. That would iterate over every file and directory in the base EW6 directory, but we know it's a much more limited set of options. It has to be Databases/Data/Songs.db, Data/Songs.db, or Songs.db. Also, if the user was at some point messing around in the EW6 directory and made a copy of the Databases or Databases/Data directories, the os.walk() solution could pick up the wrong files. Switching to os.walk() would only save about 5 lines of code, and it would be less efficient and introduce a possible bug.

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

> That would iterate over every file and directory in the base EW6 directory

Actually, it only iterates over every directory, not every file. It gives you a list of files, and you can either iterate over the files yourself (which is usually what people do with it), or you can just check if a particular file is in the list of files.

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Hi Gary,

One other thing. The person I imported their EW6 database for said that the importer added the title of each verse at the top of each verse, so Verse 1 would start with "Verse 1" and then the rest of the lines of the verse. I don't see anything like that in your code, but I thought I'd just check that with you any way.

Revision history for this message
Gary Talent (gtalent) wrote :

OK, thanks for the path_list[-1]. That should be handy.

We've been using our import for months and haven't found any issues like that. Could you send me a copy of their database?

2705. By Gary Talent

EW6 Importer: Cleanup array cropping.

2706. By Gary Talent

Fix error message for invalid EasyWorship 6 database directories.
The old one was copied from the EasyWorship 2009 database importer.

2707. By Gary Talent

Cleanup EW6 invalid directory messages.

Revision history for this message
Gary Talent (gtalent) wrote :

Also, do you have any idea what their localization settings would be?

I think this is probably an issue with the RTF interpreter. There were some problems with how it parsed Unicode characters in some places, but I addressed it for the problems we were having.

EW (2009 and 6) places the Verse/Chorus/etc. as the first line of each slides words in the database, so I suppose this shouldn't be an altogether surprising bug.

Revision history for this message
Gary Talent (gtalent) wrote :

It looks like they have invalid titles before their songs. We can parse the titles out, but that will require a very different approach to parsing RTF text.

Revision history for this message
Gary Talent (gtalent) wrote :

Or, rather, they have invalid labels on their slides. EW just ignores it, but the importer assumes it's part of the slide if it's not one of a few different labels. The plain text form is really insufficient for differentiating between what EW considers the slide label and the slide text.

This is not an EW6 specific issue. It would read an EW 2009 database the same way.

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Hey Gary,

Is there any way we'd be able to detect if we can ignore the first line?

Revision history for this message
Gary Talent (gtalent) wrote :

It needs a better RTF parser. Right now, it just spits out the plain text and assumes the first line is the label if it starts with Verse/Chorus/etc, but EasyWorship identifies the label as being a particular type of RTF tag.

Here's an example slide:

{\rtf1\ansi\deff0\sdeasyworship2^M
{\fonttbl{\f0 Tahoma;}}^M
{\colortbl ;}^M
{\pard\sdparawysiwghidden\sdlistlevel-1\qc\qdef\sdewparatemplatestyle102{\*\sdasfactor 1}{\*\sdasbaseline 48.6}\sdastextstyle102\plain\sdewtemplatestyle102\fs98{\*\sdfsreal 48.6}{\*\sdfsdef 48.6}\sdfsauto Slide1Label\par}^M
{\pard\sdparawysiwghidden\sdlistlevel-1\qc\qdef\sdewparatemplatestyle102\plain\sdewtemplatestyle102\fs98{\*\sdfsreal 48.6}{\*\sdfsdef 48.6}\sdfsauto MoreSlide1Label\par}^M
{\pard\qc\qdef\sdewparatemplatestyle101{\*\sdasfactor 0}\plain\sdewtemplatestyle101\fs98{\*\sdfsreal 48.6}{\*\sdfsdef 48.6}\sdfsauto Slide1Text\par}^M
{\pard\sdslidemarker\qc\qdef\sdewparatemplatestyle101\plain\sdewtemplatestyle101\fs98{\*\sdfsreal 48.6}{\*\sdfsdef 48.6}\sdfsauto\par}^M
{\pard\sdparawysiwghidden\sdlistlevel-1\qc\qdef\sdewparatemplatestyle102\plain\sdewtemplatestyle102\fs98{\*\sdfsreal 48.6}{\*\sdfsdef 48.6}\sdfsauto Slide2Label\par}^M
{\pard\qc\qdef\sdewparatemplatestyle101{\*\sdasfactor 1}{\*\sdasbaseline 48.6}\sdastextstyle101\plain\sdewtemplatestyle101\fs98{\*\sdfsreal 48.6}{\*\sdfsdef 48.6}\sdfsauto Slide2Text\par}^M
}

Revision history for this message
Tomas Groth (tomasgroth) wrote :

Just wanted to add something to the discussion...
I've had a look at the EW6 song DB that triggered the RTF vs labels discussion...
As you state we strip out RTF tags that could be used to identify label. Normally it works out anyway, because we use the language of OpenLP to look for the localized tag names. That didn't work in this particular case because the translations isn't active/included in normal development setup, and we don't actually have translations for this particular language!

So in summary, I think we should ignore this issue, since for most users it won't be an issue.

review: Approve
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

I agree.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.