Oderik / xbmc-somafm

SomaFM Plugin for Kodi
GNU General Public License v2.0
11 stars 6 forks source link

SomaFM Links #9

Open decantur opened 8 years ago

decantur commented 8 years ago

It appears that SomaFM has updated links to its servers. As a result the plug-in no longer works for any of the SomaFM stations.

Please see: http://somafm.com/ regarding the change.

Thanks,

MaximilianKindshofer commented 8 years ago

Yes - they broke the API somehow for their webplayer

the playlists are now called:

<fastpls format="mp3">http://somafm.com/7soul.pls</fastpls>
<fastpls format="aacp">http://somafm.com/7soul64.pls</fastpls>
<slowpls format="aacp">http://somafm.com/7soul32.pls</slowpls>

I can write a patch if I understand how his code works. Iam not sure if its in channel.py or in default.py where he gets the actual playlist.

Oderik commented 8 years ago

The add-on works just fine for me. It calls https://somafm.com/channels.xml and I just verified that the url works. That resource contains links as described by MaximilianKindshofer. So, to me it looks like everything works just as expected.

MaximilianKindshofer commented 8 years ago

It failes on me with "can't get next file to play from playlist" - I looked at the xml and your code as well as your blog and I think it should work. I also reinstalled the plugin. I think I will look into it tomorrow. Where can I get more logging infos from kodi in that regard?

decantur commented 8 years ago

This is the same error that I receive.

matthewn commented 8 years ago

I am also receiving the same error; can't get anything to play. :( Have reinstalled the plugin. Example of what appears in kodi.log when you select a station:

16:34:18 T:139906462504704  NOTICE: Thread LanguageInvoker start, auto delete: false
16:34:18 T:139906462504704  NOTICE: -->Python Interpreter Initialized<--
16:34:18 T:139906462504704  NOTICE: Quality setting is 3, using priority ['highestpls', 'fastpls', 'slowpls']
16:34:18 T:139906462504704  NOTICE: Format setting is 1, using priority ['mp3', 'aac']
16:34:18 T:139906462504704  NOTICE: Trying ('fastpls', 'mp3', 'http://somafm.com/beatblender.pls')
16:34:18 T:139906462504704  NOTICE: Rejecting http://ice1.somafm.com/beatblender-128-mp3
16:34:18 T:139906462504704  NOTICE: Rejecting http://ice2.somafm.com/beatblender-128-mp3
16:34:18 T:139906462504704  NOTICE: Trying ('fastpls', 'aacp', 'http://somafm.com/beatblender64.pls')
16:34:18 T:139906462504704  NOTICE: Rejecting http://ice2.somafm.com/beatblender-64-aac
16:34:18 T:139906462504704  NOTICE: Rejecting http://ice1.somafm.com/beatblender-64-aac
16:34:18 T:139906462504704  NOTICE: Trying ('slowpls', 'aacp', 'http://somafm.com/beatblender32.pls')
16:34:18 T:139906462504704  NOTICE: Rejecting http://ice2.somafm.com/beatblender-32-aac
16:34:18 T:139906462504704  NOTICE: Rejecting http://ice1.somafm.com/beatblender-32-aac
16:34:18 T:139908287543232   ERROR: Init: Error opening file
16:34:18 T:139908287543232   ERROR: CAudioDecoder: Unable to Init Codec while loading file
16:34:18 T:139908287543232 WARNING: PAPlayer::QueueNextFileEx - Failed to create the decoder
16:34:18 T:139908287543232   ERROR: Playlist Player: skipping unplayable item: 2, path [plugin://plugin.audio.somafm/beatblender]
16:34:18 T:139907183916800  NOTICE: resetVideoWidgetWindowProps
16:34:18 T:139907183916800  NOTICE: {"end":false,"item":{"artist":["DJ Shawn"],"title":"Beat Blender","type":"song"}}
16:34:18 T:139908287543232 WARNING: Attempt to set unplayable index 2
berz commented 8 years ago

Looking at the log above it seems that the addon is finding the correct streams but rejecting them all. Grepping the code for "Rejecting" I found that the code doing the validation is in the lib/channel.py file, around line 95:

            for i in range(0, play_list.size()):
                stream_url = play_list.__getitem__(i).getfilename()
                if (urlparse.urlparse(stream_url).port is None) == self.firewall_mode:
                    streams.append(stream_url)
                    print "Accepting " + stream_url
                else:
                    print "Rejecting " + stream_url

It appears to be iterating through all the stream url's to check their port and rejecting them all. Removing this check seems to fix the issue. I did this by editing ~/.kodi/addons/plugin.audio.somafm/lib/channel.py on my HTPC running xbian:

            for i in range(0, play_list.size()):
                stream_url = play_list.__getitem__(i).getfilename()
#               if (urlparse.urlparse(stream_url).port is None) == self.firewall_mode:
                if True:
                    streams.append(stream_url)
                    print "Accepting " + stream_url
                else:
                    print "Rejecting " + stream_url

I hope someone can come up with a proper fix and submit a pull request as I don't have the time to investigate this further.

decantur commented 8 years ago

I upgraded to Jarvis this morning and the plugin appears to be functioning properly now.

MaximilianKindshofer commented 8 years ago

@berz thanks for you hotfix - I can confirm it working. @decantur since it works again with Jarvis - this could be a bug against Kodi (Isengard?)

decantur commented 8 years ago

I am just a lowly user, but I think this may be the case (Isengard bug) and the URL updates were merely a coincidence in timing.

Oderik commented 8 years ago

Ok, I'm on it.

In the meantime you can enable firewall friendly mode in the settings as a workaround.

Oderik commented 8 years ago

@berz hotfix just did the trick. I now removed the firewall feature completely. I hope nobody was relying on it...

Explanation: Some of the "old" playlist files featured an entry that was dedicated to users behind a firewall. To keep load away from the stream, I decided to implement the firewall mode so only users that really needed it would use that stream. The firewall friendly stream could be identified by the fact that it had a port setting. Since the the somaFM url update non firewall streams also may have a port set. In cases where all the streams use an explicit port, the add-on would consider them all firewall friendly, leaving no stream available to non firewall listeners.

Thanks everybody for your input!

PS: Working on this while listening to Secret Agent with Kodi. ^^

PanderMusubi commented 8 years ago

I am using that original code in https://github.com/PanderMusubi/plugin.audio.intergalacticfm and there is not a problem. So I think it is specific to SomaFM, or a bug in KODI related to the situation for SomaFM. Please, see if you can recreate the bug while using the audio plugin for Intergalactif FM playing the streams from Intergalactic FM.

Oderik commented 8 years ago

@PanderMusubi please note my previous response: all (new) somaFM streams were considered "firewall friendly" because they now contain a port and were thus rejected in non firewall mode. If you use the old code with urls that don't contain a port, everything should be fine.

PanderMusubi commented 8 years ago

Eventually Intergalactic FM also ran into troubles with that. Adding :80 to the streams solved it.