PDA

View Full Version : I broke ShoutCast somehow



Roy M. Silvernail
2005-07-15, 03:13
My fault, I'm sure. I was playing with installing slashcode, and it seems that
something in Bundle::Slash has frobbed perl. Now, when I try to use the
ShoutCast browser from either my SB1 or my SliMP3, the server dies in the midst
of 'Connecting to ShoutCast'. The error in the log isn't too helpful:

Not an ARRAY reference at /home/slimserver/Plugins/ShoutcastBrowser.pm line 384.

I had been using a SVN version from about mid-April, but I also tried installing
6.0.2 to a completely clean directory and running Bin/build-perl-modules.pl
(because the server complained about it and died right away). Still no joy.

d_info doesn't add anything clueful. Anyone have an idea which module(s) might
be responsible for this? I'm attaching Slash.pm, which lists the modules that
Bundle::Slash installs. Any hints will be appreciated. (I'm up way too late as
it is :) )
--
Roy M. Silvernail is roy (AT) rant-central (DOT) com, and you're not
"It's just this little chromium switch, here." - TFT
SpamAssassin->procmail->/dev/null->bliss
http://www.rant-central.com

mherger
2005-07-15, 03:17
> My fault, I'm sure. I was playing with installing slashcode, and it

Nope, ShoutCast's. They're somehow down, only deliver _one_ single stream.
And this one alone does not make an array...

KDF uploaded a patch to bugzilla:
http://bugs.slimdevices.com/show_bug.cgi?id=1822

It didn't make it into tonights build as we wanted to test it with
shoutcast back online.

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

chrisp810
2005-07-15, 08:23
> My fault, I'm sure. I was playing with installing slashcode, and it

Nope, ShoutCast's. They're somehow down, only deliver _one_ single stream.
And this one alone does not make an array...

KDF uploaded a patch to bugzilla:
http://bugs.slimdevices.com/show_bug.cgi?id=1822

It didn't make it into tonights build as we wanted to test it with
shoutcast back online.

This has been going on sporadically for a week or so now. I've got a SVN diff to fix this if KDF's patch doesn't work out. All I did was check the return val to see if it was an array and skip the loop if it isn't. The user can always refresh later when ShoutCast decides to respond properly. Not elegant, but avoids the crash. Let me know if you need it.

Chris

mherger
2005-07-15, 08:32
> This has been going on sporadically for a week or so now. I've got a
> SVN diff to fix this if KDF's patch doesn't work out. All I did was
> check the return val to see if it was an array and skip the loop if it
> isn't. The user can always refresh later when ShoutCast decides to
> respond properly. Not elegant, but avoids the crash. Let me know if
> you need it.

There's an easier fix: XML::Simple has a parameter to force return of an
array (see my latest patch). But we'd like to test it with Shoutcast
working before committing...

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

mherger
2005-07-15, 08:36
BTW: Shoutcast is back online. I'll commit in the patch anyway...

You lucky guys over there: most of you slept while they were down :-)

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

Roy M. Silvernail
2005-07-15, 08:40
Quoting Michael Herger <slim (AT) herger (DOT) net>:

> > My fault, I'm sure. I was playing with installing slashcode, and it
>
> Nope, ShoutCast's. They're somehow down, only deliver _one_ single stream.
> And this one alone does not make an array...

Well, that's what I get for pulling an all-nighter. :) Sure enough, it's back
to working now.

Thanks.

> KDF uploaded a patch to bugzilla:
> http://bugs.slimdevices.com/show_bug.cgi?id=1822
>
> It didn't make it into tonights build as we wanted to test it with
> shoutcast back online.

Noted. I'll update SVN later today and see how things go.
--
Roy M. Silvernail is roy (AT) rant-central (DOT) com, and you're not
"It's just this little chromium switch, here." - TFT
SpamAssassin->procmail->/dev/null->bliss
http://www.rant-central.com

mherger
2005-07-15, 08:49
>> It didn't make it into tonights build as we wanted to test it with
>> shoutcast back online.
>
> Noted. I'll update SVN later today and see how things go.

The fix is rather simple: around line 360 you'll have to add the parameter
"ForceArray" to the call to XMLin():

$data = eval { XML::Simple::XMLin($data, SuppressEmpty => '', ForceArray
=> ['entry']); };

The rest of the patch is cosmetics:
http://bugs.slimdevices.com/attachment.cgi?id=643&action=view

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

vidurapparao
2005-07-15, 09:22
Michael,

I made a change on the SqueezeNetwork version, but didn't port it back
to SlimServer. My change actually checked for the existence of an entry
array and failed otherwise (while your change will prevent the crash, it
will leave the Shoutcast list in its 1 element state). It also reduced
the length of the refresh interval if there was an error. I'll port the
change back shortly.

--Vidur

chrisp810
2005-07-15, 14:06
The fix is rather simple: around line 360 you'll have to add the parameter
"ForceArray" to the call to XMLin():

$data = eval { XML::Simple::XMLin($data, SuppressEmpty => '', ForceArray
=> ['entry']); };


There's a similar bug in the Live365 Plugin caused when people create stations with just a single song in their playlist. I'm a bit confused by the XML::Simple::XMLin syntax though. The call in ProtocolHandler.pm is:

eval '$nowPlaying = XMLin( $playlist, ForceContent => 1 )';
and $nowPlaying->{PlaylistEntry} is not coming back as an array. What should I pass to the ForceArray param to force it to always return an array for that one particular subitem? Right now, I just check ref($nowPlaying->{PlaylistEntry}) to see if it is an array.

Thanks,
Chris

mherger
2005-07-15, 15:53
> eval '$nowPlaying = XMLin( $playlist, ForceContent => 1 )';
> and $nowPlaying->{PlaylistEntry} is not coming back as an array. What
> should I pass to the ForceArray param to force it to always return an
> array for that one particular subitem? Right now, I just check
> ref($nowPlaying->{PlaylistEntry}) to see if it is an array.

First I spit out the correct value using:

use Data::Dumper;
print Dumper($myValue);

I then did the same to see the bad data structure. Compare these two to
see where they differ.

You then pass the element's name, which you want to have in the array, in
a reference to an array (if I got that right... I'm better in
copying/pasting than in really understanding what I'm doing :-)). I
therefore added a "ForceArray => [ 'elementName' ].

See
http://search.cpan.org/dist/XML-Simple/lib/XML/Simple.pm#ForceArray_=>_[_names_]_#_in_-_important
for more infos.

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

mherger
2005-07-15, 16:14
> I made a change on the SqueezeNetwork version, but didn't port it back
> to SlimServer. My change actually checked for the existence of an entry
> array and failed otherwise (while your change will prevent the crash, it
> will leave the Shoutcast list in its 1 element state).

You prefer to have nothing, than to have one single stream? Do you really
think I'd ever have listened to that polish channel they left if I wasn't
forced to? :-)

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

vidurapparao
2005-07-15, 16:24
Michael Herger wrote:

> You prefer to have nothing, than to have one single stream? Do you
> really think I'd ever have listened to that polish channel they left
> if I wasn't forced to? :-)
>
I prefer to have nothing and an immediate retry the next time I try to
browse into the plugin. Seems better than being stuck with just the
Polish station for a day, no? :-)