CSS this is not.

Unexpectedly Rapid Progress

Posted: May 31st, 2009 | Author: | Filed under: Uncategorized | Tags: | 2 Comments »

I’ve almost reached Milestone viii. It’s kind of hard to believe.

One thing that I know I’ll need is some kind of JavaScript library that can take as input an asymmetrical (dis)similarity matrix and return coordinates on a plane for each member of that matrix, in order to visually arrange artists by similarity using Last.fm’s data. I’m not really sure such a thing exists.


Getting a library-wide total playCount for a given artist

Posted: May 29th, 2009 | Author: | Filed under: Milestone ii | Tags: , , | No Comments »
1
2
3
4
5
6
7
8
9
10
var destroyerPlays = LibraryUtils.mainLibrary.getItemsByProperty(SBProperties.artistName,"Destroyer");
var destroyerPlaysNames = destroyerPlays.enumerate();
destroyerPlayCounts = 0;
while (destroyerPlaysNames.hasMoreElements()) {
  var thesePlayCounts = destroyerPlaysNames.getNext();
  if (thesePlayCounts.getProperty(SBProperties.playCount)>0) {
    destroyerPlayCounts = destroyerPlayCounts + parseInt(thesePlayCounts.getProperty(SBProperties.playCount));
  };
}
alert ( destroyerPlayCounts );

I know my variable names suck right now. I know. This took two and a half hours of mucking around aimlessly before it worked. That it works is what’s important.

My question is, doesn’t line 1 define destroyerPlays as a sbIMediaList object? Then why aren’t some of the sbIMediaList methods available to it? And what is that enumerate method? I couldn’t even find any documentation on it. Apparently it takes no arguments and returns an actual sbIMediaList.

And why is SBProperties.playCount a string rather than an integer?


Milestone i before the end of the month?

Posted: May 29th, 2009 | Author: | Filed under: Milestone i | Tags: , | No Comments »

It’s not unlikely.

1
2
3
4
5
6
var artistNames = this._mediaListView.getDistinctValuesForProperty(SBProperties.artistName);
while (artistNames.hasMore()) {
var someArtistName = document.createElement('label');
someArtistName.setAttribute('value',artistNames.getNext());
var mediaViewBox = document.getElementById("artistcloud-media-page-box"); mediaViewBox.appendChild(someArtistName);
}

Progress?? Impossible.

Posted: May 28th, 2009 | Author: | Filed under: Milestone i | Tags: , | No Comments »
1
2
3
4
5
6
for(var i=0;i<=10000;i++) {
  if(!this._mediaListView.getItemByIndex(i)) break;
  var randArtist = document.createElement('label');
  randArtist.setAttribute('value', this._mediaListView.getItemByIndex(i).getProperty(SBProperties.artistName));
  var mediaViewBox = document.getElementById("artistcloud-media-page-box"); mediaViewBox.appendChild(randArtist);
}

This code successfully lists all the artists in the current media list! Granted, they are heavily duplicated, because it lists the artist for each item in the list. And the Media View is not scrollable (probably need to set overflow: auto in some CSS?). And there is probably a much more efficient way to get this list. And it makes the media list itself disappear. And 10000 is a totally arbitrary number. But it’s something. (Is it obvious that I grew up on BASIC?)

How can I get a count of the number of items in this._mediaListView?


The First Feeble Steps

Posted: May 27th, 2009 | Author: | Filed under: Milestone i | Tags: , | No Comments »
1
2
3
var randArtist = document.createElement('label');
randArtist.setAttribute('value', this._mediaListView.getItemByIndex(287).getProperty(SBProperties.artistName));
var mediaViewBox = document.getElementById("artistcloud-media-page-box"); mediaViewBox.appendChild(randArtist);

I found this block of code that I created some time ago to perform the simple task of grabbing an artist name — any artist name — from the media library and displaying it in the Media View. It works, though I’m not quite sure how.

Also am taking a look at this article, since it seems able to get me closer to my first milestone.