Clean up, switch to pilpil

This commit is contained in:
ABelliqueux 2022-10-19 14:54:58 +02:00
parent 703083fa66
commit 179722d50c
8 changed files with 63 additions and 155 deletions

View File

@ -1,2 +0,0 @@
FROM bitnami/python:latest
#RUN apt-get update && apt-get install -y openssh rsync

5
app.py
View File

@ -15,7 +15,7 @@ config_locations = ["./", "~/.", "~/.config/"]
for location in config_locations: for location in config_locations:
# Optional config files, ~ is expanded to $HOME on *nix, %USERPROFILE% on windows # Optional config files, ~ is expanded to $HOME on *nix, %USERPROFILE% on windows
# ~ app.config.from_file("videopi.toml", load=toml.load, silent=True) # ~ app.config.from_file("videopi.toml", load=toml.load, silent=True)
if app.config.from_file(os.path.expanduser( location + "videopi.toml"), load=toml.load, silent=True): if app.config.from_file(os.path.expanduser( location + "pilpil.toml"), load=toml.load, silent=True):
print("Found configuration file in " + os.path.expanduser( location )) print("Found configuration file in " + os.path.expanduser( location ))
# ~ app.config.from_file(os.path.expanduser("~/.config/videopi.toml"), load=toml.load, silent=True) # ~ app.config.from_file(os.path.expanduser("~/.config/videopi.toml"), load=toml.load, silent=True)
@ -120,6 +120,7 @@ def checkHosts(host_l):
# File utilities # File utilities
def listMediaFiles(folder): def listMediaFiles(folder):
if os.path.exists(folder):
files = os.listdir(folder); files = os.listdir(folder);
medias = [] medias = []
for fd in files: for fd in files:
@ -127,6 +128,8 @@ def listMediaFiles(folder):
if fd.split('.')[1] in media_exts: if fd.split('.')[1] in media_exts:
medias.append(fd) medias.append(fd)
return medias return medias
else:
return []
def httpUpload(filename, hostl, trailing_slash=1): def httpUpload(filename, hostl, trailing_slash=1):
import requests import requests

View File

@ -38,7 +38,7 @@ sha256 : 0fe3fe76d0e56e445124fa20646fa8b3d8c59568786b3ebc8a96d83d92f203e3
* get_client_rssi.sh on server * get_client_rssi.sh on server
# TODO : # TODO :
* FR localisation
* GUI : Btn hover/press ? * GUI : Btn hover/press ?
* ~ Test static IP * ~ Test static IP
* Test with several rpis * Test with several rpis

View File

@ -1,34 +0,0 @@
version: '3.8' # or '2.4' # add
services: # add
videopi:
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:8080"
- "8887:8887"
- "8888:8888"
#~ command: "sh -c 'sleep 3600'"
command: "sh -c 'pip install -r requirements.txt && sleep 3600'"
volumes:
- .:/app
- ../medias:/medias
networks:
- dockervlan
networks:
dockervlan:
name: dockervlan
driver: macvlan
driver_opts:
parent: wlo1
ipam:
config:
- subnet: "10.42.0.1/24"
ip_range: "10.42.0.1/26"
gateway: "10.42.0.1"
#~ docker network create -d macvlan \
#~ --subnet=10.42.0.1/24 \
#~ --gateway=10.42.0.1 \
#~ -o parent=wlo1 \
#~ vpi-macvlan-net

View File

@ -3,6 +3,28 @@
# Options # Options
# Device block to write on # Device block to write on
# TODO : Add flags check # TODO : Add flags check
# Colored output
#~ set +x
bold=$(tput bold)
function red(){
echo -e "${bold}\x1B[31m$1 \x1B[0m"
if [ ! -z "${2}" ]; then
echo -e "\x1B[31m $($2) \x1B[0m"
fi
}
function green(){
echo -e "${bold}\x1B[32m$1 \x1B[0m"
if [ ! -z "${2}" ]; then
echo -e "\x1B[32m $($2) \x1B[0m"
fi
}
function yellow(){
echo -e "${bold}\x1B[33m$1 \x1B[0m"
if [ ! -z "${2}" ]; then
echo -e "\x1B[33m $($2) \x1B[0m"
fi
}
SDCARD=$1 SDCARD=$1
if [ "$SDCARD" == "" ] if [ "$SDCARD" == "" ]
then then
@ -29,27 +51,6 @@ BAND="bg"
# Set channel manually # Set channel manually
#~ CHAN="802-11-wireless.channel 1" #~ CHAN="802-11-wireless.channel 1"
# #
# Colored output
#~ set +x
bold=$(tput bold)
function red(){
echo -e "${bold}\x1B[31m$1 \x1B[0m"
if [ ! -z "${2}" ]; then
echo -e "\x1B[31m $($2) \x1B[0m"
fi
}
function green(){
echo -e "${bold}\x1B[32m$1 \x1B[0m"
if [ ! -z "${2}" ]; then
echo -e "\x1B[32m $($2) \x1B[0m"
fi
}
function yellow(){
echo -e "${bold}\x1B[33m$1 \x1B[0m"
if [ ! -z "${2}" ]; then
echo -e "\x1B[33m $($2) \x1B[0m"
fi
}
# #
# 0. Create AP connection # 0. Create AP connection
# #

View File

@ -1,31 +1,31 @@
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIFSDCCAzCgAwIBAgIUEKUzrybb9J5ifuzwIHIWRqY+Cf8wDQYJKoZIhvcNAQEL MIIFPjCCAyagAwIBAgIUeI1nNbqXYM/kIZ0h8dYhtPox5D4wDQYJKoZIhvcNAQEL
BQAwJTEPMA0GA1UECAwGRGVuaWFsMRIwEAYDVQQDDAkxMC40Mi4wLjEwHhcNMjIx BQAwJjEPMA0GA1UECAwGRGVuaWFsMRMwEQYDVQQDDAoxMC40Mi4wLjAxMB4XDTIy
MDE4MTAzNjU4WhcNMjMxMDE4MTAzNjU4WjAlMQ8wDQYDVQQIDAZEZW5pYWwxEjAQ MTAxODE4MDMxNloXDTI3MTAxNzE4MDMxNlowJjEPMA0GA1UECAwGRGVuaWFsMRMw
BgNVBAMMCTEwLjQyLjAuMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB EQYDVQQDDAoxMC40Mi4wLjAxMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKC
ANmJzzHfbRqWuutzBG0+dg3S1sSruM0hRYUjDyWeq8KimGFyiW7sWG/WcfGIeHT7 AgEAtpxaV4/De4M8mjdNR/78GCrBydfhQwK4SxrRwMdlHByyMT14bJB+3qRGNFqp
gpusPxmH0iu7/bEKNyQOYhivNVJaAdSb/6IOB1ILRdnyKDxM5ck8djj2byqQlcpP n5pUr8CORf/WVNDuB4naBP4UPVUPt65P8juQO4+/DFFs0SzNzpQhWEHZD7oJQFGO
gOH0lnDMP87LSmrVQvUuBTn2s+2g6DyWNYevJplpJXw8u1Fm1C0IhAlH1WOvXd9P RftTIKZnGSHLt1qtgtC0VqlVTXOGi2Gsss2u6vIGqagydziFvJRdjc4026Z1Zlzz
gxkL0/qY2zoblZkmCOS1d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1kTpvyiupexZOhHaRSAYPTxuQeRiWc8r3vFJx0ULV6b
vFaYkrEbIpUEyAtg5IXBCAu3W4vPIfw8ttlpQb61xKDdUqcPKrKC4VmmM/qKfN+i CLmQDfczGLMFE5HDpMrT81YSzr6ZNQVNprzKAEpRF+VVUs2idouHgLF/O5SSrtoI
tuH5d+25IFkhwL//nUGXhdnymkc+zQF0R3GJe051YtotX1AgQHAN2CyBUAsHEULX 24voyvf2P6/ffKi9+3XtsoysyRjpxtX3B6qimpFvUv0C2wNrVS2FNO36xWv15I9v
5b5pMZ1kuvuKjJM6Q2cdl2I/kjECa/g3Lljgg3AqIYkrERbTbCOmIQQq0lGysUs9 AR1LTJzOLE4Jjghi1xxhRe96ydZ1d8IVvykkkvACW3cJqTh3vorwNCEDvhj1D7G+
CSIP5cSveM19Yl0nhta/RQOQkJtZJ+l/sgPCEpk7L0IcAe0iO2QEO3b8EAm4k1jm dVUKUowAXR0rtzGr6TB6F0AYrQT4jhm0UFLRna2ihGbqDRECS5GrCP9k+aVid5OB
CjXf2+U9g1RYwZSx DC8=
-----END CERTIFICATE----- -----END CERTIFICATE-----

60
vlctest
View File

@ -1,60 +0,0 @@
#!/bin/bash
# E.G : ./vlctest "enqueue tst.mp4" pause "seek 0" play
# Parse options
h_set=0
#~ s_set=0
#~ d_set=0
while getopts "h:" OPT; do
case "$OPT" in
h)
echo "Sending to ${OPTARG}"
h_set=1
ADDRESSES=("${OPTARG}")
shift $((OPTIND-1))
CMDS="$*"
;;
#~ c)
#~ c_set=1
#~ CMDS=("${OPTARG}")
#~ s) s_set=1;;
#~ d) d_set=1;;
*) # getopts produces error
exit 1;;
esac
done
# If no host provided, use all by default
#~ if ((!h_set && OPTIND>$#)) ; then
if ((!h_set)) ; then
echo "Sending to all hosts"
# RPIs wlan adresses
ADDRESSES=("10.42.0.1" "10.42.0.135" "10.42.0.142")
CMDS="$*"
echo ${ADDRESSES[@]}
fi
# Split str into args
readarray -d "+" -t CMDAR <<< "$CMDS"
echo ${CMDAR[@]}
# Telnet password
PASSWD="secret"
# Send commands
for ADDR in ${ADDRESSES[@]}
do
echo "Sending command $1 and $2 to $ADDR..."
echo -e "$PASSWD\n${CMDAR[0]}\n${CMDAR[1]}" | nc "$ADDR" 9999 -w 5 &
#~ echo -e "$PASSWD\n$1\n$2" | nc "$ADDR" 9999 -w 5 &
# echo -e "$PASSWD\n$1\n$2" | nc "$ADDR" 9999 -w 5 | sed '/Welcome/d;/VLC/d;/Password/d;' &
# echo -e "$PASSWD\n$1\n$2" | nc "$ADDR" 9999 > /dev/null &
done
sleep 1
for ADDR in ${ADDRESSES[@]}
do
echo "Sending command ${CMDAR[2]} and ${CMDAR[3]} to $ADDR..."
echo -e "$PASSWD\n${CMDAR[2]}\n${CMDAR[3]}" | nc "$ADDR" 9999 > /dev/null &
#~ echo "Sending command $3 and $4} to $ADDR..."
#~ echo -e "$PASSWD\n$2\n$4" | nc "$ADDR" 9999 > /dev/null &
done