July 29, 2011

pianobar man!

Filed under: music, Ubuntu — squirreltech @ 4:16 am

Pianobar is a command line client for pandora… I am beginning to feel that it is a must have for any home automation directed squirrel, especially if he already has a pandora account.

I was searching for details on this mysterious “eventcmd” that I saw referenced somewhere as a way to get information out of pianobar when you did an action. Apparently people really want to post their current song to last.fm. Whatever. But I couldn’t find many details about the syntax and such, until this one that referenced a man page!! Duh. I somehow figured that since it didn’t have much documentation on the web site, there just wasn’t much at all.

Well, to help anyone else in this situation, i’ll paste it here for the google crawlers to find. I found it very useful, most especially the part about “ctl” as a command interface….. this means I can write some kind of gui front end to start, stop, change play from my phone. Awesome.

pianobar(1)                                                        pianobar(1)

       pianobar - console pandora.com music player


       pianobar  is  a  lightweight  console music player for the personalized
       online radio pandora.com.

       $XDG_CONFIG_HOME/pianobar/config or ~/.config/pianobar/config
              Per-user configuration file. See CONFIGURATION.

       /etc/libao.conf or ~/.libao
              Global/per-user audio output configuration. See libao documentaâ
              tion at http://xiph.org/ao/doc/config.html

       The  configuration file consists of simple key = value lines. Each terâ
       minated with a newline (\n) character. Keys and values  are  both  case
       sensitive. act_*-keys control pianobar's key-bindings.

       act_help = ?
              Show keybindings.

       act_songlove = +
              Love currently played song.

       act_songban = -
              Ban  current  track.  It  will  not be played again and can only
              removed using the pandora.com web interface.

       act_stationaddmusic = a
              Add more music to current station.  You  will  be  asked  for  a
              search  string. Just follow the instructions. If you're clueless
              try '?' (without quotes).

       act_bookmark = b
              Bookmark current song or artist.

       act_stationcreate = c
              Create new station. You have to enter a search string and select
              the song or artist of your choice.

       act_stationdelete = d
              Delete current station.

       act_songexplain = e
              Explain why this song is played.

       act_stationaddbygenre = g
              Add genre station provided by pandora.

       act_history = h
              Show history.

       act_songinfo = i
              Print information about currently played song/station.

       act_addshared = j
              Add shared station by id. id is a very long integer without "sh"
              at the beginning.

       act_songmove = m
              Move current song to another station

       act_songnext = n
              Skip current song.

       act_songpause = p

       act_quit = q
              Quit pianobar.

       act_stationrename = r
              Rename currently played station.

       act_stationchange = s
              Select another station.

       act_songtired = t
              Ban song for one month.

       act_upcoming = u
              Show next songs in playlist.

       act_stationselectquickmix = x
              Select quickmix stations.

       act_voldown = (
              Decrease volume.

       act_volup = )
              Increase volume.

       audio_format = {aacplus,mp3,mp3-hifi}
              Select audio format. aacplus is default if both libraries (faad,
              mad)  are  available. mp3-hifi is available for Pandora One cusâ
              tomers only.

       autostart_station = stationid
              Play this station when starting up. You can get the stationid by
              pressing i or the key you defined in act_songinfo.

       ban_icon = </3
              Icon for banned songs.

       control_proxy = http://host:port/
              Non-american  users  need  a  proxy to use pandora.com. Only the
              xmlrpc interface will use this  proxy.  The  music  is  streamed

       event_command = path
              File that is executed when event occurs. See section EVENTCMD

       history = 5
              Keep a history of the last n songs (5, by default). You can rate
              these songs.

       love_icon = <3
              Icon for loved songs.

       password = plaintext_password
              Your pandora.com password. Plain-text.

       proxy = http://host:port/
              Use  a  http  proxy.  Note  that  this  setting  overrides   the
              http_proxy environment variable.

       sort  =  {name_az,  name_za,  quickmix_01_name_az, quickmix_01_name_za,
       quickmix_10_name_az, quickmix_10_name_za}
              Sort station list by  name  or  type  (is  quickmix)  and  name.
              name_az   for  example  sorts  by  name  from  a  to  z,  quickâ
              mix_01_name_za by type (quickmix at the bottom) and name from  z
              to a.

       user = your@user.name
              Your pandora.com username.

       volume = 0
              Initial volume correction in dB. Usually between -30 and +5.

       pianobar  can be controlled through a fifo. You have to create it yourâ
       self by executing

        mkfifo ~/.config/pianobar/ctl

       Adjust the path if you set up a $XDG_CONFIG_HOME.  Afterwards  you  can
       write commands directly into the fifo. Example (next song):

        echo -n 'n' > ~/.config/pianobar/ctl

       n is the keybinding for "next song". If you customized your keybindings
       you have to use these characters to control pianobar.   This  behaviour
       may change in the future!

       Another example:

        while true; do;
           nc -l -p 12345 -s localhost localhost > ~/.config/pianobar/ctl;
           sleep 1;

        echo -ne 'n\x1a' | nc -q 0 12345

       pianobar  can  report  certain "events" to an external application (see
       CONFIGURATION ). This application is started with  the  event  name  as
       it's  first  argument. More information (artist, title, album, stationâ
       Name, error code, error description, song length in milliseconds,  ratâ
       ing, album art url) is supplied through stdin.

       Currently  supported events are: artistbookmark, songban, songbookmark,
       songexplain, songfinish, songlove, songmove, songshelf, songstart, staâ
       tionaddmusic,  stationaddshared, stationcreate, stationdelete, stationâ
       fetchplaylist, stationquickmixtoggle, stationrename

       An example script can be found in the contrib/ directory of  pianobar's
       source distribution.

       Lars-Dominik Braun <lars@6xq.net>


July 17, 2011

The World Cup in a file

Filed under: Ubuntu — Tags: , , , — squirreltech @ 8:07 pm

Some family friends are staying at our place for a week or so and they really wanted to see the Women’s World Cup finals. Well, they were going to be out and about for the actual game, so they asked if it was possible to record it. We got rid of DVR last November (that’s like $800 saved!!) so I decided to see what my Ubuntu machine could do.

To test it first (game hasn’t started yet), I decided to try a current, live stream and I found this site that would give me a “sop” link, but putting that into VLC gave me this error:

Your input can't be opened:
VLC is unable to open the MRL 'sop://broker.sopcast.com:3912/111719'. Check the log for details.

So, some research brought me to kabology and how to install the sopcast player. I ran these commands in a term window:

echo "deb http://ppa.launchpad.net/jason-scheunemann/ppa/ubuntu `lsb_release -cs` main" | sudo tee -a /etc/apt/sources.list && sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CD30EE56
sudo apt-get update && sudo apt-get install sopcast-player sp-auth

This created the “SopCast Player” in Applications -> Sound & Video. I fired that up and entered my test sop mrl (?) and I was then greeted with a man announcing a basketball game (I think) in some Eastern European language! I then fired up vlc (version 1.1.9)  and clicked Media > Streaming… I clicked on the Network tab and entered http://localhost:8902. (The 8902 port can be configured in the SopCast Player Edit > Preferences > Out-bound Port.) Clicking “Stream” brought me to a Stream Output wizard. I selected a File to stream to an MP4 and checked the Display Locally check box so I could check in on the game here and there. Then I hit Stream.

I was then presented with a black box with the audio, but then I realized I had been doing all this from TightNVC viewer on my win 7 laptop. I walked over to the machine itself, and noticed it was playing video too!

Create a free website or blog at WordPress.com.