[PLUGIN] Pandora Plugin 2.0

did you ever check this out?
https://developer.pandora.com/partners/join/
just curious?

I haven’t specifically responded to this - but I am having issues with no known cause or resolution, just Error then it works…

@downtownHippie: can you be more specific about your error?

Does playback stop, and you have to manually select a track to continue? Do you have the index.js from my GitHub (replacing the 2.3.0 one)? If not, try it out. I haven’t filed a new pull request and that “fix” isn’t reflected in the version available from the Plugin menu.

Unfortunately, when that error occurs (trying to access an URL), the mpd plugin throws a red error toast. I might have to verify the viability of each URL. That could be an issue but maybe there is a quick way. I have not seen this happen since yesterday, but yesterday was shot as far as working on this plugin went.

The plugin adds track data objects directly to the Volumio Queue as I fetch them. It gets a playlist from the server and I put a timestamp tag on each one. The old ones expire after (about) 45 minutes and they are removed. The expiration function runs about every 5 minutes or so, depending. It should get them all.

What I saw yesterday was a bad track, and playback stopped. I had to restart playback. Things went along, I turned it off, had lunch, and then I (and everyone else) couldn’t use the plugin until yesterday evening for whatever reason.

It may have to do with deleting tracks from the queue and choosing another track. I may have a mistake in there.

If it’s something else, I’ll have to address that. I’m going to be away for about a week but it’s a vacation. I’ll have my laptop and a couple of Raspberry Pis to work with. My niece and nephew will be around for part of the time. Hopefully, they won’t throw my gear into the bathtub.

One thing that could go wrong: We rented this place before and the Internet was pretty spotty, going off and on every few hours. So there’s that.

But to anyone else watching: You can just grab the current index.js file from my GitHub and replace the one that’s there now. You can’t break it – you can just uninstall it and reinstall the plugin again if you want. The path to the file in Volumio is /data/plugins/music_service/pandora/index.js The change is very small.

I’ve never had playback stop - I just get the red Error flag in Volumio when I go to start. I usually have an empty queue and am opening the plugin from Home and selecting a station. I should have nothing in queue…

It’s been Error-ing out for most of Saturday Aug08 PM Texas time.

still error flag Sunday Morning.

So far I’ve tested on a Pi 2B / 3B+ with an iQAudio DAC Plus and a 4B (The sound card should be irrelevant – the plugin just outputs the sound and mpd handles the output). I have not had any errors like that on startup unless there was a misconfiguration. I’ve been playing tunes for about 3 hours today on the 3B+.

IDEA: Do you have a band filter enabled? I hope it looks like this:

Cyndi Lauper%Madonna%Phil Collins%Death Cab for Cutie

The sting is parsed on the % character with bandFilter.split(’%’) It seems pretty robust but I haven’t actively tried to break it (yet).

A blank field was thowing an error for a while. I fixed that but it’s not in 2.3.0 I don’t think, and it would only fire off at initial installation (I think), not after that.

So I have a few questions:

  • Please tell me the content of the red error toast message. If I wrote the message, I can track it down. Otherwise, I’ll look in the dependencies. I know it happens fast but since it’s popping up a lot, you can give me a general idea of what it says.
  • What hardware are you running Volumio on? Pi1B, Pi1B+, Pi Zero (W), Pi 2B, Pi 3, Pi 3B+, Pi 4B, x86, x86_64 (if either of those last two, tell me the processor or make and model of machine so I get an idea), Odroid such and such, something else?

That’s all I can think of right now.

voluError

It’s still happening. I have a 3b+ fwiw.

I just disabled the plugin and re-enabled it. Got a successful login and it works now. I tried that the other day, it took a reboot to get the Pandora Browser button to show back up, and it was still not working then (I did get a successful login that time as well).

Death Cab has the coolest name for a band ever! I just want to get rid of Hammer Time! F that song.

and Volu says I have v2.3.0, I upgraded a source install via the UI a few days ago.

side question, Volumio used to show history from the stream…or am I hallucinating?

@downtownHippie: Okay. That happens when a menu is added to Volumio. It’s either:

  • the list of Pandora stations, or
  • the list of Pandora songs (usually four) (probably not)

Since it’s happening right after you start the plugin, it is most likely the first one. When the plugin first starts, it logs in and then grabs the station list with the authorization information.

Do you have a really fast internet connection? If you’re connecting over wireless to your network, I’d say that’s not the issue since wireless is much slower than Ethernet. But maybe I could introduce a slight delay of a few seconds between login and station list retrieval.

I’m not sure why you’re not getting the station list. That’s always worked for me. That’s even done over http versus https (playlist retrieval is https). I’ll have to give you a modified index.js that has more debugging in it. I wonder if you even log in. If you log in, it returns the credentials and gets they playlist. And I wonder why it doesn’t always fail. The thing is, that’s not really my code at all. I just call it with the username and password, that’s it.

Over the past few days, I made a fork of anesidora and put in some changes. For one thing, the original version only uses the main server, and I’m not sure, but I think that Pandora One users use a different one. I don’t have Pandora One and I don’t need it, but maybe I can get a brief trial and poke around a bit.

Anyway, my fork makes that small change, as well as returning Promises instead of callbacks, but it’s not ready for prime-time yet. I’m not certain it will handle an error gracefully. There are some nested calls in the code and I think I got it right but I haven’t tested it yet. My niece and nephew are here during the day and they are 3.5 and 2, so it’s a madhouse.

So I’m rambling. I just pushed v2.3.2 to GitHub on my fork. You can clone it and do a volumio plugin update from the pandora directory and it will put you on current master. I filed a pull request so hopefully it will be up in the new few days. I doubt it will fix your main issue but it addresses a couple of mistakes.

I have a station list when I get the red flag, I can’t go past there.

my rPi is wired, my local internet connection isn’t great but it’s not dial-up either…we stream TV/netflix w/o issue.

just following up, I’ve never had it die on me. When I try to use the plugin for the first time in “awhile” I get the station list but can’t open a station and get 4 songs. That’s when I get the red error flag. Is there any other debugging files on the pi I can look in when that happens?

Well, you can run journalctl -f in another ssh window when you start Volumio. Or, when that flag pops up, stop the plugin in the Volumio plugins menu (you don’t have to uninstall it), and in an ssh terminal:

To return all system messages since the last reboot:

journalctl -b --no-pager > /home/volumio/volumio.log
gzip volumio.log

Then you can send it to me here in a personal message. There is an upload file icon in the message editor. I wouldn’t post it in this thread.

Lately, I haven’t had a problems getting songs from a station. This has only happened to me when I’ve been testing my alpha version of anesidora (which only I have), and it was when I had a problem creating the request URLs (I was not escaping some of the characters of the authorization codes – this works fine in the stock anesidora code).

The delay I mentioned probably won’t work as there has to be a second or two between the station list download and the time when you click the station for a song list request.

One more thing: Is it a particular station/band that is giving you trouble? Maybe there is a character in one of the fields that is crashing the Volumio menu.

If it is a particular station, there might be a way to share the station with me on the Pandora website.

I should know a little more when I’ve seen your Volumio log.

$ journalctl -f
– Logs begin at Fri 2020-08-07 01:27:40 UTC. –
Aug 08 06:50:20 dhvani systemd[29690]: Starting Sockets.
Aug 08 06:50:20 dhvani systemd[29690]: Reached target Sockets.
Aug 08 06:50:20 dhvani systemd[29690]: Starting Basic System.
Aug 08 06:50:20 dhvani systemd[29690]: Reached target Basic System.
Aug 08 06:50:20 dhvani systemd[29690]: Starting Default.
Aug 08 06:50:20 dhvani systemd[29690]: Reached target Default.
Aug 08 06:50:20 dhvani systemd[29690]: Startup finished in 50ms.
Aug 08 06:50:20 dhvani systemd[1]: Started User Manager for UID 1000.
Aug 08 06:50:20 dhvani sshd[29686]: lastlog_openseek: Couldn’t stat /var/log/lastlog: No such file or directory
Aug 08 06:50:20 dhvani sshd[29686]: lastlog_openseek: Couldn’t stat /var/log/lastlog: No such file or directory
Aug 08 06:50:59 dhvani volumio[994]: info: [1596869459252] ControllerPandora::ExpireOldTracks::reaper
Aug 08 06:51:09 dhvani volumio[994]: info: CorePlayQueue::getQueue
Aug 08 06:51:09 dhvani volumio[994]: info: CorePlayQueue::getTrack 0
Aug 08 06:51:19 dhvani volumio[994]: info: CoreCommandRouter::executeOnPlugin: pandora , handleBrowseUri
Aug 08 06:51:19 dhvani volumio[994]: info: [1596869479377] ControllerPandora::handleBrowseUri
Aug 08 06:51:19 dhvani volumio[994]: info: [1596869479378] ControllerPandora::flushPandora
Aug 08 06:51:19 dhvani volumio[994]: info: CoreStateMachine::getQueue
Aug 08 06:51:19 dhvani volumio[994]: info: CorePlayQueue::getQueue
Aug 08 06:51:19 dhvani volumio[994]: info: CorePlayQueue::clearPlayQueue
Aug 08 06:51:19 dhvani volumio[994]: info: CorePlayQueue::saveQueue
Aug 08 06:51:19 dhvani volumio[994]: info: CoreCommandRouter::volumioPushState
Aug 08 06:51:19 dhvani volumio[994]: info: CoreCommandRouter::executeOnPlugin: volumiodiscovery , saveDeviceInfo
Aug 08 06:51:19 dhvani volumio[994]: info: CoreCommandRouter::volumioPushQueue
Aug 08 06:51:19 dhvani volumio[994]: info: CorePlayQueue::getQueue
Aug 08 06:51:19 dhvani volumio[994]: info: [1596869479418] ControllerPandora::PandoraHandler::fetchTracks
Aug 08 06:51:19 dhvani volumio[994]: info: [1596869479418] ControllerPandora::PandoraHandler::fetchTracks::fetchStationPlaylist
Aug 08 06:51:19 dhvani volumio[994]: error: [1596869479652] [Pandora] Error in PandoraHandler::fetchTracks::fetchStationPlaylist: Error: An unexpected error occurred [1001]
Aug 08 06:51:19 dhvani volumio[994]: error: [1596869479653] [Pandora] Error in PandoraHandler::fetchTracks::fillNewTracks: Error: [1596869479653] [Pandora] PandoraHandler::fetchTracks::fetchStationPlaylist
Aug 08 06:51:19 dhvani volumio[994]: error: Failed to execute browseSource: Error: [1596869479654] [Pandora] PandoraHandler::fetchTracks::fillNewTracks

So, I was playing pandora earlier. I went to work…now that I’m home I can’t get a station to load. The stations are listed in the pandora browse, but I can’t click on a station to get songs to load…feels like maybe the stations are expired. I went to Home and “re-opened” Pandora, this is what I got.

it’s not just one station, at this point all stations are saying the same thing. I am using Firefox as my browser.

ok - added a real song to the queue, played it, then went to browse, to pandora, clicked on a station and got the same error in the journal

Aug 08 07:30:26 dhvani volumio[994]: error: Failed to execute browseSource: Error: [1596871826374] [Pandora] PandoraHandler::fetchTracks::fillNewTracks

(yes, I’m aware my rPi thinks it’s 7:30am last Friday morning…)

…no, I never quit my browser, or logout…I reboot only when win10 holds a gun to my head…

That’s your issue right there. That is definitely it. The plugin needs the correct time to synchronize the authorization.

You should enable a time syncing service and make sure it’s working.

Try this: sudo timedatectl set-ntp true

That should do it. If not, just find some solution for syncing time on Debian Jessie 8.

Boom.

well, sorry for the issues…

My ntp server broke awhile back and I didn’t realize it until recently. I have a new rPi with GPS hat ready to go, just haven’t had a chance to spin it up. You’ve had some extra free time since the pandemic - I was declared essential (I’m a dishwasher, they furloughed half of my staff) so I’ve been super busy the last 6 months…I’ll get it spun up next week while I’m on vacation. I set the date and it’s working now, I’ll report back if I get that error again.

@downtownHippie: Hey no worries, man. I’m just glad it’s fixed now. That’s the way it goes with computers – they are a neverending problem. :slight_smile:

heh - 20 years in IT - I’m semi-retired now :- )

Version 2.3.4 is now available. You can update through the Plugins menu.

The biggest change is that the plugin handles a stream timeout when a track is paused for too long. Before, the track would timeout and playback would stop. Now, the plugin checks for a timeout after resuming from pause. It might take a minute or two to stop playing, and then the plugin advances to the next track to continue playback.

Other changes were minor, including fixing the format of an error logging function.

Future changes may include updating to my fork of anesidora. I have only done initial testing (with working credentials). I do not know how well my fork handles errors at this point so I don’t want to include it.

There is another API that has been worked out, but it seems to change a lot. It may or may not have more functionality. I think for now I’ll stick with the JSON interface as it’s been working for me for a couple of years, starting with v1.0.0.

That’s all for now. :slight_smile:

Stop in this thread and say “hi”. It’s nice to know that people are using the plugin!