1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-30 06:45:46 +01:00

Normalise case of player command and mapping descriptions.

This commit is contained in:
Doug Kearns
2009-03-22 16:08:18 +11:00
parent 2216878c9d
commit 032b5be2ae
2 changed files with 29 additions and 25 deletions

View File

@@ -497,6 +497,7 @@ const config = { //{{{
window.toJavaScriptConsole = function () { window.toJavaScriptConsole = function () {
toOpenWindowByType("global:console", "chrome://global/content/console.xul"); toOpenWindowByType("global:console", "chrome://global/content/console.xul");
} }
window.BrowserStop = function () { window.BrowserStop = function () {
getBrowser().mCurrentBrowser.stop(); getBrowser().mCurrentBrowser.stop();
} }

View File

@@ -1,4 +1,4 @@
//Import Artist List as this can be huge // Import Artist List as this can be huge
var artists = getArtistsArray(); var artists = getArtistsArray();
@@ -46,7 +46,7 @@ function Player() // {{{
function () { player.previous(); }); function () { player.previous(); });
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
["c"], "Pause/Unpause track", ["c"], "Pause/unpause track",
function () { player.togglePlayPause(); }); function () { player.togglePlayPause(); });
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
@@ -58,7 +58,7 @@ function Player() // {{{
function () { player.stop(); }); function () { player.stop(); });
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
["f"], "Filter Library", ["f"], "Filter library",
function () { commandline.open(":", "filter ", modes.EX); }); function () { commandline.open(":", "filter ", modes.EX); });
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
@@ -66,11 +66,11 @@ function Player() // {{{
function () { commandline.open(":", "Filter ", modes.EX); }); function () { commandline.open(":", "Filter ", modes.EX); });
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
["s"], "Toggle Shuffle", ["s"], "Toggle shuffle",
function () { player.toggleShuffle(); }); function () { player.toggleShuffle(); });
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
["r"], "Toggle Repeat", ["r"], "Toggle repeat",
function () { player.toggleRepeat(); }); function () { player.toggleRepeat(); });
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
@@ -94,11 +94,11 @@ function Player() // {{{
{ flags: Mappings.flags.COUNT }); { flags: Mappings.flags.COUNT });
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
["=", "+"], "Increase Volume by 10%", ["=", "+"], "Increase volume by 10%",
function () { player.increaseVolume(); }); function () { player.increaseVolume(); });
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
["-"], "Decrease Volume by 10%", ["-"], "Decrease volume by 10%",
function () { player.decreaseVolume(); }); function () { player.decreaseVolume(); });
////////////////// ///////////////////////////////////////////////////////////}}} ////////////////// ///////////////////////////////////////////////////////////}}}
@@ -110,15 +110,15 @@ function Player() // {{{
"Filter and play tracks", "Filter and play tracks",
function (args) function (args)
{ {
//Store the old view // Store the old view
//let prev_view = gMM.status.view; // let prev_view = gMM.status.view;
let library = LibraryUtils.mainLibrary; let library = LibraryUtils.mainLibrary;
let mainView = library.createView(); let mainView = library.createView();
let sqncr = gMM.sequencer; let sqncr = gMM.sequencer;
let customProps = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"] let customProps = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"]
.createInstance(Ci.sbIMutablePropertyArray); .createInstance(Ci.sbIMutablePropertyArray);
//args // args
switch (args.length) switch (args.length)
{ {
case 3: case 3:
@@ -152,16 +152,16 @@ function Player() // {{{
{ {
SBGetBrowser().loadMediaList(LibraryUtils.mainLibrary, null, null, myView, SBGetBrowser().loadMediaList(LibraryUtils.mainLibrary, null, null, myView,
"chrome://songbird/content/mediapages/filtersPage.xul"); "chrome://songbird/content/mediapages/filtersPage.xul");
//TODO: make this focusTrack work ? // TODO: make this focusTrack work ?
focusTrack(myView.getItemByIndex(0)); focusTrack(myView.getItemByIndex(0));
} }
}, },
{ {
argCount: "+", argCount: "+",
// completer: function (context, args) completion.tracks(context, args); //completer: function (context, args) completion.tracks(context, args);
}); });
// TODO: better off as a single command, or cmus compatible E.g. :player-next? --djk // TODO: better off as a single command (:player play) or cmus compatible (:player-play)? --djk
commands.add(["playerp[lay]"], commands.add(["playerp[lay]"],
"Play track", "Play track",
function () { player.play(); }); function () { player.play(); });
@@ -201,7 +201,7 @@ function Player() // {{{
player.volume = Math.min(Math.max(level, 0), 1); player.volume = Math.min(Math.max(level, 0), 1);
}, },
{ argCount: 1 }); { argCount: "1" });
/////////////////////////////////////////////////////////////////////////////}}} /////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION ////////////////////////////////////////// ////////////////////// PUBLIC SECTION //////////////////////////////////////////
@@ -218,11 +218,11 @@ function Player() // {{{
play: function play() play: function play()
{ {
//Check if there is any selection in place, else play first item of the visible view. // Check if there is any selection in place, else play first item of the visible view.
if (_SBGetCurrentView().selection.count != 0) if (_SBGetCurrentView().selection.count != 0)
{ {
//Play the selection. // Play the selection.
gMM.sequencer.playView(_SBGetCurrentView(),_SBGetCurrentView().getIndexForItem(_SBGetCurrentView().selection.currentMediaItem)); gMM.sequencer.playView(_SBGetCurrentView(), _SBGetCurrentView().getIndexForItem(_SBGetCurrentView().selection.currentMediaItem));
focusTrack(gMM.sequencer.currentItem); focusTrack(gMM.sequencer.currentItem);
} }
else else
@@ -291,7 +291,7 @@ function Player() // {{{
seek(interval, false); seek(interval, false);
}, },
//FIXME: 10% ? // FIXME: 10% ?
increaseVolume: function increaseVolume() increaseVolume: function increaseVolume()
{ {
gMM.volumeControl.volume = gMM.volumeControl.volume * 1.1; gMM.volumeControl.volume = gMM.volumeControl.volume * 1.1;
@@ -316,28 +316,31 @@ function Player() // {{{
let length = view.length; let length = view.length;
let tracksList = []; let tracksList = [];
for (var i=0; i < length; i++) for (var i = 0; i < length; i++)
{ {
var mediaItem = view.getItemByIndex(i); var mediaItem = view.getItemByIndex(i);
var trackName = mediaItem.getProperty(SBProperties.trackName); var trackName = mediaItem.getProperty(SBProperties.trackName);
var albumName = mediaItem.getProperty(SBProperties.albumName); var albumName = mediaItem.getProperty(SBProperties.albumName);
var artistName = mediaItem.getProperty(SBProperties.artistName); var artistName = mediaItem.getProperty(SBProperties.artistName);
tracksList[i] = [ trackName, "Album : "+albumName+" Artist : "+artistName ]; tracksList[i] = [trackName, "Album : " + albumName + " Artist : " + artistName];
} }
return tracksList; return tracksList;
}, },
//TODO: Use this for implementing "/" and "?". -ken // TODO: Use this for implementing "/" and "?". -ken
searchTracks: function searchTracks(args) searchTracks: function searchTracks(args)
{ {
let currentView = _SBGetCurrentView(); let currentView = _SBGetCurrentView();
let mediaItemList = currentView.mediaList; let mediaItemList = currentView.mediaList;
let search = _getSearchString(currentView); let search = _getSearchString(currentView);
let searchString = ""; let searchString = "";
if (search != "") if (search != "")
searchString = args + " " + search; searchString = args + " " + search;
else else
searchString = args; searchString = args;
let myView = LibraryUtils.createStandardMediaListView(mediaItemList, searchString); let myView = LibraryUtils.createStandardMediaListView(mediaItemList, searchString);
focusTrack(myView.getItemByIndex(0)); focusTrack(myView.getItemByIndex(0));
} }