Archive

Archive for the ‘CLI applications’ Category

Setting up MPD and Ncmpcpp in Arch Linux

December 15, 2009 1 comment

Just to echo Linux.com’s starting line in “CLI audio players for Linux”: What would life be without music? That’s the number 1 thing every self-respecting 21st Century man does in his free time—lip-sync to Britney Spear’s mp3 playing off their computer at eardrum shattering volume. Alsa is also the first thing I install in Arch Linux. Not X, not openssh or anything fancy. Just a good command line audio player with the ability to play mp3, ogg and streaming Internet radio.

Even if you’re running some instance of X like: Gnome, KDE, Xfce or some other window manager, there are reasons why you might want to use a command line audio player even though there are GUI audio players like Audacious, Rhythmbox and Amarok:

  • You cannot or will not install X :D
  • You are using an old computer with limited resource
  • You’re crazy

The last point doesn’t really count as a reason, but I have been trying to learn the Linux command line for the longest time. Even though my 4 year old Toshiba laptop with 1Gb RAM can do Gnome or KDE with relative ease, I’m challenging myself to make my way around Linux using only the command line—for education purposes—not as if I’m such a whiz with an obscure OS like Linux. :p

Ncmpcpp is the frontend for MPD featuring a ncurses TUI(Text User Interface). Instead of typing something like:

archer@oldlappie ~ # mpc search artist 'Lisa Ono' | mpc add
archer@oldlappie ~ # mpc play

You can have something like the image below to easily manage your playlist, browse, add, play, delete and even download lyrics for singing along when your favorite song is playing.

ncmpcpp interface

Lyrics window for your sing-along pleasure:
ncmpcpp lyrics

Even if you’re a little lost when you launch ncmpcpp for the first time, help is just a keystroke away:
ncmpcpp help

MPD has features other than the more obvious ones I’ve listed above. I installed MPD on Arch Linux, so this post contains notes on how I got MPD and ncmpcpp rolling on my chosen distro.

MPD installation notes

1. Installing mpd, mpc and ncmpcpp
2. Configuring mpd
3. Starting mpd and playing from ncmpcpp

1. Installing mpd, mpc and ncmpcpp

Install using Arch Linux’ package manager(pacman) as root:


root@oldlappie ~ $ pacman -S mpd mpc ncmpcpp

That’s it! easy peasy, japaneasy.

2. Configuring mpd

create your mpd directory: /home/[user]/.mpd

archer@oldlappie ~ # mkdir .mpd

Copy mpd.conf.example from /etc to your .mpd directory:

archer@oldlappie ~ # cp /etc/mpd.conf.example .mpd/mpd.conf

Edit /home/[user]/.mpd/mpd.conf using your favorite editor. I’ll be using vim:

archer@oldlappie ~ # vim .mpd/mp.conf

uncomment and make your mpd.conf file reflect as below:


music_directory "/home/[user]/music" # where you store your music
playlist_directory "~/.mpd/playlists"
db_file "~/.mpd/mpd.db"
log_file "~/.mpd/mpd.log"
error_file "~/.mpd/mpd.error"
pid_file "~/.mpd/mpd.pid"
state_file "~/.mpd/mpdstate"
user "[user]"

audio_output {
type "alsa"
name "My ALSA Device"
}

Make the ‘playlist’ directory as specified in your mpd.conf:

archer@oldlappie ~ # mkdir .mpd/playlists

That’s about it for configuring mpd for a local user. We’ll have to update mpd’s database before it’ll read, display and play the audio files in your directory.

archer@oldlappie ~ # mpd --create-db

That will start your mpd and you can test if it’s working by adding and playing songs with mpc:

archer@oldlappie ~ # mpc search artist 'Lisa Ono' | mpc add
archer@oldlappie ~ # mpc play
Lisa Ono - I Wish You Love
[playing] #47/62 0:01/3:49 (0%)
volume: 85% repeat: on random: on single: off consume: off
archer@oldlappie ~ #

Ncmpcpp doesn’t require too much configuration, but if you’re going to use ncmpcpp’s in-built tag editor, add your music directory to ‘~/.ncmpcpp/config’.

mpd_music_dir = "/home/[user]/music"

Start ncmpcpp by entering ‘ncmpcpp’ in the command line. That should show you an empty playlist. Top most menu bar will should you the different mode ncmpcpp is capable of. If you’re unsure of the key-bindings in ncmpcpp, hit F1 or ’1′ to get into help page. Minimal commands you should know.


        Up k        : Move Cursor up
        Down j      : Move Cursor down
        Page Up     : Page up
        Page Down   : Page down
        Home        : Home
        End         : End

        Tab         : Switch between playlist and browser
        1 F1        : Help screen
        2 F2        : Playlist screen
        3 F3        : Browse screen
        4 F4        : Search engine
        5 F5        : Media library
        6 F6        : Playlist editor
        7 F7        : Tag editor
        0 F10       : Clock screen


   Keys - Global
 -----------------------------------------
        s           : Stop
        P           : Pause
        >           : Next track
        <           : Previous track
        f           : Seek forward
        b           : Seek backward
        Left -      : Decrease volume
        Right +     : Increase volume

        t           : Toggle space mode (select/add)
        T           : Toggle add mode
        |           : Toggle mouse support
        v           : Reverse selection
        V           : Deselect all items
        A           : Add selected items to playlist/m3u file

        r           : Toggle repeat mode
        Z           : Shuffle playlist
        i           : Show song's info
        I           : Show artist's info
        L           : Toggle lyrics database
        l           : Show/hide song's lyrics

        q Q         : Quit


Hope you will enjoy using mpd and ncmpcpp as a low footprint audio player.

Posting from Command line – Charm 1.9

December 10, 2009 Leave a comment

Just installed Charm 1.9—a really great commandline blogging tool I canme across in the past. Had some trouble using it with python 2.6 a few days ago but I’m not giving up yet. If you see this post, it means I’ll be posting from Charm from now on.

Categories: CLI applications

Note to Self – Compiling Finch only flags

December 10, 2009 Leave a comment

Compiling Finch without pidgin from source in Arch Linux.

./configure --disable-gtkui --disable-vv --disable-meanwhile --disable-avahi --disable-nm --disable-tcl

Edit: There’s no sound playing from finch. I guess I’ll have to live with it—not a big problem.

More about using blogpost

August 21, 2008 Leave a comment

Using blogpost to manage and post to your wordpress blog is not exactly intuitive. There are commands and flags used in the command line that you need to remember; on top of that, you have to learn how to use AsciiDoc and a little HTML. What’s even worse—the documentation from Blogpost official site is not exactly informative. Sure, there are helpful text to be found there, but you have to dig pretty deep and keep an eye out for important information regarding the use of blogpost.

In any case, I have some notes to share here; mostly on the commands in the terminal.

For posting: <quote> $ blogpost create [your-asciidoc-text-file.txt] </quote>

For listing your entries: <quote> $ blogpost list </quote>

For deleting: <quote> $ blogpost delete —post-id=[ID-number] </quote>

For updating with your blog file: <quote> $ blogpost update [blog-text-file.txt] </quote>

For categorising: <quote> $ blogpost cat categories=[categories-seperated-with-commas] [blog-file] </quote>

That’s about the long and short of it.

Categories: CLI applications, Linux

Using Linux Command line applications

August 18, 2008 1 comment

Linux command line applications suffer from a problem. The commands written into the programs are not universal. That means commands from one program to the other conflicts with what you’ve learned. Take for example Audio player X uses ‘n’ to skip a track. That’s not the case for Audio player Y—if you decide to change another music player(Maybe you just need a certain feature in Y).

That’s probably the biggest problem surrounding CLI applications—the programs are just not as intuitive to use. Other than that, not having flash, java… etc doesn’t really drive me away from CLI. Fact is, I’ve learned a lot more about concentration after using command line applications—Just using bash itself taught me quite a bit. There are minimal distraction when you’re typing a document in VI/Emacs when you’re running everything full-screen. You can argue that it can be achieved in X too.

That’s too true, but CLI uses less resource. I can run elinks, Emacs, mpg123, mutt without putting a dent on my ‘pretty old’ P4 1.7GHz with 256 RAM machine. Sure, I can use a light windows manager like fluxbox, wmii; but I’ve gotta used to the command line system.

Categories: CLI applications, Linux

Why I ditched the GUI

August 8, 2008 2 comments

I get weird looks from friends when ever I boot up Arch Linux on my eee pc. The same can be said when I load up Emacs/VI to type something. After all, it’s a console application for text-editing. In the world of Windows/OSX, where word processors like Microsoft office rules, it’s akin to saying that you’re a vegetarian for ethical reasons.

I can clearly remember the first time I installed GNU/Linux on my machine. Back then, I thought that Linux was an OS reserved only for the geeks or programmers. I wasn’t too far from the truth. The path to GNU/Linux is tough and required a certain know-how, using strictly text-based application is worse. There are no cute icons to ease your soul. The only thing graphical is the blinking cursor. Some would call such endeavour masochistic. Why did I ditch the GUI? Doing more with less.

In an effort to focus on writing and nothing else, I started on a search for a text-editor that allows me to turn off all the useless tool bars, menus. I found Q10, a full-screen text-editor for Windows. It was a joy to use.

After dropping my last 500 bucks on a Asus eee pc 900, I proceed to find the Linux version of Q10 for my box only to find out–Q10 has no Linux version. That’s when I decided to find an alternative to Q10. After a search on google, I found Emacs and VI. Both text-based applications where the use of the mouse is considered sacrilegious. An affront to all things GNU.

At first, I bemoan the dead of my mouse in Emacs. After learning the key-strokes in Emacs, I found that I can do things in Emacs with relative ease and came to love the idea that my hands don’t have to leave the keyboard at all. It greatly increase my productivity, not to mention that I’m more focused on the screen than ever, since I don’t have to deal with a certain irritating paperclip asking if I needed any help every 5 minutes.

Today, I can surf the web, read my mail, write, instant message all from the console without the use of a GUI. Is it easier? For certain it’s a big NO. So why use command line applications at all? It’s all for simplicity’s sake. Do you remember the days of WordStar? Nothing but just a word processor, it’s effectively just a box with nothing but WordStar loaded. Just for word processing, a far cry from the word processors of today. Those days are far gone, but in the search for more processing power, we keep updating our software like we need the latest glitzy features, when all we need is a blinking cursor and a keyboard.

That’s good enough a reason for me to ditch the GUI and return to the world of console applications–where simplicity rules.

Categories: CLI applications, Linux
Follow

Get every new post delivered to your Inbox.