Working with iTunesSpy

Declarations

the ony thing you have to declare is the wp_iTunesSpy class if exists

<?php
if (class_exists('wp_iTunesSpy')) {
	$iTunesSpy = new wp_iTunesSpy();
}
?>

Sample functions

Add tracks to posts

To add tracks to posts you have to do the following:

Cover-Rotation

If you want to display the covers with the flash cover-rotator then you have to use the following code:

(Watch out: The following lines of code have line breaks due to better readability. Remove these line breaks because otherwise the code isn't functional at all)

<?php $url = parse_url(get_settings('siteurl')); ?>
<object type="application/x-shockwave-flash" width="160" height="160"
		bgcolor="#EEEEEE" data="<?= $url['path'] . '/wp-content/plugins/
		wp-itunesspy/pages/cover-rotation/' ?>rotator.swf?file=
		<?= rawurlencode($url['path'] . '/?itunesspy=pages&itunesspy_page=
		cover-rotation/covers.php') ?>">
	<param name="movie" value="<?= $url['path'] . 
		'/wp-content/plugins/wp-itunesspy/pages/cover-rotation/' ?>
		rotator.swf?file=<?= rawurlencode($url['path'] . 
		'/?itunesspy=pages&itunesspy_page=cover-rotation/covers.php') ?>" />
	<param name="bgcolor" value="#EEEEEE" />
</object>
	

Insert custom covers

If you want to display covers of an album where no info is available from amazon you have the posibillity to link your own covers!

Simply select the desired Track in the management screen and click on the 'x' (or 'Add') in the 'Artwork'-column.
Then just insert the urls to your covers.
That's it!

Variables

The variables in iTunesSpy must have a %-char before the variale name and after it. For example if you want to display the 'title' value you have to use %title%.

Variables in version 2.1 and above

variable description
id the track's unique id
art_id identifies the cover in the artcache table in the database
title the track's title
artist the track's artist
album the track's album
composer the track's composer
genre the track's genre
year release year
time lenght of the track
count how often the track was played in iTunes
file the filename (e.g. song.mp3)
bitrate bitrate of the track
rating the rating in iTunes
art returns the album cover as image e.g. <img src="..." alt="">
art_small like 'art' but small cover
art_medium like 'art' but medium cover
art_large like 'art' but large cover
link_itunes returns the iTunes MusicStore link
link_amazon_partner returns the Amazon associate link
link_amazon returns the Amazon link
link_lyrics returns the Lyrics link
link_google returns the Google link
art_link_itunes returns the album cover with the iTunes MusicStore link
art_link_itunes_small like 'art_link_itunes' but small cover
art_link_itunes_medium like 'art_link_itunes' but medium cover
art_link_itunes_large like 'art_link_itunes' but large cover
art_link_lyrics returns the album cover with the Lyrics link
art_link_lyrics_small like 'art_link_lyrics' but small cover
art_link_lyrics_medium like 'art_link_lyrics' but medium cover
art_link_lyrics_large like 'art_link_lyrics' but large cover
art_link_amazon returns the album cover with the Amazon link
art_link_amazon_small like 'art_link_amazon' but small cover
art_link_amazon_medium like 'art_link_amazon' but medium cover
art_link_amazon_large like 'art_link_amazon' but large cover
art_link_amazon_partner returns the album cover with the Amazon associate link
art_link_amazon_partner_small like 'art_link_amazon_partner' but small cover
art_link_amazon_partner_medium like 'art_link_amazon_partner' but medium cover
art_link_amazon_partner_large like 'art_link_amazon_partner' but large cover
art_link_google returns the album cover with the Google link
art_link_google_small like 'art_link_google' but small cover
art_link_google_medium like 'art_link_google' but medium cover
art_link_google_large like 'art_link_google' but large cover

Step by Step - Get iTunesSpy working with your theme...

  1. Open the sidebar.php of your current theme - you can find it in the '<worpress>/wp-content/themes/<current theme>/'-folder - in an editor like notepad or dreamweaver.
    step-by-step - Step 1
  2. Decide where you want to display the iTunesSpy output.
    step-by-step - Step 2
  3. Insert the appropriate php code and declarations...
    1. First of all check if the class 'wp_iTunesSpy' is available - otherwise the iTunesSpy plugin is disabled.
    2. Then insert a new sidebar section
    3. And now insert the php code from e.g. sample 1

    step-by-step - Step 3
  4. And here is the result...
    step-by-step - Step 4

iTunesSpy and the WordPress Widgets

iTunesSpy now supports the WordPress Widgets functionality!
So you can display your iTunes tracks also in your sidebar using the 'widgets' plugin. (Only if your theme supports widgets!)

To do that just activate the 'iTunesSpy SidebarWidget' plugin and drag-drop the iTunesSpy widget onto your sidebar.

If you want to edit the iTunesSpy output just edit the 'wp-itunesspySidebarWidgetContents.php' file in the iTunesSpy directory.

Note: The widget functionality is not officially supported!!!! So please send support questions concerning the widget at all!