Page 1 of 2

Pidora: My Pandora radio

Posted: Fri Oct 26, 2012 6:52 am
by jacroe
This isn't nearly as neat or cool as some of the other projects being shown in this forum, but I figure I'll show what I've thrown together.

Pidora uses pianobar and a small PHP web app to play music from a Pandora radio station over HDMI (since we have that analog audio bug I couldn't make it headless yet). Basically you give it internet, a tv or monitor, and power and you'll have Pandora music being played with a minimal display showing the current track's information and albumart. Really simple but I'm proud of it. I'd like to know what you think.

Here's a screenshot and I've put my code up on Github

Re: Pidora: My Pandora radio

Posted: Sun Nov 18, 2012 6:22 pm
by bababooey
Thanks! Was able to get it working in a few minutes.

I'm playing the toddlers station in pandora, have wifi connect to the PI and some cheap speakers to play songs in the babys room headless. You mention audio problems and using HDMI but I'm using the 3.5mm jack out and some speakers.

It would be cool to be able to start/stop pianobar as well as change stations from the web GUI.

OUT.

Re: Pidora: My Pandora radio

Posted: Mon Nov 19, 2012 2:56 am
by jacroe
Wow, I'm so glad you were able to use it, and for your baby no less. That's incredible. Oh I totally wanted it to be headless from the get-go, and I'm so excited that you're able to get it working with analog audio without any hitches. Awesome!

If you did follow all the instructions and have the webserver set up, you can go to it's IP address and see what's playing in real-time. And then, if you tack on "api.php?control=[Command]" to the end of the URL, you'll be able to control it that way. For example: "p" plays and pauses the music, "n" goes to the next song, "q" quits pianobar, etc. You can look in the man file for pianobar for all the commands. Eventually, I'll want to add a way to do this other than access that URL manually.

Another option would be SSH'ing into the box, killing pianobar and then re-executing it. Then you'll be able to control and see all the log information coming from pianobar. If I'm feeling picky at work, I'll use this method.

Re: Pidora: My Pandora radio

Posted: Mon Nov 19, 2012 4:39 pm
by bababooey
Yeah the webpage works, I can see who is playing currently. Thanks for the command info, I'll give that a shot.

Ideally I would like to have a web GUI to control the headless pandora box, simple enough my wife can operate with her smart phone or laptop without having to know ssh etc..

I've searched around a bit and Pidora and Pianobar is about all I could find. Are there any other apps I should take a look at?

Thanks.

Re: Pidora: My Pandora radio

Posted: Mon Nov 19, 2012 9:45 pm
by jacroe
If you'll give me some time, I can easily add controls. That's something I wanted to do anyway. What all do you need? Play/Pause, Next, Thumbs Up and Down, Tired. What else?

I'll be getting out of university for Thanksgiving on Wednesday. I should be able to build it in then.

Re: Pidora: My Pandora radio

Posted: Tue Nov 20, 2012 8:19 pm
by ski522
Nice little app, controls would be great! What you listed as controls are pretty much what is needed, maybe the ability to change a station.

Re: Pidora: My Pandora radio

Posted: Wed Nov 21, 2012 12:57 am
by Boomer
Can you help the computer-challenged by giving us instructions how to download and install the program?

Thanks,

Jack

Re: Pidora: My Pandora radio

Posted: Sat Nov 24, 2012 4:33 am
by jacroe
ski522 wrote:Nice little app, controls would be great! What you listed as controls are pretty much what is needed, maybe the ability to change a station.
I'm currently working on the controls right now. The back-end is finished, but I'm still deciding how I want to have them be displayed, trying to figure out how to make them appear only when needed. Easy with a mouse, slightly harder on touch devices.
Boomer wrote:Can you help the computer-challenged by giving us instructions how to download and install the program?
Sure. You'll need to be comfortable with the command-line, but if you are it's real easy. You can get the code from Github (https://github.com/jacroe/pidora/), and then all you have to do is follow the README. The easiest way I've found to download it is to install git on the Pi and then

Code: Select all

git clone git://github.com/jacroe/pidora.git
into the web-server's directory.

Re: Pidora: My Pandora radio

Posted: Sat Nov 24, 2012 11:27 am
by ski522
jacroe wrote: I'm currently working on the controls right now. The back-end is finished, but I'm still deciding how I want to have them be displayed, trying to figure out how to make them appear only when needed. Easy with a mouse, slightly harder on touch devices.
I was working on modifying this app to be used with Pianobar, it's a front end for mplayer. Might provide some help.
http://sourceforge.net/projects/mywebplayer/

Re: Pidora: My Pandora radio

Posted: Sat Dec 01, 2012 12:46 pm
by ski522
Curious to know if you got an further along?

Re: Pidora: My Pandora radio

Posted: Tue Dec 04, 2012 8:38 am
by jacroe
I took a look at MyWebPlayer and creating sockets seems to be a little bit of overkill. We already use a FIFO with PHP's file_put_contents. And running another program (albeit a shell script) could turn into another point of failure if you use the controls religiously.

That said, the general concept and feel of the program is great. Since his stuff is all GPL'd, I'll probably copy his icons and create a small mobile page to use. So thanks for that; I've been looking for some icon images.

I've also added keyboard shortcuts to the main interface in addition to the controls at the top right.. You can now [p]ause, go to the [n]ext song, [l]ove it, an it, or say that you're [t]ired of it. I find it useful to be able to Alt-Tab over the interface and then press a key instead of using a mouse.

Re: Pidora: My Pandora radio

Posted: Mon Dec 10, 2012 10:30 pm
by jjj
Thanks You for your work,
I have your app working nicely. I noticed that on your github page you recently added mousetrap.js. I haven't figured out how to use this. I'm not sure if this is keyboard shortcut for the keyboard attached to the pi, or the computer of the browser connecting. Could you please add instructions? Thanks again

Re: Pidora: My Pandora radio

Posted: Tue Dec 11, 2012 3:02 am
by jacroe
jjj wrote:I noticed that on your github page you recently added mousetrap.js. I haven't figured out how to use this. I'm not sure if this is keyboard shortcut for the keyboard attached to the pi, or the computer of the browser connecting. Could you please add instructions? Thanks again
Yeah no problem. So Mousetrap is a client-side program that makes it ridiculously easy to assign keyboard shortcuts to Javascript functions. So for instance, you can press the "p" key to pause it. Or press "b" to ban the song.

You'll want to do this on the computer that you're viewing the website on. For instance, if you have Pidora playing on a media centre and you're viewing the website on your laptop, you'll control it via your laptop. And if you look above at my previous post, you'll see the five commands that I currently have in it. I hope that explains it enough for you.

Re: Pidora: My Pandora radio

Posted: Fri Dec 14, 2012 1:32 am
by jacroe
bababooey wrote:Ideally I would like to have a web GUI to control the headless pandora box, simple enough my wife can operate with her smart phone or laptop without having to know ssh etc..
ski522 wrote:Curious to know if you got an further along?
Now that I'm out for Christmas break I've been able to finish building the controls.

If you get the latest from the repo, I've added a slim mobile interface. Purely textual. It should work fine on any device, including mobile phones. I've also made the links for controlling the main interface less hidden; they're now on permanent display. Let me know if this covers everything you need.

Next, I'll be working on being able to change stations.

Re: Pidora: My Pandora radio

Posted: Wed Dec 26, 2012 4:50 pm
by ski522
Just want to say thanks, great little app! Just got a chance to take a look at it again over the holidays!

Re: Pidora: My Pandora radio

Posted: Wed Jan 30, 2013 4:31 am
by compuguy
Just got this working on my RasPi, but I'm having one issue with it. After pushing like it outputs this error: "Warning: unlink(msg): Permission denied in /home/pi/www/pidora/api.php on line 25". Any idea why this occurs? Everything else seems to work but this...

Edit: Found out that this was a permission based issue, and that it wanted write access in order to write and delete a file in the directory. What would be a great addition would be the ability to start or stop pianobar.

Re: Pidora: My Pandora radio

Posted: Thu Feb 14, 2013 8:38 am
by jacroe
New feature: Song Explanations. By pressing "e" on the keyboard, we'll display the song's features as identified by the Music Genome Project. I'll be working on station changing next. If you want more features, submit a feature request at GitHub. https://github.com/jacroe/pidora

Thank y'all for your continuing interest; it's absolutely awesome that someone else found this little script useful.

Re: Pidora: My Pandora radio

Posted: Thu Feb 14, 2013 8:45 am
by jacroe
compuguy wrote:What would be a great addition would be the ability to start or stop pianobar.
That's definitely in the works. Until then though, pausing it is just as effective. And if it stays paused for long enough, on unpause pianobar will dump the old playlist and start playing a new one due to a timeout.

But yes, stopping/restarting pianobar (and perhaps other musical services) is planned.

Re: Pidora: My Pandora radio

Posted: Thu Feb 21, 2013 12:30 am
by jacroe
You can now change the station via the web interface. Pressing "s" or clicking "Station" will give you a list of your stations and by clicking or keypressing will change it. Enjoy.

Re: Pidora: My Pandora radio

Posted: Thu Mar 21, 2013 8:24 pm
by morbidpete
Thanks for this!
This was my first attempt at doing anything with a Rpi. Granted it took me 7.5 hours to get it going. Its going. We are now ordering 23 pi's for all our locations! to be able to control the music from the main office.

Now I just need to figure out the audio pops while using the analog out :-(

Re: Pidora: My Pandora radio

Posted: Thu Mar 21, 2013 10:52 pm
by ski522
morbidpete wrote:Thanks for this!
This was my first attempt at doing anything with a Rpi. Granted it took me 7.5 hours to get it going. Its going. We are now ordering 23 pi's for all our locations! to be able to control the music from the main office.

Now I just need to figure out the audio pops while using the analog out :-(
This is a problem with the sound driver itself, make sure you're up to date with the latest firmware, otherwise USB soundcard will solve the popping problem.

Re: Pidora: My Pandora radio

Posted: Fri Mar 22, 2013 2:24 am
by jacroe
morbidpete wrote:We are now ordering 23 pi's for all our locations! to be able to control the music from the main office.
...I'm speechless. That's incredible. Dude, you've got to let me know how that turns out. :D

Re: Pidora: My Pandora radio

Posted: Mon Mar 25, 2013 3:20 pm
by morbidpete
jacroe wrote:
morbidpete wrote:We are now ordering 23 pi's for all our locations! to be able to control the music from the main office.
...I'm speechless. That's incredible. Dude, you've got to let me know how that turns out. :D
will do, The boss is very impressed with the stability and web controls as basic as they are. But basic is good for him. I had a 3 day drill weekend and came back today to find it still going strong. No outages or issues reported.

oddly enough, Cant hear the pop between songs. The amp must be filtering it 8-)

Re: Pidora: My Pandora radio

Posted: Thu Mar 28, 2013 12:20 am
by jacroe
A small, but cool (or, I think it is) update: Pidora will now play NPR's Daily News Summary as it becomes available each hour. This turns Pidora from simply being a Pandora client to being a more modern radio. After the 5 minute broadcast, the music comes right back. If you wish to update your installation, install the packages "python-feedparser" and "mpg123" from the repo, and overwrite update.py.

There's also the ability to quit from the web interface by pressing "q". This also clears all the cached albumart to free up space.

Re: Pidora: My Pandora radio

Posted: Fri Mar 29, 2013 1:45 pm
by morbidpete
jacroe wrote:A small, but cool (or, I think it is) update: Pidora will now play NPR's Daily News Summary as it becomes available each hour. This turns Pidora from simply being a Pandora client to being a more modern radio. After the 5 minute broadcast, the music comes right back. If you wish to update your installation, install the packages "python-feedparser" and "mpg123" from the repo, and overwrite update.py.

There's also the ability to quit from the web interface by pressing "q". This also clears all the cached albumart to free up space.
can we restart it after we use "q" to quit? I noticed the only way to get new stations to show in the list is to restart the service