Réécriture du music-convert

This commit is contained in:
Breizh 2023-06-17 11:56:49 +02:00
parent 603a0536c9
commit aadadd64bc
10 changed files with 53 additions and 75 deletions

View file

@ -86,7 +86,7 @@ URxvt*shading: 25
! URxvt.keysym.M-v: perl:clipboard:paste ! URxvt.keysym.M-v: perl:clipboard:paste
! URxvt.keysym.M-C-v: perl:clipboard:paste_escaped ! URxvt.keysym.M-C-v: perl:clipboard:paste_escaped
! URxvt*termName: string ! URxvt*termName: string
URxvt*geometry: 400x100 ! URxvt*geometry: 80x24
! URxvt*chdir: string ! URxvt*chdir: string
! URxvt*reverseVideo: boolean ! URxvt*reverseVideo: boolean
! URxvt*loginShell: boolean ! URxvt*loginShell: boolean

View file

@ -96,7 +96,7 @@ ${color2}${font2}Sylvexplorer $hr$font$color${voffset 2}
${texeci 3600 /home/breizh/.config/conky/sylv.sh} ${texeci 3600 /home/breizh/.config/conky/sylv.sh}
${color2}${font2}MPD $hr$font$color${voffset 2} ${color2}${font2}MPD $hr$font$color${voffset 2}
$alignc${scroll wait 43 1 2 ${mpd_smart}} $alignc${scroll wait 43 1 2  ${mpd_smart} }
$alignc${if_match "$mpd_album"!=""}${scroll wait 48 1 2 ${mpd_album}}$endif $alignc${if_match "$mpd_album"!=""}${scroll wait 48 1 2 ${mpd_album}}$endif
$alignr$mpd_elapsed / $mpd_length ${goto 140}${if_match "${mpd_status}"=="Playing"}${color 99CC99}$endif${if_match "${mpd_status}"=="Paused"}${color FFCC66}$endif${if_match "${mpd_status}"=="Stopped"}${color F2777A}$endif$mpd_bar$color $alignr$mpd_elapsed / $mpd_length ${goto 140}${if_match "${mpd_status}"=="Playing"}${color 99CC99}$endif${if_match "${mpd_status}"=="Paused"}${color FFCC66}$endif${if_match "${mpd_status}"=="Stopped"}${color F2777A}$endif$mpd_bar$color

View file

@ -370,7 +370,7 @@ exec claws-mail --online
exec --no-startup-id urxvtc -name newsboat -e newsboat exec --no-startup-id urxvtc -name newsboat -e newsboat
exec --no-startup-id redshift-gtk exec --no-startup-id redshift-gtk
exec --no-startup-id nm-applet exec --no-startup-id nm-applet
exec --no-startup-id steam-native -silent -noverifyfiles -language french exec --no-startup-id sleep 2m && steam-native -silent -noverifyfiles -language french
#exec --no-startup-id SVPManager #exec --no-startup-id SVPManager
#exec --no-startup-id hp-systray -x #exec --no-startup-id hp-systray -x
exec --no-startup-id sleep 5 && play "$HOME/Musique/WELCOME BACK.wav" exec --no-startup-id sleep 5 && play "$HOME/Musique/WELCOME BACK.wav"

View file

@ -13,7 +13,7 @@ hwdec=auto-copy
hwdec-codecs=all hwdec-codecs=all
# Audio # Audio
# audio-channels=stereo audio-channels=stereo
alang=fr,fre,fra alang=fr,fre,fra
# Sous-titres # Sous-titres

View file

@ -1,18 +1,18 @@
[sync] [sync]
develpkgsexpiration = 30 develpkgsexpiration = 30
alwaysshowpkgorigin = no alwaysshowpkgorigin = yes
upgradesorting = versiondiff upgradesorting = versiondiff
showdownloadsize = yes showdownloadsize = yes
ignoreoutofdateaurupgrades = no ignoreoutofdateaurupgrades = no
[build] [build]
keepbuilddir = no keepbuilddir = yes
keepdevbuilddir = no keepdevbuilddir = yes
keepbuilddeps = no keepbuilddeps = no
skipfailedbuild = no skipfailedbuild = no
alwaysusedynamicusers = no
ignorearch = no ignorearch = no
gpgdir = /etc/pacman.d/gnupg gpgdir = /etc/pacman.d/gnupg
dynamicusers = root
[review] [review]
donteditbydefault = no donteditbydefault = no

View file

@ -3,7 +3,7 @@
--embed-subs --embed-subs
--write-subs --write-subs
--write-auto-subs --write-auto-subs
--sub-langs fr,en,en(-|_)?[A-Z]+,-live_chat --sub-langs fr,en,en(-|_)?.+,-live_chat
#--sub-langs en #--sub-langs en
--embed-thumbnail --embed-thumbnail
-i -i
@ -13,8 +13,8 @@
--hls-use-mpegts --hls-use-mpegts
--compat-options no-keep-subs --compat-options no-keep-subs
--download-archive ".yt-dlp_archive" --download-archive ".yt-dlp_archive"
-N 4 -N 1
--netrc #--netrc
# For 429 errors # For 429 errors
--retry-sleep fragment:exp=1:320 --retry-sleep fragment:exp=1:320

View file

@ -3,10 +3,18 @@
# 1: Temps en minutes # 1: Temps en minutes
# 2: Type dextinction # 2: Type dextinction
#reset-dpms() {
# xset dpms 600 600 600
# exit
#}
trap 'exit' INT TERM trap 'exit' INT TERM
touch /dev/shm/mccount touch /dev/shm/mccount
#xset dpms 10 10 10
#xset dpms force standby
while true while true
do do

View file

@ -13,57 +13,51 @@ reset=$(tput sgr0)
bold=$(tput bold) bold=$(tput bold)
# Répertoire source # Répertoire source
rootdir="${HOME}/Musique/" rootdir="${HOME}/Vidéos/Musique"
cd "$rootdir" cd "$rootdir"
# Pour tous les sous-répertoires, à tous les niveaux # Pour tous les sous-répertoires, à tous les niveaux
for dir in **/ . for dir in **/ ./
do do
# Ignorer les liens symboliques # Ignorer les liens symboliques
#if [[ -h "${rootdir}/${dir::-1}" && "${dir}" != "Vidéos/" ]] if [[ -h "${rootdir}/${dir::-1}" ]]
# Converti uniquement les vidéos
if [[ "${dir}" != "Vidéos/" ]]
then then
continue continue
fi fi
# Affichage du répertoire en cours de traitement
echo "$bold$dir$reset"
# Définition du répertoire de destination # Répertoire de destination
dstdir="${HOME}/Musique.opus/${dir}" dstdir="${HOME}/Musique/Vidéos/${dir}"
# Création de la destination # Création du répertoire de destination
mkdir -p "${dstdir}" mkdir -p "${dstdir}"
# On entre dans le répertoire à traiter # On entre dans le répertoire à traiter
cd "${rootdir}/${dir}" cd "${rootdir}/${dir}"
# Pour chaque fichier # Pour chaque fichier
for file in * for file in *
do do
# On ignore les dossiers # On ignore les dossiers
if [[ -d "${file}" ]] if [[ -d "${file}" ]]
then then
continue continue
fi fi
# Sil sagit de FLAC ou dune vidéo # Converti uniquement les vidéos
if [[ "${file}" =~ .flac$ ]] || [[ "${dir}" == "Vidéos/" && "$(file --mime-type -b -e ascii -e compress -e tar -e cdf "$file")" =~ video/ ]] if [[ "$(file --mime-type -b -e ascii -e compress -e tar -e cdf "$file")" =~ video/ ]]
then then
# Définition du fichier de destination # Définition du fichier de destination
dstfile="$(basename -s .flac "$file").opus" dstfile="${file%.*}.opus"
# Sil a déjà été traité on passe, pour gagner du # Passe les fichiers déjà traités
# temps. if [[ "${dstdir}${dstfile}" -nt "${file}" ]]
if [[ -f "${dstdir}${dstfile}" ]]
then then
echo "[${blue}SKIP${reset}] $file" echo "[${blue}SKIP${reset}] ${dir#./}$file"
continue continue
fi fi
# Parrallélisation des conversions # Parallélisation des conversions
declare -a running declare -a running
mapfile -t running < <(jobs -p) mapfile -t running < <(jobs -p)
@ -72,37 +66,18 @@ do
wait -n wait -n
fi fi
togain="true"
( (
echo " $file" echo " ${dir#./}$file"
ffmpeg -n -loglevel error -i "file:$file" -c:a libopus -b:a 256K "file:${dstdir}${dstfile}" ffmpeg -n -loglevel error -i "file:$file" -c:a libopus -b:a 256K "file:${dstdir}${dstfile}" && \
echo "[${green} OK ${reset}] $file" loudgain -S -r -k -q -s e "${dstdir}${dstfile}" &>/dev/null && \
echo "[${green} OK ${reset}] ${dir#./}$file" || \
echo "[${red}FAIL${reset}] ${dir#./}$file"
) & ) &
else else
# Pour les autres fichiers, les copier tel quels # Copie les autres types de fichiers
echo "[${green}COPY${reset}] $file" echo "[${green}COPY${reset}] ${dir#./}$file"
cp -n --reflink=auto "${file}" "${dstdir}/" || true cp -n --reflink=auto "${file}" "${dstdir}/" || true
fi fi
done done
wait
# Si le moindre fichier a été converti, on refait les tags replay gain
#if ${togain} && [[ "${dir}" != "Vidéos/" ]]
#then
# (
# cd "${dstdir}"
# shopt -s nullglob
# echo "[${blue}GAIN${reset}] $dir"
# loudgain -S -a -k -q -s e -- *.opus &>/dev/null && \
# echo "[${green}GAIN${reset}] $dir" || \
# echo "[${red}GAIN${reset}] $dir"
# shopt -u nullglob
# ) & disown $!
#
# # Réinitialise le tag togain
# togain="false"
#fi
done done
wait wait

View file

@ -15,4 +15,8 @@ weekday=$($date +%-u)
hour=$(( ($($date +%-H)%12)*5 + $($date +%-M)/12)) hour=$(( ($($date +%-H)%12)*5 + $($date +%-M)/12))
minute=$($date +%-M) minute=$($date +%-M)
convert "bg.jpg" "month${month}.png" -composite "day${day}.png" -composite "weekday${weekday}.png" -composite "hour${hour}.png" -composite "minute${minute}.png" -composite "/tmp/output.png" # Avec jour de la semaine
#convert "bg.jpg" "month${month}.png" -composite "day${day}.png" -composite "weekday${weekday}.png" -composite "hour${hour}.png" -composite "minute${minute}.png" -composite "/tmp/output.png"
# Sans jour de la semaine
convert "bg.jpg" "month${month}.png" -composite "day${day}.png" -composite "hour${hour}.png" -composite "minute${minute}.png" -composite "/tmp/output.png"

View file

@ -1,9 +0,0 @@
#!/bin/bash
cvlc --loop "$HOME/.wine/drive_c/Maxis/FullTilt/CADET/SOUND/TABA1.MID" &
pid=$!
wine .wine/drive_c/Maxis/FullTilt/CADET/CADET.EXE
kill $pid
timeout 2 wait $pid || kill -9 $pid