25 const Cc = Components.classes;
26 const CC = Components.Constructor;
27 const Ci = Components.interfaces;
28 const Cr = Components.results;
29 const Cu = Components.utils;
31 Cu.import(
"resource://gre/modules/XPCOMUtils.jsm");
32 Cu.import(
"resource://app/jsmodules/SBJobUtils.jsm");
33 Cu.import(
"resource://app/jsmodules/ArrayConverter.jsm");
34 Cu.import(
"resource://app/jsmodules/sbProperties.jsm");
40 {
artist:
"Hootie & The Blowfish", title:
"Let Her Cry"},
41 {
artist:
"Genesis", title:
"Throwing It All Away"},
42 {
artist:
"Pretenders", title:
"I'll Stand By You"},
43 {
artist:
"Jesus Jones", title:
"Right Here, Right Now"},
44 {
artist:
"Bad Company", title:
"Feel Like Makin' Love"},
45 {
artist:
"Alannah Myles", title:
"Black Velvet"},
46 {
artist:
"Foreigner", title:
"I Want To Know What Love Is"},
47 {
artist:
"Boston", title:
"Amanda"},
48 {
artist:
"Meat Loaf", title:
"I'd Do Anything For Love (But I Won't Do That"},
49 {
artist:
"Pat Benatar", title:
"We Belong"},
50 {
artist:
"April Wine", title:
"Just Between You And Me"},
51 {
artist:
"INXS", title:
"Never Tear Us Apart"},
52 {
artist:
"Lita Ford", title:
"Shot Of Poison"},
53 {
artist:
"Nazareth", title:
"Love Hurts"},
54 {
artist:
"Skid Row", title:
"I Remember You"}
58 {
artist:
"The Lonely Island", title:
"Who Said We're Wack?"},
59 {
artist:
"The Lonely Island", title:
"Santana DVX (feat. E-40)"},
60 {
artist:
"The Lonely Island", title:
"Jizz In My Pants"},
61 {
artist:
"The Lonely Island", title:
"I'm On A Boat (feat. T-Pain)"},
62 {
artist:
"The Lonely Island", title:
"Sax Man (feat. Jack Black)"},
63 {
artist:
"The Lonely Island", title:
"Lazy Sunday (feat. Chris Parnell)"},
64 {
artist:
"The Lonely Island", title:
"Normal Guy - Interlude"},
65 {
artist:
"The Lonely Island", title:
"Boombox (feat. Julian Casablancas)"},
66 {
artist:
"The Lonely Island", title:
"Shrooms - Interlude"},
67 {
artist:
"The Lonely Island", title:
"Like A Boss"},
68 {
artist:
"The Lonely Island", title:
"We Like Sports"},
69 {
artist:
"The Lonely Island", title:
"Dreamgirl (feat. Norah Jones)"},
70 {
artist:
"The Lonely Island", title:
"Ras Trent"},
71 {
artist:
"The Lonely Island", title:
"Dick In A Box (feat. Justin Timberlake)"},
72 {
artist:
"The Lonely Island", title:
"The Old Saloon - Interlude"},
73 {
artist:
"The Lonely Island", title:
"Punch You In The Jeans"},
74 {
artist:
"The Lonely Island", title:
"Space Olympics"},
75 {
artist:
"The Lonely Island", title:
"Natalie's Rap (feat. Natalie Portman & Chris Parnell)"},
76 {
artist:
"The Lonely Island", title:
"Incredibad"},
80 {
artist:
"Not The Lonely Island", title:
"Fake Track 1"},
81 {
artist:
"Not The Lonely Island", title:
"Fake Track 2"},
82 {
artist:
"Not The Lonely Island", title:
"Fake Track 3"},
83 {
artist:
"Not The Lonely Island", title:
"Fake Track 4"},
84 {
artist:
"Not The Lonely Island", title:
"Fake Track 5"},
85 {
artist:
"Not The Lonely Island", title:
"Fake Track 6"},
86 {
artist:
"Not The Lonely Island", title:
"Fake Track 7"},
87 {
artist:
"Not The Lonely Island", title:
"Fake Track 8"},
88 {
artist:
"Not The Lonely Island", title:
"Fake Track 9"},
89 {
artist:
"Not The Lonely Island", title:
"Fake Track 10"},
90 {
artist:
"Not The Lonely Island", title:
"Fake Track 11"},
91 {
artist:
"Not The Lonely Island", title:
"Fake Track 12"},
92 {
artist:
"Not The Lonely Island", title:
"Fake Track 13"},
93 {
artist:
"Not The Lonely Island", title:
"Fake Track 14"},
94 {
artist:
"Not The Lonely Island", title:
"Fake Track 15"},
95 {
artist:
"Not The Lonely Island", title:
"Fake Track 16"},
96 {
artist:
"Not The Lonely Island", title:
"Fake Track 17"},
97 {
artist:
"Not The Lonely Island", title:
"Fake Track 18"},
98 {
artist:
"Not The Lonely Island", title:
"Fake Track 19"},
102 {
artist:
"Songbird", title:
"No Data"},
107 classID : Components.ID(
'9e599632-1dd1-11b2-ab82-e0952e7285ce'),
108 contractID :
'@songbirdnest.com/Songbird/MetadataLookup/testProvider;1',
110 Ci.nsITimerCallback]),
112 name :
"TestProvider",
114 description :
"Test provider. Unless you like Britney, U2, or Midnight Rock, you probably don't want this.",
115 infoURL :
"http://getsongbird.com",
117 identifyTOC :
function sbTestProvider_identifyTOC(aTOC) {
118 if (aTOC.firstTrackIndex == 1 && aTOC.lastTrackIndex == 15 &&
119 aTOC.leadOutTrackOffset == 285675)
120 return Ci.sbIMockCDDeviceController.MOCK_MEDIA_DISC_MIDNIGHT_ROCK;
121 else if (aTOC.firstTrackIndex == 1 && aTOC.lastTrackIndex == 12 &&
122 aTOC.leadOutTrackOffset == 260335)
123 return Ci.sbIMockCDDeviceController.MOCK_MEDIA_DISC_BABY_ONE_MORE_TIME;
124 else if (aTOC.firstTrackIndex == 1 && aTOC.lastTrackIndex == 11 &&
125 aTOC.leadOutTrackOffset == 225562)
126 return Ci.sbIMockCDDeviceController.MOCK_MEDIA_DISC_U2;
127 else if (aTOC.firstTrackIndex == 1 && aTOC.lastTrackIndex == 19 &&
128 aTOC.leadOutTrackOffset == 190565)
129 return Ci.sbIMockCDDeviceController.MOCK_MEDIA_DISC_INCREDIBAD;
130 else if (aTOC.firstTrackIndex == 1 && aTOC.lastTrackIndex == 1 &&
131 aTOC.leadOutTrackOffset == 131072)
132 return Ci.sbIMockCDDeviceController.MOCK_MEDIA_DISC_INSTANT_JUNK;
134 throw Components.results.NS_ERROR_UNEXPECTED;
138 queryDisc :
function sbTestProvider_queryDisc(aTOC) {
139 var
id = this.identifyTOC(aTOC);
140 this.
_timer =
Cc[
"@mozilla.org/timer;1"].createInstance(
Ci.nsITimer);
142 var job =
Cc[
"@songbirdnest.com/Songbird/MetadataLookup/job;1"]
143 .createInstance(
Ci.sbIMetadataLookupJob);
144 job.init(
Ci.sbIMetadataLookupJob.JOB_DISC_LOOKUP,
145 Ci.sbIJobProgress.STATUS_RUNNING);
148 this.whichAlbum =
id;
151 case Ci.sbIMockCDDeviceController.MOCK_MEDIA_DISC_MIDNIGHT_ROCK:
154 this.
_timer.initWithCallback(
this, 5000,
155 Ci.nsITimerCallback.TYPE_ONE_SHOT);
157 case Ci.sbIMockCDDeviceController.MOCK_MEDIA_DISC_BABY_ONE_MORE_TIME:
160 this.
_timer.initWithCallback(
this, 5000,
161 Ci.nsITimerCallback.TYPE_ONE_SHOT);
163 case Ci.sbIMockCDDeviceController.MOCK_MEDIA_DISC_U2:
166 this.
_timer.initWithCallback(
this, 180000,
167 Ci.nsITimerCallback.TYPE_ONE_SHOT);
169 case Ci.sbIMockCDDeviceController.MOCK_MEDIA_DISC_INCREDIBAD:
172 this.
_timer.initWithCallback(
this, 5000,
173 Ci.nsITimerCallback.TYPE_ONE_SHOT);
175 case Ci.sbIMockCDDeviceController.MOCK_MEDIA_DISC_INSTANT_JUNK:
181 dump(
"This is not a recognised disc.\n");
188 getAlbumDetail:
function(album) {
189 var job =
Cc[
"@songbirdnest.com/Songbird/MetadataLookup/job;1"]
190 .createInstance(
Ci.sbIMetadataLookupJob);
191 job.init(
Ci.sbIMetadataLookupJob.JOB_ALBUM_DETAIL_LOOKUP,
192 Ci.sbIJobProgress.STATUS_RUNNING);
194 job.appendResult(album);
195 job.changeStatus(
Ci.sbIJobProgress.STATUS_SUCCEEDED);
200 makeAlbum:
function(albumToc, artistName, albumName, genre) {
203 a.QueryInterface = XPCOMUtils.generateQI([
Ci.sbIMetadataAlbumDetail]);
206 Cc[
"@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"]
207 .createInstance(
Ci.sbIMutablePropertyArray);
209 a.properties.appendProperty(SBProperties.genre, genre);
210 a.properties.appendProperty(SBProperties.artistName, artistName);
211 a.properties.appendProperty(SBProperties.albumName, albumName);
213 a.tracks =
Cc[
"@mozilla.org/array;1"].createInstance(
Ci.nsIMutableArray);
214 for (var
i = 0;
i < albumToc.length;
i++) {
215 var track =
Cc[
"@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"]
216 .createInstance(
Ci.sbIMutablePropertyArray);
217 var trackInfo = albumToc[
i];
218 track.appendProperty(SBProperties.albumArtistName, artistName);
219 track.appendProperty(SBProperties.artistName, trackInfo.artist);
220 track.appendProperty(SBProperties.trackName, trackInfo.title);
221 track.appendProperty(SBProperties.albumName, albumName);
222 track.appendProperty(SBProperties.genre, genre);
223 track.appendProperty(SBProperties.trackNumber, (
i+1).toString());
224 a.tracks.appendElement(track,
false);
230 notify:
function (aTimer) {
231 if (aTimer != this.
_timer)
235 var
id = this.whichAlbum;
236 if (
id ==
Ci.sbIMockCDDeviceController.MOCK_MEDIA_DISC_BABY_ONE_MORE_TIME)
239 this.job.changeStatus(
Ci.sbIJobProgress.STATUS_SUCCEEDED);
240 }
else if (
id ==
Ci.sbIMockCDDeviceController.MOCK_MEDIA_DISC_MIDNIGHT_ROCK)
242 var a = this.makeAlbum(midnightRock,
"Various",
"Midnight Rock Disc 1",
246 this.job.appendResult(a);
247 this.job.changeStatus(
Ci.sbIJobProgress.STATUS_SUCCEEDED);
248 }
else if (
id ==
Ci.sbIMockCDDeviceController.MOCK_MEDIA_DISC_INCREDIBAD)
250 var a = this.makeAlbum(incredibad,
"The Lonely Island",
"Incredibad",
252 var b = this.makeAlbum(notIncredibad,
"Not The Lonely Island",
253 "Fake Incredibad",
"Gospel");
254 this.job.appendResult(a);
255 this.job.appendResult(b);
256 this.job.changeStatus(
Ci.sbIJobProgress.STATUS_SUCCEEDED);
257 }
else if (
id ==
Ci.sbIMockCDDeviceController.MOCK_MEDIA_DISC_INSTANT_JUNK)
260 var a = this.makeAlbum(instantJunk,
"Songbird",
"Instant Junk",
264 this.job.appendResult(a);
265 this.job.changeStatus(
Ci.sbIJobProgress.STATUS_SUCCEEDED);
267 this.job.changeStatus(
Ci.sbIJobProgress.STATUS_FAILED);
277 function(aCompMgr, aFileSpec, aLocation) {
278 XPCOMUtils.categoryManager.addCategoryEntry(
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
sbOSDControlService prototype QueryInterface
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
sbDeviceFirmwareAutoCheckForUpdate prototype _timer
var getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow('Songbird SBProperties artist
TimerLoop prototype notify
sbDeviceFirmwareAutoCheckForUpdate prototype classID
_getSelectedPageStyle s i