# Copyright (C) 2006 Adam Olsen # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 1, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import httplib, re, urllib, md5, threading, os, xlmisc import urllib2, gobject, gtk, time import library, common from gettext import gettext as _ COVER_WIDTH = 100 __revision__ = ".01" #LOCALES = ['ca', 'de', 'fr', 'jp', 'uk', 'us'] def get_server(locale): #do 'es' here because webservices.amazon.es doesn't exist if locale in ('en', 'us', 'es'): return "xml.amazon.com" elif locale in ('jp', 'uk'): return "webservices.amazon.co.%s" % locale else: return "webservices.amazon.%s" % locale def get_encoding(locale): if locale == 'jp': return 'utf-8' else: return 'iso-8859-1' KEY = "15VDQG80MCS2K1W2VRR2" # Adam Olsen's key (synic) QUERY = "/onca/xml3?t=webservices-20&dev-t=%s&mode=music&type=lite&" % (KEY) + \ "locale={locale}&page=1&f=xml&KeywordSearch=" IMAGE_PATTERN = re.compile( r"http://(\w+\.images-amazon\.com)"