Fixes media control
This commit is contained in:
parent
6e303a2ff8
commit
12d107e3b4
3 changed files with 36 additions and 14 deletions
|
|
@ -1,13 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
formatReturn() {
|
||||
targetArtPath="/tmp/.eww.media-art.$(tr -dc 'a-zA-Z0-9' </dev/urandom | head -c 10)"
|
||||
currentArtUrl=""
|
||||
currentArtPath=""
|
||||
|
||||
updateArtPath() {
|
||||
local url="$1"
|
||||
|
||||
if [[ "$url" == "$currentArtUrl" ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
currentArtUrl="$url"
|
||||
currentArtPath="/tmp/.eww.media-art.$(tr -dc 'a-zA-Z0-9' </dev/urandom | head -c 10)"
|
||||
|
||||
rm /tmp/.eww.media-art.*
|
||||
|
||||
curl $(playerctl metadata mpris:artUrl) -o "$targetArtPath" >/dev/null
|
||||
curl "$url" -o "$currentArtPath" >/dev/null
|
||||
}
|
||||
|
||||
playerctl metadata | jq -R -s -c -r --arg artPath "$targetArtPath" 'split("\n") | map(match("(\\w+) {1}([\\w:]+) {3,}(.+)") | {(.captures[1].string): .captures[2].string}) | add | .["mpris:artUrl"] = $artPath'
|
||||
formatReturn() {
|
||||
|
||||
updateArtPath $(playerctl metadata mpris:artUrl)
|
||||
|
||||
playerctl metadata | jq -R -s -c -r --arg artPath "$currentArtPath" 'split("\n") | map(match("(\\w+) {1}([\\w:]+) {3,}(.+)") | {(.captures[1].string): .captures[2].string}) | add | .["mpris:artUrl"] = $artPath'
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue