From 3724d047caa0ae5a16fd250fbad5c4f5235ab56d Mon Sep 17 00:00:00 2001 From: stephendenham Date: Sun, 29 Jun 2014 11:52:26 +0000 Subject: [PATCH] Fix artwork download. git-svn-id: svn://svn.code.sf.net/p/xbmc-groove/code@100 2dec19e3-eb1d-4749-8193-008c8bba0994 --- addon.xml | 2 +- changelog.txt | 4 ++++ default.py | 10 +++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/addon.xml b/addon.xml index 40502e8..ab0e3e2 100644 --- a/addon.xml +++ b/addon.xml @@ -1,6 +1,6 @@  + version="2.0.11" provider-name="Stephen Denham"> diff --git a/changelog.txt b/changelog.txt index 5dcfffe..d6a337b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +2.11.0 + +Fix artwork download. + 2.10.0 Fix sessions bug. diff --git a/default.py b/default.py index 75cc6b0..7528a13 100644 --- a/default.py +++ b/default.py @@ -16,7 +16,7 @@ # along with xbmc-groove. If not, see . -import urllib, sys, os, shutil, re, pickle, time, traceback, xbmcaddon, xbmcplugin, xbmcgui, xbmc +import urllib, urllib2, sys, os, shutil, re, pickle, time, traceback, xbmcaddon, xbmcplugin, xbmcgui, xbmc __addon__ = xbmcaddon.Addon('plugin.audio.groove') __addonname__ = __addon__.getAddonInfo('name') @@ -728,8 +728,12 @@ class Grooveshark: localThumb = os.path.join(xbmc.translatePath(os.path.join(thumbDir, str(songid)))) + '.tbn' try: if os.path.isfile(localThumb) == False: - loc = urllib.URLopener() - loc.retrieve(url, localThumb) + headers = { 'User-Agent' : 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/32.0.1700.102 Chrome/32.0.1700.102 Safari/537.36' } + req = urllib2.Request(url, None, headers) + loc = urllib2.urlopen(req) + output = open(localThumb,'wb') + output.write(loc.read()) + output.close() except: shutil.copy2(thumbDef, localThumb) return os.path.join(os.path.join(thumbDir, str(songid))) + '.tbn' -- 2.20.1