]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
Lastfm support added
authorkrome <nicolas@upian.com>
Tue, 28 Sep 2010 14:17:10 +0000 (16:17 +0200)
committerkrome <nicolas@upian.com>
Tue, 28 Sep 2010 14:17:10 +0000 (16:17 +0200)
demos/semantic_video/index.html
demos/semantic_video/xml/webMadeMovies.xml
popcorn.js

index 8b9e05c299ae3e328a3e834e0e831d4efc1142fe..cdcb07a62bbcac21160130a6431022d792e45e2d 100644 (file)
@@ -85,7 +85,7 @@
           <!-- Start Primary Links -->
           <nav id="demo-info">
             <ul>
-              <li><a href="#" onclick="javascript:void();" class="clickhere green"><img src="images/video_icon.png" alt="" width="18" height="14" />watch a video and learn more about this demo</a></li>
+              <li><a href="#" onClick="javascript:void();" class="clickhere green"><img src="images/video_icon.png" alt="" width="18" height="14" />watch a video and learn more about this demo</a></li>
             </ul>
           </nav>
           <!-- End Primary Links -->
                 };
                 Popcorn.VideoManager.prototype.loaded = function() {
                   for (var i in this.commandObjects) {
-                    if (this.commandObjects[i].name === 'flickr' || this.commandObjects[i].name === 'footnote' || this.commandObjects[i].name === 'location' || this.commandObjects[i].name === 'twitter' || this.commandObjects[i].name === 'wiki') {
+                    if (this.commandObjects[i].name === 'flickr' || this.commandObjects[i].name === 'footnote' || this.commandObjects[i].name === 'location' || this.commandObjects[i].name === 'twitter' || this.commandObjects[i].name === 'wiki' || this.commandObjects[i].name === 'lastfm') {
                       this.commandObjects[i].extension.image = createImage("images/overlay/" + this.commandObjects[i].name + ".png");
                       this.commandObjects[i].extension.onIn = function() {
                         this.image.setAttribute('style', "display:inline");
                 <h3><img src="images/logo_google_news.png" alt="Google News" width="74" height="33" />
                 </h3>
                 <div id="googlenewsdiv"><div class="overlay"></div><div class="inactive"></div></div>
+              </section>
+                         <section>
+                <h3><img src="images/logo_lastfm.png" alt="Lastfm" width="80" height="24" /></h3>
+                <a href="#" class="collapse"><span>Collapse</span></a>
+                <div class="content" id="lastfmdiv"><div class="overlay"></div><div class="inactive"></div></div>
               </section>
             </div>
             <!-- End Column B -->
index 3ff05acb7e1b32adf0e382c836ebddc8385a73ed..0662c607d05590ecb298cec538061339af279e09 100644 (file)
       <twitter in="00:04:19:06" out="00:04:24:01" title="Celine Celines" source="from:celinecelines" target="personaltwitter" width="238" height="120"/>
       <videotag target="inthisvideo" in="00:04:19:06" out="00:04:24:01">Celine Celines</videotag>
       <flickr in="00:04:19:06" out="00:04:24:01" target="personalflickr" userid="13072070@N00" numberofimages="8" padding="4px"/>
+         <lastfm in="00:00:00" out="00:05:00" resourceid="the rolling stones" target="lastfmdiv"/>
+         <lastfm in="00:05:00" out="00:10:00" resourceid="arctic monkeys" target="lastfmdiv"/>
+         <lastfm in="00:10:00" out="00:15:00" resourceid="johnny cash" target="lastfmdiv"/>
+         <lastfm in="00:15:00" out="01:00:00" resourceid="the libertines" target="lastfmdiv"/>
     </resources>
 
     <map>
index d66e03395095ef7e8cfb32fa99cfaa3c20eaea1d..2328ac9bd8beb59b49a7af9e7077099d83ccc551 100644 (file)
     };
   };
 
+  ////////////////////////////////////////////////////////////////////////////
+  // Lastfm Command
+  ////////////////////////////////////////////////////////////////////////////
+  
+  Popcorn.LastfmCommand = function(name, params, text, videoManager) {
+       Popcorn.VideoCommand.call(this, name, params, text, videoManager);
+    // Setup a default, hidden div to hold the images
+    var target = document.createElement('div');
+    target.setAttribute('id', this.id);
+    document.getElementById(this.params.target).appendChild(target);
+    // Div is hidden by default
+    target.setAttribute('style', 'display:none');
+    // This uses jquery
+       $.getJSON("http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist="+ this.params.resourceid +"&api_key=30ac38340e8be75f9268727cb4526b3d&format=json&callback=?",
+         function(data){       
+           htmlString = '';
+           //console.log(data.artist.image[2]['#text']);
+               htmlString += '<h3>'+data.artist.name+'</h3>';
+           htmlString += '<a href="'+data.artist.url+'" target="_blank" style="float:left;margin:0 10px 0 0;"><img src="'+ data.artist.image[2]['#text'] +'" alt=""></a>';
+               htmlString += '<p>'+ data.artist.bio.summary +'</p>';
+               htmlString += '<hr /><p><h4>Tags</h4><ul>';
+               jQuery.each(data.artist.tags.tag, function(i,val) {
+                 htmlString += '<li><a href="'+ this.url +'">'+ this.name +'</a></li>';
+               });
+               htmlString += '</ul></p>';
+               htmlString += '<hr /><p><h4>Similar</h4><ul>';
+               jQuery.each(data.artist.similar.artist, function(i,val) {
+                 htmlString += '<li><a href="'+ this.url +'">'+ this.name +'</a></li>';
+               });
+               htmlString += '</ul></p>';
+           target.innerHTML = htmlString;
+         }
+       );
+       
+    this.target = target;
+    this.onIn = function() {
+      this.target.setAttribute('style', 'display:inline');
+    };
+    this.onOut = function() {
+      this.target.setAttribute('style', 'display:none');
+    };
+       this.preload = function() {}; // Probably going to need to preload this.
+  };
+  
   ////////////////////////////////////////////////////////////////////////////
   // Twitter Command
   ////////////////////////////////////////////////////////////////////////////
       create: function(name, params, text, videoManager) {
         return new Popcorn.WikiCommand(name, params, text, videoManager);
       }
+    },
+       lastfm: {
+      create: function(name, params, text, videoManager) {
+        return new Popcorn.LastfmCommand(name, params, text, videoManager);
+      }
     },
     lowerthird: {
       create: function(name, params, text, videoManager) {