56 var
prefSvc =
Cc[
"@mozilla.org/preferences-service;1"]
57 .getService(
Ci.nsIPrefBranch);
58 var oldWritingEnabledPref = prefSvc.getBoolPref(
"songbird.metadata.enableWriting");
61 prefSvc.setBoolPref(
"songbird.metadata.enableWriting",
false);
65 throw new Error(
"MetadataJobManager does not respect enableWriting pref!");
67 if (Components.lastResult != Components.results.NS_ERROR_NOT_AVAILABLE) {
68 throw new Error(
"MetadataJobManager does not respect enableWriting pref!");
72 prefSvc.setBoolPref(
"songbird.metadata.enableWriting", oldWritingEnabledPref);
74 testFolder.remove(
true);
84 var scan =
Cc[
"@songbirdnest.com/Songbird/FileScan;1"]
85 .createInstance(
Ci.sbIFileScan);
86 var query =
Cc[
"@songbirdnest.com/Songbird/FileScanQuery;1"]
87 .createInstance(
Ci.sbIFileScanQuery);
88 query.setDirectory(folder.path);
89 query.setRecurse(
true);
92 query.addFileExtension(extension);
95 scan.submitQuery(query);
99 while (query.isScanning()) {
104 var urls = query.getResultRangeAsURIStrings(0, query.getFileCount() - 1);
116 var items = library.batchCreateMediaItems(files,
null,
true);
119 for (var
i = 0;
i < items.length;
i++) {
120 jsItems.push(items.queryElementAt(
i,
Ci.sbIMediaItem));
130 var
array = Components.classes[
"@songbirdnest.com/moz/xpcom/threadsafe-array;1"]
131 .createInstance(Components.interfaces.nsIMutableArray);
132 for each (var item
in items) {
133 array.appendElement(item,
false);
135 manager = Components.classes[
"@songbirdnest.com/Songbird/FileMetadataService;1"]
136 .getService(Components.interfaces.sbIFileMetadataService);
137 return manager.write(
array);
function sleep(ms, suppressOutput)
function newAppRelativeFile(path)
function assertEqual(aExpected, aActual, aMessage)
function getCopyOfFolder(folder, tempName)
Copy the given folder to tempName, returning an nsIFile for the new location.
_getSelectedPageStyle s i