mirror of
https://github.com/ksyasuda/rice.git
synced 2025-12-06 08:53:37 -08:00
updates
This commit is contained in:
@@ -123,7 +123,7 @@
|
||||
<!-- Music -->
|
||||
<def name="music">
|
||||
<box class="genwin" orientation="h" space-evenly="false" vexpand="false" hexpand="false">
|
||||
<box class="album_art" vexpand="false" hexpand="false" style="background-image: url('{{COVER}}');">
|
||||
<box class="album_art" vexpand="false" hexpand="false" style="background-image: url('.coverart/cover.png);">
|
||||
</box>
|
||||
<box orientation="v" spacing="20" space-evenly="false" vexpand="false" hexpand="false">
|
||||
<label halign="center" class="song" wrap="true" limit-width="20" text="{{SONG}}"/>
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
(box :orientation "h" :spacing 20 :halign "center" :space-evenly "true" :vexpand "false" :hexpand "false"
|
||||
(button :class "btn_prev" :onclick "~/.config/eww/scripts/music_info --prev" "玲")
|
||||
(button :class "btn_play" :onclick "~/.config/eww/scripts/music_info --toggle" STATUS)
|
||||
(button :class "btn_next" :onclick "~/.config/eww/scripts/music_info --next" "怜"))
|
||||
(button :class "btn_next" :onclick "~/.config/eww/scripts/music_info --next" "怜"))
|
||||
(box :class "music_bar" :halign "center" :vexpand "false" :hexpand "false"
|
||||
(scale :onscroll "mpc -q seek +1" :min 0 :active "true" :max 100 :value CURRENT)))))
|
||||
|
||||
|
||||
@@ -62,30 +62,33 @@ get_ttime() {
|
||||
|
||||
## Get cover
|
||||
get_cover() {
|
||||
ffmpeg -i "${MUSIC_DIR}/$(mpc current -f %file%)" "${COVER}" -y &> /dev/null
|
||||
STATUS=$?
|
||||
|
||||
# # Check if the file has a embbeded album art
|
||||
# if [ "$STATUS" -eq 0 ];then
|
||||
# echo "$COVER"
|
||||
# else
|
||||
# echo "cover.png"
|
||||
# fi
|
||||
# echo "GETTING COVER" >> ~/.config/eww/a.out
|
||||
current=$(mpc current -f '%file%')
|
||||
# echo "$current" >> ~/.config/eww/a.out
|
||||
artist=$(printf "%s\n" "$current" | awk -F '/' '{print $1}')
|
||||
album=$(printf "%s\n" "$current" | awk -F '/' '{print $2}')
|
||||
# echo "$artist $album" >> ~/.config/eww/a.out
|
||||
dir="$MUSIC_DIR/$artist/$album"
|
||||
cover_path=$(find "$dir/" -type f -name "cover*")
|
||||
if [[ $(echo "$cover_path" | wc -l) -eq 1 ]]; then
|
||||
lines=$(printf "%s\n" "$cover_path" | wc -l)
|
||||
if [[ "$lines" -eq 1 ]]; then
|
||||
cp "$cover_path" "$HOME/.config/eww/.coverart/cover.png"
|
||||
return 0
|
||||
[ "$?" -eq 0 ] && return 0 || return 1
|
||||
else
|
||||
song=$(printf "%s\n" "$current" | awk -F "/" '{print $3}')
|
||||
dir="$MUSIC_DIR/$artist/$album/$song/cover.png"
|
||||
[ ! -f "$dir" ] && dir="$MUSIC_DIR/$artist/$album/$song/cover.jpg"
|
||||
[ ! -f "$dir" ] && exit 1
|
||||
# pth=$(echo "$dir" | sed -E 's/ /\\ /g')
|
||||
echo "$dir"
|
||||
cp "$dir" "$HOME/.config/eww/.coverart/cover.png"
|
||||
[ "$?" -eq 0 ] && return 0 || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -107,7 +110,7 @@ elif [[ "$1" == "--cover" ]]; then
|
||||
elif [[ "$1" == "--toggle" ]]; then
|
||||
mpc -q toggle
|
||||
elif [[ "$1" == "--next" ]]; then
|
||||
{ mpc -q next; get_cover; }
|
||||
{ mpc -q next; get_cover; }
|
||||
elif [[ "$1" == "--prev" ]]; then
|
||||
{ mpc -q prev; get_cover; }
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user