A couple of questions about episodeobject/videoclipobject generation, services and m3u8 urls

plugin-dev

#1

The documentation for writing channels is extremely poor, so I'm hoping some of you could help me out here. :)

First of all, if you take a look at channels like this or this, they do not have any services defined. They create episodeobjects with a specific url, and that's apparently it. The SVT one seems to pass the url of the page one would normally visit to watch the clip. When I try that with another service (NRK), either with the url of the player of the clip or with the m3u8 url, I get errors of the kind "No service found for URL …" and "No matching services found for …". What's the difference here? What are the premises for being able to pass the url directly with no service like these two channels are?

Second, when I create a videoclipobject or episodeobject, full of metadata and containing the url to the stream, what is the point of this needing either a url or a key, when all it is seemingly used for is creating metadata which already exists in the object? This seems downright stupid. I would actually expect it to be possible to give the m3u8 paths as the urls to the videoclip-/episodeobjects and fill them with the corresponding metadata, without having to do the exact same thing one more time. I see some have created a function for creating these objects, providing them with a callback to the very same function, but for this to be necessary seems too silly to be true. And the aforementioned channels don't seem to do this, but I haven't gotten it to work any other way. Any of you have any input on this?


#2

@kvolden there used to be a nice web-base API reference, but it's not there anymore. Some of it may still be found in the WayBackMachine (https://web.archive.org/web/20150219023357/http://dev.plexapp.com:80/docs/index.html), but it looks like the styles are broken.

As for your questions, for the official Plex channels, it may be that their respective URL services are already included with the Plex distribution, they can be found under Plug-Ins directory, in Services.bundle/Contents/Service Sets.

The URL is basically needed only for the URL Services, if you don't implement those in your own channels, you can ignore it and use key and rating_key attributes instead. The purpose of it is that you could tell Plex to "play this webpage URL" and it'll know what to do, provided there's a URL Service in place for this URL pattern.

That said, URL Services in Plex can be pretty confusing, but most channels out there use them, so there will be more example for you if you were to follow suit. URL Services system can also help you with "wiring" the Media objects together, so you won't have to implement a function with a callback to itself, for example. On the other hand, it imposes some limitations on what you can and can't do, introduces some redundancy to the channel code and makes the whole plugin less readable.


#3

Thanks! :)

Very strange that the same "content object" has to be created again, instead of Plex just using the information in the first object directly. The possibility of doing another individual metadata lookup is good, but it's not always necessary. It'd be nice if, instead, the content objects had an additional streamUrl member or something, which provided the actual stream url, and a possibility of providing a callback for fetching additional metadata. But it is what it is.


#4

Just to add a little extra info.

There is no longer a web based interface for the Framework, but this post provides it as a PDF document - forums.plex.tv/discussion/262554/plex-channel-development-support-documents#latest that you can download. And this document lists anything that may have changed or is known to be missing from the Channel Framework documentation - Missing from the Official Plugin Documentation

And as @czukowski stated, the URL services for some Plex channels are not in the actual channel bundle and have instead been added to the Services.bundle. This is done because media pages for a website whose URL service is in the plexinc-plugins Services.bundle repository on Github will work with the PlexIt/Watch Later function.

Also, this link in the Plex Channel Development Support Documents thread called Introduction to URL Services may help in understanding URL services and when one is needed. As this document explains, if you do not use a separate URL service, you need to create a separate function to create the media object. Since most Plex players have a pre-play screen this function loops through twice, first pulling the metadata for the pre-play screen and then pulling the actual media stream, once the user clicks play.