Lasso Soft Inc. > Home

[amazon_albumcover]

Linkamazon_albumcover
AuthorJason Huck
CategoryUtility
Version8.x
Licensehttp://opensource.org/licenses/artistic-license.php
Posted26 Apr 2006
Updated26 Apr 2006
More by this author...

Description

This tag returns the first Large Image URL for the given album from Amazon Web Services. Requires a valid AWS Access Key ID.

Sample Usage

var('coverURL') = amazon_albumcover(
	-key=$key,
	-artist=$artist,
	-album=$album
);

$coverURL->size ? '';

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

define_tag(
	'albumcover',
	-namespace='amazon_',
	-required='key',
	-type='string',
	-required='artist',
	-type='string',
	-required='album',
	-type='string',
	-priority='replace',
	-description='Returns the first Large Image URL for the given album from Amazon Web Services.'
);
	local('baseurl' = 'http://webservices.amazon.com/onca/xml');

	local('params') = array(
		'Service' = 'AWSECommerceService',
		'AWSAccessKeyId' = #key,
		'Operation' = 'ItemSearch',
		'SearchIndex' = 'Music',
		'Artist' = encode_url(#artist),
		'Title' = encode_url(#album),
		'ResponseGroup' = 'Images'
	);
	
	local('response') = include_url(
		#baseurl,
		-getparams=#params
	);

	#response = string_replaceregexp(
		#response,
		-find='xmlns=".+?"',
		-replace=''
	);
	
	#response = xml(#response);
	
	local('imagedata') = #response->extract('//LargeImage/URL/text()');
	
	#imagedata->size ? return(#imagedata->first) | return;
/define_tag;

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft