MAJ config de run_music_background : volume
This commit is contained in:
parent
68c2fc7e38
commit
03307fa788
|
@ -1,34 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
## Read config file
|
||||
## Read config file or create/update
|
||||
config_filename=~/.config/$(basename ${0})
|
||||
test -f ${config_filename} && . ${config_filename} || config_file_create=1
|
||||
test -f ${config_filename} && . ${config_filename} || echo "# Fichier de configuration créé $(date +%c)" | tee ${config_filename}
|
||||
|
||||
### Check directory music background
|
||||
if [[ -z "${path_music_file}+set" ]]; then
|
||||
### edit directory path music background
|
||||
if [[ -z "${path_music_files+set}" ]]; then
|
||||
path_music_files=$(xdg-user-dir MUSIC)
|
||||
echo "path_music_files=${path_music_files}" | tee -a ${config_filename}
|
||||
fi
|
||||
if [[ -z "${path_music_file}+set" ]]; then
|
||||
path_music_files=${USER}
|
||||
if [[ -z "${path_music_files+set}" ]]; then
|
||||
path_music_files=~
|
||||
echo "path_music_files=${path_music_files}" | tee -a ${config_filename}
|
||||
fi
|
||||
|
||||
## Write config file
|
||||
if [ config_file_create -eq 1 ]; then
|
||||
echo "# Fichier de configuration créé $(date +%c)" | tee ${config_filename}
|
||||
echo "path_music_files=${path_music_files}" | tee ${config_filename}
|
||||
### edit volume
|
||||
if [[ -z "${volume+set}" ]]; then
|
||||
volume=0.06
|
||||
echo "volume=${volume}" | tee -a ${config_filename}
|
||||
fi
|
||||
|
||||
## Init var
|
||||
files=($path_music_files/*)
|
||||
volume=0.06
|
||||
|
||||
## execute
|
||||
echo Process number $$
|
||||
echo Path files : $path_music_files
|
||||
echo Number of files in the path : ${#files[@]}
|
||||
|
||||
while [ 1 ];do
|
||||
run_play=0
|
||||
while [ ${run_play} -eq 0 ];do
|
||||
file=${files["$[RANDOM % ${#files[@]}]"]}
|
||||
echo Now playing $file
|
||||
play -v $volume "$file" &> /dev/null
|
||||
play -S -v $volume "$file"
|
||||
run_play=$(echo $?)
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue