mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-21 12:15:47 +01:00
Port Xulmus/Muttator. Not tested yet.
This commit is contained in:
@@ -221,18 +221,6 @@ const config = { //{{{
|
||||
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 //////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
@@ -251,10 +239,6 @@ const config = { //{{{
|
||||
delete img;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// COMMANDS ////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
@@ -4,72 +4,55 @@
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
|
||||
|
||||
function Library() { //{{{
|
||||
const Library = Module("library", {
|
||||
init: function () {
|
||||
this.MAIN_LIBRARY = LibraryUtils.mainLibrary;
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// 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 //////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
_toJSArray: function (enum) ArrayConverter.JSArray(enum),
|
||||
|
||||
// TODO: return some actually useful objects. ;-)
|
||||
return {
|
||||
/**
|
||||
* Returns an array of all the artist names in the main library.
|
||||
*
|
||||
* @returns {string[]}
|
||||
*/
|
||||
getArtists: function getArtists() this._toJSArray(this.MAIN_LIBRARY.getDistinctValuesForProperty(SBProperties.artistName)),
|
||||
|
||||
/**
|
||||
* Returns an array of all the artist names in the main library.
|
||||
*
|
||||
* @returns {string[]}
|
||||
*/
|
||||
getArtists: function getArtists() artists,
|
||||
// FIXME: ken do we really want to remove duplicates? If so, why not tracks too? --djk
|
||||
/**
|
||||
* Returns an array of all the album names for <b>artist</b> in the
|
||||
* main library.
|
||||
*
|
||||
* @param {param} artist The artist name.
|
||||
* @returns {string[]}
|
||||
*/
|
||||
getAlbums: function getAlbums(artist) {
|
||||
let albums = this._toJSArray(this.MAIN_LIBRARY.getItemsByProperty(SBProperties.artistName, artist))
|
||||
.map(function (track) track.getProperty(SBProperties.albumName));
|
||||
return util.Array.uniq(albums);
|
||||
},
|
||||
|
||||
// FIXME: ken do we really want to remove duplicates? If so, why not tracks too? --djk
|
||||
/**
|
||||
* Returns an array of all the album names for <b>artist</b> in the
|
||||
* main library.
|
||||
*
|
||||
* @param {param} artist The artist name.
|
||||
* @returns {string[]}
|
||||
*/
|
||||
getAlbums: function getAlbums(artist) {
|
||||
let albums = toJSArray(MAIN_LIBRARY.getItemsByProperty(SBProperties.artistName, artist))
|
||||
.map(function (track) track.getProperty(SBProperties.albumName));
|
||||
return util.Array.uniq(albums);
|
||||
},
|
||||
/**
|
||||
* Returns an array of all the track names for <b>artist</b> and
|
||||
* <b>album</b> in the main library.
|
||||
*
|
||||
* @param {param} artist The artist name.
|
||||
* @param {param} album The album name.
|
||||
* @returns {string[]}
|
||||
*/
|
||||
getTracks: function getTracks(artist, album) {
|
||||
const properties = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"]
|
||||
.createInstance(Ci.sbIMutablePropertyArray);
|
||||
|
||||
/**
|
||||
* Returns an array of all the track names for <b>artist</b> and
|
||||
* <b>album</b> in the main library.
|
||||
*
|
||||
* @param {param} artist The artist name.
|
||||
* @param {param} album The album name.
|
||||
* @returns {string[]}
|
||||
*/
|
||||
getTracks: function getTracks(artist, album) {
|
||||
const properties = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"]
|
||||
.createInstance(Ci.sbIMutablePropertyArray);
|
||||
properties.appendProperty(SBProperties.artistName, artist);
|
||||
properties.appendProperty(SBProperties.albumName, album);
|
||||
|
||||
properties.appendProperty(SBProperties.artistName, artist);
|
||||
properties.appendProperty(SBProperties.albumName, album);
|
||||
|
||||
return toJSArray(MAIN_LIBRARY.getItemsByProperties(properties))
|
||||
.map(function (track) track.getProperty(SBProperties.trackName));
|
||||
}
|
||||
|
||||
};
|
||||
//}}}
|
||||
} //}}}
|
||||
return this._toJSArray(this.MAIN_LIBRARY.getItemsByProperties(properties))
|
||||
.map(function (track) track.getProperty(SBProperties.trackName));
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
});
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user