2011-06-14 16:10:20 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2012-12-11 19:55:47 +00:00
|
|
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
2011-06-14 16:10:20 +00:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# OpenLP - Open Source Lyrics Projection #
|
|
|
|
# --------------------------------------------------------------------------- #
|
2012-12-29 20:56:56 +00:00
|
|
|
# Copyright (c) 2008-2013 Raoul Snyman #
|
|
|
|
# Portions copyright (c) 2008-2013 Tim Bentley, Gerald Britton, Jonathan #
|
2012-06-22 14:14:53 +00:00
|
|
|
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
|
2012-11-11 21:16:14 +00:00
|
|
|
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
|
2012-10-21 13:16:22 +00:00
|
|
|
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
|
|
|
|
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
|
|
|
|
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
|
2012-12-01 07:57:54 +00:00
|
|
|
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
|
2011-06-14 16:10:20 +00:00
|
|
|
# --------------------------------------------------------------------------- #
|
|
|
|
# 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 #
|
|
|
|
###############################################################################
|
2013-02-02 06:32:29 +00:00
|
|
|
"""
|
|
|
|
The :mod:`~openlp.core.ui.media.mediaplayer` module contains the MediaPlayer class.
|
|
|
|
"""
|
2013-02-03 16:44:03 +00:00
|
|
|
from openlp.core.lib import Registry
|
2011-07-10 21:43:07 +00:00
|
|
|
from openlp.core.ui.media import MediaState
|
2011-06-14 16:10:20 +00:00
|
|
|
|
2013-02-02 06:32:29 +00:00
|
|
|
|
2011-11-11 16:45:25 +00:00
|
|
|
class MediaPlayer(object):
|
2011-06-14 16:10:20 +00:00
|
|
|
"""
|
2012-10-15 17:35:14 +00:00
|
|
|
This is the base class media Player class to provide OpenLP with a
|
|
|
|
pluggable media display framework.
|
2011-06-14 16:10:20 +00:00
|
|
|
"""
|
2011-09-22 18:22:35 +00:00
|
|
|
|
2011-11-11 16:45:25 +00:00
|
|
|
def __init__(self, parent, name=u'media_player'):
|
2013-02-02 06:32:29 +00:00
|
|
|
"""
|
|
|
|
Constructor
|
|
|
|
"""
|
2011-06-14 16:10:20 +00:00
|
|
|
self.parent = parent
|
|
|
|
self.name = name
|
|
|
|
self.available = self.check_available()
|
|
|
|
self.isActive = False
|
|
|
|
self.canBackground = False
|
2011-09-22 18:22:35 +00:00
|
|
|
self.canFolder = False
|
2011-06-14 16:10:20 +00:00
|
|
|
self.state = MediaState.Off
|
|
|
|
self.hasOwnWidget = False
|
|
|
|
self.audio_extensions_list = []
|
|
|
|
self.video_extensions_list = []
|
|
|
|
|
|
|
|
def check_available(self):
|
|
|
|
"""
|
2011-11-11 16:45:25 +00:00
|
|
|
Player is available on this machine
|
2011-06-14 16:10:20 +00:00
|
|
|
"""
|
|
|
|
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):
|
|
|
|
"""
|
2012-04-04 07:26:51 +00:00
|
|
|
If the main display size or position is changed, the media widgets
|
2011-11-02 20:27:53 +00:00
|
|
|
should also resized
|
2011-06-14 16:10:20 +00:00
|
|
|
"""
|
|
|
|
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):
|
|
|
|
"""
|
2011-11-02 20:27:53 +00:00
|
|
|
Do some ui related stuff (e.g. update the seek slider)
|
2011-06-14 16:10:20 +00:00
|
|
|
"""
|
|
|
|
pass
|
|
|
|
|
2011-08-29 19:55:58 +00:00
|
|
|
def get_media_display_css(self):
|
2011-06-14 16:10:20 +00:00
|
|
|
"""
|
|
|
|
Add css style sheets to htmlbuilder
|
|
|
|
"""
|
|
|
|
return u''
|
|
|
|
|
2011-08-29 19:55:58 +00:00
|
|
|
def get_media_display_javascript(self):
|
2011-06-14 16:10:20 +00:00
|
|
|
"""
|
|
|
|
Add javascript functions to htmlbuilder
|
|
|
|
"""
|
|
|
|
return u''
|
|
|
|
|
2011-08-29 19:55:58 +00:00
|
|
|
def get_media_display_html(self):
|
2011-06-14 16:10:20 +00:00
|
|
|
"""
|
|
|
|
Add html code to htmlbuilder
|
|
|
|
"""
|
|
|
|
return u''
|
2012-10-15 17:35:14 +00:00
|
|
|
|
|
|
|
def get_info(self):
|
|
|
|
"""
|
|
|
|
Returns Information about the player
|
|
|
|
"""
|
|
|
|
return u''
|
2013-02-03 09:07:31 +00:00
|
|
|
|
2013-02-03 19:23:12 +00:00
|
|
|
def _get_application(self):
|
2013-02-03 09:07:31 +00:00
|
|
|
"""
|
|
|
|
Adds the openlp to the class dynamically
|
|
|
|
"""
|
2013-02-03 19:23:12 +00:00
|
|
|
if not hasattr(self, u'_application'):
|
|
|
|
self._application = Registry().get(u'application')
|
|
|
|
return self._application
|
2013-02-03 09:07:31 +00:00
|
|
|
|
2013-02-03 19:23:12 +00:00
|
|
|
application = property(_get_application)
|