removed tagging files
This commit is contained in:
parent
007c9eca20
commit
79e81a4a0a
38
kunst
38
kunst
|
@ -99,8 +99,8 @@ get_cover_online() {
|
||||||
API_URL="http://api.deezer.com/search/autocomplete?q=$(mpc current)" && API_URL=${API_URL//' '/'%20'}
|
API_URL="http://api.deezer.com/search/autocomplete?q=$(mpc current)" && API_URL=${API_URL//' '/'%20'}
|
||||||
|
|
||||||
# Extract the albumcover from the json returned
|
# Extract the albumcover from the json returned
|
||||||
#IMG_URL=$(curl -s "$API_URL" | jq -r '.playlists.data[0] | .picture_big')
|
IMG_URL=$(curl -s "$API_URL" | jq -r '.playlists.data[0] | .picture_big')
|
||||||
IMG_URL=$( curl -s "$API_URL" | jq -r '.tracks.data[0].album.cover_big')
|
|
||||||
if [ "$IMG_URL" = '' ] || [ "$IMG_URL" = 'null' ];then
|
if [ "$IMG_URL" = '' ] || [ "$IMG_URL" = 'null' ];then
|
||||||
if [ ! $SILENT ];then
|
if [ ! $SILENT ];then
|
||||||
echo "error: cover not found online"
|
echo "error: cover not found online"
|
||||||
|
@ -111,35 +111,11 @@ get_cover_online() {
|
||||||
echo "kunst: cover found online"
|
echo "kunst: cover found online"
|
||||||
fi
|
fi
|
||||||
curl -o $COVER -s $IMG_URL
|
curl -o $COVER -s $IMG_URL
|
||||||
eyeD3 --add-image $COVER:FRONT_COVER $MUSIC_DIR$(mpc current -f %file%)
|
|
||||||
ARTLESS=false
|
ARTLESS=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
write_tag(){
|
|
||||||
#writes down song data if absent
|
|
||||||
#uses eyeD3
|
|
||||||
eyeD3 -v "$MUSIC_DIR$(mpc current -f %file%)" | egrep "None|null" && tags="0" || tags="1"
|
|
||||||
if [ $tags -eq "0" ] ;then
|
|
||||||
echo "kunst: couldn't find some tags missing"
|
|
||||||
API_URL="http://api.deezer.com/search/autocomplete?q=$(mpc current)" && API_URL=${API_URL//' '/'%20'}
|
|
||||||
album_name="$( curl -s "$API_URL" | jq -r '.tracks.data[0].album.title')"
|
|
||||||
album_artist="$( curl -s "$API_URL" | jq -r '.tracks.data[0].artist.name')"
|
|
||||||
|
|
||||||
#album
|
|
||||||
echo "kunst: writing down album name"
|
|
||||||
echo "Album name : $album_name"
|
|
||||||
eyeD3 -A "$album_name" $MUSIC_DIR$(mpc current -f %file%)
|
|
||||||
#album artist
|
|
||||||
echo "kunst: writing down album artist"
|
|
||||||
echo "Album artist : $album_artist"
|
|
||||||
eyeD3 -b "$album_artist" $MUSIC_DIR$(mpc current -f %file%)
|
|
||||||
else
|
|
||||||
echo "kunst: all tags are present"
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
update_cover() {
|
update_cover() {
|
||||||
# Extract the album art from the mp3 file and dont show the messsy
|
# Extract the album art from the mp3 file and dont show the messsy
|
||||||
|
@ -206,12 +182,15 @@ main() {
|
||||||
|
|
||||||
# Flag to run some commands only once in the loop
|
# Flag to run some commands only once in the loop
|
||||||
FIRST_RUN=true
|
FIRST_RUN=true
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
|
||||||
update_cover
|
update_cover
|
||||||
|
|
||||||
if [ $ARTLESS == true ];then
|
if [ $ARTLESS == true ];then
|
||||||
# Dhange the path to COVER because the music note
|
# Dhange the path to COVER because the music note
|
||||||
# image is a png not jpg
|
# image is a png not jpg
|
||||||
COVER=/tmp/kunst.jpg
|
COVER=/tmp/kunst.png
|
||||||
|
|
||||||
# Decode the base64 encoded image and save it
|
# Decode the base64 encoded image and save it
|
||||||
# to /tmp/kunst.png
|
# to /tmp/kunst.png
|
||||||
|
@ -236,10 +215,7 @@ main() {
|
||||||
|
|
||||||
# Waiting for an event from mpd; play/pause/next/previous
|
# Waiting for an event from mpd; play/pause/next/previous
|
||||||
# this is lets kunst use less CPU :)
|
# this is lets kunst use less CPU :)
|
||||||
event=$(mpc idle)
|
mpc idle &> /dev/null
|
||||||
if [ $event == "player" ] ;then
|
|
||||||
write_tag
|
|
||||||
fi
|
|
||||||
if [ ! $SILENT ];then
|
if [ ! $SILENT ];then
|
||||||
echo "kunst: received event from mpd"
|
echo "kunst: received event from mpd"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue