Playback of a shoutcast or AAC stream?

Having issues with Laika (0.9) TrackObject() for streaming sources.
I just started working on a plugin for Laika (0.9.5) to stream audio directly. Most of the sources are from a single site.

My problems start with the new ObjectContainer and TrackObject style.


1. It appears the URL won't be handled properly, and won't open at all. I get errors when the plugin attempts to access the URL, usually related to an exception from the TrackObject itself. It specifically claims that there is no service for the URL.*

2. Moving back to an old framework setup (MediaContainer() and TrackItem()) doesn't solve much, but does permit the plugin to at least get a directory listing of the various streams. While not perfect, that part is functional for now. I can't open the audio stream and the thumbnails are completely wrong, but it's kind of working.

* The specific errors are a little obscure:

No service found for URL 'http://streamer.FOOBAR.com:80/stream/1018'


Exception when constructing response:



 File "/Users/jb/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/runtime.py", line 818, in construct_response<br />
    resultStr = self._core.data.xml.to_string(result._to_xml(context=context))<br />
  File "/Users/jb/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/objectkit.py", line 356, in _to_xml<br />
    el = Framework.modelling.objects.ModelInterfaceObjectContainer._to_xml(self, context)<br />
  File "/Users/jb/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/modelling/objects.py", line 351, in _to_xml<br />
    root = Container._to_xml(self, context)<br />
  File "/Users/jb/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/modelling/objects.py", line 124, in _to_xml<br />
    self._append_children(root, self._objects, context)<br />
  File "/Users/jb/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/modelling/objects.py", line 130, in _append_children<br />
    el = obj._to_xml(context)<br />
  File "/Users/jb/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/objectkit.py", line 292, in _to_xml<br />
    if urlservice._media_objects_function_for_url_is_deferred(url):<br />
  File "/Users/jb/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/servicekit.py", line 87, in _media_objects_function_for_url_is_deferred<br />
    return self._media_objects_function_for_service_is_deferred(service)<br />
  File "/Users/jb/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/servicekit.py", line 90, in _media_objects_function_for_service_is_deferred<br />
    return self._function_for_service_is_deferred(service, 'MediaObjectsForURL')<br />
  File "/Users/jb/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/servicekit.py", line 93, in _function_for_service_is_deferred<br />
    ret = self._core.services._function_in_service_is_deferred(f_name, service, context=self._context)<br />
  File "/Users/jb/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/core.py", line 829, in _function_in_service_is_deferred<br />
    return service.host.function_is_deferred(fname, self._create_service_context(service.host, context))<br />
AttributeError: 'NoneType' object has no attribute 'host'<br />




What I'm trying to insert in to the ObjectContainer():

<br />
oc.add(TrackObject(<br />
   url='http://streamer.FOOBAR.com:80/stream/1018',<br />
   title = title,<br />
   thumb = Callback(Thumb, url=thumb),<br />
   ))<br />




Yes, these are intentionally the same stream of audio. I'm still debugging why it won't even build the container for the streams on the fly.

Try specifying ‘key’ instead of ‘URL’ for the TrackObject. I’m pretty sure that using the ‘URL’ argument tells the framework to pass that URL to the appropriate URL service. I think if you set key = your_url it should try to play it directly. I’m not 100% sure since the only v2.1 plugins I’ve done made use of URL services.



The documentation seems to indicate that "url" should be used generally. Key, supposedly, is a MediaObject that contains metadata.

Moving "url" to "key" gives me this error:


<br />
  File "/Users/jb/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/objectkit.py", line 259, in _to_xml<br />
    raise Framework.AttributeException('If no URL is provided, the key and rating_key attributes must be set.')<br />
AttributeException: If no URL is provided, the key and rating_key attributes must be set.<br />




Setting "key_ratings" to "None" or "0" doesn't change much, except cause a whole new error:

<br />
FrameworkException: The 'key_rating' attribute is inaccessible from model interfaces.<br />




Going for "url" and "key" (set to the same string):

<br />
   ret = self._core.services._function_in_service_is_deferred(f_name, service, context=self._context)<br />
  File "/Users/jb/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/core.py", line 829, in _function_in_service_is_deferred<br />
    return service.host.function_is_deferred(fname, self._create_service_context(service.host, context))<br />
AttributeError: 'NoneType' object has no attribute 'host'<br />


Ok, figured part of the problem out.



Forcing rating_key to 0, and using the stream URL as “key” gets me the listing of the various TrackObjects from the ObjectContainer. I still have problems with cached images for the wrong station, but that is, as far as I know, just a problem with the code in its current state.



Thank you for your help.

And, stuck again.



In this case I can’t seem to get PMS to open the stream, at all. Doesn’t matter how current it is, it just throws an error instead of opening the stream. The presented error is “Playlist Playback Aborted. The original file may have moved, been deleted, or is currently unavailable.”



PMS log shows this:



<br />
Dec 09, 2011 00:57:05 [0xb0bad000] DEBUG - (Capabilities) Adding WebKit.<br />
Dec 09, 2011 00:57:05 [0xb0bad000] DEBUG - (Capabilties) Passing down capabilities of 'protocols=http-video,shoutcast,webkit;audioDecoders=mp3,aac' to plug-in.<br />
Dec 09, 2011 00:57:06 [0xb0bad000] DEBUG - HTTP request to: http://127.0.0.1:60042/music/tester<br />
Dec 09, 2011 00:57:06 [0xb0bad000] DEBUG - [com.plexapp.plugins.tester] HTTP reply status 200, with 7932 bytes of content.<br />
Dec 09, 2011 00:57:09 [0xb0617000] DEBUG - Request: GET /:/progress?key=FOO%20BAR&identifier=com.plexapp.plugins.tester&time=0&state=stopped [127.0.0.1] (1 live)<br />
Dec 09, 2011 00:57:09 [0xb0617000] DEBUG -  * key => FOO BAR<br />
Dec 09, 2011 00:57:09 [0xb0617000] DEBUG -  * identifier => com.plexapp.plugins.tester<br />




It's the only reference to the plugin I've found. The log file for the plugin specifically has nothing relating to the failure.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.