Skip to content

Commit

Permalink
Fix img_url not working
Browse files Browse the repository at this point in the history
Switched img_url code to fetch thumbnail_url from their oEmbed API using the trackid field. This could very well just be fixed by changing the hostname for img_url to `https://i.scdn.co/image/` as mentioned in issue Madh93#7, but using the api ensure more safety in case spotify decides to host their files on a different hostname.
  • Loading branch information
harsh2204 committed Sep 14, 2020
1 parent 8683c11 commit 056912f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/imgurl.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash

imgurl=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' | egrep -A 1 "artUrl" | egrep -v "artUrl"| cut -b 44- | cut -d '"' -f 1`
trackid=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' | egrep -A 1 "trackid" | egrep -v "trackid"| cut -b 44- | cut -d '"' -f 1`
#echo $trackid
oembed_url="https://open.spotify.com/oembed?url=$trackid"
#echo $oembed_url
imgurl=`curl -s $oembed_url | jq '.thumbnail_url' | tr -d '"'`
echo $imgurl

0 comments on commit 056912f

Please sign in to comment.