From e8b7c08673671ad0c3816492da9d68a511f6f75d Mon Sep 17 00:00:00 2001 From: cedricAbonnel Date: Mon, 28 Mar 2022 18:51:39 +0200 Subject: [PATCH 1/5] Initialisation --- run_music_background | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/run_music_background b/run_music_background index e4718c8..8701670 100644 --- a/run_music_background +++ b/run_music_background @@ -2,7 +2,12 @@ path_files=/home/cedric24c/Musique/non_stop_music files=($path_files/*) +<<<<<<< HEAD volume=0.06 +======= +volume=0.02 + +>>>>>>> 0150ef4 (Initialisation) echo Process number $$ echo Path files : $path_files @@ -13,3 +18,8 @@ while [ 1 ];do echo Now playing $file play -v $volume "$file" &> /dev/null done +<<<<<<< HEAD +======= + + +>>>>>>> 0150ef4 (Initialisation) From 9701ff87e7d775d211df277597d5103370675c50 Mon Sep 17 00:00:00 2001 From: cedricAbonnel Date: Mon, 28 Mar 2022 19:18:35 +0200 Subject: [PATCH 2/5] =?UTF-8?q?fichier=20de=20configuration=20.config=20cr?= =?UTF-8?q?=C3=A9=C3=A9e.\n=20Prise=20en=20compte=20dans=20le=20script=20r?= =?UTF-8?q?un=5Fmusic=5Fbackground?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config_exemple | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 .config_exemple diff --git a/.config_exemple b/.config_exemple new file mode 100755 index 0000000..609a770 --- /dev/null +++ b/.config_exemple @@ -0,0 +1,3 @@ + +# run_music_background +path_music_files=/home/$USER/Musique/non_stop_music From a420587f8a580f27b704e7310aabfbdc4a16eb6d Mon Sep 17 00:00:00 2001 From: cedricAbonnel Date: Mon, 28 Mar 2022 19:52:10 +0200 Subject: [PATCH 3/5] Prise en compte d'un fichier de config dans run_music_background --- .config_exemple => run_music_background.config | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) rename .config_exemple => run_music_background.config (68%) mode change 100755 => 100644 diff --git a/.config_exemple b/run_music_background.config old mode 100755 new mode 100644 similarity index 68% rename from .config_exemple rename to run_music_background.config index 609a770..0543184 --- a/.config_exemple +++ b/run_music_background.config @@ -1,3 +1,2 @@ - -# run_music_background +#run_music_background path_music_files=/home/$USER/Musique/non_stop_music From 3da120155ff42bdcfc2f2f1386261a588f3139f4 Mon Sep 17 00:00:00 2001 From: cedricAbonnel Date: Mon, 28 Mar 2022 19:52:41 +0200 Subject: [PATCH 4/5] Prise en compte d'un fichier de config dans run_music_background --- run_music_background.config | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 run_music_background.config diff --git a/run_music_background.config b/run_music_background.config deleted file mode 100644 index 0543184..0000000 --- a/run_music_background.config +++ /dev/null @@ -1,2 +0,0 @@ -#run_music_background -path_music_files=/home/$USER/Musique/non_stop_music From 84792a9080f5ec8fd2605d654d60a24763cf6a08 Mon Sep 17 00:00:00 2001 From: cedricAbonnel Date: Mon, 28 Mar 2022 19:56:57 +0200 Subject: [PATCH 5/5] 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)