From 84792a9080f5ec8fd2605d654d60a24763cf6a08 Mon Sep 17 00:00:00 2001 From: cedricAbonnel Date: Mon, 28 Mar 2022 19:56:57 +0200 Subject: [PATCH] Prise en compte d'un fichier de config dans run_music_background --- run_music_background | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) mode change 100644 => 100755 run_music_background diff --git a/run_music_background b/run_music_background old mode 100644 new mode 100755 index 8701670..ad157ce --- a/run_music_background +++ b/run_music_background @@ -1,16 +1,30 @@ #!/bin/bash -path_files=/home/cedric24c/Musique/non_stop_music -files=($path_files/*) -<<<<<<< HEAD +## Read config file +config_filename=~/.config/$(basename ${0}) +test -f ${config_filename} && . ${config_filename} || config_file_create=1 + +### Check directory music background +if [[ -z "${path_music_file}+set" ]]; then + path_music_files=$(xdg-user-dir MUSIC) +fi +if [[ -z "${path_music_file}+set" ]]; then + path_music_files=${USER} +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} +fi + +## Init var +files=($path_music_files/*) volume=0.06 -======= -volume=0.02 - ->>>>>>> 0150ef4 (Initialisation) +## execute echo Process number $$ -echo Path files : $path_files +echo Path files : $path_music_files echo Number of files in the path : ${#files[@]} while [ 1 ];do @@ -18,8 +32,3 @@ while [ 1 ];do echo Now playing $file play -v $volume "$file" &> /dev/null done -<<<<<<< HEAD -======= - - ->>>>>>> 0150ef4 (Initialisation)