forked from openlp/openlp
Head
This commit is contained in:
commit
9546c338fc
@ -81,17 +81,14 @@ body {
|
||||
</style>
|
||||
<script language="javascript">
|
||||
var timer = null;
|
||||
var video_timer = null;
|
||||
var transition = %s;
|
||||
|
||||
function show_video(state, path, volume, loop){
|
||||
var vid = document.getElementById('video');
|
||||
if(path != null)
|
||||
if(path != null){
|
||||
vid.src = path;
|
||||
if(loop != null){
|
||||
if(loop)
|
||||
vid.loop = 'loop';
|
||||
else
|
||||
vid.loop = '';
|
||||
vid.load();
|
||||
}
|
||||
if(volume != null){
|
||||
vid.volume = volume;
|
||||
@ -100,23 +97,55 @@ body {
|
||||
case 'play':
|
||||
vid.play();
|
||||
vid.style.display = 'block';
|
||||
if(loop)
|
||||
video_timer = setInterval('video_loop()', 200);
|
||||
break;
|
||||
case 'pause':
|
||||
if(video_timer!=null){
|
||||
clearInterval(video_timer);
|
||||
video_timer = null;
|
||||
}
|
||||
vid.pause();
|
||||
vid.style.display = 'block';
|
||||
break;
|
||||
case 'stop':
|
||||
if(video_timer!=null){
|
||||
clearInterval(video_timer);
|
||||
video_timer = null;
|
||||
}
|
||||
vid.pause();
|
||||
vid.style.display = 'none';
|
||||
vid.load();
|
||||
break;
|
||||
case 'close':
|
||||
if(video_timer!=null){
|
||||
clearInterval(video_timer);
|
||||
video_timer = null;
|
||||
}
|
||||
vid.pause();
|
||||
vid.style.display = 'none';
|
||||
vid.src = '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function video_loop(){
|
||||
// The preferred method would be to use the video tag loop attribute
|
||||
// But QtWebKit doesn't support this. Neither does it support the
|
||||
// onended event, hence the setInterval()
|
||||
// In addition, setting the currentTime attribute to zero to restart
|
||||
// the video raises an INDEX_SIZE_ERROR: DOM Exception 1
|
||||
// To complicate it further, sometimes vid.currentTime stops
|
||||
// slightly short of vid.duration and vid.ended is intermittent!
|
||||
//
|
||||
// Note, currently the background may go black between loops. Not
|
||||
// desirable. Need to investigate using two <video>'s, and hiding/
|
||||
// preloading one, and toggle between the two when looping.
|
||||
var vid = document.getElementById('video');
|
||||
if(vid.ended||vid.currentTime+0.2>=vid.duration){
|
||||
vid.load();
|
||||
vid.play();
|
||||
}
|
||||
}
|
||||
function show_image(src){
|
||||
var img = document.getElementById('image');
|
||||
img.src = src;
|
||||
|
@ -66,7 +66,7 @@ class LanguageManager(object):
|
||||
Find all available language files in this OpenLP install
|
||||
"""
|
||||
trans_dir = AppLocation.get_directory(AppLocation.AppDir)
|
||||
trans_dir = QtCore.QDir(os.path.join(trans_dir, u'resources', u'i18n'))
|
||||
trans_dir = QtCore.QDir(os.path.join(trans_dir, u'openlp', u'i18n'))
|
||||
file_names = trans_dir.entryList(QtCore.QStringList("*.qm"),
|
||||
QtCore.QDir.Files, QtCore.QDir.Name)
|
||||
for name in file_names:
|
||||
|
0
openlp/plugins/remotes/html/jquery.js
vendored
Executable file → Normal file
0
openlp/plugins/remotes/html/jquery.js
vendored
Executable file → Normal file
@ -28,6 +28,7 @@ The :mod:`olp1import` module provides the functionality for importing
|
||||
openlp.org 1.x song databases into the current installation database.
|
||||
"""
|
||||
import logging
|
||||
import chardet
|
||||
try:
|
||||
import sqlite
|
||||
except:
|
||||
@ -56,6 +57,21 @@ class OpenLP1SongImport(SongImport):
|
||||
SongImport.__init__(self, manager)
|
||||
self.import_source = kwargs[u'filename']
|
||||
|
||||
def decode_string(self, raw):
|
||||
"""
|
||||
Use chardet to detect the encoding of the raw string, and convert it
|
||||
to unicode.
|
||||
|
||||
``raw``
|
||||
The raw bytestring to decode.
|
||||
"""
|
||||
detection = chardet.detect(raw)
|
||||
if detection[u'confidence'] < 0.8:
|
||||
codec = u'windows-1252'
|
||||
else:
|
||||
codec = detection[u'encoding']
|
||||
return unicode(raw, codec)
|
||||
|
||||
def do_import(self):
|
||||
"""
|
||||
Run the import for an openlp.org 1.x song database.
|
||||
@ -63,6 +79,11 @@ class OpenLP1SongImport(SongImport):
|
||||
# Connect to the database
|
||||
connection = sqlite.connect(self.import_source)
|
||||
cursor = connection.cursor()
|
||||
# Determine if we're using a new or an old DB
|
||||
cursor.execute(u'SELECT name FROM sqlite_master '
|
||||
u'WHERE type = \'table\' AND name = \'tracks\'')
|
||||
table_list = cursor.fetchall()
|
||||
new_db = len(table_list) > 0
|
||||
# Count the number of records we need to import, for the progress bar
|
||||
cursor.execute(u'SELECT COUNT(songid) FROM songs')
|
||||
count = int(cursor.fetchone()[0])
|
||||
@ -71,6 +92,7 @@ class OpenLP1SongImport(SongImport):
|
||||
# "cache" our list of authors
|
||||
cursor.execute(u'SELECT authorid, authorname FROM authors')
|
||||
authors = cursor.fetchall()
|
||||
if new_db:
|
||||
# "cache" our list of tracks
|
||||
cursor.execute(u'SELECT trackid, fulltrackname FROM tracks')
|
||||
tracks = cursor.fetchall()
|
||||
@ -84,9 +106,9 @@ class OpenLP1SongImport(SongImport):
|
||||
success = False
|
||||
break
|
||||
song_id = song[0]
|
||||
title = unicode(song[1], u'cp1252')
|
||||
lyrics = unicode(song[2], u'cp1252').replace(u'\r', u'')
|
||||
copyright = unicode(song[3], u'cp1252')
|
||||
title = self.decode_string(song[1])
|
||||
lyrics = self.decode_string(song[2]).replace(u'\r', u'')
|
||||
copyright = self.decode_string(song[3])
|
||||
self.import_wizard.incrementProgressBar(
|
||||
unicode(translate('SongsPlugin.ImportWizardForm',
|
||||
'Importing "%s"...')) % title)
|
||||
@ -102,15 +124,12 @@ class OpenLP1SongImport(SongImport):
|
||||
break
|
||||
for author in authors:
|
||||
if author[0] == author_id[0]:
|
||||
self.parse_author(unicode(author[1], u'cp1252'))
|
||||
self.parse_author(self.decode_string(author[1]))
|
||||
break
|
||||
if self.stop_import_flag:
|
||||
success = False
|
||||
break
|
||||
cursor.execute(u'SELECT name FROM sqlite_master '
|
||||
u'WHERE type = \'table\' AND name = \'tracks\'')
|
||||
table_list = cursor.fetchall()
|
||||
if len(table_list) > 0:
|
||||
if new_db:
|
||||
cursor.execute(u'SELECT trackid FROM songtracks '
|
||||
u'WHERE songid = %s ORDER BY listindex' % song_id)
|
||||
track_ids = cursor.fetchall()
|
||||
@ -120,10 +139,11 @@ class OpenLP1SongImport(SongImport):
|
||||
break
|
||||
for track in tracks:
|
||||
if track[0] == track_id[0]:
|
||||
self.add_media_file(unicode(track[1], u'cp1252'))
|
||||
self.add_media_file(self.decode_string(track[1]))
|
||||
break
|
||||
if self.stop_import_flag:
|
||||
success = False
|
||||
break
|
||||
self.finish()
|
||||
return success
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user