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:
# Optional config files, ~ is expanded to $HOME on *nix, %USERPROFILE% on windows
# ~ 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 ))
# ~ 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
def listMediaFiles(folder):
if os.path.exists(folder):
files = os.listdir(folder);
medias = []
for fd in files:
@ -127,6 +128,8 @@ def listMediaFiles(folder):
if fd.split('.')[1] in media_exts:
medias.append(fd)
return medias
else:
return []
def httpUpload(filename, hostl, trailing_slash=1):
import requests

View File

@ -38,7 +38,7 @@ sha256 : 0fe3fe76d0e56e445124fa20646fa8b3d8c59568786b3ebc8a96d83d92f203e3
* get_client_rssi.sh on server
# TODO :
* FR localisation
* GUI : Btn hover/press ?
* ~ Test static IP
* 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
# Device block to write on
# 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
if [ "$SDCARD" == "" ]
then
@ -29,27 +51,6 @@ BAND="bg"
# Set channel manually
#~ 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
#

View File

@ -1,31 +1,31 @@
-----BEGIN CERTIFICATE-----
MIIFSDCCAzCgAwIBAgIUEKUzrybb9J5ifuzwIHIWRqY+Cf8wDQYJKoZIhvcNAQEL
BQAwJTEPMA0GA1UECAwGRGVuaWFsMRIwEAYDVQQDDAkxMC40Mi4wLjEwHhcNMjIx
MDE4MTAzNjU4WhcNMjMxMDE4MTAzNjU4WjAlMQ8wDQYDVQQIDAZEZW5pYWwxEjAQ
BgNVBAMMCTEwLjQyLjAuMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggI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24voyvf2P6/ffKi9+3XtsoysyRjpxtX3B6qimpFvUv0C2wNrVS2FNO36xWv15I9v
AR1LTJzOLE4Jjghi1xxhRe96ydZ1d8IVvykkkvACW3cJqTh3vorwNCEDvhj1D7G+
dVUKUowAXR0rtzGr6TB6F0AYrQT4jhm0UFLRna2ihGbqDRECS5GrCP9k+aVid5OB
DC8=
-----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