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