Tidy up code more
|
@ -34,7 +34,6 @@ class ApiController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||
The APIController handles the starting of the API middleware.
|
||||
The HTTP and Websocket servers are started
|
||||
The core endpoints are generated (just by their declaration).
|
||||
|
||||
"""
|
||||
def __init__(self, parent=None):
|
||||
"""
|
||||
|
|
|
@ -29,7 +29,7 @@ from openlp.core.common.settings import Settings
|
|||
from openlp.core.api.http.wsgiapp import WSGIApplication
|
||||
from .errors import NotFound, ServerError, HttpError
|
||||
|
||||
ROOT_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'endpoint')
|
||||
ROOT_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'www')
|
||||
|
||||
application = WSGIApplication('api', ROOT_DIR)
|
||||
|
||||
|
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 340 B After Width: | Height: | Size: 340 B |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 364 B After Width: | Height: | Size: 364 B |
Before Width: | Height: | Size: 460 B After Width: | Height: | Size: 460 B |
Before Width: | Height: | Size: 453 B After Width: | Height: | Size: 453 B |
Before Width: | Height: | Size: 519 B After Width: | Height: | Size: 519 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 231 B |
|
@ -67,9 +67,8 @@ def media_stop(request):
|
|||
|
||||
:param request: The http request object.
|
||||
"""
|
||||
media = Registry().get('media_controller')
|
||||
live = Registry().get('live_controller')
|
||||
status = media.media_stop(live)
|
||||
return {'results': {'success': status}}
|
||||
event = getattr(Registry().get('live_controller'), 'mediacontroller_live_stop')
|
||||
event.emit()
|
||||
return {'results': {'success': True}}
|
||||
|
||||
register_endpoint(media_endpoint)
|
||||
|
|
|
@ -618,6 +618,14 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||
"""
|
||||
self.media_play(msg[0], status)
|
||||
|
||||
def on_media_play(self):
|
||||
"""
|
||||
Responds to the request to play a loaded video from the web.
|
||||
|
||||
:param msg: First element is the controller which should be used
|
||||
"""
|
||||
self.media_play(Registry().get('live_controller'), False)
|
||||
|
||||
def media_play(self, controller, first_time=True):
|
||||
"""
|
||||
Responds to the request to play a loaded video
|
||||
|
@ -692,6 +700,14 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||
"""
|
||||
self.media_pause(msg[0])
|
||||
|
||||
def on_media_pause(self):
|
||||
"""
|
||||
Responds to the request to pause a loaded video from the web.
|
||||
|
||||
:param msg: First element is the controller which should be used
|
||||
"""
|
||||
self.media_pause(Registry().get('live_controller'))
|
||||
|
||||
def media_pause(self, controller):
|
||||
"""
|
||||
Responds to the request to pause a loaded video
|
||||
|
@ -732,6 +748,14 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||
"""
|
||||
self.media_stop(msg[0])
|
||||
|
||||
def on_media_stop(self):
|
||||
"""
|
||||
Responds to the request to stop a loaded video from the web.
|
||||
|
||||
:param msg: First element is the controller which should be used
|
||||
"""
|
||||
self.media_stop(Registry().get('live_controller'))
|
||||
|
||||
def media_stop(self, controller, looping_background=False):
|
||||
"""
|
||||
Responds to the request to stop a loaded video
|
||||
|
|
|
@ -430,6 +430,10 @@ class SlideController(DisplayController, RegistryProperties):
|
|||
# NOTE: {t} used to keep line length < maxline
|
||||
getattr(self,
|
||||
'slidecontroller_{t}_previous'.format(t=self.type_prefix)).connect(self.on_slide_selected_previous)
|
||||
if self.is_live:
|
||||
getattr(self, 'mediacontroller_live_play').connect(self.media_controller.on_media_play)
|
||||
getattr(self, 'mediacontroller_live_pause').connect(self.media_controller.on_media_pause)
|
||||
getattr(self, 'mediacontroller_live_stop').connect(self.media_controller.on_media_stop)
|
||||
|
||||
def _slide_shortcut_activated(self):
|
||||
"""
|
||||
|
@ -1501,6 +1505,9 @@ class LiveController(RegistryMixin, OpenLPMixin, SlideController):
|
|||
slidecontroller_live_next = QtCore.pyqtSignal()
|
||||
slidecontroller_live_previous = QtCore.pyqtSignal()
|
||||
slidecontroller_toggle_display = QtCore.pyqtSignal(str)
|
||||
mediacontroller_live_play = QtCore.pyqtSignal()
|
||||
mediacontroller_live_pause = QtCore.pyqtSignal()
|
||||
mediacontroller_live_stop = QtCore.pyqtSignal()
|
||||
|
||||
def __init__(self, parent):
|
||||
"""
|
||||
|
|
|
@ -23,7 +23,7 @@ import logging
|
|||
|
||||
from openlp.core.api.http.endpoint import Endpoint
|
||||
from openlp.core.api.http.endpoint.pluginhelpers import search, live, service
|
||||
from openlp.core.api.http import register_endpoint, requires_auth
|
||||
from openlp.core.api.http import requires_auth
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -65,6 +65,3 @@ def songs_service(request):
|
|||
:param request: The http request object.
|
||||
"""
|
||||
return service(request, 'songs', log)
|
||||
|
||||
register_endpoint(songs_endpoint)
|
||||
register_endpoint(api_songs_endpoint)
|
|
@ -34,7 +34,6 @@ from openlp.core.lib import translate
|
|||
from openlp.plugins.songs.lib.db import MediaFile, Song
|
||||
from .db import Author
|
||||
from .ui import SongStrings
|
||||
from .endpoint import songs_endpoint
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -31,11 +31,13 @@ from tempfile import gettempdir
|
|||
|
||||
from PyQt5 import QtCore, QtWidgets
|
||||
|
||||
from openlp.core.api.http import register_endpoint
|
||||
from openlp.core.common import UiStrings, Registry, translate
|
||||
from openlp.core.common.actions import ActionList
|
||||
from openlp.core.lib import Plugin, StringContent, build_icon
|
||||
from openlp.core.lib.db import Manager
|
||||
from openlp.core.lib.ui import create_action
|
||||
from openlp.plugins.songs.endpoint import api_songs_endpoint, songs_endpoint
|
||||
from openlp.plugins.songs.forms.duplicatesongremovalform import DuplicateSongRemovalForm
|
||||
from openlp.plugins.songs.forms.songselectform import SongSelectForm
|
||||
from openlp.plugins.songs.lib import clean_song, upgrade
|
||||
|
@ -46,6 +48,7 @@ from openlp.plugins.songs.lib.mediaitem import SongMediaItem
|
|||
from openlp.plugins.songs.lib.mediaitem import SongSearch
|
||||
from openlp.plugins.songs.lib.songstab import SongsTab
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
__default_settings__ = {
|
||||
'songs/db type': 'sqlite',
|
||||
|
@ -85,6 +88,8 @@ class SongsPlugin(Plugin):
|
|||
self.icon_path = ':/plugins/plugin_songs.png'
|
||||
self.icon = build_icon(self.icon_path)
|
||||
self.songselect_form = None
|
||||
register_endpoint(songs_endpoint)
|
||||
register_endpoint(api_songs_endpoint)
|
||||
|
||||
def check_pre_conditions(self):
|
||||
"""
|
||||
|
|