forked from openlp/openlp
HEAD
This commit is contained in:
commit
81b84cc780
@ -753,4 +753,5 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
else:
|
else:
|
||||||
self.progressLabel.setText(translate(
|
self.progressLabel.setText(translate(
|
||||||
'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))
|
'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))
|
||||||
|
del self.manager.db_cache[importer.name]
|
||||||
delete_database(self.plugin.settingsSection, importer.file)
|
delete_database(self.plugin.settingsSection, importer.file)
|
||||||
|
@ -94,8 +94,6 @@ class CSVBible(BibleDB):
|
|||||||
self.testamentsfile = None
|
self.testamentsfile = None
|
||||||
self.booksfile = kwargs[u'booksfile']
|
self.booksfile = kwargs[u'booksfile']
|
||||||
self.versesfile = kwargs[u'versefile']
|
self.versesfile = kwargs[u'versefile']
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
|
||||||
QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
|
|
||||||
|
|
||||||
def setup_testaments(self):
|
def setup_testaments(self):
|
||||||
"""
|
"""
|
||||||
|
@ -33,7 +33,7 @@ from sqlalchemy import Column, ForeignKey, or_, Table, types
|
|||||||
from sqlalchemy.orm import class_mapper, mapper, relation
|
from sqlalchemy.orm import class_mapper, mapper, relation
|
||||||
from sqlalchemy.orm.exc import UnmappedClassError
|
from sqlalchemy.orm.exc import UnmappedClassError
|
||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.lib import Receiver, translate
|
||||||
from openlp.core.lib.db import BaseModel, init_db, Manager
|
from openlp.core.lib.db import BaseModel, init_db, Manager
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
|
|
||||||
@ -162,6 +162,8 @@ class BibleDB(QtCore.QObject, Manager):
|
|||||||
if u'file' in kwargs:
|
if u'file' in kwargs:
|
||||||
self.get_name()
|
self.get_name()
|
||||||
self.wizard = None
|
self.wizard = None
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
|
||||||
|
|
||||||
def stop_import(self):
|
def stop_import(self):
|
||||||
"""
|
"""
|
||||||
|
@ -236,8 +236,20 @@ class BGExtract(object):
|
|||||||
while found_count < verse_count:
|
while found_count < verse_count:
|
||||||
content = content.findNext(u'sup', u'versenum')
|
content = content.findNext(u'sup', u'versenum')
|
||||||
raw_verse_num = content.next
|
raw_verse_num = content.next
|
||||||
raw_verse_text = raw_verse_num.next
|
clean_verse_num = 0
|
||||||
verse_list[int(str(raw_verse_num))] = unicode(raw_verse_text)
|
# Not all verses exist in all translations and may or may not be
|
||||||
|
# represented by a verse number. If they are not fine, if they are
|
||||||
|
# it will probably be in a format that breaks int(). We will then
|
||||||
|
# have no idea what garbage may be sucked in to the verse text so
|
||||||
|
# if we do not get a clean int() then ignore the verse completely.
|
||||||
|
try:
|
||||||
|
clean_verse_num = int(str(raw_verse_num))
|
||||||
|
except ValueError:
|
||||||
|
log.exception(u'Illegal verse number in %s %s %s:%s',
|
||||||
|
version, bookname, chapter, unicode(raw_verse_num))
|
||||||
|
if clean_verse_num:
|
||||||
|
raw_verse_text = raw_verse_num.next
|
||||||
|
verse_list[clean_verse_num] = unicode(raw_verse_text)
|
||||||
found_count += 1
|
found_count += 1
|
||||||
return SearchResults(bookname, chapter, verse_list)
|
return SearchResults(bookname, chapter, verse_list)
|
||||||
|
|
||||||
|
@ -46,8 +46,6 @@ class OpenLP1Bible(BibleDB):
|
|||||||
log.debug(self.__class__.__name__)
|
log.debug(self.__class__.__name__)
|
||||||
BibleDB.__init__(self, parent, **kwargs)
|
BibleDB.__init__(self, parent, **kwargs)
|
||||||
self.filename = kwargs[u'filename']
|
self.filename = kwargs[u'filename']
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
|
||||||
QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
|
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
"""
|
"""
|
||||||
|
@ -46,8 +46,6 @@ class OpenSongBible(BibleDB):
|
|||||||
log.debug(self.__class__.__name__)
|
log.debug(self.__class__.__name__)
|
||||||
BibleDB.__init__(self, parent, **kwargs)
|
BibleDB.__init__(self, parent, **kwargs)
|
||||||
self.filename = kwargs['filename']
|
self.filename = kwargs['filename']
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
|
||||||
QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
|
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
"""
|
"""
|
||||||
|
@ -41,15 +41,11 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class OSISBible(BibleDB):
|
class OSISBible(BibleDB):
|
||||||
"""
|
"""
|
||||||
OSIS Bible format importer class.
|
`OSIS <http://www.bibletechnologies.net/>`_ Bible format importer class.
|
||||||
"""
|
"""
|
||||||
log.info(u'BibleOSISImpl loaded')
|
log.info(u'BibleOSISImpl loaded')
|
||||||
|
|
||||||
def __init__(self, parent, **kwargs):
|
def __init__(self, parent, **kwargs):
|
||||||
"""
|
|
||||||
Constructor to create and set up an instance of the OpenSongBible
|
|
||||||
class. This class is used to import Bibles from OpenSong's XML format.
|
|
||||||
"""
|
|
||||||
log.debug(self.__class__.__name__)
|
log.debug(self.__class__.__name__)
|
||||||
BibleDB.__init__(self, parent, **kwargs)
|
BibleDB.__init__(self, parent, **kwargs)
|
||||||
self.filename = kwargs[u'filename']
|
self.filename = kwargs[u'filename']
|
||||||
@ -86,8 +82,6 @@ class OSISBible(BibleDB):
|
|||||||
finally:
|
finally:
|
||||||
if fbibles:
|
if fbibles:
|
||||||
fbibles.close()
|
fbibles.close()
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
|
||||||
QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
|
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
"""
|
"""
|
||||||
|
@ -94,11 +94,10 @@ import os
|
|||||||
from lxml import etree, objectify
|
from lxml import etree, objectify
|
||||||
|
|
||||||
from openlp.core.ui.wizard import WizardStrings
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from openlp.plugins.songs.lib import VerseType
|
from openlp.plugins.songs.lib import add_author_unknown, VerseType
|
||||||
from openlp.plugins.songs.lib.songimport import SongImport
|
from openlp.plugins.songs.lib.songimport import SongImport
|
||||||
from openlp.plugins.songs.lib.db import Author, Book, Song, Topic
|
from openlp.plugins.songs.lib.db import Author, Book, Song, Topic
|
||||||
from openlp.plugins.songs.lib.xml import SongXML
|
from openlp.plugins.songs.lib.xml import SongXML
|
||||||
from openlp.plugins.songs.lib.ui import SongStrings
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -293,13 +292,13 @@ class FoilPresenter(object):
|
|||||||
if copyright.find(u'Rechte') != -1:
|
if copyright.find(u'Rechte') != -1:
|
||||||
temp = copyright.partition(u'Rechte')
|
temp = copyright.partition(u'Rechte')
|
||||||
copyright = temp[0]
|
copyright = temp[0]
|
||||||
markers = [u'Text +u\.?n?d? +Melodie[a-zA-Z0-9\,\. ]*:',
|
markers = [u'Text +u\.?n?d? +Melodie[\w\,\. ]*:',
|
||||||
u'Text +u\.?n?d? +Musik', u'T & M', u'Melodie und Satz',
|
u'Text +u\.?n?d? +Musik', u'T & M', u'Melodie und Satz',
|
||||||
u'Text[a-zA-Z0-9\,\. ]*:', u'Melodie', u'Musik', u'Satz',
|
u'Text[\w\,\. ]*:', u'Melodie', u'Musik', u'Satz',
|
||||||
u'Weise', u'[dD]eutsch', u'[dD]t[\.\:]', u'Englisch',
|
u'Weise', u'[dD]eutsch', u'[dD]t[\.\:]', u'Englisch',
|
||||||
u'[oO]riginal', u'Bearbeitung', u'[R|r]efrain']
|
u'[oO]riginal', u'Bearbeitung', u'[R|r]efrain']
|
||||||
for marker in markers:
|
for marker in markers:
|
||||||
copyright = re.compile(marker).sub(u'<marker>', copyright)
|
copyright = re.compile(marker).sub(u'<marker>', copyright, re.U)
|
||||||
copyright = re.compile(u'(?<=<marker>) *:').sub(u'', copyright)
|
copyright = re.compile(u'(?<=<marker>) *:').sub(u'', copyright)
|
||||||
i = 0
|
i = 0
|
||||||
x = 0
|
x = 0
|
||||||
@ -338,8 +337,6 @@ class FoilPresenter(object):
|
|||||||
authors.append(tempx)
|
authors.append(tempx)
|
||||||
elif (len(author) > 2):
|
elif (len(author) > 2):
|
||||||
authors.append(author)
|
authors.append(author)
|
||||||
if not authors:
|
|
||||||
authors.append(SongStrings.AuthorUnknown)
|
|
||||||
for display_name in authors:
|
for display_name in authors:
|
||||||
author = self.manager.get_object_filtered(Author,
|
author = self.manager.get_object_filtered(Author,
|
||||||
Author.display_name == display_name)
|
Author.display_name == display_name)
|
||||||
@ -350,6 +347,8 @@ class FoilPresenter(object):
|
|||||||
first_name = u' '.join(display_name.split(u' ')[:-1]))
|
first_name = u' '.join(display_name.split(u' ')[:-1]))
|
||||||
self.manager.save_object(author)
|
self.manager.save_object(author)
|
||||||
song.authors.append(author)
|
song.authors.append(author)
|
||||||
|
if not song.authors:
|
||||||
|
add_author_unknown(self.manager, song)
|
||||||
|
|
||||||
def _process_cclinumber(self, foilpresenterfolie, song):
|
def _process_cclinumber(self, foilpresenterfolie, song):
|
||||||
"""
|
"""
|
||||||
|
@ -381,6 +381,7 @@ class OpenLyrics(object):
|
|||||||
author = Author.populate(display_name=display_name,
|
author = Author.populate(display_name=display_name,
|
||||||
last_name=display_name.split(u' ')[-1],
|
last_name=display_name.split(u' ')[-1],
|
||||||
first_name=u' '.join(display_name.split(u' ')[:-1]))
|
first_name=u' '.join(display_name.split(u' ')[:-1]))
|
||||||
|
song.authors.append(author)
|
||||||
if not song.authors:
|
if not song.authors:
|
||||||
add_author_unknown(self.manager, song)
|
add_author_unknown(self.manager, song)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user