Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: nfelger/tractor
base: d078cc346b
...
head fork: nfelger/tractor
compare: 979a05e7e2
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 29, 2011
Phil Cowans Support artist images 246cb9d
Phil Cowans Fixing bad merge 979a05e
Showing with 32 additions and 3 deletions.
  1. +7 −0 popup.css
  2. +1 −2  popup.html
  3. +24 −1 tractor.js
View
7 popup.css
@@ -50,6 +50,13 @@ body
font-size: 0.8em;
}
+.artist-image img
+{
+ border: 1px solid black;
+ margin-right: 6px;
+ margin-top: 4px;
+}
+
.songkick-listing
{
font-family: 'lucida grande', tahoma, verdana, sans-serif;
View
3  popup.html
@@ -25,7 +25,7 @@
</ul>
<script type="text/template" id="artist-template">
- <h2><%= name %></h2>
+ <h2><span class="artist-image"></span><%= name %></h2>
<div class="soundCloudPlayer">Loading SoundCloud player...</div>
<h3>Youtube Plays</h3>
<div><span class="sparkline-youtube">Loading chart data...</span></div>
@@ -34,7 +34,6 @@
<h3>Is Myspace Dead Yet?</h3>
<div><span class="sparkline-myspace">Loading chart data...</span></div>
<h3>Upcoming Events</h3>
- <div><span class="sparkline">Loading chart data...</span></div>
<table class="songkick-listing"></table>
</script>
View
25 tractor.js
@@ -53,7 +53,7 @@ window.Timeseries = Backbone.Model.extend({
},
url: function() {
- return "http://apib2.semetric.com/artist/musicbrainz:" + escape(this.musicbrainzID) + "/" + escape(this.dataset) + "?token=bbc004e8891211e0ba8f00163e499d92"
+ return "http://apib2.semetric.com/artist/musicbrainz:" + escape(this.musicbrainzID) + "/" + escape(this.dataset) + "?token=bbc004e8891211e0ba8f00163e499d92";
},
parse: function(response) {
@@ -61,6 +61,20 @@ window.Timeseries = Backbone.Model.extend({
}
});
+window.ArtistImage = Backbone.Model.extend({
+ initialize: function() {
+ _.bindAll(this, "url");
+ },
+
+ url: function() {
+ return "http://ws.audioscrobbler.com/2.0/?format=json&method=artist.getinfo&artist=" + escape(this.artistName) + "&api_key=55452202851c1c703bb26c4f42045b16";
+ },
+
+ parse: function(response) {
+ return response.artist.image[1];
+ }
+});
+
window.SongkickCalendarView = Backbone.View.extend({
initialize: function() {
_.bindAll(this, "setCalendar", "render");
@@ -123,6 +137,10 @@ window.ArtistView = Backbone.View.extend({
return function(timeseries) {element.sparkline(timeseries.get("data"));};
},
+ renderArtistImage: function(element) {
+ return function(artistImage) {element.html("<img src=\"" + artistImage.get("#text") + "\"></img>");};
+ },
+
render: function(artist) {
$(this.el).html(this.template(artist.toJSON()));
@@ -149,6 +167,11 @@ window.ArtistView = Backbone.View.extend({
timeseries.bind("change", this.renderTimeseries(this.$(".sparkline-myspace")));
timeseries.fetch();
+ var artistImage = new ArtistImage;
+ artistImage.artistName = artist.get("name");
+ artistImage.bind("change", this.renderArtistImage(this.$(".artist-image")));
+ artistImage.fetch();
+
var calendar = new Calendar;
calendar.musicbrainzID = artist.get("mbid");

No commit comments for this range

Something went wrong with that request. Please try again.