37 var ITEMS_PER_JOB = 200;
42 .getService(Components.interfaces.sbIFileMetadataService);
44 var scan =
Cc[
"@songbirdnest.com/Songbird/FileScan;1"]
45 .createInstance(
Ci.sbIFileScan);
47 var query =
Cc[
"@songbirdnest.com/Songbird/FileScanQuery;1"]
48 .createInstance(
Ci.sbIFileScanQuery);
49 query.setDirectory(
"/media/sdb1/steve/old/steve/fakemp3s");
50 query.setRecurse(
true);
52 query.addFileExtension(
"mp3");
54 scan.submitQuery(query);
58 while (query.isScanning()) {
61 var urls = query.getResultRangeAsURIStrings(0, query.getFileCount() - 1);
65 log(
"Creating " + urls.length +
" items...");
66 var items = library.batchCreateMediaItems(urls,
null,
true);
70 var jobs = items.length / ITEMS_PER_JOB;
71 log(
"jobs = " + jobs);
73 for (var
i = 0;
i < jobs;
i++) {
74 var a =
Cc[
"@songbirdnest.com/moz/xpcom/threadsafe-array;1"].createInstance(
Ci.nsIMutableArray);
75 for (var j = 0; j < ITEMS_PER_JOB; j++) {
76 if (index >= items.length) {
79 a.appendElement(items.queryElementAt(index,
Ci.sbIMediaItem),
false);
86 log(
"length = " + a.length +
" count = " +
count);
93 if (job.status == Components.interfaces.sbIJobProgress.STATUS_RUNNING) {
101 var time = Date.now() -
t;
102 log(
"Metadata scan finished in " + (time / 1000) +
"s");
function sleep(ms, suppressOutput)
_getSelectedPageStyle s i