danielvijge / SqueezeCloud

SoundCloud plugin for Squeezebox
GNU General Public License v2.0
26 stars 11 forks source link

SoundCloud V0.10.0 not Playing on Logitech Media Server V7.9.4 #30

Closed mcattini closed 2 years ago

mcattini commented 4 years ago

Hi Daniel

I'm having problems with both the Mixcloud and Soundcloud plugins not playing streams. They both search and find trcaks but won't play the streams. Below is an excerpt from my LMS log from when I tried to play a stream. I opend a similar issue in the you Mixcloud repro:

[20-09-22 18:36:16.2718] Slim::Player::Song::open (472) Warning: stream failed to open [soundcloud://840285352]. [20-09-22 18:36:28.1691] Slim::Player::Song::open (472) Warning: stream failed to open [soundcloud://840285352]. [20-09-22 22:17:36.3494] Slim::Player::Song::open (472) Warning: stream failed to open [soundcloud://22820004]

Do you have any suggestions as to what could be causing this? and is there anything I need to do with my configuration to sort it out? The other plugins I use (BBC IPlayer, Spotty and BandCampOut) work fine.

Kind regards

Marc

SpruceGoose7 commented 4 years ago

I seem to have the same problem. I have connected my accounts just fine for Mixcloud and Soundcloud so I can find all my tracks and search for others etc. But The songs never play. I'm running LMS server on my windows computer and playing with Picore on a RasberryPI4. Everything was installed around a month ago so I should be using the latest(or close to) versions. I can also use Spotty just fine.

HebrewzHammer commented 3 years ago

Same problem here.

I've tried some debugging but can't figure out what's wrong.

pupvogel commented 3 years ago

Hi guys, did anyone figure out how to make this work ? I am trying to stream Soundcloud from my LMS on a Windows 10 machine, but having the same problems. Do I need to install SSL for Perl on a Windows-system, too ? If so, how !? Any help greatly appreciated ! 8o)

HebrewzHammer commented 3 years ago

Nope, still has the same problem. I'm running LMS v8.1.2 and v0.11 of the plugin now.

Any chance someone has looked into this? I've tried but have reached the limit of my skills in this area.

You shouldn't have to manually install anything else.

HebrewzHammer commented 3 years ago

Tried some more digging and found these errors in the debug logs:

[21-05-08 15:34:51.6747] Slim::Player::Protocols::HTTP::canSeekError (959) bitrate unknown for: soundcloud://220141654
[21-05-08 15:34:51.6751] Slim::Player::TranscodingHelper::enabledFormat (231) Checking to see if mp3-mp3-*-* is enabled
[21-05-08 15:34:51.6753] Slim::Player::TranscodingHelper::checkBin (264) Checking formats for: mp3-mp3-*-*
[21-05-08 15:34:51.6754] Slim::Player::TranscodingHelper::enabledFormat (231) Checking to see if mp3-mp3-*-* is enabled
[21-05-08 15:34:51.6755] Slim::Player::TranscodingHelper::checkBin (272)    enabled
[21-05-08 15:34:51.6756] Slim::Player::TranscodingHelper::checkBin (274)   Found command: -
[21-05-08 15:34:51.6757] Slim::Player::TranscodingHelper::getConvertCommand2 (404) Rejecting - because no available stream mode supported: R
[21-05-08 15:34:51.6759] Slim::Player::TranscodingHelper::checkBin (264) Checking formats for: mp3-mp3-transcode-*
[21-05-08 15:34:51.6759] Slim::Player::TranscodingHelper::enabledFormat (231) Checking to see if mp3-mp3-transcode-* is enabled
[21-05-08 15:34:51.6760] Slim::Player::TranscodingHelper::checkBin (272)    enabled
[21-05-08 15:34:51.6761] Slim::Player::TranscodingHelper::checkBin (274)   Found command: [lame] --silent -q $QUALITY$ $BITRATE$ $RESAMPLE$ --mp3input $FILE$ -
[21-05-08 15:34:51.7346] Slim::Player::TranscodingHelper::getConvertCommand2 (404) Rejecting [lame] --silent -q $QUALITY$ $BITRATE$ $RESAMPLE$ --mp3input $FILE$ - because no available stream mode supported: R
[21-05-08 15:34:51.7347] Slim::Player::TranscodingHelper::getConvertCommand2 (485) Error: Didn't find any command matches for type: mp3

So maybe the bit-rate isn't being set correctly for a stream? I've tried messing around with the code a bit, but no luck. :/

HebrewzHammer commented 3 years ago

I think I just found a fix!

So I don't know if this is the "correct" way to fix the problem, but it seems like the plugin was incorrectly setting a song's streamUrl for some reason.

Anyway, in ProtocolHandler.pm on line 147 change $song->streamUrl($redirector); to $song->streamUrl($stream);

Again, this is a quick and dirty way to get it to start working again. It may not work in all cases.

pupvogel commented 3 years ago

Whoa - I just tried that out, but somehow this setting will crash my server as soon as I start streaming..!? I can't connect to it anymore until I reboot the whole system... 8o§

pupvogel commented 3 years ago

Ok, some more info: Streaming WORKS, when I play on my software player, SqueezeElite-X. The server CRASHES, when I try to play on my Squeezebox Classic, getting this log output (first two lines are streaming to SqueezeElite-X, the rest happens after trying to stream on Squeezebox Classic: Plugins::SqueezeCloud::ProtocolHandler::gotNextTrack (138) https://api.soundcloud.com/tracks/1035193807/stream?client_id=112d35211af80d72c8ff470ab66400d8 Plugins::SqueezeCloud::ProtocolHandler::gotNextTrack (153) setting soundcloud_meta_1035193807 Slim::Player::Song::open (415) Error: Couldn't create command line for mp3 playback for [soundcloud://1035193807] Plugins::MixCloud::Plugin::__ANON__ (150) Fetching https://api.mixcloud.com/me/?offset=0&limit=500&&access_token=<myToken 8o)> Plugins::MixCloud::Plugin::__ANON__ (150) Fetching https://api.mixcloud.com/me/?offset=0&limit=1&&access_token=<myToken 8o)> Plugins::MixCloud::Plugin::__ANON__ (150) Fetching http://api.mixcloud.com/pupvogel/following?offset=0&limit=500& Plugins::MixCloud::Plugin::__ANON__ (150) Fetching https://api.mixcloud.com/me/?offset=0&limit=1&&access_token=<myToken 8o)> Plugins::MixCloud::Plugin::__ANON__ (150) Fetching http://api.mixcloud.com/pupvogel/following?offset=0&limit=1& Plugins::MixCloud::Plugin::__ANON__ (150) Fetching http://api.mixcloud.com/michiwoky/?offset=0&limit=500& Plugins::MixCloud::Plugin::__ANON__ (150) Fetching https://api.mixcloud.com/me/?offset=0&limit=1&&access_token=<myToken 8o)> Plugins::MixCloud::Plugin::__ANON__ (150) Fetching http://api.mixcloud.com/pupvogel/following?offset=0&limit=1& Plugins::MixCloud::Plugin::__ANON__ (150) Fetching http://api.mixcloud.com/michiwoky/?offset=2&limit=1& Plugins::MixCloud::Plugin::__ANON__ (150) Fetching http://api.mixcloud.com/michiwoky/cloudcasts?offset=0&limit=500& Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 2 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 2 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 2 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 2 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 2 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 2 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 2 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 4 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 1 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 3 total: 501 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 20 total: 700 Plugins::SqueezeCloud::Plugin::__ANON__ (483) this page: 10 total: 700 Plugins::SqueezeCloud::ProtocolHandler::gotNextTrack (138) https://api.soundcloud.com/tracks/1020522061/stream?client_id=112d35211af80d72c8ff470ab66400d8 Plugins::SqueezeCloud::ProtocolHandler::gotNextTrack (153) setting soundcloud_meta_1020522061 Plugins::SqueezeCloud::ProtocolHandler::new (205) Remote streaming Soundcloud track: https://api.soundcloud.com/tracks/1020522061/stream?client_id=112d35211af80d72c8ff470ab66400d8 Plugins::SqueezeCloud::ProtocolHandler::new (205) Remote streaming Soundcloud track: https://api.soundcloud.com/tracks/1020522061/stream?client_id=112d35211af80d72c8ff470ab66400d8 --- last line repeating infinitely ---

HebrewzHammer commented 3 years ago

Weird. Yeah, I was worried that my "fix" wouldn't work in all instances. I only run software players. I don't do any dev on Squeezebox or anything, and I don't fully understand how this plugin system works. So I'm sort of doing things blindly here.

I'm wondering what's causing the difference between a software player and hardware? 🤔

It looks like the line of code my "fix" modifies is expecting the http(s) request to return a redirection url. When playing with the code before, I saw that the redirection variable it uses is blank for me. So my "fix" just uses the stream url the http(s) request returns, which fixes the problem for me.

So, I'm thinking your problem may be that your hardware player is actually getting a redirection url instead of the actual url, for some reason. Because if that's the case, then my "fix" would probably cause an infinite loop of http(s) requests, which it looks like might be happening based on your logs. If so though, I'm not really sure why the hardware player would get a redirection url, and a software player would not 😕. Is your hardware player running the same version of LMS and the SoundCoud plugin as your software player? (I'm not even sure that's a valid question honestly, since I don't know what your setup is like or how software/hardware players work/interact).

If my assumptions are correct, we could try making my "fix" work in both instances by using the redirection url if it exists, else use the url returned. To do this, try changing line 147 of ProtocolHandler.pm to $song->streamUrl($redirector || $stream);.

Also, it'd help if you turn logging for the SoundCloud plugin to debug. You can also add the following lines right before line 147 to see what the values of the variables actually are:

 $log->debug("redirector: ". $redirector);
 $log->debug("stream: ". $stream);
pupvogel commented 3 years ago

No worries, I'm really happy you give this a try, otherwise I'd be quite alone with my problem 8o)

Ok, I did exactly as you said, but unfortunately streaming to the hardware player will still hang the server:

Plugins::SqueezeCloud::ProtocolHandler::getNextTrack (191) Getting track from soundcloud for 1044553660 Plugins::SqueezeCloud::ProtocolHandler::gotNextTrack (138) https://api.soundcloud.com/tracks/1044553660/stream?client_id=112d35211af80d72c8ff470ab66400d8 Plugins::SqueezeCloud::ProtocolHandler::gotNextTrack (147) redirector: Plugins::SqueezeCloud::ProtocolHandler::gotNextTrack (148) stream: https://api.soundcloud.com/tracks/1044553660/stream?client_id=112d35211af80d72c8ff470ab66400d8 Plugins::SqueezeCloud::ProtocolHandler::gotNextTrack (155) setting soundcloud_meta_1044553660 Plugins::SqueezeCloud::ProtocolHandler::new (207) Remote streaming Soundcloud track: https://api.soundcloud.com/tracks/1044553660/stream?client_id=112d35211af80d72c8ff470ab66400d8 Plugins::SqueezeCloud::ProtocolHandler::new (207) Remote streaming Soundcloud track: https://api.soundcloud.com/tracks/1044553660/stream?client_id=112d35211af80d72c8ff470ab66400d8 Plugins::SqueezeCloud::ProtocolHandler::new (207) Remote streaming Soundcloud track: https://api.soundcloud.com/tracks/1044553660/stream?client_id=112d35211af80d72c8ff470ab66400d8 ...and so on...

So $redirector seems to be blank for the hardware player too, Of course both players, hardware and software, use the same server, so it's also the same plugin.

So...why this loop...I'll try to deactive my other plugins and check...

pupvogel commented 3 years ago

Well, it's not the other plugins... same problem when this one is alone... 8o(

HebrewzHammer commented 3 years ago

Huh, I'm not sure why the change is working for me but not for you.

And looking into it more I find that the url the http(s) request uses actually does return a redirection code (302) with a valid location header to the actual stream (via Chrome). So now I'm not even sure why the current plugin code isn't working but my fix is. So confused. 😖

pupvogel commented 3 years ago

It's really strange - but your fix is working for me too, as long as I only use the software player. Really don't know what the hardware player (Squeeze Classic) does differently to cause that loop... 🤔

pupvogel commented 3 years ago

I dug out a Squeezebox Boom, and get the same problem on that one. When I check the ProtocolHandler.pm a bit further down, around line 207, I find stuff that deals with remote streaming. I used some commenting to find out where exactly the loop happens, and it happens in this thing:

my $sock = $class->SUPER::new( { url => $streamUrl, song => $song, client => $client, } ) || return;

The next line will not be hit, so it looks like this doesn't work and returns... For $song I get Slim::Player::Song=ARRAY(0xc4346cc) For $client I get Slim::Player::Boom=ARRAY(0xb924474)

pupvogel commented 3 years ago

...and it's not because of that extra-comma, I just checked... 8o)

danielvijge commented 3 years ago

It's difficult to test and support all kinds of different players. For me, on v0.11 it is still playing correctly (with a Squeezebox Touch). The plugin could do with a rewrite, like philippe44 just did for the MixCloud plugin. His changes removed a lot of specific code to make use of features that are now available in LMS 8.1+. However, at the moment I don't have to time to do it myself. If anyone want to help, I'd be more than happy to review and push pull requests. The MixCloud and SqueezeCloud are similar. Squeezecloud should actually be a bit simpler, because it doesn't need an external site to get the media URL, but can just use the API directly.

pupvogel commented 3 years ago

...at least I can confirm that the Mixcloud-plugin works in all my players since the recent changes - so philippe44 's rewrite was definitely a success ! 8o)

mcattini commented 3 years ago

Hi

I’ve just cloned this myself now. I’ll have a look at it over the weekend, but do not have much spare time with work and family commitments. Not used Perl before so it should be fu. In the meantime if anyone has suggestions where to look in the code for the problem, that would help. I use SqueezeBox Duets throughout my home and run LMS on my Windows 10 laptop.

Kind regards

Marc Cattini

From: pupvogel @.> Sent: 18 May 2021 08:53 To: danielvijge/SqueezeCloud @.> Cc: mcattini @.>; Author @.> Subject: Re: [danielvijge/SqueezeCloud] SoundCloud V0.10.0 not Playing on Logitech Media Server V7.9.4 (#30)

...at least I can confirm that the Mixcloud-plugin works in all my players since the recent changes - so philippe44 's rewrite was definitely a success ! 8o)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/danielvijge/SqueezeCloud/issues/30#issuecomment-842943593 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ADT2EV2RTKKSEHIHPM25ST3TOIMGXANCNFSM4RWKSKVA . https://github.com/notifications/beacon/ADT2EV4MSYXHJQWXOXXNMJTTOIMGXA5CNFSM4RWKSKVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGI7EY2I.gif

kwarklabs commented 2 years ago

@mcattini @SpruceGoose7 @HebrewzHammer is this still an issue after updating the SoundCloud plugin to v0.14 released two weeks ago?

kwarklabs commented 2 years ago

No reply. Closing.