3 const Cc = Components.classes;
4 const Ci = Components.interfaces;
5 const Cu = Components.utils;
9 Cu.import(
"resource://app/jsmodules/sbProperties.jsm");
10 Cu.import(
"resource://app/jsmodules/StringUtils.jsm");
12 .getService(
Ci.fuelIApplication);
18 LS_NS:
"http://songbirdnest.com/rdf/library-servicepane#",
19 SC_NS:
"http://songbirdnest.com/rdf/shoutcast-servicepane#",
21 ensureFavouritesNode:
function() {
22 let SPS =
Cc[
'@songbirdnest.com/servicepane/service;1']
23 .getService(
Ci.sbIServicePaneService);
26 if (SPS.getNodesByAttributeNS(
this.SC_NS,
"SHOUTcast",
"true").length > 0)
30 let libGuid = Application.prefs.getValue(
"extensions.shoutcast-radio.templib.guid",
"");
35 Cc[
"@songbirdnest.com/Songbird/library/Manager;1"]
36 .getService(
Ci.sbILibraryManager);
39 tempLib = libraryManager.getLibrary(libGuid);
45 let
array = tempLib.getItemsByProperty(SBProperties.customType,
46 "radio_favouritesList");
50 let favesList = array.queryElementAt(0,
Ci.sbIMediaList);
51 if (!favesList.length) {
57 let radioFolder = SPS.getNode(
"SB:RadioStations");
59 Components.utils.reportError(
new Exception(
"Unexpected: attempt to create SHOUTcast favorites node without radio folder being created first"));
65 let
node = SPS.createNode();
67 node.id =
"urn:item:" + favesList.guid;
68 node.className =
"medialist-favorites medialist medialisttype-" + favesList.type;
69 node.name = strings.get(
"favourites",
"Favorite Stations");
71 node.editable =
false;
72 node.setAttributeNS(this.LS_NS,
"ListType", favesList.type);
73 node.setAttributeNS(this.LS_NS,
"ListGUID", favesList.guid);
74 node.setAttributeNS(this.LS_NS,
"LibraryGUID", tempLib.guid);
75 node.setAttributeNS(this.LS_NS,
"ListCustomType", favesList.getProperty(SBProperties.customType));
76 node.setAttributeNS(this.LS_NS,
"LibraryCustomType", tempLib.getProperty(SBProperties.customType));
77 node.setAttributeNS(this.
SC_NS,
"SHOUTcast",
"true");
78 radioFolder.appendChild(node);
function SBStringBundle(aBundle)