gPodder and EMMS
Date: 28 March 2012
I use gPodder to pull podcasts for all my listening pleasure at work. I had been using gnome-mplayer to listen to them but after a recent re-install, gnome-mplayer started to hanging every when I pause the playback. Gmplayer works fine so I know that mplayer, by itself, is not the problem but that doesn’t have a systray icon to make it easy to click and pause playback.
Since I’m so frequently using emacs, I thought to myself “I wonder if I can do this in emacs?” Of course, I can. Enter emms.
emms Configuration
Based on a little bit of research, I decided to use mplayer as the backend. The setup is pretty easy. This is what I’m using based on this blog post.
;; emms
(require 'emms-player-mplayer)
(require 'emms-source-file)
(require 'emms-source-playlist)
(setq emms-player-mplayer-command-name "mplayer"
emms-player-mplayer-parameters '("-slave")
emms-player-mpg321-command-name "mpg123"
emms-player-list
'(emms-player-mplayer
emms-player-mplayer-playlist
emms-player-mpg321
emms-player-ogg123))
gPodder Configuration
Now that I can listen to the music via emacs, I need to tell gPodder how to feed the podcasts into emms. It’s simple to add them to playlist from outside of emacs with this:
emacsclient --server-file=work --eval '(emms-add-file "TD140.mp3")'
In $HOME/.config/gpodder/gpodder.conf
, you can set the player
setting. gPodder replaces the %U
with the file name. … In
theory. In practice, gPodder only replaces %U
if it’s at the end of
the line. That means I needed to write a quick wrapper.
my $file = shift @ARGV;
my $emacs = "emacsclient –server-file=work";
my $command = "$emacs –eval '(emms-add-file "$file")'";
#print "$command\n";
system "$command";
I run emacs in daemon mode (with TCP). If you don’t, you’ll want to
change the $emacs
variable.
And you’re done. Happy listening.