Skip to content

Commit

Permalink
Tools - py3 and PEP8 to remove noise from Flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
Twol committed Oct 5, 2023
1 parent 3a0e37e commit 1a9e634
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 74 deletions.
10 changes: 5 additions & 5 deletions tools/create_picon_e1_to_e2.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@

sat = str(ref[1] / 16 / 16 / 16 / 16)

# SID:NS:TSID:ONID:STYPE:UNUSED(channelnumber in enigma1)
# X X X X D D
# SID:NS:TSID:ONID:STYPE:UNUSED(channelnumber in enigma1)
# X X X X D D

# REFTYPE:FLAGS:STYPE:SID:TSID:ONID:NS:PARENT_SID:PARENT_TSID:UNUSED
# D D X X X X X X X X
# REFTYPE:FLAGS:STYPE:SID:TSID:ONID:NS:PARENT_SID:PARENT_TSID:UNUSED
# D D X X X X X X X X

refstr = "1:0:%X:%X:%X:%X:%X:0:0:0" % (ref[4], ref[0], ref[2], ref[3], ref[1])
refstr = refstr.replace(':', '_')
Expand All @@ -61,7 +61,7 @@
filename = sat + "_" + provider + "_" + servicetype + "_" + filename

sat = sat[0:2] + '.' + sat[-1:] + 'e'
#TODO: west
# TODO: west

try:
makedirs(sat + '/' + servicetype)
Expand Down
8 changes: 4 additions & 4 deletions tools/create_picon_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

name = name.replace('\xc2\x87', '').replace('\xc2\x86', '')

# SID:NS:TSID:ONID:STYPE:UNUSED(channelnumber in enigma1)
# X X X X D D
# SID:NS:TSID:ONID:STYPE:UNUSED(channelnumber in enigma1)
# X X X X D D

# REFTYPE:FLAGS:STYPE:SID:TSID:ONID:NS:PARENT_SID:PARENT_TSID:UNUSED
# D D X X X X X X X X
# REFTYPE:FLAGS:STYPE:SID:TSID:ONID:NS:PARENT_SID:PARENT_TSID:UNUSED
# D D X X X X X X X X

refstr = "1:0:%X:%X:%X:%X:%X:0:0:0" % (ref[4], ref[0], ref[2], ref[3], ref[1])
refstr = refstr.replace(':', '_')
Expand Down
8 changes: 4 additions & 4 deletions tools/create_picon_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@

sat = str(ref[1] / 16 / 16 / 16 / 16)

# SID:NS:TSID:ONID:STYPE:UNUSED(channelnumber in enigma1)
# X X X X D D
# SID:NS:TSID:ONID:STYPE:UNUSED(channelnumber in enigma1)
# X X X X D D

# REFTYPE:FLAGS:STYPE:SID:TSID:ONID:NS:PARENT_SID:PARENT_TSID:UNUSED
# D D X X X X X X X X
# REFTYPE:FLAGS:STYPE:SID:TSID:ONID:NS:PARENT_SID:PARENT_TSID:UNUSED
# D D X X X X X X X X

refstr = "1:0:%X:%X:%X:%X:%X:0:0:0" % (ref[4], ref[0], ref[2], ref[3], ref[1])
refstr = refstr.replace(':', '_')
Expand Down
10 changes: 5 additions & 5 deletions tools/create_picon_sats.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@

sat = str(ref[1] / 16 / 16 / 16 / 16)

# SID:NS:TSID:ONID:STYPE:UNUSED(channelnumber in enigma1)
# X X X X D D
# SID:NS:TSID:ONID:STYPE:UNUSED(channelnumber in enigma1)
# X X X X D D

# REFTYPE:FLAGS:STYPE:SID:TSID:ONID:NS:PARENT_SID:PARENT_TSID:UNUSED
# D D X X X X X X X X
# REFTYPE:FLAGS:STYPE:SID:TSID:ONID:NS:PARENT_SID:PARENT_TSID:UNUSED
# D D X X X X X X X X

refstr = "1:0:%X:%X:%X:%X:%X:0:0:0" % (ref[4], ref[0], ref[2], ref[3], ref[1])
refstr = refstr.replace(':', '_')
Expand Down Expand Up @@ -65,7 +65,7 @@
filename = sat + "_" + provider + "_" + servicetype + "_" + filename

sat = sat[0:2] + '.' + sat[-1:] + 'e'
#TODO: west
# TODO: west

try:
makedirs(sat + '/' + servicetype)
Expand Down
31 changes: 0 additions & 31 deletions tools/enigma2.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,6 @@ if grep -q 'config\.crash\.logtimeformat' @sysconfdir@/enigma2/settings; then
export ENIGMA_DEBUG_TIME=`grep "config\.crash\.logtimeformat" @sysconfdir@/enigma2/settings | sed -E "s/^.*=(.*)$/\1/" -`
fi

# Enable generation of core dumps
debug_dir=$(sed -n 's/config.crash.debug_path=//p' @sysconfdir@/enigma2/settings)
[ -n "${debug_dir}" -a -d "${debug_dir}" ] || debug_dir=/home/root/logs/
# It would be best to have this at system startup because this way we may not
# catch core dumps that happen early to enigma2.
# The kernel.core_pattern could be set via /etc/sysctl.conf.
# The size limit could be set via /etc/security/limits.conf.
if [ "$(grep -i config.crash.coredump=true /etc/enigma2/settings)" != "" ]; then
COREDUMPSIZE=$((10 * 512 * 4 - 1 * 512 * 4)) # size is in blocks (512 byte) so this sets 10 MB - 1 MB for log files
COREDUMPFILE=${debug_dir}%t-enigma2-core.dump
if [ "$(grep -i config.crash.sizeloglimit= /etc/enigma2/settings | sed 's/config.crash.sizeloglimit=//g')" != "" ]; then
COREDUMPSIZE=$(grep -i config.crash.sizeloglimit= /etc/enigma2/settings | sed 's/config.crash.sizeloglimit=//g')
COREDUMPSIZE=$((${COREDUMPSIZE} * 512 * 4 - 1 * 512 * 4))
fi
echo ${COREDUMPFILE} > /proc/sys/kernel/core_pattern
ulimit -c ${COREDUMPSIZE}
fi
# If we are running with a log then we need to set up a sub-process to
# do this so that it can open a new log if the current one's size
# becomes too large.
Expand Down Expand Up @@ -322,20 +305,6 @@ else
ret=$?
fi

enigma2pid=$!

# Enable generation of core dumps with ELF header included.
# This seem to be required by gdb.
# Would be default if kernel is configured with CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS.
# Default coredump filter can only be set via kernel command line.
# In all other cases this is only available per process.
if [ "$(grep -i config.crash.coredump=true /etc/enigma2/settings)" != "" ]; then
COREDUMPFILTER=0x33
echo ${COREDUMPFILTER} > /proc/${enigma2pid}/coredump_filter
fi

wait ${enigma2pid}

# enigma2 exit codes:
#
# 1 - halt
Expand Down
1 change: 0 additions & 1 deletion tools/genmetaindex.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# usage: genmetaindex.py <xml-files> > index.xml
from os import path as ospath
import sys
import os
from xml.etree.ElementTree import ElementTree, Element

root = Element("index")
Expand Down
6 changes: 3 additions & 3 deletions tools/host_tools/FormatConverter/datasource.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import print_function
from input import inputChoices
from . import input


class datasource:
Expand Down Expand Up @@ -66,7 +66,7 @@ def merge(self):
def copymerge(self, action="copy"):
choice = -1
while choice is not None:
choice = inputChoices(["select source", "select destination", "copy now!"])
choice = input.inputChoices(["select source", "select destination", "copy now!"])
if choice == 0:
print("\nselect source:")
self.source = self.selectDatasource()
Expand Down Expand Up @@ -106,7 +106,7 @@ def selectDatasource(self):
if source != self:
list.append(source.getName() + (" (%d sats)" % len(source.transponderlist.keys())))
sources.append(source)
choice = inputChoices(list)
choice = input.inputChoices(list)
if choice is None:
return None
return sources[choice]
1 change: 0 additions & 1 deletion tools/host_tools/FormatConverter/input.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import sys


Expand Down
5 changes: 3 additions & 2 deletions tools/host_tools/FormatConverter/lamedb.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from __future__ import print_function
from datasource import datasource
from . import datasource


class lamedb(datasource):
Expand Down Expand Up @@ -30,6 +29,8 @@ def read(self):
transpondersreading = False
sats = {}
transponders = {}
tsid = None
onid = None
for line in lines:
if line.strip() == "transponders":
transpondersreading = True
Expand Down
8 changes: 4 additions & 4 deletions tools/host_tools/FormatConverter/lamedb2satxml.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/usr/bin/python
from __future__ import print_function
from datasource import genericdatasource
from satxml import satxml
from lamedb import lamedb
from . import datasource
from . import satxml
from . import lamedb

import sys

if len(sys.argv) != 3:
print("usage: %s <lamedb> <satellites.xml>" % sys.argv[0])
sys.exit()

gen = genericdatasource()
gen = datasource.genericdatasource()
db = lamedb(sys.argv[1])
xml = satxml(sys.argv[2])

Expand Down
17 changes: 7 additions & 10 deletions tools/host_tools/FormatConverter/main.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/python
from os import system as ossystem

from datasource import genericdatasource
from satxml import satxml
from lamedb import lamedb
from input import *
from . import datasource
from . import satxml
from . import lamedb
from . import input

maindata = genericdatasource()
maindata = datasource.genericdatasource()

sources = [satxml, lamedb]

Expand All @@ -23,7 +23,7 @@
list = []
for index in list(range(len(datasources))):
list.append(datasources[index].getName() + (" (%d sats)" % len(datasources[index].transponderlist.keys())))
index = inputChoices(list, "q", "quit")
index = input.inputChoices(list, "q", "quit")
if index is None:
break

Expand All @@ -32,11 +32,8 @@
list = []
for action in datasources[index].getCapabilities():
list.append(action[0])
action = inputChoices(list)
action = input.inputChoices(list)
if action is None:
break

datasources[index].getCapabilities()[action][1]()
#except:
# print sys.exc_info()
# print "sorry, could not execute that command"
7 changes: 3 additions & 4 deletions tools/host_tools/FormatConverter/satxml.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from __future__ import print_function
from os import path as ospath
from datasource import datasource
from . import datasource
from xml.dom import minidom
from xml.dom.minidom import Document
from input import inputText
from . import input


class satxml(datasource):
Expand All @@ -26,7 +25,7 @@ def getName(self):

def setFilename(self):
print("Please give a filename <satellites.xml>:")
filename = inputText()
filename = input.inputText()
if filename == "":
self.filename = "satellites.xml"
else:
Expand Down

0 comments on commit 1a9e634

Please sign in to comment.