1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 11:47:58 +01:00

Port Xulmus/Muttator. Not tested yet.

This commit is contained in:
Kris Maglione
2009-11-09 02:39:23 -05:00
parent a11cb93fa8
commit 4d88ccb036
6 changed files with 1749 additions and 1873 deletions

View File

@@ -3,17 +3,13 @@
// This work is licensed for reuse under an MIT license. Details are // This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file. // given in the LICENSE.txt file included with this file.
function Addressbook() { //{{{ const Addressbook = Module("addressbook", {
//////////////////////////////////////////////////////////////////////////////// init: function () {
////////////////////// PRIVATE SECTION ///////////////////////////////////////// },
/////////////////////////////////////////////////////////////////////////////{{{
const abManager = Cc["@mozilla.org/abmanager;1"].getService(Ci.nsIAbManager);
const rdf = Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
// TODO: add option for a format specifier, like: // TODO: add option for a format specifier, like:
// :set displayname=%l, %f // :set displayname=%l, %f
function generateDisplayName(firstName, lastName) { generateDisplayName: function (firstName, lastName) {
if (firstName && lastName) if (firstName && lastName)
return lastName + ", " + firstName; return lastName + ", " + firstName;
else if (firstName) else if (firstName)
@@ -22,88 +18,13 @@ function Addressbook() { //{{{
return lastName; return lastName;
else else
return ""; return "";
}
function getDirectoryFromURI(uri) services.get("rdf").GetResource(uri).QueryInterface(Ci.nsIAbDirectory)
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// OPTIONS /////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// MAPPINGS ////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
var myModes = config.mailModes;
mappings.add(myModes, ["a"],
"Open a prompt to save a new addressbook entry for the sender of the selected message",
function () {
try {
var to = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor;
}
catch (e) {
liberator.beep();
}
if (!to)
return;
let address = to.substring(to.indexOf("<") + 1, to.indexOf(">"));
let displayName = to.substr(0, to.indexOf("<") - 1);
if (/^\S+\s+\S+\s*$/.test(displayName)) {
let names = displayName.split(/\s+/);
displayName = "-firstname=" + names[0].replace(/"/g, "")
+ " -lastname=" + names[1].replace(/"/g, "");
}
else
displayName = "-name=\"" + displayName.replace(/"/g, "") + "\"";
commandline.open(":", "contact " + address + " " + displayName, modes.EX);
});
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// COMMANDS ////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
commands.add(["con[tact]"],
"Add an address book entry",
function (args) {
let mailAddr = args[0]; // TODO: support more than one email address
let firstName = args["-firstname"] || null;
let lastName = args["-lastname"] || null;
let displayName = args["-name"] || null;
if (!displayName)
displayName = generateDisplayName(firstName, lastName);
if (addressbook.add(mailAddr, firstName, lastName, displayName))
liberator.echomsg("Added address: " + displayName + " <" + mailAddr + ">", 1, commandline.FORCE_SINGLELINE);
else
liberator.echoerr("Exxx: Could not add contact `" + mailAddr + "'", commandline.FORCE_SINGLELINE);
}, },
{
argCount: "+",
options: [[["-firstname", "-f"], commands.OPTION_STRING],
[["-lastname", "-l"], commands.OPTION_STRING],
[["-name", "-n"], commands.OPTION_STRING]]
});
commands.add(["contacts", "addr[essbook]"], getDirectoryFromURI: function (uri) services.get("rdf").GetResource(uri).QueryInterface(Ci.nsIAbDirectory),
"List or open multiple addresses",
function (args) { addressbook.list(args.string, args.bang); },
{ bang: true });
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION //////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
return {
add: function (address, firstName, lastName, displayName) { add: function (address, firstName, lastName, displayName) {
const personalAddressbookURI = "moz-abmdbdirectory://abook.mab"; const personalAddressbookURI = "moz-abmdbdirectory://abook.mab";
let directory = getDirectoryFromURI(personalAddressbookURI); let directory = this.getDirectoryFromURI(personalAddressbookURI);
let card = Cc["@mozilla.org/addressbook/cardproperty;1"].createInstance(Ci.nsIAbCard); let card = Cc["@mozilla.org/addressbook/cardproperty;1"].createInstance(Ci.nsIAbCard);
if (!address || !directory || !card) if (!address || !directory || !card)
@@ -131,7 +52,7 @@ function Addressbook() { //{{{
//var mail = card.primaryEmail || ""; //XXX //var mail = card.primaryEmail || ""; //XXX
let displayName = card.displayName; let displayName = card.displayName;
if (!displayName) if (!displayName)
displayName = generateDisplayName(card.firstName, card.lastName); displayName = this.generateDisplayName(card.firstName, card.lastName);
if (displayName.toLowerCase().indexOf(lowerFilter) > -1 if (displayName.toLowerCase().indexOf(lowerFilter) > -1
|| card.primaryEmail.toLowerCase().indexOf(lowerFilter) > -1) || card.primaryEmail.toLowerCase().indexOf(lowerFilter) > -1)
@@ -164,8 +85,67 @@ function Addressbook() { //{{{
} }
return true; return true;
} }
}; }, {
//}}} }, {
} //}}} commands: function () {
commands.add(["con[tact]"],
"Add an address book entry",
function (args) {
let mailAddr = args[0]; // TODO: support more than one email address
let firstName = args["-firstname"] || null;
let lastName = args["-lastname"] || null;
let displayName = args["-name"] || null;
if (!displayName)
displayName = this.generateDisplayName(firstName, lastName);
if (addressbook.add(mailAddr, firstName, lastName, displayName))
liberator.echomsg("Added address: " + displayName + " <" + mailAddr + ">", 1, commandline.FORCE_SINGLELINE);
else
liberator.echoerr("Exxx: Could not add contact `" + mailAddr + "'", commandline.FORCE_SINGLELINE);
},
{
argCount: "+",
options: [[["-firstname", "-f"], commands.OPTION_STRING],
[["-lastname", "-l"], commands.OPTION_STRING],
[["-name", "-n"], commands.OPTION_STRING]]
});
commands.add(["contacts", "addr[essbook]"],
"List or open multiple addresses",
function (args) { addressbook.list(args.string, args.bang); },
{ bang: true });
},
mappings: function () {
var myModes = config.mailModes;
mappings.add(myModes, ["a"],
"Open a prompt to save a new addressbook entry for the sender of the selected message",
function () {
try {
var to = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor;
}
catch (e) {
liberator.beep();
}
if (!to)
return;
let address = to.substring(to.indexOf("<") + 1, to.indexOf(">"));
let displayName = to.substr(0, to.indexOf("<") - 1);
if (/^\S+\s+\S+\s*$/.test(displayName)) {
let names = displayName.split(/\s+/);
displayName = "-firstname=" + names[0].replace(/"/g, "")
+ " -lastname=" + names[1].replace(/"/g, "");
}
else
displayName = "-name=\"" + displayName.replace(/"/g, "") + "\"";
commandline.open(":", "contact " + address + " " + displayName, modes.EX);
});
},
});
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -3,24 +3,12 @@
// This work is licensed for reuse under an MIT license. Details are // This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file. // given in the LICENSE.txt file included with this file.
const config = (function () { //{{{ const config = { //{{{
////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION /////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
var name = "Muttator";
var host = "Thunderbird";
var tabmail;
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION //////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
return {
/*** required options, no checks done if they really exist, so be careful ***/ /*** required options, no checks done if they really exist, so be careful ***/
name: name, name: "Muttator",
hostApplication: host, // TODO: can this be found out otherwise? gBrandBundle.getString("brandShortName"); hostApplication: "Thunderbird", // TODO: can this be found out otherwise? gBrandBundle.getString("brandShortName");
// Yes, but it will be localized unlike all other strings. So, it's best left until we i18n liberator. --djk // Yes, but it will be localized unlike all other strings. So, it's best left until we i18n liberator. --djk
get mainWindowId() this.isComposeWindow ? "msgcomposeWindow" : "messengerWindow", get mainWindowId() this.isComposeWindow ? "msgcomposeWindow" : "messengerWindow",
/*** optional options, there are checked for existence and a fallback provided ***/ /*** optional options, there are checked for existence and a fallback provided ***/
@@ -28,7 +16,7 @@ const config = (function () { //{{{
defaults: { defaults: {
guioptions: "frb", guioptions: "frb",
showtabline: 1, showtabline: 1,
titlestring: name titlestring: "Muttator"
}, },
guioptions: { guioptions: {
@@ -48,15 +36,14 @@ const config = (function () { //{{{
"chrome://messenger/content/messengercompose/messengercompose.xul"], "chrome://messenger/content/messengercompose/messengercompose.xul"],
autocommands: [["DOMLoad", "Triggered when a page's DOM content has fully loaded"], autocommands: [["DOMLoad", "Triggered when a page's DOM content has fully loaded"],
["FolderLoad", "Triggered after switching folders in " + host], ["FolderLoad", "Triggered after switching folders in Thunderbird"],
["PageLoadPre", "Triggered after a page load is initiated"], ["PageLoadPre", "Triggered after a page load is initiated"],
["PageLoad", "Triggered when a page gets (re)loaded/opened"], ["PageLoad", "Triggered when a page gets (re)loaded/opened"],
[name + "Enter", "Triggered after " + host + " starts"], ["MuttatorEnter", "Triggered after Thunderbird starts"],
[name + "Leave", "Triggered before exiting " + host], ["MuttatorLeave", "Triggered before exiting Thunderbird"],
[name + "LeavePre", "Triggered before exiting " + host]], ["MuttatorLeavePre", "Triggered before exiting Thunderbird"]],
dialogs: [ dialogs: [
["about", "About " + host, ["about", "About Thunderbird",
function () { window.openAboutDialog(); }], function () { window.openAboutDialog(); }],
["addons", "Manage Add-ons", ["addons", "Manage Add-ons",
function () { window.openAddonsMgr(); }], function () { window.openAddonsMgr(); }],
@@ -82,7 +69,7 @@ const config = (function () { //{{{
function () { BrowserPageInfo(); }], function () { BrowserPageInfo(); }],
["pagesource", "View page source", ["pagesource", "View page source",
function () { BrowserViewSourceOfDocument(content.document); }],*/ function () { BrowserViewSourceOfDocument(content.document); }],*/
["preferences", "Show " + host + " preferences dialog", ["preferences", "Show Thunderbird preferences dialog",
function () { openOptionsDialog(); }], function () { openOptionsDialog(); }],
/*["printpreview", "Preview the page before printing", /*["printpreview", "Preview the page before printing",
function () { PrintUtils.printPreview(onEnterPrintPreview, onExitPrintPreview); }],*/ function () { PrintUtils.printPreview(onEnterPrintPreview, onExitPrintPreview); }],*/
@@ -111,14 +98,13 @@ const config = (function () { //{{{
}, },
getBrowser: function () { getBrowser: function () {
if (!tabmail) { var tabmail = { __proto__: document.getElementById("tabmail") };
tabmail = { __proto__: document.getElementById("tabmail") };
tabmail.__defineGetter__("mTabContainer", function () this.tabContainer); tabmail.__defineGetter__("mTabContainer", function () this.tabContainer);
tabmail.__defineGetter__("mTabs", function () this.tabContainer.childNodes); tabmail.__defineGetter__("mTabs", function () this.tabContainer.childNodes);
tabmail.__defineGetter__("mCurrentTab", function () this.tabContainer.selectedItem); tabmail.__defineGetter__("mCurrentTab", function () this.tabContainer.selectedItem);
tabmail.__defineGetter__("mStrip", function () this.tabStrip); tabmail.__defineGetter__("mStrip", function () this.tabStrip);
tabmail.__defineGetter__("browsers", function () [browser for (browser in Iterator(this.mTabs))]); tabmail.__defineGetter__("browsers", function () [browser for (browser in Iterator(this.mTabs))]);
} config.getBrowser = function () tabmail;
return tabmail; return tabmail;
}, },
@@ -157,11 +143,9 @@ const config = (function () { //{{{
return document.getElementById("appcontent").boxObject.height; return document.getElementById("appcontent").boxObject.height;
}, },
scripts: [ get scripts() this.isComposeWindow() ? ["compose/compose.js"] : [
"addressbook.js", "addressbook.js",
"compose/compose.js",
"mail.js", "mail.js",
"tabs.js"
], ],
// to allow Vim to :set ft=mail automatically // to allow Vim to :set ft=mail automatically
@@ -171,18 +155,6 @@ const config = (function () { //{{{
// don't wait too long when selecting new messages // don't wait too long when selecting new messages
// GetThreadTree()._selectDelay = 300; // TODO: make configurable // GetThreadTree()._selectDelay = 300; // TODO: make configurable
// load Muttator specific modules
if (this.isComposeWindow)
// TODO: this should probably be "composer"
liberator.loadModule("compose", Compose);
else {
liberator.loadModule("mail", Mail);
liberator.loadModule("addressbook", Addressbook);
liberator.loadModule("tabs", Tabs);
liberator.loadModule("marks", Marks);
liberator.loadModule("hints", Hints);
}
commands.add(["pref[erences]", "prefs"], commands.add(["pref[erences]", "prefs"],
"Show " + config.hostApplication + " preferences", "Show " + config.hostApplication + " preferences",
function () { window.openOptionsDialog(); }, function () { window.openOptionsDialog(); },
@@ -211,6 +183,5 @@ const config = (function () { //{{{
//}}} //}}}
} }
}; //}}} }; //}}}
})(); //}}}
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et:

File diff suppressed because it is too large Load Diff

View File

@@ -221,18 +221,6 @@ const config = { //{{{
context.completions = displayPanes; // FIXME: useful description etc context.completions = displayPanes; // FIXME: useful description etc
}; };
// load Xulmus specific modules
liberator.loadModule("browser", Browser);
liberator.loadModule("finder", Finder);
liberator.loadModule("bookmarks", Bookmarks);
liberator.loadModule("history", History);
liberator.loadModule("tabs", Tabs);
liberator.loadModule("marks", Marks);
liberator.loadModule("quickmarks", QuickMarks);
liberator.loadModule("hints", Hints);
liberator.loadModule("player", Player);
liberator.loadModule("library", Library);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// STYLES ////////////////////////////////////////////////// ////////////////////// STYLES //////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{ /////////////////////////////////////////////////////////////////////////////{{{
@@ -251,10 +239,6 @@ const config = { //{{{
delete img; delete img;
}; };
////////////////////////////////////////////////////////////////////////////////
////////////////////// MAPPINGS ////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
/////////////////////////////////////////////////////////////////////////////}}} /////////////////////////////////////////////////////////////////////////////}}}
////////////////////// COMMANDS //////////////////////////////////////////////// ////////////////////// COMMANDS ////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{ /////////////////////////////////////////////////////////////////////////////{{{

View File

@@ -4,36 +4,20 @@
// given in the LICENSE.txt file included with this file. // given in the LICENSE.txt file included with this file.
function Library() { //{{{ const Library = Module("library", {
init: function () {
this.MAIN_LIBRARY = LibraryUtils.mainLibrary;
},
//////////////////////////////////////////////////////////////////////////////// _toJSArray: function (enum) ArrayConverter.JSArray(enum),
////////////////////// PRIVATE SECTION /////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
const MAIN_LIBRARY = LibraryUtils.mainLibrary;
function toJSArray(enum) ArrayConverter.JSArray(enum)
function getArtistsArray() {
return toJSArray(MAIN_LIBRARY.getDistinctValuesForProperty(SBProperties.artistName));
}
// Get the artist names before hand.
let artists = getArtistsArray();
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION //////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
// TODO: return some actually useful objects. ;-) // TODO: return some actually useful objects. ;-)
return {
/** /**
* Returns an array of all the artist names in the main library. * Returns an array of all the artist names in the main library.
* *
* @returns {string[]} * @returns {string[]}
*/ */
getArtists: function getArtists() artists, getArtists: function getArtists() this._toJSArray(this.MAIN_LIBRARY.getDistinctValuesForProperty(SBProperties.artistName)),
// FIXME: ken do we really want to remove duplicates? If so, why not tracks too? --djk // FIXME: ken do we really want to remove duplicates? If so, why not tracks too? --djk
/** /**
@@ -44,7 +28,7 @@ function Library() { //{{{
* @returns {string[]} * @returns {string[]}
*/ */
getAlbums: function getAlbums(artist) { getAlbums: function getAlbums(artist) {
let albums = toJSArray(MAIN_LIBRARY.getItemsByProperty(SBProperties.artistName, artist)) let albums = this._toJSArray(this.MAIN_LIBRARY.getItemsByProperty(SBProperties.artistName, artist))
.map(function (track) track.getProperty(SBProperties.albumName)); .map(function (track) track.getProperty(SBProperties.albumName));
return util.Array.uniq(albums); return util.Array.uniq(albums);
}, },
@@ -64,12 +48,11 @@ function Library() { //{{{
properties.appendProperty(SBProperties.artistName, artist); properties.appendProperty(SBProperties.artistName, artist);
properties.appendProperty(SBProperties.albumName, album); properties.appendProperty(SBProperties.albumName, album);
return toJSArray(MAIN_LIBRARY.getItemsByProperties(properties)) return this._toJSArray(this.MAIN_LIBRARY.getItemsByProperties(properties))
.map(function (track) track.getProperty(SBProperties.trackName)); .map(function (track) track.getProperty(SBProperties.trackName));
} }
}, {
}; }, {
//}}} });
} //}}}
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -4,38 +4,32 @@
// given in the LICENSE.txt file included with this file. // given in the LICENSE.txt file included with this file.
function Player() { //{{{ const Player = Module("player", {
init: function () {
//////////////////////////////////////////////////////////////////////////////// this._lastSearchString = "";
////////////////////// PRIVATE SECTION ///////////////////////////////////////// this._lastSearchIndex = 0;
/////////////////////////////////////////////////////////////////////////////{{{ this._lastSearchView = _SBGetCurrentView();
let lastSearchString = "";
let lastSearchIndex = 0;
let lastSearchView = _SBGetCurrentView();
// Get the focus to the visible playlist first // Get the focus to the visible playlist first
//window._SBShowMainLibrary(); //window._SBShowMainLibrary();
services.add("mediaPageManager", "@songbirdnest.com/Songbird/MediaPageManager;1", Ci.sbIMediaPageManager); gMM.addListener(this._mediaCoreListener);
services.add("propertyManager","@songbirdnest.com/Songbird/Properties/PropertyManager;1", Ci.sbIPropertyManager); },
destroy: function () {
// Register Callbacks for searching. gMM.removeListener(this._mediaCoreListener);
commandline.registerCallback("change", modes.SEARCH_VIEW_FORWARD, function (str) { player.onSearchKeyPress(str); }); },
commandline.registerCallback("submit", modes.SEARCH_VIEW_FORWARD, function (str) { player.onSearchSubmit(str); });
commandline.registerCallback("cancel", modes.SEARCH_VIEW_FORWARD, function () { player.onSearchCancel(); });
// interval (milliseconds) // interval (milliseconds)
function seek(interval, direction) { _seek: function (interval, direction) {
let position = gMM.playbackControl ? gMM.playbackControl.position : 0; let position = gMM.playbackControl ? gMM.playbackControl.position : 0;
player.seekTo(position + (direction ? interval : -interval)); player.seekTo(position + (direction ? interval : -interval));
} },
function focusTrack(mediaItem) { _focusTrack: function (mediaItem) {
SBGetBrowser().mediaTab.mediaPage.highlightItem(_SBGetCurrentView().getIndexForItem(mediaItem)); SBGetBrowser().mediaTab.mediaPage.highlightItem(_SBGetCurrentView().getIndexForItem(mediaItem));
} },
var mediaCoreListener = { _mediaCoreListener: {
onMediacoreEvent: function (event) { onMediacoreEvent: function (event) {
switch (event.type) { switch (event.type) {
case Ci.sbIMediacoreEvent.BEFORE_TRACK_CHANGE: case Ci.sbIMediacoreEvent.BEFORE_TRACK_CHANGE:
@@ -71,136 +65,313 @@ function Player() { //{{{
break; break;
} }
} }
}; },
// TODO: check bounds and round, 0 - 1 or 0 - 100?
/**
* @property {string} The player volume as a percentage.
*/
get volume() gMM.volumeControl.volume,
set volume(value) {
gMM.volumeControl.volume = value;
},
gMM.addListener(mediaCoreListener); // FIXME: can't be called from non-media tabs since 840e78
liberator.registerObserver("shutdown", function () { play: function play() {
gMM.removeListener(mediaCoreListener); // Check if there is any selection in place, else play first item of the visible view.
}); if (_SBGetCurrentView().selection.count != 0) {
// Play the selection.
gMM.sequencer.playView(_SBGetCurrentView(), _SBGetCurrentView().getIndexForItem(_SBGetCurrentView().selection.currentMediaItem));
this._focusTrack(gMM.sequencer.currentItem);
}
else {
gMM.sequencer.playView(SBGetBrowser().currentMediaListView, 0);
this._focusTrack(gMM.sequencer.currentItem);
}
},
/////////////////////////////////////////////////////////////////////////////}}} stop: function stop() {
////////////////////// OPTIONS ///////////////////////////////////////////////// gMM.sequencer.stop();
/////////////////////////////////////////////////////////////////////////////{{{ },
options.add(["repeat"], next: function next() {
"Set the playback repeat mode", gSongbirdWindowController.doCommand("cmd_control_next");
"number", 0, gSongbirdWindowController.doCommand("cmd_find_current_track");
{ },
setter: function (value) gMM.sequencer.repeatMode = value,
getter: function () gMM.sequencer.repeatMode,
completer: function (context) [
["0", "Repeat none"],
["1", "Repeat one"],
["2", "Repeat all"]
],
validator: Option.validateCompleter
});
options.add(["shuffle"], previous: function previous() {
"Play tracks in shuffled order", gSongbirdWindowController.doCommand("cmd_control_previous");
"boolean", false, gSongbirdWindowController.doCommand("cmd_find_current_track");
{ },
setter: function (value) value ? gMM.sequencer.mode = gMM.sequencer.MODE_SHUFFLE :
gMM.sequencer.mode = gMM.sequencer.MODE_FORWARD,
getter: function () gMM.sequencer.mode == gMM.sequencer.MODE_SHUFFLE
});
/////////////////////////////////////////////////////////////////////////////}}} togglePlayPause: function togglePlayPause() {
////////////////////// MAPPINGS //////////////////////////////////////////////// gSongbirdWindowController.doCommand("cmd_control_playpause");
/////////////////////////////////////////////////////////////////////////////{{{ this._focusTrack(gMM.sequencer.currentItem);
},
mappings.add([modes.PLAYER], toggleShuffle: function toggleShuffle() {
["x"], "Play track", if (gMM.sequencer.mode != gMM.sequencer.MODE_SHUFFLE)
function () { player.play(); }); gMM.sequencer.mode = gMM.sequencer.MODE_SHUFFLE;
else
gMM.sequencer.mode = gMM.sequencer.MODE_FORWARD;
},
mappings.add([modes.PLAYER], // FIXME: not really toggling - good enough for now.
["z"], "Previous track", toggleRepeat: function toggleRepeat() {
function () { player.previous(); }); switch (gMM.sequencer.repeatMode) {
case gMM.sequencer.MODE_REPEAT_NONE:
gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_ONE;
break;
case gMM.sequencer.MODE_REPEAT_ONE:
gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_ALL;
break;
case gMM.sequencer.MODE_REPEAT_ALL:
gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_NONE;
break;
default:
gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_NONE;
break;
}
},
mappings.add([modes.PLAYER], /**
["c"], "Pause/unpause track", * Seek forward <b>interval</b> milliseconds in the currently playing
function () { player.togglePlayPause(); }); * track.
*
* @param {number} interval The time interval (ms) to advance the
* current track.
*/
seekForward: function seekForward(interval) {
this._seek(interval, true);
},
mappings.add([modes.PLAYER], /**
["b"], "Next track", * Seek backwards <b>interval</b> milliseconds in the currently
function () { player.next(); }); * playing track.
*
* @param {number} interval The time interval (ms) to rewind the
* current track.
*/
seekBackward: function seekBackward(interval) {
this._seek(interval, false);
},
mappings.add([modes.PLAYER], /**
["v"], "Stop track", * Seek to a specific position in the currently playing track.
function () { player.stop(); }); *
* @param {number} The new position (ms) in the track.
*/
seekTo: function seekTo(position) {
// FIXME: if not playing
if (!gMM.playbackControl)
this.play();
mappings.add([modes.PLAYER], let min = 0;
["Q"], "Queue tracks by artist/album/track", let max = gMM.playbackControl.duration - 5000; // TODO: 5s buffer like cmus desirable?
function () { commandline.open(":", "queue ", modes.EX); });
mappings.add([modes.PLAYER], gMM.playbackControl.position = util.Math.constrain(position, min, max);
["f"], "Loads current view filtered by the keywords", },
function () { commandline.open(":", "filter ", modes.EX); });
mappings.add([modes.PLAYER], // FIXME: 10% ?
["i"], "Select current track", // I think just general increments of say 0.05 might be better --djk
function () { gSongbirdWindowController.doCommand("cmd_find_current_track"); }); increaseVolume: function increaseVolume() {
gMM.volumeControl.volume = gMM.volumeControl.volume * 1.1;
},
mappings.add([modes.PLAYER], decreaseVolume: function decreaseVolume() {
["s"], "Toggle shuffle", if (gMM.volumeControl.volume == 0)
function () { player.toggleShuffle(); }); gMM.volumeControl.volume = 0.1;
else
gMM.volumeControl.volume = gMM.volumeControl.volume * 0.9;
},
mappings.add([modes.PLAYER], focusPlayingTrack :function focusPlayingTrack() {
["r"], "Toggle repeat", this._focusTrack(gMM.sequencer.currentItem);
function () { player.toggleRepeat(); }); },
mappings.add([modes.PLAYER], listTracks: function listTracks(view) {
["h", "<Left>"], "Seek -10s", //let myView = LibraryUtils.createStandardMediaListView(LibraryUtils.mainLibrary, args);
function (count) { player.seekBackward(Math.max(1, count) * 10000); }, let length = view.length;
{ count: true }); let tracksList = [];
mappings.add([modes.PLAYER], for (let i = 0; i < length; i++) {
["l", "<Right>"], "Seek +10s", let mediaItem = view.getItemByIndex(i);
function (count) { player.seekForward(Math.max(1, count) * 10000); }, let trackName = mediaItem.getProperty(SBProperties.trackName);
{ count: true }); let albumName = mediaItem.getProperty(SBProperties.albumName);
let artistName = mediaItem.getProperty(SBProperties.artistName);
mappings.add([modes.PLAYER], tracksList[i] = [trackName, "Album : " + albumName + " Artist : " + artistName];
["H", "<S-Left>"], "Seek -1m",
function (count) { player.seekBackward(Math.max(1, count) * 60000); },
{ count: true });
mappings.add([modes.PLAYER],
["L", "<S-Right>"], "Seek +1m",
function (count) { player.seekForward(Math.max(1, count) * 60000); },
{ count: true });
mappings.add([modes.PLAYER],
["=", "+"], "Increase volume by 10%",
function () { player.increaseVolume(); });
mappings.add([modes.PLAYER],
["-"], "Decrease volume by 10%",
function () { player.decreaseVolume(); });
mappings.add([modes.PLAYER],
["/"], "Search forward for a track",
function (args) { commandline.open("/", "", modes.SEARCH_VIEW_FORWARD); });
mappings.add([modes.PLAYER],
["n"], "Find the next track",
function () { player.searchViewAgain(false);});
mappings.add([modes.PLAYER],
["N"], "Find the previous track",
function () { player.searchViewAgain(true);});
for (let i in util.range(0, 6)) {
let (rating = i) {
mappings.add([modes.PLAYER],
["<C-" + rating + ">"], "Rate the current media item " + rating,
function () { player.rateMediaItem(rating); });
};
} }
////////////////// ///////////////////////////////////////////////////////////}}} return tracksList;
////////////////////// COMMANDS //////////////////////////////////////////////// },
/////////////////////////////////////////////////////////////////////////////{{{
searchView: function searchView(args) {
let currentView = _SBGetCurrentView();
let mediaItemList = currentView.mediaList;
let search = _getSearchString(currentView);
let searchString = "";
if (search != "")
searchString = args + " " + search;
else
searchString = args;
this._lastSearchString = searchString;
let mySearchView = LibraryUtils.createStandardMediaListView(mediaItemList, searchString);
if (mySearchView.length) {
this._lastSearchView = mySearchView;
this._lastSearchIndex = 0;
this._focusTrack(mySearchView.getItemByIndex(this._lastSearchIndex));
}
else
liberator.echoerr("E486 Pattern not found: " + searchString, commandline.FORCE_SINGLELINE);
},
searchViewAgain: function searchViewAgain(reverse) {
function echo(str) {
setTimeout(function () {
commandline.echo(str, commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES | commandline.FORCE_SINGLELINE);
}, 0);
}
if (reverse) {
if (this._lastSearchIndex == 0) {
this._lastSearchIndex = this._lastSearchView.length - 1;
echo("Search hit TOP, continuing at BOTTOM");
}
else
this._lastSearchIndex = this._lastSearchIndex - 1;
}
else {
if (this._lastSearchIndex == (this._lastSearchView.length - 1)) {
this._lastSearchIndex = 0;
echo("Search hit BOTTOM, continuing at TOP");
}
else
this._lastSearchIndex = this._lastSearchIndex + 1;
}
// FIXME: Implement for "?" --ken
commandline.echo("/" + this._lastSearchString, null, commandline.FORCE_SINGLELINE);
this._focusTrack(this._lastSearchView.getItemByIndex(this._lastSearchIndex));
},
/**
* The search dialog keypress callback.
*
* @param {string} str The contents of the search dialog.
*/
onSearchKeyPress: function (str) {
if (options["incsearch"])
this.searchView(str);
},
/**
* The search dialog submit callback.
*
* @param {string} str The contents of the search dialog.
*/
onSearchSubmit: function (str) {
this.searchView(str);
},
/**
* The search dialog cancel callback.
*/
onSearchCancel: function () {
// TODO: restore the view state if altered by an 'incsearch' search
},
getPlaylists: function getPlaylists() {
let mainLibrary = LibraryUtils.mainLibrary;
let playlists = [mainLibrary];
let listener = {
onEnumerationBegin: function () { },
onEnumerationEnd: function () { },
onEnumeratedItem: function (list, item) {
// FIXME: why are there null items and duplicates?
if (!playlists.some(function (list) list.name == item.name) && item.name != null)
playlists.push(item);
return Ci.sbIMediaListEnumerationListener.CONTINUE;
}
};
mainLibrary.enumerateItemsByProperty("http://songbirdnest.com/data/1.0#isList", "1", listener);
return playlists;
},
// Play track at 'row' in 'playlist'
playPlaylist: function playPlaylist(playlist, row) {
gMM.sequencer.playView(playlist.createView(), row);
},
getMediaPages: function getMediaPages() {
let list = gBrowser.currentMediaPage.mediaListView.mediaList;
let pages = services.get("mediaPageManager").getAvailablePages(list);
return ArrayConverter.JSArray(pages).map(function (page) page.QueryInterface(Ci.sbIMediaPageInfo));
},
loadMediaPage: function loadMediaList(page, list, view) {
services.get("mediaPageManager").setPage(list, page);
gBrowser.loadMediaList(list, null, null, view, null);
},
rateMediaItem: function rateMediaItem(rating) {
if (gMM.sequencer.currentItem)
gMM.sequencer.currentItem.setProperty(SBProperties.rating, rating);
},
getUserViewable: function getUserViewable() {
let propManager = services.get("propertyManager");
let propEnumerator = propManager.propertyIDs;
let properties = [];
while (propEnumerator.hasMore()) {
let propertyId = propEnumerator.getNext();
if (propManager.getPropertyInfo(propertyId).userViewable) {
//liberator.dump("propertyId - " + propManager.getPropertyInfo(propertyId).id);
properties.push(propManager.getPropertyInfo(propertyId).displayName);
}
}
return properties;
},
sortBy: function sortBy(property, order) {
let pa = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"].createInstance(Ci.sbIMutablePropertyArray);
liberator.dump("Property: " + property);
switch (property.string) {
case "#":
case "Title":
pa.appendProperty(SBProperties.trackName, "a");
break;
case "Rating":
pa.appendProperty(SBProperties.rating, 1);
break;
case "Album":
pa.appendProperty(SBProperties.albumName, "a");
break;
default:
pa.appendProperty(SBProperties.trackName, "a");
break;
}
_SBGetCurrentView().setSort(pa);
}
}, {
}, {
commandline: function () {
commandline.registerCallback("change", modes.SEARCH_VIEW_FORWARD, function (str) { player.onSearchKeyPress(str); });
commandline.registerCallback("submit", modes.SEARCH_VIEW_FORWARD, function (str) { player.onSearchSubmit(str); });
commandline.registerCallback("cancel", modes.SEARCH_VIEW_FORWARD, function () { player.onSearchCancel(); });
},
commands: function () {
commands.add(["f[ilter]"], commands.add(["f[ilter]"],
"Filter tracks based on keywords {genre/artist/album/track}", "Filter tracks based on keywords {genre/artist/album/track}",
function (args) { function (args) {
@@ -212,8 +383,8 @@ function Player() { //{{{
else { else {
SBGetBrowser().loadMediaList(LibraryUtils.mainLibrary, null, null, view, SBGetBrowser().loadMediaList(LibraryUtils.mainLibrary, null, null, view,
"chrome://songbird/content/mediapages/filtersPage.xul"); "chrome://songbird/content/mediapages/filtersPage.xul");
// TODO: make this focusTrack work ? // TODO: make this this._focusTrack work ?
focusTrack(view.getItemByIndex(0)); this._focusTrack(view.getItemByIndex(0));
} }
}, },
{ {
@@ -234,7 +405,7 @@ function Player() { //{{{
for ([i, list] in Iterator(playlists)) { for ([i, list] in Iterator(playlists)) {
if (util.compareIgnoreCase(arg, list.name) == 0) { if (util.compareIgnoreCase(arg, list.name) == 0) {
SBGetBrowser().loadMediaList(playlists[i]); SBGetBrowser().loadMediaList(playlists[i]);
focusTrack(_SBGetCurrentView().getItemByIndex(0)); this._focusTrack(_SBGetCurrentView().getItemByIndex(0));
return; return;
} }
} }
@@ -388,11 +559,8 @@ function Player() { //{{{
player.volume = util.Math.constrain(level, 0, 1); player.volume = util.Math.constrain(level, 0, 1);
}, },
{ argCount: "1" }); { argCount: "1" });
},
/////////////////////////////////////////////////////////////////////////////}}} completions: function () {
////////////////////// COMPLETIONS /////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
completion.song = function song(context, args) { completion.song = function song(context, args) {
// TODO: useful descriptions? // TODO: useful descriptions?
function map(list) list.map(function (i) [i, ""]); function map(list) list.map(function (i) [i, ""]);
@@ -424,314 +592,124 @@ function Player() { //{{{
context.keys = { text: "contentTitle", description: "contentUrl" }; context.keys = { text: "contentTitle", description: "contentUrl" };
context.completions = player.getMediaPages(); context.completions = player.getMediaPages();
}; };
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION //////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
return {
// TODO: check bounds and round, 0 - 1 or 0 - 100?
/**
* @property {string} The player volume as a percentage.
*/
get volume() gMM.volumeControl.volume,
set volume(value) {
gMM.volumeControl.volume = value;
}, },
mappings: function () {
mappings.add([modes.PLAYER],
["x"], "Play track",
function () { player.play(); });
// FIXME: can't be called from non-media tabs since 840e78 mappings.add([modes.PLAYER],
play: function play() { ["z"], "Previous track",
// Check if there is any selection in place, else play first item of the visible view. function () { player.previous(); });
if (_SBGetCurrentView().selection.count != 0) {
// Play the selection.
gMM.sequencer.playView(_SBGetCurrentView(), _SBGetCurrentView().getIndexForItem(_SBGetCurrentView().selection.currentMediaItem));
focusTrack(gMM.sequencer.currentItem);
}
else {
gMM.sequencer.playView(SBGetBrowser().currentMediaListView, 0);
focusTrack(gMM.sequencer.currentItem);
}
},
stop: function stop() { mappings.add([modes.PLAYER],
gMM.sequencer.stop(); ["c"], "Pause/unpause track",
}, function () { player.togglePlayPause(); });
next: function next() { mappings.add([modes.PLAYER],
gSongbirdWindowController.doCommand("cmd_control_next"); ["b"], "Next track",
gSongbirdWindowController.doCommand("cmd_find_current_track"); function () { player.next(); });
},
previous: function previous() { mappings.add([modes.PLAYER],
gSongbirdWindowController.doCommand("cmd_control_previous"); ["v"], "Stop track",
gSongbirdWindowController.doCommand("cmd_find_current_track"); function () { player.stop(); });
},
togglePlayPause: function togglePlayPause() { mappings.add([modes.PLAYER],
gSongbirdWindowController.doCommand("cmd_control_playpause"); ["Q"], "Queue tracks by artist/album/track",
focusTrack(gMM.sequencer.currentItem); function () { commandline.open(":", "queue ", modes.EX); });
},
toggleShuffle: function toggleShuffle() { mappings.add([modes.PLAYER],
if (gMM.sequencer.mode != gMM.sequencer.MODE_SHUFFLE) ["f"], "Loads current view filtered by the keywords",
gMM.sequencer.mode = gMM.sequencer.MODE_SHUFFLE; function () { commandline.open(":", "filter ", modes.EX); });
else
gMM.sequencer.mode = gMM.sequencer.MODE_FORWARD;
},
// FIXME: not really toggling - good enough for now. mappings.add([modes.PLAYER],
toggleRepeat: function toggleRepeat() { ["i"], "Select current track",
switch (gMM.sequencer.repeatMode) { function () { gSongbirdWindowController.doCommand("cmd_find_current_track"); });
case gMM.sequencer.MODE_REPEAT_NONE:
gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_ONE;
break;
case gMM.sequencer.MODE_REPEAT_ONE:
gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_ALL;
break;
case gMM.sequencer.MODE_REPEAT_ALL:
gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_NONE;
break;
default:
gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_NONE;
break;
}
},
/** mappings.add([modes.PLAYER],
* Seek forward <b>interval</b> milliseconds in the currently playing ["s"], "Toggle shuffle",
* track. function () { player.toggleShuffle(); });
*
* @param {number} interval The time interval (ms) to advance the
* current track.
*/
seekForward: function seekForward(interval) {
seek(interval, true);
},
/** mappings.add([modes.PLAYER],
* Seek backwards <b>interval</b> milliseconds in the currently ["r"], "Toggle repeat",
* playing track. function () { player.toggleRepeat(); });
*
* @param {number} interval The time interval (ms) to rewind the
* current track.
*/
seekBackward: function seekBackward(interval) {
seek(interval, false);
},
/** mappings.add([modes.PLAYER],
* Seek to a specific position in the currently playing track. ["h", "<Left>"], "Seek -10s",
* function (count) { player.seekBackward(Math.max(1, count) * 10000); },
* @param {number} The new position (ms) in the track. { count: true });
*/
seekTo: function seekTo(position) {
// FIXME: if not playing
if (!gMM.playbackControl)
this.play();
let min = 0; mappings.add([modes.PLAYER],
let max = gMM.playbackControl.duration - 5000; // TODO: 5s buffer like cmus desirable? ["l", "<Right>"], "Seek +10s",
function (count) { player.seekForward(Math.max(1, count) * 10000); },
{ count: true });
gMM.playbackControl.position = util.Math.constrain(position, min, max); mappings.add([modes.PLAYER],
}, ["H", "<S-Left>"], "Seek -1m",
function (count) { player.seekBackward(Math.max(1, count) * 60000); },
{ count: true });
// FIXME: 10% ? mappings.add([modes.PLAYER],
// I think just general increments of say 0.05 might be better --djk ["L", "<S-Right>"], "Seek +1m",
increaseVolume: function increaseVolume() { function (count) { player.seekForward(Math.max(1, count) * 60000); },
gMM.volumeControl.volume = gMM.volumeControl.volume * 1.1; { count: true });
},
decreaseVolume: function decreaseVolume() { mappings.add([modes.PLAYER],
if (gMM.volumeControl.volume == 0) ["=", "+"], "Increase volume by 10%",
gMM.volumeControl.volume = 0.1; function () { player.increaseVolume(); });
else
gMM.volumeControl.volume = gMM.volumeControl.volume * 0.9;
},
focusPlayingTrack :function focusPlayingTrack() { mappings.add([modes.PLAYER],
focusTrack(gMM.sequencer.currentItem); ["-"], "Decrease volume by 10%",
}, function () { player.decreaseVolume(); });
listTracks: function listTracks(view) { mappings.add([modes.PLAYER],
//let myView = LibraryUtils.createStandardMediaListView(LibraryUtils.mainLibrary, args); ["/"], "Search forward for a track",
let length = view.length; function (args) { commandline.open("/", "", modes.SEARCH_VIEW_FORWARD); });
let tracksList = [];
for (let i = 0; i < length; i++) { mappings.add([modes.PLAYER],
let mediaItem = view.getItemByIndex(i); ["n"], "Find the next track",
let trackName = mediaItem.getProperty(SBProperties.trackName); function () { player.searchViewAgain(false);});
let albumName = mediaItem.getProperty(SBProperties.albumName);
let artistName = mediaItem.getProperty(SBProperties.artistName);
tracksList[i] = [trackName, "Album : " + albumName + " Artist : " + artistName]; mappings.add([modes.PLAYER],
} ["N"], "Find the previous track",
function () { player.searchViewAgain(true);});
return tracksList; for (let i in util.range(0, 6)) {
}, let (rating = i) {
mappings.add([modes.PLAYER],
searchView: function searchView(args) { ["<C-" + rating + ">"], "Rate the current media item " + rating,
let currentView = _SBGetCurrentView(); function () { player.rateMediaItem(rating); });
let mediaItemList = currentView.mediaList;
let search = _getSearchString(currentView);
let searchString = "";
if (search != "")
searchString = args + " " + search;
else
searchString = args;
lastSearchString = searchString;
let mySearchView = LibraryUtils.createStandardMediaListView(mediaItemList, searchString);
if (mySearchView.length) {
lastSearchView = mySearchView;
lastSearchIndex = 0;
focusTrack(mySearchView.getItemByIndex(lastSearchIndex));
}
else
liberator.echoerr("E486 Pattern not found: " + searchString, commandline.FORCE_SINGLELINE);
},
searchViewAgain: function searchViewAgain(reverse) {
function echo(str) {
setTimeout(function () {
commandline.echo(str, commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES | commandline.FORCE_SINGLELINE);
}, 0);
}
if (reverse) {
if (lastSearchIndex == 0) {
lastSearchIndex = lastSearchView.length - 1;
echo("Search hit TOP, continuing at BOTTOM");
}
else
lastSearchIndex = lastSearchIndex - 1;
}
else {
if (lastSearchIndex == (lastSearchView.length - 1)) {
lastSearchIndex = 0;
echo("Search hit BOTTOM, continuing at TOP");
}
else
lastSearchIndex = lastSearchIndex + 1;
}
// FIXME: Implement for "?" --ken
commandline.echo("/" + lastSearchString, null, commandline.FORCE_SINGLELINE);
focusTrack(lastSearchView.getItemByIndex(lastSearchIndex));
},
/**
* The search dialog keypress callback.
*
* @param {string} str The contents of the search dialog.
*/
onSearchKeyPress: function (str) {
if (options["incsearch"])
this.searchView(str);
},
/**
* The search dialog submit callback.
*
* @param {string} str The contents of the search dialog.
*/
onSearchSubmit: function (str) {
this.searchView(str);
},
/**
* The search dialog cancel callback.
*/
onSearchCancel: function () {
// TODO: restore the view state if altered by an 'incsearch' search
},
getPlaylists: function getPlaylists() {
let mainLibrary = LibraryUtils.mainLibrary;
let playlists = [mainLibrary];
let listener = {
onEnumerationBegin: function () { },
onEnumerationEnd: function () { },
onEnumeratedItem: function (list, item) {
// FIXME: why are there null items and duplicates?
if (!playlists.some(function (list) list.name == item.name) && item.name != null)
playlists.push(item);
return Ci.sbIMediaListEnumerationListener.CONTINUE;
}
}; };
mainLibrary.enumerateItemsByProperty("http://songbirdnest.com/data/1.0#isList", "1", listener);
return playlists;
},
// Play track at 'row' in 'playlist'
playPlaylist: function playPlaylist(playlist, row) {
gMM.sequencer.playView(playlist.createView(), row);
},
getMediaPages: function getMediaPages() {
let list = gBrowser.currentMediaPage.mediaListView.mediaList;
let pages = services.get("mediaPageManager").getAvailablePages(list);
return ArrayConverter.JSArray(pages).map(function (page) page.QueryInterface(Ci.sbIMediaPageInfo));
},
loadMediaPage: function loadMediaList(page, list, view) {
services.get("mediaPageManager").setPage(list, page);
gBrowser.loadMediaList(list, null, null, view, null);
},
rateMediaItem: function rateMediaItem(rating) {
if (gMM.sequencer.currentItem)
gMM.sequencer.currentItem.setProperty(SBProperties.rating, rating);
},
getUserViewable: function getUserViewable() {
let propManager = services.get("propertyManager");
let propEnumerator = propManager.propertyIDs;
let properties = [];
while (propEnumerator.hasMore()) {
let propertyId = propEnumerator.getNext();
if (propManager.getPropertyInfo(propertyId).userViewable) {
//liberator.dump("propertyId - " + propManager.getPropertyInfo(propertyId).id);
properties.push(propManager.getPropertyInfo(propertyId).displayName);
} }
}
return properties;
}, },
options: function () {
options.add(["repeat"],
"Set the playback repeat mode",
"number", 0,
{
setter: function (value) gMM.sequencer.repeatMode = value,
getter: function () gMM.sequencer.repeatMode,
completer: function (context) [
["0", "Repeat none"],
["1", "Repeat one"],
["2", "Repeat all"]
],
validator: Option.validateCompleter
});
sortBy: function sortBy(property, order) { options.add(["shuffle"],
let pa = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"].createInstance(Ci.sbIMutablePropertyArray); "Play tracks in shuffled order",
liberator.dump("Property: " + property); "boolean", false,
{
switch (property.string) { setter: function (value) value ? gMM.sequencer.mode = gMM.sequencer.MODE_SHUFFLE :
case "#": gMM.sequencer.mode = gMM.sequencer.MODE_FORWARD,
case "Title": getter: function () gMM.sequencer.mode == gMM.sequencer.MODE_SHUFFLE
pa.appendProperty(SBProperties.trackName, "a"); });
break; },
case "Rating": services: function () {
pa.appendProperty(SBProperties.rating, 1); services.add("mediaPageManager", "@songbirdnest.com/Songbird/MediaPageManager;1", Ci.sbIMediaPageManager);
break; services.add("propertyManager","@songbirdnest.com/Songbird/Properties/PropertyManager;1", Ci.sbIPropertyManager);
case "Album": },
pa.appendProperty(SBProperties.albumName, "a"); });
break;
default:
pa.appendProperty(SBProperties.trackName, "a");
break;
}
_SBGetCurrentView().setSort(pa);
}
};
//}}}
} //}}}
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et: