Conkeror page-mode for controlling media players on websites like Youtube, Grooveshark, etc.
These are the provided commands and their bindings:
| Command | Key |
|---|---|
| play | C-c C-return |
| mute | C-c C-m |
| previous | C-c C-p |
| next | C-c C-n |
| fullscreen | C-c C-f |
| Site/Feature | Play | Pause | Next | Previous | Mute | Unmute | Fullscreen |
|---|---|---|---|---|---|---|---|
| 8tracks | X | X | X | - | X | X | N/A |
| Amazon MP3 Store | X | X | - | - | - | - | N/A |
| Amazon CloudPlayer | X | X | X | X | X | X | N/A |
| Bandcamp | X | X | X | X | - | - | N/A |
| Hype Machine | X | X | X | X | X | X | N/A |
| Google Music | X | X | X | X | NW | NW | N/A |
| Grooveshark | X | X | X | X | X | X | N/A |
| Indie Shuffle | X | X | X | - | - | - | N/A |
| Jamendo | X | X | X | X | NW | NW | N/A |
| Last.fm | X | X | X | - | NW | NW | N/A |
| Pandora | X | X | X | - | X | NW | N/A |
| rdio | X | X | X | X | X | X | N/A |
| songza | X | X | X | - | X | X | N/A |
| SoundCloud | X | X | X | X | X | X | N/A |
| Spotify | X | X | X | X | NW | NW | N/A |
| Twitter Music | X | X | X | - | - | - | N/A |
| Youtube HTML5 | X | X | X | X | X | X | X |
| X | Works |
| NW | Not Working/Needs Work |
| N/A | Not Applicable |
| - | Not Supported by Site |
- Amazon Instant Video
- Netflix
cd ~/.conkerorrc git clone https://github.com/scottjad/player-mode.git ln -s player-mode/player.js .
Add something like this to your Conkeror RC file:
def_player_site("grooveshark",
build_url_regexp($domain = "grooveshark", $allow_www = true),
{"play": "#play-pause",
"mute": "#volume",
"previous": "#play-prev",
"next": "#play-next"});
If you’re adding support for a popular site, please consider adding it to player.js and creating a pull request once you’ve tested it extensively.
You might want to use something like this to find the the selectors.
require("dom-inspector");
define_key(default_global_keymap, "C-c i", "inspect-click");
Say you like to give songs the thumbs down on Pandora. You could add support like this:
player_button_selectors["pandora"]["thumbs-down"] = ".thumbsDownButton";
interactive("player-thumbs-down",
"Click the thumbs down button.",
player_command("thumbs-down",
"No thumbs down button found"));
define_key(player_keymap, "C-c C-d", "player-thumbs-down");
Or for a like button on Spotify:
player_button_selectors["spotify"]["like"] = player_iframe_button("#app-player","#track-add:not(.added)");
interactive("player-like",
"Click the like button.",
player_command("like",
"No like button found"));
define_key(player_keymap, "C-c C-u", "player-like");
You could bind a key in your window manager to run a command like this:
conkeror -f player-play
This will first try to interact with the current buffer, but if player-mode is not supported there, then it will interact with the last buffer where player-mode commands were used, if that buffer has not changed to a new document.
To interact with the same buffer that player last used, if it is no longer the current buffer, you would use:
conkeror -f player-last -f player-play
To do this from within conkeror on a buffer that is in player-mode,
you can use C-c C-l then a normal player command keybinding like
C-c C-n.
There’s currently no way to control the last used buffer from within Conkeror if the current buffer is not in player-mode. I use my window manager bindings in that scenario.
- Does not handle players whose controls are Flash not HTML. If the site uses Flash to play the media itself that’s fine.
- Currently no way to turn page-modes on by something other than url. So Youtube players on blogs won’t work unless player-mode is enabled manually. And right now even if it is enabled manually it won’t be able to find the player because that’s done by url. There should be a fix for this.
- Currently no way to have two different players on one page, such as a blog where one article has a youtube player and a soundcloud player.
- Should eventually support the browser’s built-in HTML5 media player itself. Maybe work up from the currently focused element to find a media player to use, and failing that use the url.
MIT/X11