Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaces VLC with Qt #1930

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
15 changes: 15 additions & 0 deletions docker/Dockerfile.viewer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ RUN --mount=type=cache,target=/var/cache/apt \
libgles2-mesa-dev \
libglib2.0-dev \
libgst-dev \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
libgstreamer-plugins-bad1.0-dev \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
gstreamer1.0-libav \
gstreamer1.0-tools \
gstreamer1.0-x \
gstreamer1.0-alsa \
gstreamer1.0-gl \
gstreamer1.0-gtk3 \
gstreamer1.0-qt5 \
gstreamer1.0-pulseaudio \
libicu-dev \
libinput-dev \
libiodbc2-dev \
Expand Down
29 changes: 15 additions & 14 deletions viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ def sigusr1(signum, frame):
playing web or image asset is skipped.
"""
logging.info('USR1 received, skipping.')

# @TODO: Stop the Qt media player here via a DBus call.

MediaPlayerProxy.get_instance().stop()


Expand Down Expand Up @@ -383,22 +386,20 @@ def view_video(uri, duration):
logging.debug('Displaying video %s for %s ', uri, duration)
media_player = MediaPlayerProxy.get_instance()

media_player.set_asset(uri, duration)
media_player.play()

view_image('null')

try:
while media_player.is_playing():
watchdog()
sleep(1)
except sh.ErrorReturnCode_1:
logging.info(
'Resource URI is not correct, remote host is not responding or '
'request was rejected.'
)
if browser is None or not browser.process.alive:
load_browser()

browser_bus.loadVideo(uri, int(duration))

while True:
is_ready = browser_bus.isReady()
if is_ready:
break
sleep(1)

media_player.stop()
logging.info('Current url is {0}'.format(uri))


def load_settings():
Expand Down Expand Up @@ -438,7 +439,7 @@ def asset_loop(scheduler):
else:
logging.error('Unknown MimeType %s', mime)

if 'image' in mime or 'web' in mime:
if any(mimetype in mime for mimetype in ['image', 'web']):
duration = int(asset['duration'])
logging.info('Sleeping for %s', duration)
sleep(duration)
Expand Down
Loading