Some updates
This commit is contained in:
parent
e8daad84f4
commit
c91c0a184a
32
amplifier
32
amplifier
@ -1,32 +0,0 @@
|
|||||||
#!/usr/bin/env python2
|
|
||||||
import subprocess
|
|
||||||
import time
|
|
||||||
from requests.exceptions import ConnectionError
|
|
||||||
from kodijson import Kodi # sudo pip install kodi-json
|
|
||||||
|
|
||||||
def monitor_state():
|
|
||||||
mon_state = subprocess.check_output(['/usr/bin/tvservice', '-s'])
|
|
||||||
return mon_state.split(' ')[1] in ['0xa', '0x12000a', '0x40002']
|
|
||||||
|
|
||||||
|
|
||||||
def kodi_state():
|
|
||||||
try:
|
|
||||||
kodi = Kodi("http://tv:8080/jsonrpc")
|
|
||||||
ap = kodi.Player.GetActivePlayers()
|
|
||||||
return len(ap['result']) > 0
|
|
||||||
except ConnectionError: # This is a dirty trick, if kodi is not yet ready to answer requests
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
prev_state = None
|
|
||||||
while True:
|
|
||||||
# second count
|
|
||||||
curr_state = kodi_state()
|
|
||||||
# check if there is a change in the screen state
|
|
||||||
if curr_state != prev_state:
|
|
||||||
if curr_state is True:
|
|
||||||
subprocess.check_output(['sispmctl', '-o', '1'])
|
|
||||||
else:
|
|
||||||
subprocess.check_output(['sispmctl', '-f', '1'])
|
|
||||||
prev_state = curr_state
|
|
||||||
time.sleep(1.)
|
|
@ -6,21 +6,25 @@
|
|||||||
COMMON="
|
COMMON="
|
||||||
joe git tmux
|
joe git tmux
|
||||||
keepass2 xdotool
|
keepass2 xdotool
|
||||||
|
brasero
|
||||||
sshfs curlftpfs openssh-server
|
sshfs curlftpfs openssh-server
|
||||||
fonts-powerline powerline python3-powerline python3-powerline-gitstatus
|
fonts-powerline powerline python3-powerline python3-powerline-gitstatus
|
||||||
lib32stdc++6
|
lib32stdc++6
|
||||||
"
|
"
|
||||||
|
|
||||||
MULTIMEDIA="
|
MULTIMEDIA="
|
||||||
|
ffmpeg
|
||||||
kodi kodi-pvr-hts
|
kodi kodi-pvr-hts
|
||||||
spotify-client
|
spotify-client
|
||||||
"
|
"
|
||||||
|
|
||||||
TOOLS="
|
TOOLS="
|
||||||
evolution
|
evolution
|
||||||
|
gnuplot
|
||||||
gnome-boxes
|
gnome-boxes
|
||||||
gvncviewer
|
gvncviewer
|
||||||
texlive-binaries texlive-latex-extra texlive-lang-german texlive-fonts-recommended texstudio
|
texlive-binaries texlive-latex-extra texlive-lang-german texlive-fonts-recommended texstudio
|
||||||
|
gimp
|
||||||
"
|
"
|
||||||
|
|
||||||
PROGRAMMING="
|
PROGRAMMING="
|
||||||
@ -28,7 +32,10 @@ pycodestyle
|
|||||||
virtualenv
|
virtualenv
|
||||||
python-coverage python3-coverage python-jinja2 python3-jinja2
|
python-coverage python3-coverage python-jinja2 python3-jinja2
|
||||||
python-wxtools python3-wxgtk4.0
|
python-wxtools python3-wxgtk4.0
|
||||||
|
python3-evdev python3-serial
|
||||||
|
python3-sphinx python3-sphinx-rtd-theme
|
||||||
meld
|
meld
|
||||||
|
retext
|
||||||
"
|
"
|
||||||
|
|
||||||
ALL=$COMMON\ $MULTIMEDIA\ $TOOLS\ $PROGRAMMING
|
ALL=$COMMON\ $MULTIMEDIA\ $TOOLS\ $PROGRAMMING
|
||||||
|
89
eachsubdir
Executable file
89
eachsubdir
Executable file
@ -0,0 +1,89 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
|
||||||
|
BASEDIR=`pwd`
|
||||||
|
|
||||||
|
usage="Execute a command in each subdirectory:\n\nUsage: $0 [-p | print subdir info] \"command\""
|
||||||
|
|
||||||
|
# More safety, by turning some bugs into errors.
|
||||||
|
# Without `errexit` you don’t need ! and can replace
|
||||||
|
# PIPESTATUS with a simple $?, but I don’t do that.
|
||||||
|
set -o errexit -o pipefail -o noclobber -o nounset
|
||||||
|
|
||||||
|
# -allow a command to fail with !’s side effect on errexit
|
||||||
|
# -use return value from ${PIPESTATUS[0]}, because ! hosed $?
|
||||||
|
! getopt --test > /dev/null
|
||||||
|
if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
|
||||||
|
echo 'I’m sorry, `getopt --test` failed in this environment.'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
OPTIONS=phe:
|
||||||
|
LONGOPTS=print-subdir,help,exclude:
|
||||||
|
|
||||||
|
# -regarding ! and PIPESTATUS see above
|
||||||
|
# -temporarily store output to be able to check for errors
|
||||||
|
# -activate quoting/enhanced mode (e.g. by writing out “--options”)
|
||||||
|
# -pass arguments only via -- "$@" to separate them correctly
|
||||||
|
! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@")
|
||||||
|
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
|
||||||
|
# e.g. return value is 1
|
||||||
|
# then getopt has complained about wrong arguments to stdout
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
# read getopt’s output this way to handle the quoting right:
|
||||||
|
eval set -- "$PARSED"
|
||||||
|
|
||||||
|
p=n
|
||||||
|
exc=""
|
||||||
|
# now enjoy the options in order and nicely split until we see --
|
||||||
|
while true; do
|
||||||
|
case "$1" in
|
||||||
|
-p|--print-subdir)
|
||||||
|
p=y
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
echo -e "Execute a command in each subdirectory:\n\nUsage: $0 [-p(--print-subdir) -e(--exclude) dir1, dir2,...,dirn)] \"command\""
|
||||||
|
exit 0
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-e|--exclude)
|
||||||
|
exc="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
shift
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Programming error"
|
||||||
|
exit 3
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# handle non-option arguments
|
||||||
|
if [[ $# -ne 1 ]]; then
|
||||||
|
echo "$0: A single command is required."
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for subdir in `find $BASEDIR -maxdepth 1 -type d`
|
||||||
|
do
|
||||||
|
bn=`basename $subdir`
|
||||||
|
if [[ $subdir != $BASEDIR ]] && [[ ",$exc," != *",$bn,"* ]]; then
|
||||||
|
cd $subdir
|
||||||
|
if [[ $p = "y" ]]; then
|
||||||
|
echo -en "\n\n\033[1;33m╔"
|
||||||
|
for ((i=1;i<=$((${#bn} + 2));i++)); do echo -n "═"; done ; echo "╗"
|
||||||
|
echo "║ $bn ║"
|
||||||
|
echo -n "╚"
|
||||||
|
for ((i=1;i<=$((${#bn} + 2));i++)); do echo -n "═"; done ; echo "╝"
|
||||||
|
echo -e "\033[00m"
|
||||||
|
fi
|
||||||
|
eval $1
|
||||||
|
fi
|
||||||
|
done
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
|
|
||||||
REPLACE_FOLDERS="Audio Bilder data Dokumente Downloads eclipse Musik prj Schreibtisch Videos"
|
REPLACE_FOLDERS="Audio Bilder data Dokumente Downloads eclipse Musik prj Schreibtisch Videos choords"
|
||||||
|
|
||||||
|
|
||||||
echo The following folders will be deleted:
|
echo The following folders will be deleted:
|
||||||
|
57
mkunittest
57
mkunittest
@ -134,15 +134,68 @@ def testrun(tcl):
|
|||||||
#
|
#
|
||||||
tcl.testCase('description', TCEL_FULL, test_.func, *args, **kwargs)
|
tcl.testCase('description', TCEL_FULL, test_.func, *args, **kwargs)
|
||||||
""" % name
|
""" % name
|
||||||
|
|
||||||
|
main_makefile = """MODULE_NAME := $(shell basename `pwd`)
|
||||||
|
|
||||||
|
view_unittest:
|
||||||
|
xdg-open pylibs/$(MODULE_NAME)/_testresults_/unittest.pdf
|
||||||
|
|
||||||
|
view_requirements:
|
||||||
|
xdg-open pylibs/$(MODULE_NAME)/_requirements_/specification.pdf
|
||||||
|
|
||||||
|
view_docs:
|
||||||
|
xdg-open pylibs/$(MODULE_NAME)/_docs_/index.html
|
||||||
|
|
||||||
|
clean:
|
||||||
|
make -kC docs clean; make -kC requirements cleanall; make -kC unittest clean
|
||||||
|
"""
|
||||||
|
|
||||||
|
docs_makefile = """# Minimal makefile for Sphinx documentation
|
||||||
|
#
|
||||||
|
|
||||||
|
# You can set these variables from the command line.
|
||||||
|
SPHINXOPTS =
|
||||||
|
SPHINXBUILD = sphinx-build
|
||||||
|
SPHINXPRJ = state_machine
|
||||||
|
SOURCEDIR = .
|
||||||
|
BUILDDIR = _build
|
||||||
|
|
||||||
|
# Put it first so that "make" without argument is like "make help".
|
||||||
|
help:
|
||||||
|
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||||
|
|
||||||
|
.PHONY: help Makefile
|
||||||
|
|
||||||
|
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||||
|
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||||
|
%: $(SPHINXPRJ)
|
||||||
|
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||||
|
|
||||||
|
$(SPHINXPRJ): Makefile
|
||||||
|
make -C $@/_examples_ all
|
||||||
|
|
||||||
|
release: html
|
||||||
|
rm -rf $(SPHINXPRJ)/_docs_
|
||||||
|
mv $(BUILDDIR)/html $(SPHINXPRJ)/_docs_
|
||||||
|
|
||||||
|
view_html: html
|
||||||
|
xdg-open $(BUILDDIR)/html/index.html
|
||||||
|
"""
|
||||||
|
|
||||||
with open('.gitignore', 'w') as fh:
|
with open('.gitignore', 'w') as fh:
|
||||||
fh.write(gitignore)
|
fh.write(gitignore)
|
||||||
|
with open('Makefile', 'w') as fh:
|
||||||
|
fh.write(main_makefile)
|
||||||
os.mkdir('docs')
|
os.mkdir('docs')
|
||||||
|
with open('docs/Makefile', 'w') as fh:
|
||||||
|
fh.write(docs_makefile)
|
||||||
os.symlink('../pylibs/%s' % name, 'docs/%s' % name)
|
os.symlink('../pylibs/%s' % name, 'docs/%s' % name)
|
||||||
os.mkdir('pylibs')
|
os.mkdir('pylibs')
|
||||||
os.mkdir('requirements')
|
os.mkdir('requirements')
|
||||||
|
os.symlink('../pylibs/reqif/scripts/Makefile', 'requirements/Makefile')
|
||||||
|
os.symlink('../pylibs/reqif', 'requirements/reqif')
|
||||||
os.mkdir('unittest')
|
os.mkdir('unittest')
|
||||||
os.symlink('../pylibs/unittest/scripts/unittest.sh', 'unittest/unittest.sh')
|
os.symlink('../pylibs/unittest/scripts/Makefile', 'unittest/Makefile')
|
||||||
os.symlink('../pylibs/unittest/scripts/unittest.py', 'unittest/unittest.py')
|
|
||||||
os.mkdir('unittest/input_data')
|
os.mkdir('unittest/input_data')
|
||||||
os.mkdir('unittest/output_data')
|
os.mkdir('unittest/output_data')
|
||||||
os.mkdir('unittest/src')
|
os.mkdir('unittest/src')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user