Re: [Openlp-core] [Merge] lp:~tomasgroth/openlp/chordpro-fixes into lp:openlp
Review: Needs Fixing Minor issue. Diff comments: > === modified file 'openlp/plugins/songs/lib/importers/chordpro.py' > --- openlp/plugins/songs/lib/importers/chordpro.py2019-04-13 13:00:22 > + > +++ openlp/plugins/songs/lib/importers/chordpro.py2019-08-28 19:52:20 > + > @@ -73,6 +75,29 @@ > self.title = tag_value > elif tag_name in ['subtitle', 'su', 'st']: > self.alternate_title = tag_value > +elif tag_name == 'composer': > +self.parse_author(tag_value, AuthorType.Music) > +elif tag_name in ['lyricist', 'author']: Sorry, one small change. According to the ChordPro site, there's no "author" but there is an "artist" > +self.parse_author(tag_value, AuthorType.Words) > +elif tag_name == 'meta': > +meta_tag_name, meta_tag_value = tag_value.split(' ', 1) > +# Skip, if no value > +if not meta_tag_value: > +continue > +# The meta-tag can contain anything. We check for title, > subtitle, composer, lyricist > +if meta_tag_name in ['title', 't']: > +self.title = meta_tag_value > +elif meta_tag_name in ['subtitle', 'su', 'st']: > +self.alternate_title = meta_tag_value > +elif meta_tag_name == 'composer': > +self.parse_author(meta_tag_value, AuthorType.Music) > +elif meta_tag_name in ['lyricist', 'author']: Same as above > +self.parse_author(meta_tag_value, AuthorType.Words) > +elif meta_tag_name in ['topic', 'topics']: > +for topic in meta_tag_value.split(','): > +self.topics.append(topic.strip()) > +elif 'ccli' in meta_tag_name: > +self.ccli_number = meta_tag_value > elif tag_name in ['comment', 'c', 'comment_italic', 'ci', > 'comment_box', 'cb']: > # Detect if the comment is used as a chorus repeat marker > if tag_value.lower().startswith('chorus'): -- https://code.launchpad.net/~tomasgroth/openlp/chordpro-fixes/+merge/371955 Your team OpenLP Core is subscribed to branch lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] Linting: Passed
Linting passed! -- https://code.launchpad.net/~tomasgroth/openlp/chordpro-fixes/+merge/371955 Your team OpenLP Core is subscribed to branch lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] macOS Test Results: Passed
macOS tests passed! -- https://code.launchpad.net/~tomasgroth/openlp/chordpro-fixes/+merge/371955 Your team OpenLP Core is subscribed to branch lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] Linux Test Results: Passed
Linux tests passed! -- https://code.launchpad.net/~tomasgroth/openlp/chordpro-fixes/+merge/371955 Your team OpenLP Core is subscribed to branch lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] JavaScript Test Results: Passed
JavaScript tests passed! -- https://code.launchpad.net/~tomasgroth/openlp/chordpro-fixes/+merge/371955 Your team OpenLP Core is subscribed to branch lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] [Merge] lp:~tomasgroth/openlp/chordpro-fixes into lp:openlp
Tomas Groth has proposed merging lp:~tomasgroth/openlp/chordpro-fixes into lp:openlp. Commit message: Added support for more directives/tags when importing chord pro files. Requested reviews: Tim Bentley (trb143) For more details, see: https://code.launchpad.net/~tomasgroth/openlp/chordpro-fixes/+merge/371955 -- Your team OpenLP Core is subscribed to branch lp:openlp. === modified file 'openlp/plugins/songs/lib/importers/chordpro.py' --- openlp/plugins/songs/lib/importers/chordpro.py 2019-04-13 13:00:22 + +++ openlp/plugins/songs/lib/importers/chordpro.py 2019-08-28 19:52:20 + @@ -28,6 +28,7 @@ from openlp.core.common.settings import Settings from openlp.plugins.songs.lib.importers.songimport import SongImport +from openlp.plugins.songs.lib.db import AuthorType log = logging.getLogger(__name__) @@ -39,6 +40,7 @@ This importer is based on the information available on these webpages: +- https://www.chordpro.org - http://webchord.sourceforge.net/tech.html - http://www.vromans.org/johan/projects/Chordii/chordpro/ - http://www.tenbyten.com/software/songsgen/help/HtmlHelp/files_reference.htm @@ -73,6 +75,29 @@ self.title = tag_value elif tag_name in ['subtitle', 'su', 'st']: self.alternate_title = tag_value +elif tag_name == 'composer': +self.parse_author(tag_value, AuthorType.Music) +elif tag_name in ['lyricist', 'author']: +self.parse_author(tag_value, AuthorType.Words) +elif tag_name == 'meta': +meta_tag_name, meta_tag_value = tag_value.split(' ', 1) +# Skip, if no value +if not meta_tag_value: +continue +# The meta-tag can contain anything. We check for title, subtitle, composer, lyricist +if meta_tag_name in ['title', 't']: +self.title = meta_tag_value +elif meta_tag_name in ['subtitle', 'su', 'st']: +self.alternate_title = meta_tag_value +elif meta_tag_name == 'composer': +self.parse_author(meta_tag_value, AuthorType.Music) +elif meta_tag_name in ['lyricist', 'author']: +self.parse_author(meta_tag_value, AuthorType.Words) +elif meta_tag_name in ['topic', 'topics']: +for topic in meta_tag_value.split(','): +self.topics.append(topic.strip()) +elif 'ccli' in meta_tag_name: +self.ccli_number = meta_tag_value elif tag_name in ['comment', 'c', 'comment_italic', 'ci', 'comment_box', 'cb']: # Detect if the comment is used as a chorus repeat marker if tag_value.lower().startswith('chorus'): @@ -156,6 +181,13 @@ 'songs/disable chords import'): current_verse = re.sub(r'\[.*?\]', '', current_verse) self.add_verse(current_verse.rstrip(), current_verse_type) +# if no title was in directives, get it from the first line +if not self.title: +(verse_def, verse_text, lang) = self.verses[0] +# strip any chords from the title +self.title = re.sub(r'\[.*?\]', '', verse_text.split('\n')[0]) +# strip the last char if it a punctuation +self.title = re.sub(r'[^\w\s]$', '', self.title) if not self.finish(): self.log_error(song_file.name) === modified file 'tests/resources/songs/chordpro/swing-low.chordpro' --- tests/resources/songs/chordpro/swing-low.chordpro 2016-09-25 19:27:46 + +++ tests/resources/songs/chordpro/swing-low.chordpro 2019-08-28 19:52:20 + @@ -1,5 +1,7 @@ {title:Swing Low Sweet Chariot} {st:Traditional} +{lyricist:Wallis Willis} +{meta:composer Wallis Willis} {start_of_chorus} Swing [D]low, sweet [G]chari[D]ot, === modified file 'tests/resources/songs/chordpro/swing-low.json' --- tests/resources/songs/chordpro/swing-low.json 2016-09-25 19:27:46 + +++ tests/resources/songs/chordpro/swing-low.json 2019-08-28 19:52:20 + @@ -1,6 +1,10 @@ { "title": "Swing Low Sweet Chariot", "alternative_title": "Traditional", +"authors": [ +["Wallis Willis", "words"], +["Wallis Willis", "music"] +], "verses": [ [ "Swing [D]low, sweet [G]chari[D]ot,\nComin' for to carry me [A7]home.\nSwing [D7]low, sweet [G]chari[D]ot,\nComin' for to [A7]carry me [D]home.", ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] [Merge] lp:~tomasgroth/openlp/chordpro-fixes into lp:openlp
The proposal to merge lp:~tomasgroth/openlp/chordpro-fixes into lp:openlp has been updated. Status: Needs review => Superseded For more details, see: https://code.launchpad.net/~tomasgroth/openlp/chordpro-fixes/+merge/371954 -- Your team OpenLP Core is subscribed to branch lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
Re: [Openlp-core] [Merge] lp:~tomasgroth/openlp/chordpro-fixes into lp:openlp
Review: Approve -- https://code.launchpad.net/~tomasgroth/openlp/chordpro-fixes/+merge/371954 Your team OpenLP Core is subscribed to branch lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] JavaScript Test Results: Failed
JavaScript tests failed, please see https://ci.openlp.io/job/MP-02-JavaScript-Tests/14/ for more details -- https://code.launchpad.net/~tomasgroth/openlp/chordpro-fixes/+merge/371954 Your team OpenLP Core is requested to review the proposed merge of lp:~tomasgroth/openlp/chordpro-fixes into lp:openlp. ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp
[Openlp-core] [Merge] lp:~tomasgroth/openlp/chordpro-fixes into lp:openlp
Tomas Groth has proposed merging lp:~tomasgroth/openlp/chordpro-fixes into lp:openlp. Commit message: Added support for more directives/tags when importing chord pro files. Requested reviews: OpenLP Core (openlp-core) For more details, see: https://code.launchpad.net/~tomasgroth/openlp/chordpro-fixes/+merge/371954 -- Your team OpenLP Core is requested to review the proposed merge of lp:~tomasgroth/openlp/chordpro-fixes into lp:openlp. === modified file 'openlp/plugins/songs/lib/importers/chordpro.py' --- openlp/plugins/songs/lib/importers/chordpro.py 2019-04-13 13:00:22 + +++ openlp/plugins/songs/lib/importers/chordpro.py 2019-08-28 19:30:47 + @@ -28,6 +28,7 @@ from openlp.core.common.settings import Settings from openlp.plugins.songs.lib.importers.songimport import SongImport +from openlp.plugins.songs.lib.db import AuthorType log = logging.getLogger(__name__) @@ -39,6 +40,7 @@ This importer is based on the information available on these webpages: +- https://www.chordpro.org - http://webchord.sourceforge.net/tech.html - http://www.vromans.org/johan/projects/Chordii/chordpro/ - http://www.tenbyten.com/software/songsgen/help/HtmlHelp/files_reference.htm @@ -73,6 +75,29 @@ self.title = tag_value elif tag_name in ['subtitle', 'su', 'st']: self.alternate_title = tag_value +elif tag_name == 'composer': +self.parse_author(tag_value, AuthorType.Music) +elif tag_name in ['lyricist', 'author']: +self.parse_author(tag_value, AuthorType.Words) +elif tag_name == 'meta': +meta_tag_name, meta_tag_value = tag_value.split(' ', 1) +# Skip, if no value +if not meta_tag_value: +continue +# The meta-tag can contain anything. We check for title, subtitle, composer, lyricist +if meta_tag_name in ['title', 't']: +self.title = meta_tag_value +elif meta_tag_name in ['subtitle', 'su', 'st']: +self.alternate_title = meta_tag_value +elif meta_tag_name == 'composer': +self.parse_author(meta_tag_value, AuthorType.Music) +elif meta_tag_name in ['lyricist', 'author']: +self.parse_author(meta_tag_value, AuthorType.Words) +elif meta_tag_name in ['topic', 'topics']: +for topic in meta_tag_value.split(','): +self.topics.append(topic.strip()) +elif 'ccli' in meta_tag_name: +self.ccli_number = meta_tag_value elif tag_name in ['comment', 'c', 'comment_italic', 'ci', 'comment_box', 'cb']: # Detect if the comment is used as a chorus repeat marker if tag_value.lower().startswith('chorus'): @@ -156,6 +181,13 @@ 'songs/disable chords import'): current_verse = re.sub(r'\[.*?\]', '', current_verse) self.add_verse(current_verse.rstrip(), current_verse_type) +# if no title was in directives, get it from the first line +if not self.title: +(verse_def, verse_text, lang) = self.verses[0] +# strip any chords from the title +self.title = re.sub(r'\[.*?\]', '', verse_text.split('\n')[0]) +# strip the last char if it a punctuation +self.title = re.sub(r'[^\w\s]$', '', self.title) if not self.finish(): self.log_error(song_file.name) === modified file 'tests/resources/songs/chordpro/swing-low.chordpro' --- tests/resources/songs/chordpro/swing-low.chordpro 2016-09-25 19:27:46 + +++ tests/resources/songs/chordpro/swing-low.chordpro 2019-08-28 19:30:47 + @@ -1,5 +1,7 @@ {title:Swing Low Sweet Chariot} {st:Traditional} +{lyricist:Wallis Willis} +{meta:composer Wallis Willis} {start_of_chorus} Swing [D]low, sweet [G]chari[D]ot, === modified file 'tests/resources/songs/chordpro/swing-low.json' --- tests/resources/songs/chordpro/swing-low.json 2016-09-25 19:27:46 + +++ tests/resources/songs/chordpro/swing-low.json 2019-08-28 19:30:47 + @@ -1,6 +1,10 @@ { "title": "Swing Low Sweet Chariot", "alternative_title": "Traditional", +"authors": [ +["Wallis Willis", "words"], +["Wallis Willis", "music"] +], "verses": [ [ "Swing [D]low, sweet [G]chari[D]ot,\nComin' for to carry me [A7]home.\nSwing [D7]low, sweet [G]chari[D]ot,\nComin' for to [A7]carry me [D]home.", ___ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp