31 Components.utils.import(
"resource://app/jsmodules/sbProperties.jsm");
32 Components.utils.import(
"resource://app/jsmodules/ArrayConverter.jsm");
40 if (databaseLocation) {
41 directory = databaseLocation.QueryInterface(
Ci.nsIFileURL).file;
44 directory =
Cc[
"@mozilla.org/file/directory_service;1"].
46 get(
"ProfD",
Ci.nsIFile);
47 directory.append(
"db");
50 var
file = directory.clone();
51 file.append(databaseGuid +
".db");
54 Cc[
"@songbirdnest.com/Songbird/Library/LocalDatabase/LibraryFactory;1"]
55 .getService(
Ci.sbILibraryFactory);
56 var hashBag =
Cc[
"@mozilla.org/hash-property-bag;1"].
58 hashBag.setPropertyAsInterface(
"databaseFile", file);
59 var library = libraryFactory.createLibrary(hashBag);
69 libraryManager.registerLibrary(library,
false);
78 Components.classes[
"@mozilla.org/system-info;1"]
79 .getService(Components.interfaces.nsIPropertyBag2);
80 platform = sysInfo.getProperty(
"name");
83 dump(
"System-info not available, trying the user agent string.\n");
84 var user_agent = navigator.userAgent;
85 if (user_agent.indexOf(
"Windows") != -1)
86 platform =
"Windows_NT";
87 else if (user_agent.indexOf(
"Mac OS X") != -1)
89 else if (user_agent.indexOf(
"Linux") != -1)
91 else if (user_agent.indexOf(
"SunOS") != -1)
101 for (var
id in mapA) {
112 log(
"\n\n\nMetadata - " + jobName +
" job progress - " +
113 job.progress +
"/" + job.total +
", " + job.errorCount +
" failed. " +
114 "Status " + job.statusText +
" (" + job.status +
"), Title: " + job.titleText);
115 var errorEnumerator = job.getErrorMessages();
116 while (errorEnumerator.hasMore()) {
117 log(
"MetadataJob " + jobName +
" - failed url: " + errorEnumerator.getNext());
130 folder.copyTo(tempFolder, tempName);
131 folder = tempFolder.clone();
132 folder.append(tempName);
144 var folder = optionalLocation ? optionalLocation :
getTempFolder();
145 file.copyTo(folder, tempName);
146 file = folder.clone();
147 file.append(tempName);
161 gTempFolder = Components.classes[
"@mozilla.org/file/directory_service;1"]
162 .getService(Components.interfaces.nsIProperties)
163 .get(
"TmpD", Components.interfaces.nsIFile);
164 gTempFolder.append(
"songbird_metadata_tests.tmp");
165 gTempFolder.createUnique(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777);
175 if (gTempFolder && gTempFolder.exists()) {
176 gTempFolder.remove(
true);
178 log(
"\n\n\nMetadata Manager Test may not have performed cleanup. Temp files may exist.\n\n\n");
function assertNotEqual(aExpected, aActual, aMessage)
function assertEqual(aExpected, aActual, aMessage)
getService(Ci.sbIFaceplateManager)