diff --git a/common/content/completion.js b/common/content/completion.js index 5592ec36..d90b6bd4 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -1409,6 +1409,21 @@ function Completion() //{{{ } }, + playlist: function playlist(context, args) + { + let playlists = Player().getPlaylists(); + let length = playlists.length; + let playlistNames = []; + + for (var i=0; i < length; i++) + { + playlistNames[i] = [playlists[i].name.toString(),playlists[i].name]; + } + + context.title = ["Playlists"]; + context.completions = playlistNames; + }, + buffer: function buffer(context) { filter = context.filter.toLowerCase(); diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 76208183..448055b1 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -203,6 +203,37 @@ function Player() // {{{ }, { argCount: "1" }); + commands.add(["load"], + "Load a playlist", + function (args) + { + + if (args.length != 0) + { + //load the selected playlist/smart playlist + let playlists = player.getPlaylists(); + let length = playlists.length; + let playlistNames = []; + + for (var i=0; i < length; i++) + { + playlistNames[i] = playlists[i].name.toLowerCase(); + } + + let playlist = args.string.replace("\\",""); + SBGetBrowser().loadMediaList(playlists[playlistNames.indexOf(playlist.toLowerCase())]); + focusTrack(_SBGetCurrentView().getItemByIndex(0)); + } + else + { + //load main library if there are no args + _SBShowMainLibrary(); + } + }, + { + //args: + completer: function(context, args) completion.playlist(context, args) + }); /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{