From 30109430d57ae0e7a0fc4350cecf0ca503fb8c5a Mon Sep 17 00:00:00 2001 From: "P.M. Kuipers" Date: Thu, 5 Jan 2023 13:11:40 +0100 Subject: [PATCH] Updated to work with root read-only fs --- lib/systemd/system/mediaserver.service | 3 ++- mediaserver/basicplayer.py | 8 +++++--- mediaserver/mediaserver.py | 20 +++++++++----------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/systemd/system/mediaserver.service b/lib/systemd/system/mediaserver.service index b1cb78d..0cd9b4e 100644 --- a/lib/systemd/system/mediaserver.service +++ b/lib/systemd/system/mediaserver.service @@ -2,6 +2,7 @@ Description=Start Mediaserver [Service] +Environment="HOME=/tmp" ExecStart=/usr/bin/startx /usr/sbin/mediaserver Restart=always RestartSec=10s @@ -9,4 +10,4 @@ KillMode=process TimeoutSec=infinity [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target diff --git a/mediaserver/basicplayer.py b/mediaserver/basicplayer.py index 88ab5ba..116bd59 100755 --- a/mediaserver/basicplayer.py +++ b/mediaserver/basicplayer.py @@ -3,15 +3,17 @@ # Copyright (c) 2014 Miqra Engineering # -import sys, os +import os +import sys + # perform gstreamer imports (python3 style) import gi + gi.require_version('Gst','1.0') gi.require_version('GstGL', '1.0') gi.require_version('GstVideo', '1.0') -from gi.repository import GObject -from gi.repository import Gst, GstGL, GstVideo +from gi.repository import GObject, Gst, GstGL, GstVideo class BasicPlayer(GObject.GObject): diff --git a/mediaserver/mediaserver.py b/mediaserver/mediaserver.py index 79e2349..3fc0875 100755 --- a/mediaserver/mediaserver.py +++ b/mediaserver/mediaserver.py @@ -3,27 +3,25 @@ # Copyright (c) 2021 Miqra Engineering # -import sys, os +import os import signal - -from optparse import OptionParser +import sys from collections import OrderedDict - -from .resources import Resources +from optparse import OptionParser # perform gstreamer imports (python3 style) import gi + +from .resources import Resources + gi.require_version('Gst', '1.0') gi.require_version('Gtk', '3.0') gi.require_version('GstGL', '1.0') gi.require_version('GstVideo', '1.0') gi.require_version('GdkPixbuf', '2.0') -from gi.repository import GObject -from gi.repository import Gst, GstGL, GstVideo -from gi.repository import GdkPixbuf -from gi.repository import GLib, Gio, Gtk, Gdk -from gi.repository import GdkX11 +from gi.repository import (Gdk, GdkPixbuf, GdkX11, Gio, GLib, GObject, Gst, + GstGL, GstVideo, Gtk) Gst.init(None) @@ -36,7 +34,7 @@ from dbus.mainloop.glib import DBusGMainLoop DBusGMainLoop(set_as_default=True) # imports from module -from . monitoredplayer import MonitoredPlayer +from .monitoredplayer import MonitoredPlayer class MediaService(dbus.service.Object):