From 90f927ae7ff93baf6bb5b57968467dfbea122416 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 24 May 2016 13:40:01 +0200 Subject: [PATCH 01/13] Fix traceback while handling traceback in videopsalm import --- openlp/plugins/songs/lib/importers/videopsalm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/importers/videopsalm.py b/openlp/plugins/songs/lib/importers/videopsalm.py index 0bc581239..6723fb4c1 100644 --- a/openlp/plugins/songs/lib/importers/videopsalm.py +++ b/openlp/plugins/songs/lib/importers/videopsalm.py @@ -117,6 +117,6 @@ class VideoPsalmImport(SongImport): if not self.finish(): self.log_error('Could not import %s' % self.title) except Exception as e: - self.log_error(translate('SongsPlugin.VideoPsalmImport', 'File %s' % file.name), + self.log_error(translate('SongsPlugin.VideoPsalmImport', 'File %s') % song_file.name, translate('SongsPlugin.VideoPsalmImport', 'Error: %s') % e) song_file.close() From 72120d8b2fd29167cc156598df6277ae26769ca9 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 24 May 2016 13:49:08 +0200 Subject: [PATCH 02/13] Skip PresentationManager files we do not support. --- openlp/plugins/songs/lib/importers/presentationmanager.py | 8 +++++++- openlp/plugins/songs/lib/importers/videopsalm.py | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/lib/importers/presentationmanager.py b/openlp/plugins/songs/lib/importers/presentationmanager.py index c26f11312..5d8db4d26 100644 --- a/openlp/plugins/songs/lib/importers/presentationmanager.py +++ b/openlp/plugins/songs/lib/importers/presentationmanager.py @@ -55,7 +55,13 @@ class PresentationManagerImport(SongImport): # Open file with detected encoding and remove encoding declaration text = open(file_path, mode='r', encoding=encoding).read() text = re.sub('.+\?>\n', '', text) - tree = etree.fromstring(text, parser=etree.XMLParser(recover=True)) + try: + tree = etree.fromstring(text, parser=etree.XMLParser(recover=True)) + except ValueError: + self.log_error(file_path, + translate('SongsPlugin.PresentationManagerImport', + 'File is not in XML-format, which is the only format supported.')) + continue root = objectify.fromstring(etree.tostring(tree)) self.process_song(root) diff --git a/openlp/plugins/songs/lib/importers/videopsalm.py b/openlp/plugins/songs/lib/importers/videopsalm.py index 6723fb4c1..edf5e89a8 100644 --- a/openlp/plugins/songs/lib/importers/videopsalm.py +++ b/openlp/plugins/songs/lib/importers/videopsalm.py @@ -117,6 +117,5 @@ class VideoPsalmImport(SongImport): if not self.finish(): self.log_error('Could not import %s' % self.title) except Exception as e: - self.log_error(translate('SongsPlugin.VideoPsalmImport', 'File %s') % song_file.name, - translate('SongsPlugin.VideoPsalmImport', 'Error: %s') % e) + self.log_error(song_file.name, translate('SongsPlugin.VideoPsalmImport', 'Error: %s') % e) song_file.close() From fd4cfd1eaa4819bd67498158e366e7854c792981 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Wed, 25 May 2016 09:04:41 +0200 Subject: [PATCH 03/13] Fix traceback during songshowplus import. Fixes bug 1585489. Fixes: https://launchpad.net/bugs/1585489 --- .../songs/lib/importers/songshowplus.py | 14 +++++-- .../songs/test_songshowplusimport.py | 2 + .../songshowplussongs/cleanse-me.json | 38 ++++++++++++++++++ .../songshowplussongs/cleanse-me.sbsong | Bin 0 -> 1093 bytes 4 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 tests/resources/songshowplussongs/cleanse-me.json create mode 100644 tests/resources/songshowplussongs/cleanse-me.sbsong diff --git a/openlp/plugins/songs/lib/importers/songshowplus.py b/openlp/plugins/songs/lib/importers/songshowplus.py index d9a205e22..23aa5173b 100644 --- a/openlp/plugins/songs/lib/importers/songshowplus.py +++ b/openlp/plugins/songs/lib/importers/songshowplus.py @@ -105,6 +105,7 @@ class SongShowPlusImport(SongImport): song_data = open(file, 'rb') while True: block_key, = struct.unpack("I", song_data.read(4)) + log.debug('block_key: %d' % block_key) # The file ends with 4 NULL's if block_key == 0: break @@ -116,7 +117,13 @@ class SongShowPlusImport(SongImport): null, verse_name_length, = struct.unpack("BB", song_data.read(2)) verse_name = self.decode(song_data.read(verse_name_length)) length_descriptor_size, = struct.unpack("B", song_data.read(1)) - log.debug(length_descriptor_size) + log.debug('length_descriptor_size: %d' % length_descriptor_size) + # In the case of song_numbers the number is in the data from the + # current position to the next block starts + if block_key == SONG_NUMBER: + sn_bytes = song_data.read(length_descriptor_size - 1) + self.song_number = int.from_bytes(sn_bytes, byteorder='little') + continue # Detect if/how long the length descriptor is if length_descriptor_size == 12 or length_descriptor_size == 20: length_descriptor, = struct.unpack("I", song_data.read(4)) @@ -126,8 +133,9 @@ class SongShowPlusImport(SongImport): length_descriptor = 0 else: length_descriptor, = struct.unpack("B", song_data.read(1)) - log.debug(length_descriptor_size) + log.debug('length_descriptor: %d' % length_descriptor) data = song_data.read(length_descriptor) + log.debug(data) if block_key == TITLE: self.title = self.decode(data) elif block_key == AUTHOR: @@ -164,8 +172,6 @@ class SongShowPlusImport(SongImport): self.ssp_verse_order_list.append(verse_tag) elif block_key == SONG_BOOK: self.song_book_name = self.decode(data) - elif block_key == SONG_NUMBER: - self.song_number = ord(data) elif block_key == CUSTOM_VERSE: verse_tag = self.to_openlp_verse_tag(verse_name) self.add_verse(self.decode(data), verse_tag) diff --git a/tests/functional/openlp_plugins/songs/test_songshowplusimport.py b/tests/functional/openlp_plugins/songs/test_songshowplusimport.py index ec86eca07..a96f21a47 100644 --- a/tests/functional/openlp_plugins/songs/test_songshowplusimport.py +++ b/tests/functional/openlp_plugins/songs/test_songshowplusimport.py @@ -52,6 +52,8 @@ class TestSongShowPlusFileImport(SongImportTestHelper): self.load_external_result_data(os.path.join(TEST_PATH, 'Beautiful Garden Of Prayer.json'))) self.file_import([os.path.join(TEST_PATH, 'a mighty fortress is our god.sbsong')], self.load_external_result_data(os.path.join(TEST_PATH, 'a mighty fortress is our god.json'))) + self.file_import([os.path.join(TEST_PATH, 'cleanse-me.sbsong')], + self.load_external_result_data(os.path.join(TEST_PATH, 'cleanse-me.json'))) class TestSongShowPlusImport(TestCase): diff --git a/tests/resources/songshowplussongs/cleanse-me.json b/tests/resources/songshowplussongs/cleanse-me.json new file mode 100644 index 000000000..c88b434f9 --- /dev/null +++ b/tests/resources/songshowplussongs/cleanse-me.json @@ -0,0 +1,38 @@ +{ + "authors": [ + "J. Edwin Orr" + ], + "ccli_number": 56307, + "comments": "", + "copyright": "Public Domain ", + "song_book_name": "", + "song_number": 438, + "title": "Cleanse Me [438]", + "topics": [ + "Cleansing", + "Communion", + "Consecration", + "Holiness", + "Holy Spirit", + "Revival" + ], + "verse_order_list": [], + "verses": [ + [ + "Search me, O God,\r\nAnd know my heart today;\r\nTry me, O Savior,\r\nKnow my thoughts, I pray.\r\nSee if there be\r\nSome wicked way in me;\r\nCleanse me from every sin\r\nAnd set me free.", + "v1" + ], + [ + "I praise Thee, Lord,\r\nFor cleansing me from sin;\r\nFulfill Thy Word,\r\nAnd make me pure within.\r\nFill me with fire\r\nWhere once I burned with shame;\r\nGrant my desire\r\nTo magnify Thy name.", + "v2" + ], + [ + "Lord, take my life,\r\nAnd make it wholly Thine;\r\nFill my poor heart\r\nWith Thy great love divine.\r\nTake all my will,\r\nMy passion, self and pride;\r\nI now surrender, Lord\r\nIn me abide.", + "v3" + ], + [ + "O Holy Ghost,\r\nRevival comes from Thee;\r\nSend a revival,\r\nStart the work in me.\r\nThy Word declares\r\nThou wilt supply our need;\r\nFor blessings now,\r\nO Lord, I humbly plead.", + "v4" + ] + ] +} diff --git a/tests/resources/songshowplussongs/cleanse-me.sbsong b/tests/resources/songshowplussongs/cleanse-me.sbsong new file mode 100644 index 0000000000000000000000000000000000000000..aa9915f8ecb4b40487d288e4e86c8926104cc294 GIT binary patch literal 1093 zcmYjRO>Yx15KUW}wkd&%JJKBZIz&}V3$4Tnl_nIZf=EOUh=a2`$y)K+E8ClBe-j5T zs6t#g@W*(w8&D3b*w1ff-kY)Wq}6J*<-2oqc6`2p)dSfbTo_h1FkLf!IXyZ5x(W2Y zoOFlY_vqarU8YNIw*VaoeD7m9F*>0)E?3&pBVcm2b-S^RpBag1xF_WHB%-Azc7=X)}mO7bp zN=sD{yyc9v|N4W|sdqW?f>9`F+h_?K!NU>rp*Z-n=HPkzXI)Rj%{XJY_~5*l=sQnI z-FIzgO*k?mC+hV}Gu6f*prV_GE}nBWXJHm4^e%PGw1tblFl*g0qp9}raZ@{THer~Z zl-`OT@F`@fHZ<_cLUTnahdN^HkbP$Lw5p3*&}u8c*Q}hhf7IG3);cOOddjPD)Y5dM zW#){L9NJ3b8f_I74sPpFL7WH?XEV<#l5q>BR4)(!Gh<1u#83sr#vuJQ!c_>`*&YQp zQ&MO};dLqnu1LlkO7GdGjJqld0n6Y>O+cz`+^*R;ZGRimTL+bc%!P;wpLn4c%20yw zhi1YuDx@DFD=G2~0n|~fuUm%xJ3ntOh{#?I3jIus@*D(mrC5kiR}`q`N>7$KmA0T8 z6T>iNXF(hw^RT%X7+6;36YvXMj`Z*$lsAv0xrB&VgIu1M7M&63o_M@_;qZ_Xui^^r p2)YZq=x+$Z>k6`8H(*p~ucLr_0`9CD@e~_*$nxjVdbYk1;4gFPC9D7d literal 0 HcmV?d00001 From 3163d335439691499cd2dd4d1c0a0c1800333a35 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Thu, 26 May 2016 15:03:00 +0200 Subject: [PATCH 04/13] Fix of tracback during SongPro import. Fixes bug 1582152. Fixes: https://launchpad.net/bugs/1582152 --- openlp/plugins/songs/lib/importers/songpro.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/importers/songpro.py b/openlp/plugins/songs/lib/importers/songpro.py index b1c8e7fe8..90fe34492 100644 --- a/openlp/plugins/songs/lib/importers/songpro.py +++ b/openlp/plugins/songs/lib/importers/songpro.py @@ -72,7 +72,7 @@ class SongProImport(SongImport): Receive a single file or a list of files to import. """ self.encoding = None - with open(self.import_source, 'rt') as songs_file: + with open(self.import_source, 'rt', errors='ignore') as songs_file: self.import_wizard.progress_bar.setMaximum(0) tag = '' text = '' From 2443b94edaa28715670f9661a0f649538ca2071f Mon Sep 17 00:00:00 2001 From: Ken Roberts Date: Mon, 6 Jun 2016 08:16:09 -0700 Subject: [PATCH 05/13] Convert htmlbuilder strings to Template() --- openlp/core/lib/htmlbuilder.py | 181 +++++++++--------- .../openlp_core_lib/test_htmlbuilder.py | 38 ++-- 2 files changed, 116 insertions(+), 103 deletions(-) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index f0d8ddef2..28976b68c 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -390,14 +390,14 @@ is the function which has to be called from outside. The generated and returned import logging from PyQt5 import QtWebKit +from string import Template from openlp.core.common import Settings from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, VerticalType, HorizontalType log = logging.getLogger(__name__) -# TODO: Verify where this is used before converting to python3 -HTMLSRC = """ +HTML_SRC = Template(""" @@ -411,14 +411,14 @@ HTMLSRC = """ -webkit-user-select: none; } body { - %s; + ${bg_css}; } .size { position: absolute; left: 0px; top: 0px; - width: 100%%; - height: 100%%; + width: 100%; + height: 100%; } #black { z-index: 8; @@ -431,14 +431,14 @@ body { #image { z-index: 2; } -%s +${css_additions} #footer { position: absolute; z-index: 6; - %s + ${footer_css} } /* lyric css */ -%s +${lyrics_css} sup { font-size: 0.6em; vertical-align: top; @@ -448,8 +448,8 @@ sup { - - -%s + + +${html_additions}
-""" +""") + +LYRICS_SRC = Template(""" +.lyricstable { + z-index: 5; + position: absolute; + display: table; + ${stable} +} +.lyricscell { + display: table-cell; + word-wrap: break-word; + -webkit-transition: opacity 0.4s ease; + ${lyrics} +} +.lyricsmain { + ${main} +} +""") + +FOOTER_SRC = Template(""" +left: ${left}px; +bottom: ${bottom}px; +width: ${width}px; +font-family: ${family}; +font-size: ${size}pt; +color: ${color}; +text-align: left; +white-space: ${space}; +""") + +LYRICS_FORMAT_SRC = Template(""" +${justify}word-wrap: break-word; +text-align: ${align}; +vertical-align: ${valign}; +font-family: ${font}; +font-size: ${size}pt; +color: ${color}; +line-height: ${line}%; +margin: 0; +padding: 0; +padding-bottom: ${bottom}; +padding-left: ${left}px; +width: ${width}px; +height: ${height}px;${font_style}${font_weight} +""") def build_html(item, screen, is_live, background, image=None, plugins=None): @@ -582,18 +627,17 @@ def build_html(item, screen, is_live, background, image=None, plugins=None): css_additions += plugin.get_display_css() js_additions += plugin.get_display_javascript() html_additions += plugin.get_display_html() - html = HTMLSRC % ( - build_background_css(item, width), - css_additions, - build_footer_css(item, height), - build_lyrics_css(item), - 'true' if theme_data and theme_data.display_slide_transition and is_live else 'false', - js_additions, - bgimage_src, - image_src, - html_additions - ) - return html + return HTML_SRC.substitute(bg_css=build_background_css(item, width), + css_additions=css_additions, + footer_css=build_footer_css(item, height), + lyrics_css=build_lyrics_css(item), + transitions='true' if (theme_data and + theme_data.display_slide_transition and + is_live) else 'false', + js_additions=js_additions, + bg_image=bgimage_src, + image=image_src, + html_additions=html_additions) def webkit_version(): @@ -650,24 +694,6 @@ def build_lyrics_css(item): :param item: Service Item containing theme and location information """ - # TODO: Verify this before converting to python3 - style = """ -.lyricstable { - z-index: 5; - position: absolute; - display: table; - %s -} -.lyricscell { - display: table-cell; - word-wrap: break-word; - -webkit-transition: opacity 0.4s ease; - %s -} -.lyricsmain { - %s -} -""" theme_data = item.theme_data lyricstable = '' lyrics = '' @@ -680,8 +706,7 @@ def build_lyrics_css(item): lyricsmain += ' text-shadow: {theme} {shadow}px ' \ '{shadow}px;'.format(theme=theme_data.font_main_shadow_color, shadow=theme_data.font_main_shadow_size) - lyrics_css = style % (lyricstable, lyrics, lyricsmain) - return lyrics_css + return LYRICS_SRC.substitute(stable=lyricstable, lyrics=lyrics, main=lyricsmain) def build_lyrics_outline_css(theme_data): @@ -710,38 +735,23 @@ def build_lyrics_format_css(theme_data, width, height): """ align = HorizontalType.Names[theme_data.display_horizontal_align] valign = VerticalType.Names[theme_data.display_vertical_align] - if theme_data.font_main_outline: - left_margin = int(theme_data.font_main_outline_size) * 2 - else: - left_margin = 0 - justify = 'white-space:pre-wrap;' + left_margin = (int(theme_data.font_main_outline_size) * 2) if theme_data.font_main_outline else 0 # fix tag incompatibilities - if theme_data.display_horizontal_align == HorizontalType.Justify: - justify = '' - if theme_data.display_vertical_align == VerticalType.Bottom: - padding_bottom = '0.5em' - else: - padding_bottom = '0' - lyrics = '{justify} word-wrap: break-word; ' \ - 'text-align: {align}; vertical-align: {valign}; font-family: {font}; ' \ - 'font-size: {size}pt; color: {color}; line-height: {line:d}%; margin: 0;' \ - 'padding: 0; padding-bottom: {bottom}; padding-left: {left}px; width: {width}px; ' \ - 'height: {height}px; '.format(justify=justify, - align=align, - valign=valign, - font=theme_data.font_main_name, - size=theme_data.font_main_size, - color=theme_data.font_main_color, - line=100 + int(theme_data.font_main_line_adjustment), - bottom=padding_bottom, - left=left_margin, - width=width, - height=height) - if theme_data.font_main_italics: - lyrics += 'font-style:italic; ' - if theme_data.font_main_bold: - lyrics += 'font-weight:bold; ' - return lyrics + justify = '' if (theme_data.display_horizontal_align == HorizontalType.Justify) else 'white-space:pre-wrap;\n' + padding_bottom = '0.5em' if (theme_data.display_vertical_align == VerticalType.Bottom) else '0' + return LYRICS_FORMAT_SRC.substitute(justify=justify, + align=align, + valign=valign, + font=theme_data.font_main_name, + size=theme_data.font_main_size, + color=theme_data.font_main_color, + line='{line:d}'.format(line=100 + int(theme_data.font_main_line_adjustment)), + bottom=padding_bottom, + left=left_margin, + width=width, + height=height, + font_style='\nfont-style:italic;' if theme_data.font_main_italics else '', + font_weight='\nfont-weight:bold;' if theme_data.font_main_bold else '') def build_footer_css(item, height): @@ -751,22 +761,11 @@ def build_footer_css(item, height): :param item: Service Item to be processed. :param height: """ - style = """ - left: {left}px; - bottom: {bottom}px; - width: {width}px; - font-family: {family}; - font-size: {size}pt; - color: {color}; - text-align: left; - white-space: {space}; - """ theme = item.theme_data if not theme or not item.footer: return '' bottom = height - int(item.footer.y()) - int(item.footer.height()) whitespace = 'normal' if Settings().value('themes/wrap footer') else 'nowrap' - lyrics_html = style.format(left=item.footer.x(), bottom=bottom, width=item.footer.width(), - family=theme.font_footer_name, size=theme.font_footer_size, - color=theme.font_footer_color, space=whitespace) - return lyrics_html + return FOOTER_SRC.substitute(left=item.footer.x(), bottom=bottom, width=item.footer.width(), + family=theme.font_footer_name, size=theme.font_footer_size, + color=theme.font_footer_color, space=whitespace) diff --git a/tests/functional/openlp_core_lib/test_htmlbuilder.py b/tests/functional/openlp_core_lib/test_htmlbuilder.py index 48c60b55f..5f385e3eb 100644 --- a/tests/functional/openlp_core_lib/test_htmlbuilder.py +++ b/tests/functional/openlp_core_lib/test_htmlbuilder.py @@ -182,19 +182,33 @@ LYRICS_CSS = """ } """ LYRICS_OUTLINE_CSS = ' -webkit-text-stroke: 0.125em #000000; -webkit-text-fill-color: #FFFFFF; ' -LYRICS_FORMAT_CSS = ' word-wrap: break-word; text-align: justify; vertical-align: bottom; ' + \ - 'font-family: Arial; font-size: 40pt; color: #FFFFFF; line-height: 108%; margin: 0;padding: 0; ' + \ - 'padding-bottom: 0.5em; padding-left: 2px; width: 1580px; height: 810px; font-style:italic; font-weight:bold; ' +LYRICS_FORMAT_CSS = """ +word-wrap: break-word; +text-align: justify; +vertical-align: bottom; +font-family: Arial; +font-size: 40pt; +color: #FFFFFF; +line-height: 108%; +margin: 0; +padding: 0; +padding-bottom: 0.5em; +padding-left: 2px; +width: 1580px; +height: 810px; +font-style:italic; +font-weight:bold; +""" FOOTER_CSS_BASE = """ - left: 10px; - bottom: 0px; - width: 1260px; - font-family: Arial; - font-size: 12pt; - color: #FFFFFF; - text-align: left; - white-space: %s; - """ +left: 10px; +bottom: 0px; +width: 1260px; +font-family: Arial; +font-size: 12pt; +color: #FFFFFF; +text-align: left; +white-space: %s; +""" FOOTER_CSS = FOOTER_CSS_BASE % ('nowrap') FOOTER_CSS_WRAP = FOOTER_CSS_BASE % ('normal') FOOTER_CSS_INVALID = '' From 0d2745a1d18f278d9a1d1998497b587815f7c535 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 7 Jun 2016 09:35:06 +0200 Subject: [PATCH 06/13] Fix bug #1589815 by first reducing the string to digits only and then checking if there's anything left. --- .../plugins/songs/lib/importers/opensong.py | 2 +- .../songs/test_opensongimport.py | 6 +- tests/helpers/songfileimport.py | 3 +- tests/resources/opensongsongs/Amazing Grace | 2 +- .../opensongsongs/Amazing Grace with bad CCLI | 56 +++++++++++++++++++ .../Amazing Grace without CCLI.json | 42 ++++++++++++++ 6 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 tests/resources/opensongsongs/Amazing Grace with bad CCLI create mode 100644 tests/resources/opensongsongs/Amazing Grace without CCLI.json diff --git a/openlp/plugins/songs/lib/importers/opensong.py b/openlp/plugins/songs/lib/importers/opensong.py index a1bfacbcb..161f8cd68 100644 --- a/openlp/plugins/songs/lib/importers/opensong.py +++ b/openlp/plugins/songs/lib/importers/opensong.py @@ -156,8 +156,8 @@ class OpenSongImport(SongImport): ustring = str(root.__getattr__(attr)) if isinstance(fn_or_string, str): if attr in ['ccli']: + ustring = ''.join(re.findall('\d+', ustring)) if ustring: - ustring = ''.join(re.findall('\d+', ustring)) setattr(self, fn_or_string, int(ustring)) else: setattr(self, fn_or_string, None) diff --git a/tests/functional/openlp_plugins/songs/test_opensongimport.py b/tests/functional/openlp_plugins/songs/test_opensongimport.py index 7d51527b8..d1386005f 100644 --- a/tests/functional/openlp_plugins/songs/test_opensongimport.py +++ b/tests/functional/openlp_plugins/songs/test_opensongimport.py @@ -22,13 +22,13 @@ """ This module contains tests for the OpenSong song importer. """ - import os from unittest import TestCase -from tests.helpers.songfileimport import SongImportTestHelper from openlp.plugins.songs.lib.importers.opensong import OpenSongImport from openlp.core.common import Registry + +from tests.helpers.songfileimport import SongImportTestHelper from tests.functional import patch, MagicMock TEST_PATH = os.path.abspath( @@ -54,6 +54,8 @@ class TestOpenSongFileImport(SongImportTestHelper): self.load_external_result_data(os.path.join(TEST_PATH, 'One, Two, Three, Four, Five.json'))) self.file_import([os.path.join(TEST_PATH, 'Amazing Grace2')], self.load_external_result_data(os.path.join(TEST_PATH, 'Amazing Grace.json'))) + self.file_import([os.path.join(TEST_PATH, 'Amazing Grace with bad CCLI')], + self.load_external_result_data(os.path.join(TEST_PATH, 'Amazing Grace without CCLI.json'))) class TestOpenSongImport(TestCase): diff --git a/tests/helpers/songfileimport.py b/tests/helpers/songfileimport.py index bc4ebc9b5..9a9ab7d2b 100644 --- a/tests/helpers/songfileimport.py +++ b/tests/helpers/songfileimport.py @@ -29,6 +29,7 @@ from unittest import TestCase from openlp.plugins.songs.lib.importers.opensong import OpenSongImport from openlp.core.common import Registry + from tests.functional import patch, MagicMock, call log = logging.getLogger(__name__) @@ -36,7 +37,7 @@ log = logging.getLogger(__name__) class SongImportTestHelper(TestCase): """ - This class is designed to be a helper class to reduce repition when testing the import of song files. + This class is designed to be a helper class to reduce repetition when testing the import of song files. """ def __init__(self, *args, **kwargs): super(SongImportTestHelper, self).__init__(*args, **kwargs) diff --git a/tests/resources/opensongsongs/Amazing Grace b/tests/resources/opensongsongs/Amazing Grace index 97062dc21..6b2c172b5 100644 --- a/tests/resources/opensongsongs/Amazing Grace +++ b/tests/resources/opensongsongs/Amazing Grace @@ -53,4 +53,4 @@ - \ No newline at end of file + diff --git a/tests/resources/opensongsongs/Amazing Grace with bad CCLI b/tests/resources/opensongsongs/Amazing Grace with bad CCLI new file mode 100644 index 000000000..292d4a825 --- /dev/null +++ b/tests/resources/opensongsongs/Amazing Grace with bad CCLI @@ -0,0 +1,56 @@ + + + Amazing Grace (Demonstration) + John Newton, Edwin Excell & John P. Rees + Public Domain + V1 V2 V3 V4 V5 + + + GE + God: Assurance/Grace/Salvation + Worship: Praise + + + + [V] +;Test the chords format +;Chords beging with . +;Verses begin with their verse number +;Link words with _ +;Comments begin with ; +. D D7 G D +1A______ma________zing grace! How sweet the sound! +2'Twas grace that taught my heart to fear, +3The Lord has pro____mised good to me, +4Thro' ma________ny dan____gers, toils and snares +5When we've been there ten thou__sand years, + +. Bm E A A7 +1That saved a wretch like me! +2And grace my fears re___lieved. +3His Word my hope se___cures. +4I have al___rea____dy come. +5Bright shi___ning as the sun, + +. D D7 G D +1I once was lost, but now am found; +2How pre___cious did that grace ap____pear, +3He will my shield and por___tion be +4'Tis grace that brought me safe thus far, +5We've no less days to sing God's praise, + +. Bm A G D +1Was blind, but now I see. +2The hour I first be_lieved. +3As long as life en_dures. +4And grace will lead me home. +5Than when we first be_gun. + + + Demonstration Songs 0 + + + + + + diff --git a/tests/resources/opensongsongs/Amazing Grace without CCLI.json b/tests/resources/opensongsongs/Amazing Grace without CCLI.json new file mode 100644 index 000000000..799fd33d9 --- /dev/null +++ b/tests/resources/opensongsongs/Amazing Grace without CCLI.json @@ -0,0 +1,42 @@ +{ + "authors": [ + "John Newton", + "Edwin Excell", + "John P. Rees" + ], + "ccli_number": null, + "comments": "\n\n\n", + "copyright": "Public Domain ", + "song_book_name": "Demonstration Songs", + "song_number": 0, + "title": "Amazing Grace (Demonstration)", + "topics": [ + "Assurance", + "Grace", + "Praise", + "Salvation" + ], + "verse_order_list": [], + "verses": [ + [ + "Amazing grace! How sweet the sound!\nThat saved a wretch like me!\nI once was lost, but now am found;\nWas blind, but now I see.", + "v1" + ], + [ + "'Twas grace that taught my heart to fear,\nAnd grace my fears relieved.\nHow precious did that grace appear,\nThe hour I first believed.", + "v2" + ], + [ + "The Lord has promised good to me,\nHis Word my hope secures.\nHe will my shield and portion be\nAs long as life endures.", + "v3" + ], + [ + "Thro' many dangers, toils and snares\nI have already come.\n'Tis grace that brought me safe thus far,\nAnd grace will lead me home.", + "v4" + ], + [ + "When we've been there ten thousand years,\nBright shining as the sun,\nWe've no less days to sing God's praise,\nThan when we first begun.", + "v5" + ] + ] +} From 5fe54b59075c2b9da658e0ee0a14cac38c2b697a Mon Sep 17 00:00:00 2001 From: Ken Roberts Date: Tue, 7 Jun 2016 06:12:22 -0700 Subject: [PATCH 07/13] Beauty spa for the htmlbuilder --- openlp/core/lib/htmlbuilder.py | 361 +++++++++--------- .../openlp_core_lib/test_htmlbuilder.py | 361 +++++++++--------- 2 files changed, 361 insertions(+), 361 deletions(-) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 28976b68c..6f2fee68c 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -398,200 +398,199 @@ from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, Vertic log = logging.getLogger(__name__) HTML_SRC = Template(""" - - - -OpenLP Display - - - - - - -${html_additions} -
- -
- - -""") + function show_text_completed(){ + return (timer == null); + } + + + + + + ${html_additions} +
+ +
+ + + """) LYRICS_SRC = Template(""" -.lyricstable { - z-index: 5; - position: absolute; - display: table; - ${stable} -} -.lyricscell { - display: table-cell; - word-wrap: break-word; - -webkit-transition: opacity 0.4s ease; - ${lyrics} -} -.lyricsmain { - ${main} -} -""") + .lyricstable { + z-index: 5; + position: absolute; + display: table; + ${stable} + } + .lyricscell { + display: table-cell; + word-wrap: break-word; + -webkit-transition: opacity 0.4s ease; + ${lyrics} + } + .lyricsmain { + ${main} + } + """) FOOTER_SRC = Template(""" -left: ${left}px; -bottom: ${bottom}px; -width: ${width}px; -font-family: ${family}; -font-size: ${size}pt; -color: ${color}; -text-align: left; -white-space: ${space}; -""") + left: ${left}px; + bottom: ${bottom}px; + width: ${width}px; + font-family: ${family}; + font-size: ${size}pt; + color: ${color}; + text-align: left; + white-space: ${space}; + """) LYRICS_FORMAT_SRC = Template(""" -${justify}word-wrap: break-word; -text-align: ${align}; -vertical-align: ${valign}; -font-family: ${font}; -font-size: ${size}pt; -color: ${color}; -line-height: ${line}%; -margin: 0; -padding: 0; -padding-bottom: ${bottom}; -padding-left: ${left}px; -width: ${width}px; -height: ${height}px;${font_style}${font_weight} -""") + ${justify}word-wrap: break-word; + text-align: ${align}; + vertical-align: ${valign}; + font-family: ${font}; + font-size: ${size}pt; + color: ${color}; + line-height: ${line}%; + margin: 0; + padding: 0; + padding-bottom: ${bottom}; + padding-left: ${left}px; + width: ${width}px; + height: ${height}px;${font_style}${font_weight} + """) def build_html(item, screen, is_live, background, image=None, plugins=None): @@ -737,7 +736,7 @@ def build_lyrics_format_css(theme_data, width, height): valign = VerticalType.Names[theme_data.display_vertical_align] left_margin = (int(theme_data.font_main_outline_size) * 2) if theme_data.font_main_outline else 0 # fix tag incompatibilities - justify = '' if (theme_data.display_horizontal_align == HorizontalType.Justify) else 'white-space:pre-wrap;\n' + justify = '' if (theme_data.display_horizontal_align == HorizontalType.Justify) else ' white-space: pre-wrap;\n' padding_bottom = '0.5em' if (theme_data.display_vertical_align == VerticalType.Bottom) else '0' return LYRICS_FORMAT_SRC.substitute(justify=justify, align=align, @@ -750,8 +749,8 @@ def build_lyrics_format_css(theme_data, width, height): left=left_margin, width=width, height=height, - font_style='\nfont-style:italic;' if theme_data.font_main_italics else '', - font_weight='\nfont-weight:bold;' if theme_data.font_main_bold else '') + font_style='\n font-style: italic;' if theme_data.font_main_italics else '', + font_weight='\n font-weight: bold;' if theme_data.font_main_bold else '') def build_footer_css(item, height): diff --git a/tests/functional/openlp_core_lib/test_htmlbuilder.py b/tests/functional/openlp_core_lib/test_htmlbuilder.py index 5f385e3eb..e76faa311 100644 --- a/tests/functional/openlp_core_lib/test_htmlbuilder.py +++ b/tests/functional/openlp_core_lib/test_htmlbuilder.py @@ -14,201 +14,200 @@ from tests.functional import MagicMock, patch from tests.helpers.testmixin import TestMixin HTML = """ - - - -OpenLP Display - - - - - - -plugin HTML -
- -
- - -""" + function show_text_completed(){ + return (timer == null); + } + + + + + + plugin HTML +
+ +
+ + + """ BACKGROUND_CSS_RADIAL = 'background: -webkit-gradient(radial, 5 50%, 100, 5 50%, 5, from(#000000), to(#FFFFFF)) fixed' LYRICS_CSS = """ -.lyricstable { - z-index: 5; - position: absolute; - display: table; - left: 10px; top: 20px; -} -.lyricscell { - display: table-cell; - word-wrap: break-word; - -webkit-transition: opacity 0.4s ease; - lyrics_format_css -} -.lyricsmain { - text-shadow: #000000 5px 5px; -} -""" + .lyricstable { + z-index: 5; + position: absolute; + display: table; + left: 10px; top: 20px; + } + .lyricscell { + display: table-cell; + word-wrap: break-word; + -webkit-transition: opacity 0.4s ease; + lyrics_format_css + } + .lyricsmain { + text-shadow: #000000 5px 5px; + } + """ LYRICS_OUTLINE_CSS = ' -webkit-text-stroke: 0.125em #000000; -webkit-text-fill-color: #FFFFFF; ' LYRICS_FORMAT_CSS = """ -word-wrap: break-word; -text-align: justify; -vertical-align: bottom; -font-family: Arial; -font-size: 40pt; -color: #FFFFFF; -line-height: 108%; -margin: 0; -padding: 0; -padding-bottom: 0.5em; -padding-left: 2px; -width: 1580px; -height: 810px; -font-style:italic; -font-weight:bold; -""" + word-wrap: break-word; + text-align: justify; + vertical-align: bottom; + font-family: Arial; + font-size: 40pt; + color: #FFFFFF; + line-height: 108%; + margin: 0; + padding: 0; + padding-bottom: 0.5em; + padding-left: 2px; + width: 1580px; + height: 810px; + font-style: italic; + font-weight: bold; + """ FOOTER_CSS_BASE = """ -left: 10px; -bottom: 0px; -width: 1260px; -font-family: Arial; -font-size: 12pt; -color: #FFFFFF; -text-align: left; -white-space: %s; -""" + left: 10px; + bottom: 0px; + width: 1260px; + font-family: Arial; + font-size: 12pt; + color: #FFFFFF; + text-align: left; + white-space: %s; + """ FOOTER_CSS = FOOTER_CSS_BASE % ('nowrap') FOOTER_CSS_WRAP = FOOTER_CSS_BASE % ('normal') FOOTER_CSS_INVALID = '' @@ -257,6 +256,8 @@ class Htmbuilder(TestCase, TestMixin): # WHEN: Create the html. html = build_html(item, screen, is_live, background, plugins=plugins) + self.maxDiff = None + # THEN: The returned html should match. self.assertEqual(html, HTML, 'The returned html should match') From 828741ec84f9d2a175990295722088043e4846d7 Mon Sep 17 00:00:00 2001 From: Ken Roberts Date: Tue, 7 Jun 2016 06:21:07 -0700 Subject: [PATCH 08/13] Remove testing verbosity flag --- tests/functional/openlp_core_lib/test_htmlbuilder.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/functional/openlp_core_lib/test_htmlbuilder.py b/tests/functional/openlp_core_lib/test_htmlbuilder.py index e76faa311..31885c2e2 100644 --- a/tests/functional/openlp_core_lib/test_htmlbuilder.py +++ b/tests/functional/openlp_core_lib/test_htmlbuilder.py @@ -256,8 +256,6 @@ class Htmbuilder(TestCase, TestMixin): # WHEN: Create the html. html = build_html(item, screen, is_live, background, plugins=plugins) - self.maxDiff = None - # THEN: The returned html should match. self.assertEqual(html, HTML, 'The returned html should match') From b84dbb15a2f077642f641eb775e81095c9a6e2ad Mon Sep 17 00:00:00 2001 From: Ken Roberts Date: Wed, 8 Jun 2016 13:26:01 -0700 Subject: [PATCH 09/13] Oops in string format --- openlp/plugins/bibles/forms/editbibledialog.py | 2 +- openlp/plugins/songs/lib/mediaitem.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/bibles/forms/editbibledialog.py b/openlp/plugins/bibles/forms/editbibledialog.py index ca3bea4ed..f1e833637 100644 --- a/openlp/plugins/bibles/forms/editbibledialog.py +++ b/openlp/plugins/bibles/forms/editbibledialog.py @@ -104,7 +104,7 @@ class Ui_EditBibleDialog(object): for book in BiblesResourcesDB.get_books(): self.book_name_label[book['abbreviation']] = QtWidgets.QLabel(self.book_name_widget) self.book_name_label[book['abbreviation']].setObjectName( - 'book_name_label[{name}]'.format(book=book['abbreviation'])) + 'book_name_label[{book}]'.format(book=book['abbreviation'])) self.book_name_edit[book['abbreviation']] = QtWidgets.QLineEdit(self.book_name_widget) self.book_name_edit[book['abbreviation']].setObjectName( 'book_name_edit[{name}]'.format(name=book['abbreviation'])) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index f52abb86f..b89858019 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -603,7 +603,7 @@ class SongMediaItem(MediaManagerItem): else: verse_index = VerseType.from_tag(verse[0]['type']) verse_tag = VerseType.translated_tags[verse_index] - verse_def = '{tag}{label}'.format(tzg=verse_tag, text=verse[0]['label']) + verse_def = '{tag}{text}'.format(tag=verse_tag, text=verse[0]['label']) service_item.add_from_text(verse[1], verse_def) service_item.title = song.title author_list = self.generate_footer(service_item, song) From e222a11390c16f2486a82b9d52f9138f3a04d254 Mon Sep 17 00:00:00 2001 From: Ken Roberts Date: Wed, 8 Jun 2016 13:41:21 -0700 Subject: [PATCH 10/13] String format oops --- openlp/core/ui/firsttimeform.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index cadb4814f..183c577ef 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -571,7 +571,7 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties): text = translate('OpenLP.FirstTimeWizard', 'Download complete. Click the {button} button to start OpenLP.' ).format(button=clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) - self.progress_label.setText() + self.progress_label.setText(text) else: if self.has_run_wizard: text = translate('OpenLP.FirstTimeWizard', @@ -582,7 +582,7 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties): text = translate('OpenLP.FirstTimeWizard', 'Click the {button} button to start OpenLP.' ).format(button=clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) - self.progress_label.setText() + self.progress_label.setText(text) self.finish_button.setVisible(True) self.finish_button.setEnabled(True) self.cancel_button.setVisible(False) From aedcecc7ffa37b390b4cb3077f719f91c581e9be Mon Sep 17 00:00:00 2001 From: Ken Roberts Date: Wed, 8 Jun 2016 19:57:21 -0700 Subject: [PATCH 11/13] String format oops --- openlp/core/ui/firsttimeform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 183c577ef..9ae2e0898 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -565,7 +565,7 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties): if self.has_run_wizard: text = translate('OpenLP.FirstTimeWizard', 'Download complete. Click the {button} button to return to OpenLP.' - ).format(text=clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) + ).format(button=clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) self.progress_label.setText(text) else: text = translate('OpenLP.FirstTimeWizard', From 41c0d3fcf9c01430ab36d8c42f01021f5d8bdf88 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 14 Jun 2016 21:11:57 +0200 Subject: [PATCH 12/13] Fix various pyodbc related issues. Fixes bug 1590657. Fixes: https://launchpad.net/bugs/1590657 --- .../plugins/songs/lib/importers/mediashout.py | 28 +++++++++++-------- openlp/plugins/songs/lib/importers/opspro.py | 6 ++-- .../songs/lib/importers/worshipcenterpro.py | 2 +- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/openlp/plugins/songs/lib/importers/mediashout.py b/openlp/plugins/songs/lib/importers/mediashout.py index cb3a19640..af9b855a0 100644 --- a/openlp/plugins/songs/lib/importers/mediashout.py +++ b/openlp/plugins/songs/lib/importers/mediashout.py @@ -24,15 +24,17 @@ The :mod:`mediashout` module provides the functionality for importing a MediaShout database into the OpenLP database. """ -# WARNING: See https://docs.python.org/2/library/sqlite3.html for value substitution +# WARNING: See https://docs.python.org/3/library/sqlite3.html for value substitution # in SQL statements import pyodbc +import logging from openlp.core.lib import translate from openlp.plugins.songs.lib.importers.songimport import SongImport VERSE_TAGS = ['V', 'C', 'B', 'O', 'P', 'I', 'E'] +log = logging.getLogger(__name__) class MediaShoutImport(SongImport): @@ -44,17 +46,19 @@ class MediaShoutImport(SongImport): """ Initialise the MediaShout importer. """ - SongImport.__init__(self, manager, **kwargs) + super(MediaShoutImport, self).__init__(manager, **kwargs) + #SongImport.__init__(self, manager, **kwargs) def do_import(self): """ Receive a single file to import. """ try: - conn = pyodbc.connect('DRIVER={Microsoft Access Driver (*.mdb)};DBQ={source};' - 'PWD=6NOZ4eHK7k'.format(sorce=self.import_source)) - except: + conn = pyodbc.connect('DRIVER={{Microsoft Access Driver (*.mdb)}};DBQ={source};' + 'PWD=6NOZ4eHK7k'.format(source=self.import_source)) + except Exception as e: # Unfortunately no specific exception type + log.exception(e) self.log_error(self.import_source, translate('SongsPlugin.MediaShoutImport', 'Unable to open the MediaShout database.')) return @@ -63,17 +67,19 @@ class MediaShoutImport(SongImport): songs = cursor.fetchall() self.import_wizard.progress_bar.setMaximum(len(songs)) for song in songs: + topics = [] if self.stop_import_flag: break - cursor.execute('SELECT Type, Number, Text FROM Verses WHERE Record = ? ORDER BY Type, Number', song.Record) + cursor.execute('SELECT Type, Number, Text FROM Verses WHERE Record = ? ORDER BY Type, Number', float(song.Record)) verses = cursor.fetchall() - cursor.execute('SELECT Type, Number, POrder FROM PlayOrder WHERE Record = ? ORDER BY POrder', song.Record) + cursor.execute('SELECT Type, Number, POrder FROM PlayOrder WHERE Record = ? ORDER BY POrder', float(song.Record)) verse_order = cursor.fetchall() - cursor.execute('SELECT Name FROM Themes INNER JOIN SongThemes ON SongThemes.ThemeId = Themes.ThemeId ' - 'WHERE SongThemes.Record = ?', song.Record) - topics = cursor.fetchall() + if cursor.tables(table='TableName', tableType='TABLE').fetchone(): + cursor.execute('SELECT Name FROM Themes INNER JOIN SongThemes ON SongThemes.ThemeId = Themes.ThemeId ' + 'WHERE SongThemes.Record = ?', float(song.Record)) + topics = cursor.fetchall() cursor.execute('SELECT Name FROM Groups INNER JOIN SongGroups ON SongGroups.GroupId = Groups.GroupId ' - 'WHERE SongGroups.Record = ?', song.Record) + 'WHERE SongGroups.Record = ?', float(song.Record)) topics += cursor.fetchall() self.process_song(song, verses, verse_order, topics) diff --git a/openlp/plugins/songs/lib/importers/opspro.py b/openlp/plugins/songs/lib/importers/opspro.py index 8f9674deb..03c5001c6 100644 --- a/openlp/plugins/songs/lib/importers/opspro.py +++ b/openlp/plugins/songs/lib/importers/opspro.py @@ -55,7 +55,7 @@ class OPSProImport(SongImport): """ password = self.extract_mdb_password() try: - conn = pyodbc.connect('DRIVER={Microsoft Access Driver (*.mdb)};DBQ={source};' + conn = pyodbc.connect('DRIVER={{Microsoft Access Driver (*.mdb)}};DBQ={source};' 'PWD={password}'.format(source=self.import_source, password=password)) except (pyodbc.DatabaseError, pyodbc.IntegrityError, pyodbc.InternalError, pyodbc.OperationalError) as e: log.warning('Unable to connect the OPS Pro database {source}. {error}'.format(source=self.import_source, @@ -74,11 +74,11 @@ class OPSProImport(SongImport): break # Type means: 0=Original, 1=Projection, 2=Own cursor.execute('SELECT Lyrics, Type, IsDualLanguage FROM Lyrics WHERE SongID = ? AND Type < 2 ' - 'ORDER BY Type DESC', song.ID) + 'ORDER BY Type DESC', float(song.ID)) lyrics = cursor.fetchone() cursor.execute('SELECT CategoryName FROM Category INNER JOIN SongCategory ' 'ON Category.ID = SongCategory.CategoryID WHERE SongCategory.SongID = ? ' - 'ORDER BY CategoryName', song.ID) + 'ORDER BY CategoryName', float(song.ID)) topics = cursor.fetchall() try: self.process_song(song, lyrics, topics) diff --git a/openlp/plugins/songs/lib/importers/worshipcenterpro.py b/openlp/plugins/songs/lib/importers/worshipcenterpro.py index df04823e8..3d5cbe9ba 100644 --- a/openlp/plugins/songs/lib/importers/worshipcenterpro.py +++ b/openlp/plugins/songs/lib/importers/worshipcenterpro.py @@ -49,7 +49,7 @@ class WorshipCenterProImport(SongImport): Receive a single file to import. """ try: - conn = pyodbc.connect('DRIVER={Microsoft Access Driver (*.mdb)};' + conn = pyodbc.connect('DRIVER={{Microsoft Access Driver (*.mdb)}};' 'DBQ={source}'.format(source=self.import_source)) except (pyodbc.DatabaseError, pyodbc.IntegrityError, pyodbc.InternalError, pyodbc.OperationalError) as e: log.warning('Unable to connect the WorshipCenter Pro ' From 4fc4fa896959b4b0f0e73ee669aa05e81604b747 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 14 Jun 2016 22:36:51 +0200 Subject: [PATCH 13/13] pep8 fixes --- openlp/plugins/songs/lib/importers/mediashout.py | 7 ++++--- openlp/plugins/songs/lib/importers/videopsalm.py | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/songs/lib/importers/mediashout.py b/openlp/plugins/songs/lib/importers/mediashout.py index af9b855a0..a3bd7bbbc 100644 --- a/openlp/plugins/songs/lib/importers/mediashout.py +++ b/openlp/plugins/songs/lib/importers/mediashout.py @@ -47,7 +47,6 @@ class MediaShoutImport(SongImport): Initialise the MediaShout importer. """ super(MediaShoutImport, self).__init__(manager, **kwargs) - #SongImport.__init__(self, manager, **kwargs) def do_import(self): """ @@ -70,9 +69,11 @@ class MediaShoutImport(SongImport): topics = [] if self.stop_import_flag: break - cursor.execute('SELECT Type, Number, Text FROM Verses WHERE Record = ? ORDER BY Type, Number', float(song.Record)) + cursor.execute('SELECT Type, Number, Text FROM Verses WHERE Record = ? ORDER BY Type, Number', + float(song.Record)) verses = cursor.fetchall() - cursor.execute('SELECT Type, Number, POrder FROM PlayOrder WHERE Record = ? ORDER BY POrder', float(song.Record)) + cursor.execute('SELECT Type, Number, POrder FROM PlayOrder WHERE Record = ? ORDER BY POrder', + float(song.Record)) verse_order = cursor.fetchall() if cursor.tables(table='TableName', tableType='TABLE').fetchone(): cursor.execute('SELECT Name FROM Themes INNER JOIN SongThemes ON SongThemes.ThemeId = Themes.ThemeId ' diff --git a/openlp/plugins/songs/lib/importers/videopsalm.py b/openlp/plugins/songs/lib/importers/videopsalm.py index 781abfeaf..25fd4d8eb 100644 --- a/openlp/plugins/songs/lib/importers/videopsalm.py +++ b/openlp/plugins/songs/lib/importers/videopsalm.py @@ -118,4 +118,3 @@ class VideoPsalmImport(SongImport): self.log_error('Could not import {title}'.format(title=self.title)) except Exception as e: self.log_error(song_file.name, translate('SongsPlugin.VideoPsalmImport', 'Error: {error}').format(error=e)) -