bugfixing

This commit is contained in:
rimach crichter@web.de 2011-06-14 18:10:20 +02:00
parent 2c62a819b3
commit 9dfb50951f
13 changed files with 221 additions and 250 deletions

View File

@ -67,15 +67,6 @@ body {
z-index:2; z-index:2;
} }
%s %s
#video1 {
z-index:3;
}
#video2 {
z-index:3;
}
#flash {
z-index:4;
}
#alert { #alert {
position: absolute; position: absolute;
left: 0px; left: 0px;
@ -288,9 +279,9 @@ def build_html(item, screen, alert, islive, background, plugins=None, image=None
plugin_html = u'' plugin_html = u''
if plugins: if plugins:
for plugin in plugins: for plugin in plugins:
plugin_css += plugin.display_css() plugin_css += plugin.getDisplayCss()
plugin_js += plugin.display_javascript() plugin_js += plugin.getDisplayJavascript()
plugin_html += plugin.display_html() plugin_html += plugin.getDisplayHtml()
html = HTMLSRC % (build_background_css(item, width, height), html = HTMLSRC % (build_background_css(item, width, height),
width, height, width, height,
plugin_css, plugin_css,

View File

@ -375,19 +375,19 @@ class Plugin(QtCore.QObject):
""" """
self.textStrings[name] = {u'title': title, u'tooltip': tooltip} self.textStrings[name] = {u'title': title, u'tooltip': tooltip}
def display_css(self): def getDisplayCss(self):
""" """
Add css style sheets to htmlbuilder Add css style sheets to htmlbuilder
""" """
return u'' return u''
def display_javascript(self): def getDisplayJavascript(self):
""" """
Add javascript functions to htmlbuilder Add javascript functions to htmlbuilder
""" """
return u'' return u''
def display_html(self): def getDisplayHtml(self):
""" """
Add html code to htmlbuilder Add html code to htmlbuilder
""" """

View File

@ -56,8 +56,6 @@ class Display(QtGui.QGraphicsView):
""" """
Set up and build the preview screen Set up and build the preview screen
""" """
# self.setGeometry(0, 0,
# self.parent().width(), self.parent().height())
self.webView = QtWebKit.QWebView(self) self.webView = QtWebKit.QWebView(self)
self.webView.setGeometry(0, 0, self.webView.setGeometry(0, 0,
self.parent().width(), self.parent().height()) self.parent().width(), self.parent().height())
@ -71,7 +69,6 @@ class Display(QtGui.QGraphicsView):
self.webView.setHtml(build_html(serviceItem, screen, self.webView.setHtml(build_html(serviceItem, screen,
None, None, None, self.controller.parent().pluginManager.plugins)) None, None, None, self.controller.parent().pluginManager.plugins))
self.webView.hide() self.webView.hide()
#self.hide()
class MainDisplay(QtGui.QGraphicsView): class MainDisplay(QtGui.QGraphicsView):
""" """
@ -88,7 +85,7 @@ class MainDisplay(QtGui.QGraphicsView):
self.videoHide = False self.videoHide = False
self.override = {} self.override = {}
self.retranslateUi() self.retranslateUi()
#self.mediaObject = None self.mediaObject = None
self.firstTime = True self.firstTime = True
self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;') self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool |
@ -118,7 +115,8 @@ class MainDisplay(QtGui.QGraphicsView):
self.webView = QtWebKit.QWebView(self) self.webView = QtWebKit.QWebView(self)
self.webView.setGeometry(0, 0, self.webView.setGeometry(0, 0,
self.screen[u'size'].width(), self.screen[u'size'].height()) self.screen[u'size'].width(), self.screen[u'size'].height())
self.webView.settings().setAttribute(QtWebKit.QWebSettings.PluginsEnabled, True) self.webView.settings().setAttribute( \
QtWebKit.QWebSettings.PluginsEnabled, True)
self.page = self.webView.page() self.page = self.webView.page()
self.frame = self.page.mainFrame() self.frame = self.page.mainFrame()
QtCore.QObject.connect(self.webView, QtCore.QObject.connect(self.webView,
@ -356,7 +354,8 @@ class MainDisplay(QtGui.QGraphicsView):
else: else:
image_bytes = None image_bytes = None
html = build_html(self.serviceItem, self.screen, self.alertTab, html = build_html(self.serviceItem, self.screen, self.alertTab,
self.isLive, background, self.controller.parent().pluginManager.plugins, image_bytes) self.isLive, background,
self.controller.parent().pluginManager.plugins, image_bytes)
log.debug(u'buildHtml - pre setHtml') log.debug(u'buildHtml - pre setHtml')
self.webView.setHtml(html) self.webView.setHtml(html)
log.debug(u'buildHtml - post setHtml') log.debug(u'buildHtml - post setHtml')

View File

@ -396,7 +396,7 @@ class SlideController(QtGui.QWidget):
# rebuild display as screen size changed # rebuild display as screen size changed
if self.display: if self.display:
self.display.close() self.display.close()
self.display = MainDisplay(self, self, self.image_manager, self.isLive) self.display = MainDisplay(self, self, self.imageManager, self.isLive)
self.display.alertTab = self.alertTab self.display.alertTab = self.alertTab
self.display.setup() self.display.setup()
if self.isLive: if self.isLive:
@ -488,7 +488,6 @@ class SlideController(QtGui.QWidget):
len(item.get_frames()) > 1: len(item.get_frames()) > 1:
self.toolbar.makeWidgetsVisible(self.loopList) self.toolbar.makeWidgetsVisible(self.loopList)
if item.is_media(): if item.is_media():
#self.toolbar.setVisible(False)
self.mediabar.setVisible(True) self.mediabar.setVisible(True)
def enablePreviewToolBar(self, item): def enablePreviewToolBar(self, item):

View File

@ -25,14 +25,6 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
class MediaAPI(object):
"""
An enumeration for possible APIs.
"""
Webkit = 0
Phonon = 1
Vlc = 2
class MediaState(object): class MediaState(object):
""" """
An enumeration for possible States of the Media Player An enumeration for possible States of the Media Player
@ -65,136 +57,9 @@ class MediaInfo(object):
end_time = 0 end_time = 0
media_type = MediaType() media_type = MediaType()
class MediaAPI(object):
"""
Specialiced Media API class
to reflect Features of the related API
"""
def __init__(self, parent, name=u'MediaApi'):
self.parent = parent
self.name = name
self.available = self.check_available()
self.isActive = False
self.canBackground = False
self.state = MediaState.Off
self.hasOwnWidget = False
self.audio_extensions_list = []
self.video_extensions_list = []
def check_available(self):
"""
API is available on this machine
"""
return False
def setup(self, display):
"""
Create the related widgets for the current display
"""
pass
def load(self, display):
"""
Load a new media file and check if it is valid
"""
return True
def resize(self, display):
"""
If the main display size or position is changed,
the media widgets should also resized
"""
pass
def play(self, display):
"""
Starts playing of current Media File
"""
pass
def pause(self, display):
"""
Pause of current Media File
"""
pass
def stop(self, display):
"""
Stop playing of current Media File
"""
pass
def volume(self, display, vol):
"""
Change volume of current Media File
"""
pass
def seek(self, display, seekVal):
"""
Change playing position of current Media File
"""
pass
def reset(self, display):
"""
Remove the current loaded video
"""
pass
def set_visible(self, display, status):
"""
Show/Hide the media widgets
"""
pass
def update_ui(self, display):
"""
Do some ui related stuff
(e.g. update the seek slider)
"""
pass
@staticmethod
def is_available():
"""
Check availability of the related API
"""
return False
def get_supported_file_types(self):
"""
Returns the supported file types for
Audio
Video
Locations
"""
pass
def display_css(self):
"""
Add css style sheets to htmlbuilder
"""
return u''
def display_javascript(self):
"""
Add javascript functions to htmlbuilder
"""
return u''
def display_html(self):
"""
Add html code to htmlbuilder
"""
return u''
from mediaitem import MediaMediaItem from mediaitem import MediaMediaItem
from mediatab import MediaTab from mediatab import MediaTab
from mediaapi import MediaAPI
from mediamanager import MediaManager from mediamanager import MediaManager
__all__ = ['MediaMediaItem'] __all__ = ['MediaMediaItem']

View File

@ -0,0 +1,139 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, #
# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias #
# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from openlp.plugins.media.lib import MediaState
class MediaAPI(object):
"""
Specialiced Media API class
to reflect Features of the related API
"""
def __init__(self, parent, name=u'MediaApi'):
self.parent = parent
self.name = name
self.available = self.check_available()
self.isActive = False
self.canBackground = False
self.state = MediaState.Off
self.hasOwnWidget = False
self.audio_extensions_list = []
self.video_extensions_list = []
def check_available(self):
"""
API is available on this machine
"""
return False
def setup(self, display):
"""
Create the related widgets for the current display
"""
pass
def load(self, display):
"""
Load a new media file and check if it is valid
"""
return True
def resize(self, display):
"""
If the main display size or position is changed,
the media widgets should also resized
"""
pass
def play(self, display):
"""
Starts playing of current Media File
"""
pass
def pause(self, display):
"""
Pause of current Media File
"""
pass
def stop(self, display):
"""
Stop playing of current Media File
"""
pass
def volume(self, display, vol):
"""
Change volume of current Media File
"""
pass
def seek(self, display, seekVal):
"""
Change playing position of current Media File
"""
pass
def reset(self, display):
"""
Remove the current loaded video
"""
pass
def set_visible(self, display, status):
"""
Show/Hide the media widgets
"""
pass
def update_ui(self, display):
"""
Do some ui related stuff
(e.g. update the seek slider)
"""
pass
def getDisplayCss(self):
"""
Add css style sheets to htmlbuilder
"""
return u''
def getDisplayJavascript(self):
"""
Add javascript functions to htmlbuilder
"""
return u''
def getDisplayHtml(self):
"""
Add html code to htmlbuilder
"""
return u''

View File

@ -139,6 +139,7 @@ class MediaMediaItem(MediaManagerItem):
ItemCapabilities.AllowsVariableStartTime) ItemCapabilities.AllowsVariableStartTime)
service_item.title = unicode(self.plugin.nameStrings[u'singular']) service_item.title = unicode(self.plugin.nameStrings[u'singular'])
service_item.add_capability(ItemCapabilities.RequiresMedia) service_item.add_capability(ItemCapabilities.RequiresMedia)
# TODO
#Receiver.send_message(u'media_video', [self.plugin.liveController, filename, False]) #Receiver.send_message(u'media_video', [self.plugin.liveController, filename, False])
# force a non-existent theme # force a non-existent theme
service_item.theme = -1 service_item.theme = -1

View File

@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
@ -6,9 +5,10 @@
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2011 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan #
# Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, #
# Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias #
# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
@ -33,9 +33,6 @@ from PyQt4 import QtCore, QtGui, QtWebKit
from openlp.core.lib import OpenLPToolbar, Receiver, translate from openlp.core.lib import OpenLPToolbar, Receiver, translate
from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.plugins.media.lib import MediaAPI, MediaState, MediaInfo from openlp.plugins.media.lib import MediaAPI, MediaState, MediaInfo
from webkitapi import WebkitAPI
from phononapi import PhononAPI
from vlcapi import VlcAPI
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -110,31 +107,31 @@ class MediaManager(object):
if not isAnyonePlaying: if not isAnyonePlaying:
self.Timer.stop() self.Timer.stop()
def display_css(self): def getDisplayCss(self):
""" """
Add css style sheets to htmlbuilder Add css style sheets to htmlbuilder
""" """
css = u''; css = u'';
for api in self.APIs.values(): for api in self.APIs.values():
css+= api.display_css() css += api.getDisplayCss()
return css return css
def display_javascript(self): def getDisplayJavascript(self):
""" """
Add javascript functions to htmlbuilder Add javascript functions to htmlbuilder
""" """
js = u'' js = u''
for api in self.APIs.values(): for api in self.APIs.values():
js+= api.display_javascript() js += api.getDisplayJavascript()
return js return js
def display_html(self): def getDisplayHtml(self):
""" """
Add html code to htmlbuilder Add html code to htmlbuilder
""" """
html = u'' html = u''
for api in self.APIs.values(): for api in self.APIs.values():
html+= api.display_html() html += api.getDisplayHtml()
return html return html
def addControllerItems(self, controller, control_panel): def addControllerItems(self, controller, control_panel):
@ -194,6 +191,7 @@ class MediaManager(object):
return return
if display == self.parent.previewController.previewDisplay or \ if display == self.parent.previewController.previewDisplay or \
display == self.parent.liveController.previewDisplay: display == self.parent.liveController.previewDisplay:
display.resize(display.controller.slidePreview.size())
display.hasAudio = False display.hasAudio = False
for api in self.APIs.values(): for api in self.APIs.values():
api.setup(display) api.setup(display)
@ -202,6 +200,7 @@ class MediaManager(object):
# Generic controls # Generic controls
controller.mediabar.setVisible(value) controller.mediabar.setVisible(value)
# Special controls # Special controls
# TODO
# for api in self.APIs.values(): # for api in self.APIs.values():
# api.setup_controls(controller, control_panel) # api.setup_controls(controller, control_panel)
@ -250,6 +249,8 @@ class MediaManager(object):
self.video_seek([controller, [0]]) self.video_seek([controller, [0]])
self.video_play([controller]) self.video_play([controller])
self.set_controls_visible(controller, True) self.set_controls_visible(controller, True)
log.debug(u'use %s controller' % self.curDisplayMediaAPI[display])
print u'use %s controller' % self.curDisplayMediaAPI[display].name
def check_file_type(self, controller, display): def check_file_type(self, controller, display):
""" """

View File

@ -78,7 +78,8 @@ class MediaTab(SettingsTab):
self.apiOrderLayout.addWidget(self.apiOrderlistWidget) self.apiOrderLayout.addWidget(self.apiOrderlistWidget)
self.orderingButtonsWidget = QtGui.QWidget(self.apiOrderGroupBox) self.orderingButtonsWidget = QtGui.QWidget(self.apiOrderGroupBox)
self.orderingButtonsWidget.setObjectName(u'orderingButtonsWidget') self.orderingButtonsWidget.setObjectName(u'orderingButtonsWidget')
self.orderingButtonLayout = QtGui.QHBoxLayout(self.orderingButtonsWidget) self.orderingButtonLayout = QtGui.QHBoxLayout( \
self.orderingButtonsWidget)
self.orderingButtonLayout.setObjectName(u'orderingButtonLayout') self.orderingButtonLayout.setObjectName(u'orderingButtonLayout')
self.orderingDownButton = QtGui.QPushButton(self.orderingButtonsWidget) self.orderingDownButton = QtGui.QPushButton(self.orderingButtonsWidget)
self.orderingDownButton.setObjectName(u'orderingDownButton') self.orderingDownButton.setObjectName(u'orderingDownButton')
@ -96,7 +97,6 @@ class MediaTab(SettingsTab):
QtCore.QObject.connect(checkbox, QtCore.QObject.connect(checkbox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onApiCheckBoxChanged) self.onApiCheckBoxChanged)
QtCore.QObject.connect(self.orderingUpButton, QtCore.QObject.connect(self.orderingUpButton,
QtCore.SIGNAL(u'pressed()'), self.onOrderingUpButtonPressed) QtCore.SIGNAL(u'pressed()'), self.onOrderingUpButtonPressed)
QtCore.QObject.connect(self.orderingDownButton, QtCore.QObject.connect(self.orderingDownButton,
@ -133,6 +133,7 @@ class MediaTab(SettingsTab):
def updateApiList(self): def updateApiList(self):
self.apiOrderlistWidget.clear() self.apiOrderlistWidget.clear()
for api in self.usedAPIs: for api in self.usedAPIs:
if api in self.ApiCheckBoxes.keys():
self.apiOrderlistWidget.addItem(api) self.apiOrderlistWidget.addItem(api)
def onOrderingUpButtonPressed(self): def onOrderingUpButtonPressed(self):

View File

@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
@ -6,9 +5,10 @@
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2011 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan #
# Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, #
# Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias #
# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
@ -135,10 +135,7 @@ class PhononAPI(MediaAPI):
display.mediaObject.setCurrentSource(Phonon.MediaSource(path)) display.mediaObject.setCurrentSource(Phonon.MediaSource(path))
if not self.mediaStateWait(display, Phonon.StoppedState): if not self.mediaStateWait(display, Phonon.StoppedState):
return False return False
vol = float(volume) / float(10) self.volume(display, volume)
display.audio.setVolume(vol)
#self.info.start_time = 10000
#self.info.end_time = 20000
return True return True
def mediaStateWait(self, display, mediaState): def mediaStateWait(self, display, mediaState):
@ -177,6 +174,7 @@ class PhononAPI(MediaAPI):
def volume(self, display, vol): def volume(self, display, vol):
# 1.0 is the highest value # 1.0 is the highest value
if display.hasAudio:
vol = float(vol) / float(100) vol = float(vol) / float(100)
display.audio.setVolume(vol) display.audio.setVolume(vol)
@ -190,7 +188,6 @@ class PhononAPI(MediaAPI):
self.state = MediaState.Off self.state = MediaState.Off
def set_visible(self, display, status): def set_visible(self, display, status):
print display, status
if self.hasOwnWidget: if self.hasOwnWidget:
display.phononWidget.setVisible(status) display.phononWidget.setVisible(status)
@ -210,6 +207,3 @@ class PhononAPI(MediaAPI):
if not controller.seekSlider.isSliderDown(): if not controller.seekSlider.isSliderDown():
controller.seekSlider.setSliderPosition( \ controller.seekSlider.setSliderPosition( \
display.mediaObject.currentTime()) display.mediaObject.currentTime())
def get_supported_file_types(self):
pass

View File

@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
@ -6,9 +5,10 @@
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2011 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan #
# Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, #
# Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias #
# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
@ -104,23 +104,6 @@ class VlcAPI(MediaAPI):
def check_available(self): def check_available(self):
return vlc_available return vlc_available
def get_supported_file_types(self):
self.supported_file_types = ['avi']
self.additional_extensions = {
u'audio/ac3': [u'.ac3'],
u'audio/flac': [u'.flac'],
u'audio/x-m4a': [u'.m4a'],
u'audio/midi': [u'.mid', u'.midi'],
u'audio/x-mp3': [u'.mp3'],
u'audio/mpeg': [u'.mp3', u'.mp2', u'.mpga', u'.mpega', u'.m4a'],
u'audio/qcelp': [u'.qcp'],
u'audio/x-wma': [u'.wma'],
u'audio/x-ms-wma': [u'.wma'],
u'video/x-flv': [u'.flv'],
u'video/x-matroska': [u'.mpv', u'.mkv'],
u'video/x-wmv': [u'.wmv'],
u'video/x-ms-wmv': [u'.wmv']}
def load(self, display): def load(self, display):
log.debug(u'load vid in Vlc Controller') log.debug(u'load vid in Vlc Controller')
controller = display.controller controller = display.controller
@ -134,6 +117,7 @@ class VlcAPI(MediaAPI):
display.vlcMediaPlayer.set_media(display.vlcMedia) display.vlcMediaPlayer.set_media(display.vlcMedia)
# parse the metadata of the file # parse the metadata of the file
display.vlcMedia.parse() display.vlcMedia.parse()
self.volume(display, volume)
return True return True
def mediaStateWait(self, display, mediaState): def mediaStateWait(self, display, mediaState):
@ -169,6 +153,7 @@ class VlcAPI(MediaAPI):
self.state = MediaState.Stopped self.state = MediaState.Stopped
def volume(self, display, vol): def volume(self, display, vol):
if display.hasAudio:
display.vlcMediaPlayer.audio_set_volume(vol) display.vlcMediaPlayer.audio_set_volume(vol)
def seek(self, display, seekVal): def seek(self, display, seekVal):
@ -190,6 +175,3 @@ class VlcAPI(MediaAPI):
if not controller.seekSlider.isSliderDown(): if not controller.seekSlider.isSliderDown():
currentPos = display.vlcMediaPlayer.get_position() * 1000 currentPos = display.vlcMediaPlayer.get_position() * 1000
controller.seekSlider.setSliderPosition(currentPos) controller.seekSlider.setSliderPosition(currentPos)
def get_supported_file_types(self):
pass

View File

@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
@ -6,9 +5,10 @@
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2011 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan #
# Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, #
# Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias #
# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
@ -73,16 +73,25 @@ class WebkitAPI(MediaAPI):
# no special controls # no special controls
pass pass
def display_css(self): def getDisplayCss(self):
""" """
Add css style sheets to htmlbuilder Add css style sheets to htmlbuilder
""" """
css = u''' css = u'''
#video1 {
z-index:3;
}
#video2 {
z-index:3;
}
#flash {
z-index:4;
}
''' '''
return css return css
def display_javascript(self): def getDisplayJavascript(self):
""" """
Add javascript functions to htmlbuilder Add javascript functions to htmlbuilder
""" """
@ -241,7 +250,7 @@ class WebkitAPI(MediaAPI):
return js return js
def display_html(self): def getDisplayHtml(self):
""" """
Add html code to htmlbuilder Add html code to htmlbuilder
""" """
@ -263,9 +272,6 @@ class WebkitAPI(MediaAPI):
def check_available(self): def check_available(self):
return True return True
def get_supported_file_types(self):
pass
def load(self, display): def load(self, display):
log.debug(u'load vid in Webkit Controller') log.debug(u'load vid in Webkit Controller')
controller = display.controller controller = display.controller
@ -289,14 +295,10 @@ class WebkitAPI(MediaAPI):
def resize(self, display): def resize(self, display):
controller = display.controller controller = display.controller
# if display == controller.previewDisplay:
# display.webView.resize(display.size())
display.webView.resize(display.size()) display.webView.resize(display.size())
def play(self, display): def play(self, display):
controller = display.controller controller = display.controller
#display.override[u'theme'] = u''
#display.override[u'video'] = True
display.webLoaded = True display.webLoaded = True
self.set_visible(display, True) self.set_visible(display, True)
if controller.media_info.isFlash: if controller.media_info.isFlash:
@ -324,10 +326,11 @@ class WebkitAPI(MediaAPI):
def volume(self, display, vol): def volume(self, display, vol):
controller = display.controller controller = display.controller
# 1.0 is the highest value # 1.0 is the highest value
if display.hasVolume:
vol = float(vol) / float(100) vol = float(vol) / float(100)
if not controller.media_info.isFlash: if not controller.media_info.isFlash:
display.frame.evaluateJavaScript(u'show_video(null, null, %s);' % display.frame.evaluateJavaScript(
str(vol)) u'show_video(null, null, %s);' % str(vol))
def seek(self, display, seekVal): def seek(self, display, seekVal):
controller = display.controller controller = display.controller
@ -374,6 +377,3 @@ class WebkitAPI(MediaAPI):
controller.seekSlider.setMaximum(length) controller.seekSlider.setMaximum(length)
if not controller.seekSlider.isSliderDown(): if not controller.seekSlider.isSliderDown():
controller.seekSlider.setSliderPosition(currentTime) controller.seekSlider.setSliderPosition(currentTime)
def get_supported_file_types(self):
pass

View File

@ -110,7 +110,6 @@ class MediaPlugin(Plugin):
store for later use store for later use
""" """
self.mediaManager.APIs[controller.name] = controller self.mediaManager.APIs[controller.name] = controller
#self.controllers[controller.name] = controller
def checkPreConditions(self): def checkPreConditions(self):
""" """
@ -143,20 +142,20 @@ class MediaPlugin(Plugin):
else: else:
return False return False
def display_css(self): def getDisplayCss(self):
""" """
Add css style sheets to htmlbuilder Add css style sheets to htmlbuilder
""" """
return self.mediaManager.display_css() return self.mediaManager.getDisplayCss()
def display_javascript(self): def getDisplayJavascript(self):
""" """
Add javascript functions to htmlbuilder Add javascript functions to htmlbuilder
""" """
return self.mediaManager.display_javascript() return self.mediaManager.getDisplayJavascript()
def display_html(self): def getDisplayHtml(self):
""" """
Add html code to htmlbuilder Add html code to htmlbuilder
""" """
return self.mediaManager.display_html() return self.mediaManager.getDisplayHtml()