1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 08:07:59 +01:00

Move library convenience functions to a library module.

This commit is contained in:
Doug Kearns
2009-04-02 01:02:20 +11:00
parent 1acb941148
commit 2499c84a48
4 changed files with 84 additions and 105 deletions

View File

@@ -1392,20 +1392,24 @@ function Completion() //{{{
song: function song(context, args)
{
// TODO: useful descriptions?
function map(list) list.map(function (i) [i, ""]);
let [artist, album] = [args[0], args[1]];
if (args.completeArg == 0)
{
context.title = ["Artists"];
context.completions = player.getArtists();
context.completions = map(library.getArtists());
}
else if (args.completeArg == 1)
{
context.title = ["Albums by " + args[0]];
context.completions = player.getAlbums(args[0]);
context.title = ["Albums by " + artist];
context.completions = map(library.getAlbums(artist));
}
else if (args.completeArg == 2)
{
context.title = ["Tracks from " + args[1] + " by " + args[0]];
context.completions = player.getTracks(args[0], args[1]);
context.title = ["Tracks from " + album + " by " + artist];
context.completions = map(library.getTracks(artist, album));
}
},