refactor: extract ignored player sources to array
This commit is contained in:
+16
-1
@@ -3,6 +3,21 @@
|
||||
# Separator variable
|
||||
separator="␟"
|
||||
|
||||
# Ignored player sources for music
|
||||
ignored_players=(
|
||||
"chromium"
|
||||
"firefox"
|
||||
"kdeconnect"
|
||||
"haruna"
|
||||
"plasma-browser-integration"
|
||||
)
|
||||
|
||||
# Convert array to a comma-separated string with no spaces
|
||||
ignored_sources=$(
|
||||
IFS=,
|
||||
echo "${ignored_players[*]}"
|
||||
)
|
||||
|
||||
# Lock file path
|
||||
lock_file="/tmp/music_wakatime_update.lock"
|
||||
|
||||
@@ -23,7 +38,7 @@ trap cleanup EXIT
|
||||
|
||||
# Update the music cache file every second
|
||||
while true; do
|
||||
playerctl --ignore-player firefox,kdeconnect,haruna,plasma-browser-integration metadata --format "{{ artist }}${separator}{{ title }}${separator}{{ album }}${separator}{{ status }}${separator}{{ volume }}${separator}{{ loop }}${separator}{{ shuffle }}" >~/.cache/music_cache.txt
|
||||
playerctl --ignore-player ${ignored_sources} metadata --format "{{ artist }}${separator}{{ title }}${separator}{{ album }}${separator}{{ status }}${separator}{{ volume }}${separator}{{ loop }}${separator}{{ shuffle }}" >~/.cache/music_cache.txt
|
||||
sleep 1
|
||||
done & # Run this loop in the background
|
||||
|
||||
|
||||
Reference in New Issue
Block a user