forked from openlp/openlp
HEAD r1890
This commit is contained in:
commit
3cf48b4eab
@ -100,7 +100,6 @@ class MediaController(object):
|
|||||||
Register each media Player controller (Webkit, Phonon, etc) and store
|
Register each media Player controller (Webkit, Phonon, etc) and store
|
||||||
for later use
|
for later use
|
||||||
"""
|
"""
|
||||||
if controller.check_available():
|
|
||||||
self.mediaPlayers[controller.name] = controller
|
self.mediaPlayers[controller.name] = controller
|
||||||
|
|
||||||
def check_available_media_players(self):
|
def check_available_media_players(self):
|
||||||
@ -134,7 +133,8 @@ class MediaController(object):
|
|||||||
QtCore.QVariant(u'webkit')).toString())
|
QtCore.QVariant(u'webkit')).toString())
|
||||||
savedPlayers = playerSettings.split(u',')
|
savedPlayers = playerSettings.split(u',')
|
||||||
invalidMediaPlayers = [mediaPlayer for mediaPlayer in savedPlayers \
|
invalidMediaPlayers = [mediaPlayer for mediaPlayer in savedPlayers \
|
||||||
if not mediaPlayer in self.mediaPlayers]
|
if not mediaPlayer in self.mediaPlayers or \
|
||||||
|
not self.mediaPlayers[mediaPlayer].check_available()]
|
||||||
if len(invalidMediaPlayers) > 0:
|
if len(invalidMediaPlayers) > 0:
|
||||||
for invalidPlayer in invalidMediaPlayers:
|
for invalidPlayer in invalidMediaPlayers:
|
||||||
savedPlayers.remove(invalidPlayer)
|
savedPlayers.remove(invalidPlayer)
|
||||||
|
@ -53,6 +53,7 @@ class OSISBible(BibleDB):
|
|||||||
self.filename = kwargs[u'filename']
|
self.filename = kwargs[u'filename']
|
||||||
fbibles = None
|
fbibles = None
|
||||||
self.books = {}
|
self.books = {}
|
||||||
|
self.language_regex = re.compile(r'<language.*>(.*?)</language>')
|
||||||
self.verse_regex = re.compile(
|
self.verse_regex = re.compile(
|
||||||
r'<verse osisID="([a-zA-Z0-9 ]*).([0-9]*).([0-9]*)">(.*?)</verse>')
|
r'<verse osisID="([a-zA-Z0-9 ]*).([0-9]*).([0-9]*)">(.*?)</verse>')
|
||||||
self.note_regex = re.compile(r'<note(.*?)>(.*?)</note>')
|
self.note_regex = re.compile(r'<note(.*?)>(.*?)</note>')
|
||||||
@ -107,19 +108,32 @@ class OSISBible(BibleDB):
|
|||||||
finally:
|
finally:
|
||||||
if detect_file:
|
if detect_file:
|
||||||
detect_file.close()
|
detect_file.close()
|
||||||
# Set meta language_id
|
|
||||||
language_id = self.get_language(bible_name)
|
|
||||||
if not language_id:
|
|
||||||
log.exception(u'Importing books from "%s" failed' % self.filename)
|
|
||||||
return False
|
|
||||||
try:
|
try:
|
||||||
osis = codecs.open(self.filename, u'r', details['encoding'])
|
osis = codecs.open(self.filename, u'r', details['encoding'])
|
||||||
repl = replacement
|
repl = replacement
|
||||||
|
language_id = False
|
||||||
for file_record in osis:
|
for file_record in osis:
|
||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
break
|
break
|
||||||
|
# Try to find the bible language
|
||||||
|
if not language_id:
|
||||||
|
language_match = self.language_regex.search(file_record)
|
||||||
|
if language_match:
|
||||||
|
language = BiblesResourcesDB.get_language(
|
||||||
|
language_match.group(1))
|
||||||
|
if language:
|
||||||
|
language_id = language[u'id']
|
||||||
|
self.create_meta(u'language_id', language_id)
|
||||||
|
continue
|
||||||
match = self.verse_regex.search(file_record)
|
match = self.verse_regex.search(file_record)
|
||||||
if match:
|
if match:
|
||||||
|
# Set meta language_id if not detected till now
|
||||||
|
if not language_id:
|
||||||
|
language_id = self.get_language(bible_name)
|
||||||
|
if not language_id:
|
||||||
|
log.exception(u'Importing books from "%s" failed'
|
||||||
|
% self.filename)
|
||||||
|
return False
|
||||||
match_count += 1
|
match_count += 1
|
||||||
book = match.group(1)
|
book = match.group(1)
|
||||||
chapter = int(match.group(2))
|
chapter = int(match.group(2))
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
-->
|
-->
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1" />
|
||||||
<title>${app_title}</title>
|
<title>${app_title}</title>
|
||||||
<link rel="stylesheet" href="/files/jquery.mobile.css" />
|
<link rel="stylesheet" href="/files/jquery.mobile.css" />
|
||||||
<link rel="stylesheet" href="/files/openlp.css" />
|
<link rel="stylesheet" href="/files/openlp.css" />
|
||||||
|
Loading…
Reference in New Issue
Block a user