Add files via upload

This commit is contained in:
Siddharth Dushantha 2019-02-12 19:50:46 +01:00 committed by GitHub
parent 59efbf9b0e
commit 5a6fabd640
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 40 additions and 0 deletions

40
cover.sh Normal file
View File

@ -0,0 +1,40 @@
#!/bin/bash
COVER=/tmp/cover.jpg
MUSIC_DIR=~/Music/
CURRENT=$(mpc current -f %file%)
update_cover() {
# extract the album art from the mp3 file
ffmpeg -i "$MUSIC_DIR$(mpc current -f %file%)" $COVER -y &> /dev/null
echo "Extracted album art"
# resize the image to 250x250
convert $COVER -resize 250x250 $COVER
echo "Resized album art to 250x250"
}
update_cover
echo "Swapped art to $(mpc current)"
#mpv --keep-open=yes --cursor-autohide=always --no-osd-bar --no-osc --title="cover" --force-window=immediate --geometry 250x250 $COVER &
sxiv -g 250x250 -b $COVER &
while true; do
NEW=$(mpc current -f %file%)
if [ "$NEW" != "$CURRENT" ];then
CURRENT=$NEW
echo "Song changed. Swapping album art"
update_cover
# mpv --keep-open=yes --no-osd-bar --no-osc --title="cover" --force-window --geometry 250x250 $COVER &
echo "Swapped art to $(mpc current)"
fi
done