コード例 #1
0
def main():
    import sys

    ecs.setLicenseKey(api_key())
    ecs.setSecretKey(secret_key())

    if "--test" in sys.argv:
        test_parse_url()

    url = sys.stdin.readline().strip()

    (domain, asin) = parse_url(url)
    locale = get_locale(domain)

    page = get_page(domain, asin, locale)

    isbn = extract(page, ['ISBN'])

    title = extract(page, ["Title"])

    if not title and isbn:
        print "status\tredirect\thttp://www.worldcat.org/isbn/%s" % isbn
        sys.exit(0)

    print "begin_tsv"
    for (k, v) in fetch(page, asin, locale):
        print unicode("%s\t%s" % (k, v)).encode("utf8")
    print "end_tsv"
コード例 #2
0
def main():
	import sys

	ecs.setLicenseKey( api_key() )
	ecs.setSecretKey( secret_key() )

	if "--test" in sys.argv:
		test_parse_url()

	url = sys.stdin.readline().strip()

	(domain,asin) = parse_url(url)
	locale = get_locale(domain)

	page = get_page(domain, asin, locale)

	isbn = extract(page, ['ISBN'])

	title = extract(page,["Title"])

	if not title and isbn:
		print "status\tredirect\thttp://www.worldcat.org/isbn/%s" % isbn
		sys.exit(0)

	print "begin_tsv"
	for (k,v) in fetch(page, asin, locale):
		print unicode("%s\t%s" % (k,v)).encode("utf8")
	print "end_tsv"
コード例 #3
0
    def process(self, file):
        if not file.has_key(u'asin'):
            return file

        if file[u'asin'] in self.covercache:
            return self.fill_file(file, self.covercache[file[u'asin']])

        ecs.setLicenseKey(config['S3.accesskey'])
        ecs.setSecretKey(config['S3.secret'])
        try:
            aitem = ecs.ItemLookup(
                file[u'asin'], 
                IdType='ASIN',
                ResponseGroup='Images',
            )
        except ecs.AWSException, e:
            sleep(1)
            return file #just keep going, we don't need albumart
コード例 #4
0
ファイル: Boxee.py プロジェクト: pomm5555/openami.amiserver
    def getCoverArt(self,var):
       # np = os.popen("curl http://localhost:8080/[email protected]/Audio/Boxee/Now_Playing").read()
	#np = pipe = os.popen("curl http://192.168.1.131","r")
       
       # np = re.sub(r'<[^>]*?>', '', np)
        #np = np.replace("Back","").replace("Result","")
        global np
        print "\n*********", np
        (artist, song, album) = np.split(' - ')
        #print artist, song, album
        #np = artist

        if not self.lastCover == artist+song+album:
            self.lastCover = artist+song+album


            ecs.setLicenseKey('AKIAIICBON46BQIRCOUQ')
            ecs.setSecretKey('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')
            print "** Searching Amazon for "+artist+" - "+album
            try:
                search = ecs.ItemSearch(Keywords='Music', SearchIndex='Music',Artist=artist, Title=album, ResponseGroup='Images')
           	print "\n*** serach result: " , search
            except:
                print 'No Cover found, trying Artist only'
                try:
                    search = ecs.ItemSearch(Keywords='Music', SearchIndex='Music',Artist=artist, ResponseGroup='Images')
                except:
                    print "\n *** No cover found \n"
                    self.lastImg = '/Filesystem/interfaces/images/nocoverart.png'
                    return self.lastImg
            img=search.next().LargeImage.URL
            print img
            self.lastImg = img
            #print "LastFM getCoverArt!!!!!!!!!!!"

            return img
        else:
            #print 'LOADING CACHED IMAGE FOR COVERART!!!'+self.lastImg
            return self.lastImg
コード例 #5
0
ファイル: LastFM.py プロジェクト: pomm5555/openami.amiserver
    def getCoverArt(self, var):
        np = os.popen("echo info | nc " + host + " " + port)
        np = np.read().replace('"', "")

        if np == "":
            return "/Filesystem/interfaces/images/nocoverart.png"
        elif "-  -" in np:
            return "/Filesystem/interfaces/images/nocoverart.png"

        try:
            (artist, song, album) = np.split(" - ")
        except:
            return "/Filesystem/interfaces/images/nocoverart.png"

        if not self.lastCover == artist + song + album:
            self.lastCover = artist + song + album
            import ecs

            ecs.setLicenseKey("AKIAIICBON46BQIRCOUQ")
            ecs.setSecretKey("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")
            try:
                # search = ecs.ItemSearch(Keywords='Music', SearchIndex='Music',Artist=artist, Title=album, ResponseGroup='Images')
                search = ecs.ItemSearch(Keywords="Music", SearchIndex="Music", Artist=artist, ResponseGroup="Images")
            except:
                print "\n *** No Cover found, trying Artist only"
                try:
                    search = ecs.ItemSearch(
                        Keywords="Music", SearchIndex="Music", Artist=artist, ResponseGroup="Images"
                    )
                except:
                    print "\n *** No cover found \n"
                    self.lastImg = "/Filesystem/interfaces/images/nocoverart.png"
                    return self.lastImg
            img = search.next().LargeImage.URL
            self.lastImg = img
            return img
        else:
            return self.lastImg
コード例 #6
0
    sys.exit(1)

from product.models import *

from ecs import setLicenseKey, setSecretKey
#from site import addsitedir

#from django.core.management import execute_manager

#from string import *

from awsProductCrawler import LastSavedId, get_products_and_save

if __name__ == "__main__" :
	setLicenseKey("AKIAJPVEF4ZXJTBXRJOA");
	setSecretKey('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')
#	global last_browse_id
	last_browse_id = LastSavedId('last_browse_id.txt')
	if last_browse_id.last_id:
		last_saved_id = last_browse_id.last_id
	else:
		last_saved_id = '0'
#	global last_asin_id
#	last_asin_id = LastSavedId('last_id.txt')

#	global cart
#	cart = None
#
#	global admin
	try:
		admin = User.objects.get(username="******")