Amélioration de la requête Pleroma scrobble

This commit is contained in:
Breizh 2024-05-29 01:16:25 +02:00
parent a57cebca97
commit 98b1820e40
3 changed files with 5 additions and 5 deletions

View file

@ -1,6 +1,5 @@
# Vidéo
profile=gpu-hq
gpu-context=x11vk
scale=ewa_lanczossharp
cscale=ewa_lanczossharp
#video-sync=display-resample

View file

@ -42,6 +42,8 @@ privilegeescalationtool = sudo
privilegeescalationtarget = pikaur
userid = 0
preserveenv = PKGDEST,VISUAL,EDITOR,http_proxy,https_proxy,ftp_proxy,HTTP_PROXY,HTTPS_PROXY,FTP_PROXY,ALL_PROXY
cachepath = /home/breizh/.cache
datapath = /home/breizh/.local/share
[network]
aururl = https://aur.archlinux.org

View file

@ -13,17 +13,16 @@ do
# Toutes les 5 secondes, ou dès que le morceau se termine
timeout 5 mpc -w current
prevfile="${infos[3]}"
mapfile -t infos < <(mpc -f '[%artist%|%name%]\n%title%\n%album%\n%file%\n%time%' current)
# Si le morceau a changé depuis la dernière vérification
if [[ "${infos[3]}" != "$prevfile" && "$title" != "<i>Arrêt</i>" ]]
if [[ "${infos[1]:-${infos[3]}}" != "$title" && "$title" != "<i>Arrêt</i>" ]]
then
artist="${infos[0]}"
title="${infos[1]:-${infos[3]}}"
album="${infos[2]}"
length="$(( ${infos[4]%%:*} * 60 + ${infos[4]##*:} ))"
[[ -n "${infos[4]}" ]] && length="$(( ${infos[4]%%:*} * 60 + ${infos[4]##*:} ))"
# Si on obtiens un chemin absolu, on naffiche que le nom, pas
# le chemin.
@ -45,7 +44,7 @@ do
--data-urlencode "title=${title}" \
--data-urlencode "artist=${artist}" \
--data-urlencode "album=${album}" \
--data-urlencode "length=${length}" \
${length:+--data-urlencode "length=${length}"} \
https://pleroma.breizh.pm/api/v1/pleroma/scrobble &>/dev/null
fi
done