Skip to content

Commit

Permalink
Change over namespace for properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurt Ruppel committed Feb 23, 2011
1 parent aeeb424 commit a23b229
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 82 deletions.
28 changes: 0 additions & 28 deletions README.txt
@@ -1,33 +1,9 @@
### Options for updating Dashboard/Favorites ###
A) Update periodically via nsIObserver/nsITimer [done]
- Makes sense for the Dashboard
B) Flag update and post event [done]
- Maybe makes more sense for Favorites? Still a usecase where a user
could go through another client, favorite, and not see the update in
Songbird.

note:
Related issue around losing view state... i.e. User plays from favorites
library and then library is refreshed (clear/populate) - Is that ok? Is
there another way to go about this?

### Blur searchbox once search is triggered ###

### Display informative message when no results are found ###

### Add favorited date to Favorites ###

### Allow for configuration of sandbox/test environment ###

### Disable edit, "dropping", and removal for directory ###

### Focus authorization dialog window ###

### Attempt to login to SoundCloud in the background before auth ###

### Scrape artist for the playback history service ###
Requirement for scrobbling tracks.

### [pref] Mediacore adjustments ###
- songbird.mediacore.output.buffertime
- songbird.mediacore.streaming.buffersize
Expand All @@ -38,7 +14,3 @@ Copy over all properties

### Disable editable title ###
Not sure if this is even possible...

### [playlistcommand] Copy permalink URL ###

### [playlistcommand] Follow user ###
6 changes: 4 additions & 2 deletions chrome/content/directory.js
Expand Up @@ -144,7 +144,6 @@ CloudDirectory.onLoad = function CloudDirectory_onLoad() {
this._library = this._service.library;
}


var node = gServicePane.activeNode;
document.title = node.displayName;

Expand Down Expand Up @@ -190,7 +189,10 @@ CloudDirectory.onLoad = function CloudDirectory_onLoad() {
Application.prefs.setValue(SOUNDCLOUD_FIRST_RUN, false);
}
},
onSearchCompleted: function listener_onSearchCompleted() {
onSearchCompleted: function listener_onSearchCompleted(aLibrary) {
if (!self._library || self._library != aLibrary)
return;

var count = self._library
.getItemCountByProperty(SBProperties.hidden,
"0");
Expand Down
26 changes: 14 additions & 12 deletions chrome/content/main.js.in
Expand Up @@ -156,21 +156,23 @@ SoundCloud.onLoad = function SoundCloud_onLoad() {
self._user.country;
},
onSearchTriggered: function listener_onSearchTriggered() {
self._searchTriggered = true;
},
onSearchCompleted: function listener_onSearchCompleted() {
self._searchComplete = true;
},
onTracksAdded: function listener_onTracksAdded(aLibrary) {
if (self._searchComplete) {
onSearchCompleted: function listener_onSearchCompleted(aLibrary) {
if (self._searchTriggered) {
self._searchTriggered = false;
var sps = Cc["@songbirdnest.com/servicepane/service;1"]
.getService(Ci.sbIServicePaneService);
var searchNode = sps.getNode("SB:RadioStations:SoundCloud");
if (gServicePane.activeNode != searchNode) {
gServicePane.activateAndLoadNode(searchNode, null, null);
// XXX - Don't want to do this, but for now, going with it
window.setTimeout(function() {
gServicePane.activateAndLoadNode(searchNode, null, null);
}, 0);
}
}

self._searchComplete = false;
},
onTracksAdded: function listener_onTracksAdded(aLibrary) {
},
QueryInterface: XPCOMUtils.generateQI([Ci.sbISoundCloudListener])
};
Expand Down Expand Up @@ -897,8 +899,8 @@ function SoundCloud_onShowCurrentTrack(aEvent) {
.getService(Ci.sbIMediacoreManager);
var item = mediacoreManager.sequencer.currentItem;
var streamSrc = SoundCloud._service.soundcloudURL;
// This could potentially problematic if we have a SoundCloud streaming item
// outside of the addon context... meh don't care.
// This could potentially be problematic if we have a SoundCloud streaming
// item outside of the addon context... meh don't care.
if (item.contentSrc.spec.indexOf(streamSrc) != -1) {
var node;
var sps = Cc["@songbirdnest.com/servicepane/service;1"]
Expand All @@ -919,10 +921,10 @@ function SoundCloud_onShowCurrentTrack(aEvent) {
gServicePane.activateAndLoadNode(node);
}

// Disables the onSearchCompleted node switch
self._searchTriggered = false;
var view = mediacoreManager.sequencer.view;
var row = mediacoreManager.sequencer.viewPosition;
view.treeView.selection.select(row);
view.treeView.selection.tree.ensureRowIsVisible(row);
}

// It's a SoundCloud stream so don't bubble
Expand Down
27 changes: 14 additions & 13 deletions chrome/content/soundcloudProperties.js
@@ -1,16 +1,17 @@
// SoundCloud property constants
const NS = "http://songbirdnest.com/soundcloud#";
const SB_NS = "http://songbirdnest.com/data/1.0#";

const SB_PROPERTY_TRACK_ID = SB_NS + "trackID";
const SB_PROPERTY_CREATION_DATE = SB_NS + "creationDate";
const SB_PROPERTY_COMMENTABLE = SB_NS + "commentable";
const SB_PROPERTY_USER = SB_NS + "user";
const SB_PROPERTY_USER_ID = SB_NS + "userID";
const SB_PROPERTY_USER_PERMALINK = SB_NS + "userPermalink";
const SB_PROPERTY_PLAYS = SB_NS + "playcount";
const SB_PROPERTY_FAVS = SB_NS + "favcount";
const SB_PROPERTY_PERMALINK = SB_NS + "permalinkURL";
const SB_PROPERTY_WAVEFORM = SB_NS + "waveformURL";
const SB_PROPERTY_DOWNLOAD_IMAGE = SB_NS + "downloadImage";
const SB_PROPERTY_DOWNLOAD_URL = SB_NS + "downloadURL";
const SB_PROPERTY_URL = SB_NS + "streamURL";
const SB_PROPERTY_TRACK_ID = NS + "trackID";
const SB_PROPERTY_CREATION_DATE = NS + "creationDate";
const SB_PROPERTY_COMMENTABLE = NS + "commentable";
const SB_PROPERTY_USER = NS + "user";
const SB_PROPERTY_USER_ID = NS + "userID";
const SB_PROPERTY_USER_PERMALINK = NS + "userPermalink";
const SB_PROPERTY_PLAYS = NS + "playcount";
const SB_PROPERTY_FAVS = NS + "favcount";
const SB_PROPERTY_PERMALINK = NS + "permalinkURL";
const SB_PROPERTY_WAVEFORM = NS + "waveformURL";
const SB_PROPERTY_DOWNLOAD_IMAGE = NS + "downloadImage";
const SB_PROPERTY_DOWNLOAD_URL = NS + "downloadURL";
const SB_PROPERTY_URL = NS + "streamURL";
20 changes: 10 additions & 10 deletions chrome/skin/directory.css
@@ -1,41 +1,41 @@
treecol[bind="http://songbirdnest.com/data/1.0#user"]
treecol[bind="http://songbirdnest.com/soundcloud#user"]
{
text-align: left;
}

treecol[bind="http://songbirdnest.com/data/1.0#playcount"],
treecol[bind="http://songbirdnest.com/data/1.0#favcount"],
treecol[bind="http://songbirdnest.com/data/1.0#downloadImage"]
treecol[bind="http://songbirdnest.com/soundcloud#playcount"],
treecol[bind="http://songbirdnest.com/soundcloud#favcount"],
treecol[bind="http://songbirdnest.com/soundcloud#downloadImage"]
{
background-image: url("chrome://soundcloud/skin/elements.png");
background-repeat: no-repeat;
max-width: 45px;
min-width: 45px;
}

treecol[bind="http://songbirdnest.com/data/1.0#playcount"]
treecol[bind="http://songbirdnest.com/soundcloud#playcount"]
{
background-position: 105% 1px;
}

treecol[bind="http://songbirdnest.com/data/1.0#favcount"]
treecol[bind="http://songbirdnest.com/soundcloud#favcount"]
{
background-position: 105% -43px;
}

treecol[bind="http://songbirdnest.com/data/1.0#downloadImage"]
treecol[bind="http://songbirdnest.com/soundcloud#downloadImage"]
{
background-position: 105% -68px;
text-align: center;
}

treecol[bind="http://songbirdnest.com/data/1.0#user"] > label,
.sb-playlist-tree > treechildren::-moz-tree-cell-text( http-songbirdnest-com-data-1-0-user )
treecol[bind="http://songbirdnest.com/soundcloud#user"] > label,
.sb-playlist-tree > treechildren::-moz-tree-cell-text( http-songbirdnest-com-soundcloud-user )
{
padding-right: 15px;
}

.sb-playlist-tree > treechildren::-moz-tree-image( http-songbirdnest-com-data-1-0-downloadImage )
.sb-playlist-tree > treechildren::-moz-tree-image( http-songbirdnest-com-soundcloud-downloadImage )
{
cursor: pointer;
}
Expand Down
6 changes: 4 additions & 2 deletions components/public/sbISoundCloudService.idl
Expand Up @@ -50,6 +50,8 @@ interface sbISoundCloudService : nsISupports
{
attribute AString nowPlayingURL;

attribute sbILibrary activeLibrary;

readonly attribute AString soundcloudURL;

readonly attribute sbISoundCloudUser user;
Expand Down Expand Up @@ -127,7 +129,7 @@ interface sbISoundCloudService : nsISupports
* \interface sbISoundCloudListener
* \brief
*/
[scriptable, uuid(88657d7e-1dd2-11b2-a624-e043dcf791bb)]
[scriptable, uuid(d8dbe513-453d-4487-9c42-da73039d2faf)]
interface sbISoundCloudListener : nsISupports
{
void onLoginBegins();
Expand All @@ -142,7 +144,7 @@ interface sbISoundCloudListener : nsISupports

void onSearchTriggered();

void onSearchCompleted();
void onSearchCompleted(in sbILibrary aLibrary);

void onTracksAdded(in sbILibrary aLibrary);
};
31 changes: 16 additions & 15 deletions components/src/sbSoundCloud.js
Expand Up @@ -45,18 +45,18 @@ const SB_NS = "http://songbirdnest.com/data/1.0#";
const SP_NS = "http://songbirdnest.com/rdf/servicepane#";

// SoundCloud property constants
const SB_PROPERTY_TRACK_ID = SB_NS + "trackID";
const SB_PROPERTY_CREATION_DATE = SB_NS + "creationDate";
const SB_PROPERTY_COMMENTABLE = SB_NS + "commentable";
const SB_PROPERTY_USER = SB_NS + "user";
const SB_PROPERTY_USER_ID = SB_NS + "userID";
const SB_PROPERTY_USER_PERMALINK = SB_NS + "userPermalink";
const SB_PROPERTY_PLAYS = SB_NS + "playcount";
const SB_PROPERTY_FAVS = SB_NS + "favcount";
const SB_PROPERTY_PERMALINK = SB_NS + "permalinkURL";
const SB_PROPERTY_WAVEFORM = SB_NS + "waveformURL";
const SB_PROPERTY_DOWNLOAD_IMAGE = SB_NS + "downloadImage";
const SB_PROPERTY_DOWNLOAD_URL = SB_NS + "downloadURL";
const SB_PROPERTY_TRACK_ID = NS + "trackID";
const SB_PROPERTY_CREATION_DATE = NS + "creationDate";
const SB_PROPERTY_COMMENTABLE = NS + "commentable";
const SB_PROPERTY_USER = NS + "user";
const SB_PROPERTY_USER_ID = NS + "userID";
const SB_PROPERTY_USER_PERMALINK = NS + "userPermalink";
const SB_PROPERTY_PLAYS = NS + "playcount";
const SB_PROPERTY_FAVS = NS + "favcount";
const SB_PROPERTY_PERMALINK = NS + "permalinkURL";
const SB_PROPERTY_WAVEFORM = NS + "waveformURL";
const SB_PROPERTY_DOWNLOAD_IMAGE = NS + "downloadImage";
const SB_PROPERTY_DOWNLOAD_URL = NS + "downloadURL";

const SOCL_URL = "https://api.soundcloud.com";
const AUTH_PAGE = "chrome://soundcloud/content/soundcloudAuthorize.xul";
Expand Down Expand Up @@ -688,8 +688,10 @@ function sbSoundCloudService() {
var batchListener = {
onProgress: function(aIndex) {},
onComplete: function(aMediaItems, aResult) {
if (aComplete) {
self.notifyListeners("onSearchCompleted");
if (!aMediaItems) { return; }

if (aComplete && aMediaItems.length == itemArray.length) {
self.notifyListeners("onSearchCompleted", [aLibrary]);
}
self.notifyListeners("onTracksAdded", [aLibrary]);
if (aLibrary == self.dashboard) {
Expand Down Expand Up @@ -1322,7 +1324,6 @@ sbSoundCloudService.prototype = {
this._dbs.insertSearch(url + "?" + aFlags, aQuery);
}

this.notifyListeners("onSearchTriggered");
this._library.clear();
}

Expand Down

0 comments on commit a23b229

Please sign in to comment.