Artist information for 'yacht' will appear at 5 seconds and disappear at 15 seconds.
+
Artist information for 'Coldplay' will appear at 20 seconds and disappear at 45 seconds.
+
+
+
+
+
+
+
diff --git a/plugins/lastfm/popcorn.lastfm.js b/plugins/lastfm/popcorn.lastfm.js
new file mode 100644
index 0000000..ad390ff
--- /dev/null
+++ b/plugins/lastfm/popcorn.lastfm.js
@@ -0,0 +1,91 @@
+// PLUGIN: LASTFM
+
+(function (Popcorn) {
+
+ /**
+ * LastFM popcorn plug-in
+ * Appends information about a LastFM artist to an element on the page.
+ * Options parameter will need a start, end, target and artist.
+ * Start is the time that you want this plug-in to execute
+ * End is the time that you want this plug-in to stop executing
+ * Artist is the name of who's LastFM information you wish to show
+ * Target is the id of the document element that the images are
+ * appended to, this target element must exist on the DOM
+ *
+ * @param {Object} options
+ *
+ * Example:
+ var p = Popcorn('#video')
+ .lastfm({
+ start: 5, // seconds, mandatory
+ end: 15, // seconds, mandatory
+ artist: 'yacht', // mandatory
+ target: 'lastfmdiv' // mandatory
+ } )
+ *
+ */
+ Popcorn.plugin( "lastfm" , {
+
+ manifest: {
+ about:{
+ name: "Popcorn LastFM Plugin",
+ version: "0.1",
+ author: "Steven Weerdenburg",
+ website: "http://sweerdenburg.wordpress.com/"
+ },
+ options:{
+ start : {elem:'input', type:'text', label:'In'},
+ end : {elem:'input', type:'text', label:'Out'},
+ target : 'lastfm-container',
+ artist : {elem:'input', type:'text', label:'Artist'}
+ }
+ },
+
+ _setup: function( options ) {
+ options.container = document.createElement( 'div' );
+ options.container.style.display = "none";
+ if ( document.getElementById( options.target ) ) {
+ document.getElementById( options.target ).appendChild( options.container );
+ }
+
+ var htmlString = "";;
+ $.getJSON("http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist="+ options.artist +"&api_key=30ac38340e8be75f9268727cb4526b3d&format=json&callback=?",
+ function(data){
+ htmlString += '
';
+ options.container.innerHTML = htmlString;
+ }
+ );
+ },
+ /**
+ * @member LastFM
+ * The start function will be executed when the currentTime
+ * of the video reaches the start time provided by the
+ * options variable
+ */
+ start: function( event, options ) {
+ options.container.style.display = "inline";
+ },
+ /**
+ * @member LastFM
+ * The end function will be executed when the currentTime
+ * of the video reaches the end time provided by the
+ * options variable
+ */
+ end: function( event, options ) {
+ options.container.style.display = "none";
+ }
+ });
+
+})( Popcorn );
diff --git a/plugins/lastfm/popcorn.lastfm.unit.html b/plugins/lastfm/popcorn.lastfm.unit.html
new file mode 100644
index 0000000..f7bf0f0
--- /dev/null
+++ b/plugins/lastfm/popcorn.lastfm.unit.html
@@ -0,0 +1,45 @@
+
+
+
+ Popcorn API
+
+
+
+
+
+
+
+
+
+
+
+
+