# You should have received a copy of the GNU General Public License
# along with xbmc-groove. If not, see <http://www.gnu.org/licenses/>.
-import urllib2, pprint, md5, os, pickle, tempfile, time, re, simplejson, base64
+import urllib2, pprint, md5, os, pickle, tempfile, time, re, simplejson, base64, sys, socket
from blowfish import Blowfish
SESSION_EXPIRY = 1209600 # 2 weeks
self._debugging = debug
self.simplejson = simplejson
+ if "linux" in sys.platform.lower():
+ socket.setdefaulttimeout(30)
+
self.cacheDir = os.path.join(tempfile.gettempdir(), 'groovesharkapi')
if os.path.isdir(self.cacheDir) == False:
os.makedirs(self.cacheDir)
# Get IP
def _getIP(self):
try:
- myip = urllib2.urlopen('http://whatismyip.org').read()
+ myip = urllib2.urlopen('http://ipecho.net/plain').read()
if re.match("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", myip):
if self._debugging:
print "IP is " + myip
coverart = THUMB_URL+s['CoverArtFilename'].encode('ascii', 'ignore')
else:
coverart = 'None'
- list.append([s['SongName'].encode('ascii', 'ignore'),\
+ if 'Name' in s:
+ name = s['Name']
+ else:
+ name = s['SongName']
+ list.append([name.encode('ascii', 'ignore'),\
s['SongID'],\
s['AlbumName'].encode('ascii', 'ignore'),\
s['AlbumID'],\
while (i < len(playlists)):
s = playlists[i]
- list.append([str(s['PlaylistName']).encode('ascii', 'ignore'), s['PlaylistID']])
+ list.append([str(s['PlaylistName']).encode('utf-8'), s['PlaylistID']])
i = i + 1
return list