Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Album covers broken #3

Closed
ph03 opened this issue Jan 13, 2013 · 4 comments
Closed

Album covers broken #3

ph03 opened this issue Jan 13, 2013 · 4 comments

Comments

@ph03
Copy link
Contributor

ph03 commented Jan 13, 2013

Hi!

I get
Traceback (most recent call last):
File "/usr/bin/spotify-dbus.py", line 274, in change_listener
self.show_playing()
File "/usr/bin/spotify-dbus.py", line 130, in show_playing
self.nid = interface.Notify('Spotify', 0, self.get_cover(), self.get_info(track, 'title'), text, actions, hints, self.timeout)
File "/usr/bin/spotify-dbus.py", line 410, in get_cover
os.system('wget -q -O ' + path + ' ' + match.group(0))
AttributeError: 'NoneType' object has no attribute 'group'

On album cover query.

I fixed it temporarily by adding a

        if not match:
            path = '/usr/share/pixmaps/spotify.png'
            if self.debug == True:
                print "Download cover failed..."
            return path

after the regex match at line 404. It would be nice if this could be fixed. I guess the image url has changed in a newer spotify version. I'm using media-sound/spotify-0.8.8.323-r1 on gentoo.

@frederic-romagne
Copy link

Checked the text returned by curl, the page indeed changed, this patch fixes it.
--- /usr/bin/spotify-dbus.py 2012-11-20 19:23:35.000000000 +0100
+++ ./spotify-dbus.py 2013-01-14 14:45:32.778764654 +0100
@@ -400,7 +400,7 @@
# Generate cover URL
id = track['xesam:url'].split(':')
url = 'http://open.spotify.com/track/' + id[2]

  •                   output = commands.getoutput('curl -v ' + url + '| grep \'id="cover-art"\'')
    
  •                   output = commands.getoutput('curl -v ' + url + '| grep \'property="og:image"\'')
                      match = re.search('http(.+)image\/(\w+)', output)
    
                    # Download the cover

@ph03
Copy link
Contributor Author

ph03 commented Jan 14, 2013

Nice, this works! :) Will you be able to commit this?

@mrpdaemon
Copy link
Owner

Thanks, committed the fix at 55ce7a3

@ph03
Copy link
Contributor Author

ph03 commented Feb 12, 2013

I'm afraid this issue has returned..

Traceback (most recent call last):
  File "/usr/bin/spotify-dbus.py", line 295, in change_listener
    self.show_playing()
  File "/usr/bin/spotify-dbus.py", line 137, in show_playing
    self.nid = interface.Notify('Spotify', 0, self.get_cover(), self.get_info(track, 'title'), text, actions, hints, self.timeout)
  File "/usr/bin/spotify-dbus.py", line 417, in get_cover
    os.system('wget -q -O ' + path + ' ' + match.group(0))
AttributeError: 'NoneType' object has no attribute 'group'

I'm using the gentoo version equivalent to 20130119 .

Interrestengly, most of the time cover fetching works and only sometimes fails.
I worked around this issue it in the pull request with hash 98768c7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants