28 const Cc = Components.classes;
29 const Ci = Components.interfaces;
30 const Cr = Components.results;
31 const Cu = Components.utils;
33 Cu.import(
"resource://gre/modules/XPCOMUtils.jsm");
34 Cu.import(
"resource://app/jsmodules/ArrayConverter.jsm");
35 Cu.import(
"resource://app/jsmodules/PlatformUtils.jsm");
47 classID: Components.ID(
"{a11690c2-1dd1-11b2-82ba-8a4e72869f7a}"),
48 contractID:
"@songbirdnest.com/Songbird/PlaylistWriter/M3U;1",
52 write:
function(aFile, aMediaList, aContentType, aPlaylistFormatType) {
53 var foStream =
Cc[
"@mozilla.org/network/file-output-stream;1"]
54 .createInstance(
Ci.nsIFileOutputStream);
58 PR_WRONLY| PR_CREATE_FILE | PR_TRUNCATE,
64 onEnumerationBegin:
function(aMediaList) {},
65 onEnumeratedItem:
function(aMediaList, aMediaItem) {
66 var
uri = aMediaItem.contentSrc;
68 if (!uri || uri.scheme !=
"file") {
return; }
71 var f = uri.QueryInterface(
Ci.nsIFileURL).file;
72 f.QueryInterface(
Ci.nsILocalFile);
76 var platform = PlatformUtils.platformString;
77 if (platform ==
"Windows_NT") {
78 var fileUtils =
Cc[
"@songbirdnest.com/Songbird/FileUtils;1"]
79 .getService(
Ci.sbIFileUtils);
80 var exactPath = fileUtils.getExactPath(f.path);
82 f.initWithPath(exactPath);
95 var
data = f.getRelativeDescriptor(aFile.parent) +
"\n";
100 if (aPlaylistFormatType && aPlaylistFormatType.pathSeparator) {
101 data = data.replace(/\
103 foStream.write(data, data.length);
106 Cu.reportError(
"Error writing M3U: " + e);
109 onEnumerationEnd:
function(aMediaList, aResultCode) {}
112 aMediaList.enumerateAllItems(buildM3U);
118 return "Songbird M3U Writer";
121 description:
function() {
122 return "Write M3U playlists";
125 supportedMIMETypes:
function(aMIMECount) {
126 var mimeTypes = [
"audio/mpegurl",
"audio/x-mpegurl"];
127 aMIMECount.value = mimeTypes.length;
131 supportedFileExtensions:
function(aExtCount) {
132 var exts = [
"m3u",
"m3u8"];
133 aExtCount.value = exts.length;
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
sbOSDControlService prototype QueryInterface
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
function NSGetModule(compMgr, fileSpec)
function sbM3UPlaylistWriter()
sbDeviceFirmwareAutoCheckForUpdate prototype classID
sbWindowsAutoPlayServiceCfg _xpcom_categories