How to listen to a network radio station in a Linux Command Line

Source: Internet
Author: User
Tags echo command

How to listen to a network radio station in a Linux Command Line

For system administrators and Linux fans who spend a lot of time on Linux screens, music on the Network/local station can greatly improve productivity, do you know? Whether you believe it or not, a sound in your work environment, such as music or chatting, can improve our creativity. If you like to work in a music environment, this tutorial may be useful to you. I will show you how to listen to Pandora online Radio (LCTT: Pandora Internet Radio) in the command line is a system that provides automatic music recommendations only for the US, Australia, and New Zealand. Prandoea radio station details)

As you know, Pandora is one of the most famous online radio services. It contains countless different types of free music streams and a powerful music recommendation engine. Pandora can be accessed in different ways, such as browsers, desktop clients, or mobile Apps. the open-source community also provides another method to access Pandora music services: Linux Command Line.

Pianobar is an open-source command line music player that plays Pandora online station music. It has a simple terminal interface for playing and managing music stations. There are also other features including song rating, music list coming soon, Playing History, custom shortcut key binding, and remote control. Pianobar also supports proxy services for users living in areas not accessible to Pandora music services (users outside the United States, Australia, and New Zealand.

Install Pianobar in Linux

In Debian or other Debian derivatives, such as Ubuntu or LinuxMint, Pianobar is a compiled software package. Therefore, to install Pianobar, simply enter the following command:

  1. $ Sudo apt-get install pianobar

Pianobar is not included in the basic software library in Fedora. Therefore, you need to compile and install Pianobar through source code. The entire installation process may be a little troublesome, but the following tutorial will compile and install Pianobar in the Frdora system. This tutorial is successfully tested in Fedora20.

First, compile and install FFmpeg according to the FFmpeg installation tutorial.

Compile FFmpeg in Linux to download and compile the source file

Linux compiling and upgrading FFmpeg

Install FFMPEG on CentOS 5.6

Install FFmpeg in Ubuntu

------------------------------------------ Split line ------------------------------------------

Enable RPM Fusion source () and install other dependent software:

  1. $ Sudo yum install wget gcc-c ++ pkgconfig gnutls-devel json-c-devel libgcrypt-devel make libao-devel faad2-devel libmad-devel libao faad2-libs

Compile and install Pianobar

  1. $ Wget http://6xq.net/projects/pianobar/pianobar-2014.06.08.tar.bz2
  2. $ Tar xvfvj pianobar-2014.06.08.tar.bz2
  3. $ Pianobar-2014.06.08 cd
  4. $ PKG_CONFIG_PATH =/usr/local/lib/pkgconfig: $ PKG_CONFIG_PATH make
  5. $ Sudo make install

Finally, allow Paniobar to load the FFmpeg shared library installed in the/usr/local/lib directory and add the following line to the/etc/ld. so. conf configuration file:

/usr/local/lib

Reload all shared libraries

  1. $ Sudo ldconfig

In this way, Pianobar has been installed in the Fedora system.

Listen to Pandora music in the command line

The basic usage of paniobar is to enter the following command:

  1. $ Pianobar

This command will require you to log on to Pandora and select the station you want to listen to from your personalized radio list. After you select a radio station, the music starts to play automatically.

Press '? 'Press pianobar to list a series of available commands, some of which are as follows:

  • S: change the radio station
  • U: view the music list to be launched
  • H: view the playback history
  • N: play the next one
  • B: Add songs or artists to favorites
  • (Or): reduces or increases the playback volume.
  • S: pause playback
  • P: Resume playback.
  • V: Create a radio station for the current song or artist
  • + Or-: view the previous or next song.
  • A: add music to the radio station.
  • Q: Exit pianobar.

Configure Pianobar for Automatic Installation

You can configure the default configurations of Pianobar in a separate configuration file. For example, you can put your login information in the configuration file, so that you do not need to enter it manually every time. The following is an example of how to create a configuration file:

  1. $ Mkdir-p ~ /. Config/pianobar
  1. $ Vi ~ /. Config/pianobar/config
# Example pianobar configuration file# Pandora login infouser = your@email_addresspassword = plaintext_password# Users who cannot access Pandora in their region can set a proxy.control_proxy = http://user:password@host:port/# Initial volume in dB: between -30 and +5volume = 0# Audio quality: high, medium or lowaudio_quality = high

For complete configuration options, see the man manual page.

  1. $ Man pianobar
Remote Pianobar Control

Another outstanding feature of Pianobar is its support for remote control. You can use the command pipeline (FIFO) to send commands to a running instance of Pianobar. The following is an example of remote Pianobar control:

First in the directory ~ /. Config/pianobar create a FIFO command Pipeline

  1. $ Mkfifo ~ /. Config/pianobar/ctl

Then run Pianobar

Now, you can use the echo command to send any single-character command key to Pianobar. For example, play the next song:

  1. $ Echo-n 'n'> ~ /. Config/pianobar/ctl

You can easily extend this configuration to a remote computer. When Pianobar runs on Host X, you can control Pianobar through SSH in remote host Y, as shown below:

In host Y, run:

  1. $ Ssh user @ host_X "echo-n 'n'> ~ /. Config/pianobar/ctl"

Of course, you want to enable key authentication for SSH logon authentication on Host X, so that you do not need to enter the SSH password every time.

When you want to set up an online radio player that can be remotely controlled on Raspberry Pi, Pianobar's remote control feature will make it very convenient for you to implement this requirement.

I hope you like Pianobar as much as you do. If you have any ideas, please let me know in the comments.

This article permanently updates the link address:

  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.