Skip to content

Commit

Permalink
Merge pull request #1 from audi06/patch-1
Browse files Browse the repository at this point in the history
Fixed DreamOS, add gstreamer1.0-plugins-base-apps
  • Loading branch information
zKhadiri authored May 17, 2021
2 parents 7410852 + f78c75f commit 3136f19
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions src/IPtoSAT/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
from twisted.web.client import getPage, downloadPage
from datetime import datetime
import json
import os

config.plugins.IPToSAT = ConfigSubsection()
config.plugins.IPToSAT.enable = ConfigYesNo(default=False)
config.plugins.IPToSAT.player = ConfigSelection(default="gstplayer", choices=[
# Fixed DreamOS by. audi06_19
("gst-play-1.0", _("OE-2.5 Player")),
("gstplayer", _("GstPlayer")),
("exteplayer3", _("Exteplayer3")),
])
Expand All @@ -44,7 +47,6 @@ def log(data):
open('/tmp/IPtoSAT.log', 'a').write(now+' : '+str(data)+'\r\n')

def getversioninfo():
import os
currversion = '1.0'
version_file = '/usr/lib/enigma2/python/Plugins/Extensions/IPtoSAT/version'
if os.path.exists(version_file):
Expand Down Expand Up @@ -102,6 +104,8 @@ def __init__(self, session):
self["key_red"] = Button(_("Cancel"))
self["key_green"] = Button(_("Save"))
self.createSetup()
# Fixed DreamOS by. audi06_19
self.onShown.append(self.dos)
self.onLayoutFinish.append(self.layoutFinished)

def layoutFinished(self):
Expand Down Expand Up @@ -131,6 +135,31 @@ def save(self):
x[1].save()
self.close(True)

# start Fixed DreamOS by. audi06_19
def dos(self):
self.onShown.remove(self.dos)
f = ''
if os.path.exists('/var/lib/dpkg/status'):
f = open('/var/lib/dpkg/status', 'r')
sw = f.read()
f.close()
text = _('Installing')
gstplay = ''
# gstreamer1.0-plugins-base-apps
if sw.find('Package: gstreamer1.0-plugins-base-meta') == -1:
gstplay = 'gstreamer1.0-plugins-base-meta'
text += ' ' + gstplay + ' '
if gstplay == 'gstreamer1.0-plugins-base-meta':
self.session.openWithCallback(self.installBinaries(gstplay), MessageBox, text, type=MessageBox.TYPE_WARNING, timeout=10)

def installBinaries(self, gstplay=''):
self.container = eConsoleAppContainer()
if os.path.exists('/var/lib/dpkg/status'):
cmd = 'apt-get update; apt-get install --fix-broken --yes --force-yes --assume-yes {} > /dev/null; apt-get -f -y install --force-yes; systemctl restart enigma2'.format(gstplay)
else:
print('cmd: s%' % cmd)
self.container.execute(cmd)
# finish Fixed DreamOS by. audi06_19

class IPtoSAT(Screen):

Expand Down Expand Up @@ -548,10 +577,11 @@ def autostart(reason, **kwargs):
if config.plugins.IPToSAT.enable.value:
session = kwargs["session"]
if fileExists('/var/lib/dpkg/status'):
if fileExists('/usr/bin/exteplayer3'):
# Fixed DreamOS by. audi06_19
if fileExists('/usr/bin/gst-play-1.0'):
IPtoSAT(session)
else:
log("Cannot start IPtoSat, exteplayer3 not found")
log("Cannot start IPtoSat, gst-play-1.0 not found")
else:
if fileExists('/usr/bin/{}'.format(config.plugins.IPToSAT.player.value)):
IPtoSAT(session)
Expand Down

0 comments on commit 3136f19

Please sign in to comment.