31 Components.utils.import(
"resource://app/jsmodules/ArrayConverter.jsm");
32 Components.utils.import(
"resource://app/jsmodules/sbProperties.jsm");
33 Components.utils.import(
"resource://app/jsmodules/sbLibraryUtils.jsm");
39 .getService(
Ci.sbIDirectoryImportService);
55 libraryManager.registerLibrary(gLibrary,
false);
57 var job = gDirectoryImporter.import(gDirectories, gLibrary);
70 log(
"DirectoryImport: onFirstImportProgress: " + job.statusText +
71 " status " + job.status +
" added " + job.totalAddedToLibrary );
74 if (job.status ==
Ci.sbIJobProgress.STATUS_RUNNING) {
81 log(
"DirectoryImport: onFirstImportProgress: totalAddedToLibrary=" + job.totalAddedToLibrary);
82 log(
"DirectoryImport: onFirstImportProgress: totalDuplicates=" + job.totalDuplicates);
83 log(
"DirectoryImport: onFirstImportProgress: gLibrary.length=" + gLibrary.length);
85 assertEqual(gLibrary.length, job.totalAddedToLibrary);
87 assertTrue(job.enumerateAllItems().hasMoreElements());
88 assertTrue(job.enumerateAllItems().getNext() instanceof
Ci.sbIMediaItem);
92 var foundSomeMetadata =
false;
93 for (var
i=0;
i < gLibrary.length;
i++) {
94 var item = gLibrary.getItemByIndex(
i);
95 var
artist = item.getProperty(SBProperties.artistName);
96 log(
"DirectoryImport: onFirstImportProgress: found item with artist=" + artist);
98 foundSomeMetadata =
true;
119 gMediaList = gLibrary.createMediaList(
"simple");
123 gMediaList.add(gLibrary.getItemByIndex(1));
124 gMediaList.add(gLibrary.getItemByIndex(2));
126 var job = gDirectoryImporter.import(gDirectories, gMediaList,
140 log(
"DirectoryImport: onSecondImportProgress: " + job.statusText +
141 " status " + job.status +
" added " + job.totalAddedToLibrary );
144 if (job.status ==
Ci.sbIJobProgress.STATUS_RUNNING) {
150 log(
"DirectoryImport: onSecondImportProgress: totalAddedToLibrary=" + job.totalAddedToLibrary);
151 log(
"DirectoryImport: onSecondImportProgress: totalDuplicates=" + job.totalDuplicates);
152 log(
"DirectoryImport: onSecondImportProgress: totalAddedToMediaList=" + job.totalAddedToMediaList);
153 log(
"DirectoryImport: onSecondImportProgress: gLibrary.length=" + gLibrary.length);
157 assertEqual(job.totalDuplicates, gLibrary.length - 1);
158 assertEqual(gLibrary.length, job.totalAddedToMediaList + 1);
159 assertEqual(gLibrary.length - 1, gMediaList.length - 2);
165 var enumerator = job.enumerateAllItems();
166 for (var
i=1;
i < gMediaList.length - 1;
i++) {
167 var item = gMediaList.getItemByIndex(
i);
168 log(
"DirectoryImport: onSecondImportProgress: found item with guid=" +
function newAppRelativeFile(path)
const MEDIALIST_TARGET_INDEX
getService(Ci.sbIDirectoryImportService)
function onFirstImportProgress(job)
function assertTrue(aTest, aMessage)
function assertEqual(aExpected, aActual, aMessage)
var getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow('Songbird SBProperties artist
function runTest()
Advanced DataRemote unit tests.
function createLibrary(databaseGuid, databaseLocation)
function onSecondImportProgress(job)
function startSecondImport()
_getSelectedPageStyle s i