Jump to content

Plugin? or is it a channel? or is a plugin and a channel the same thing?


Recommended Posts

Posted

I would like to add a new link to the Theaters Home screen which opens a new page.

 

 

Mostly my page will include information gathered from an RSS List online. Writing the code to get the information is no biggie, what I can't wrap my head around is how I would display it in the Theater. Especially if I'm using tv.emby.media as my front end.

 

I have seen how to write plugins for the Server, but my idea really isn't meant for the server. 

 

Would it be a theater plugin?

 

if I want to keep it for my own use only, how could it be displayed in the theater, if the app itself seems to be hosted online?

 

Slightly confused how it works?

 

:huh:

Posted

Channels are plugins.

 

A theater plugin is client-side and different from a server plugin. For an RSS list, can't you already use the Podcasts plugin?

Posted

Channels are plugins.

 

A theater plugin is client-side and different from a server plugin. For an RSS list, can't you already use the Podcasts plugin?

I will certainly try the podcast plugin. It would save a bunch of time.

 

Thank you :)

Posted

Are you looking for a way to display lists of items for which you want to offer a method to trigger some kind of download?

 

Then you'll definetely need a channel plugin (server side).

Posted

Thanks for clearing that up for me guys :)

 

 how is it possible to have the plugin act as a library in the web client. Like how Podcasts will act as a library?

Posted

Thanks for clearing that up for me guys :)

 

 how is it possible to have the plugin act as a library in the web client. Like how Podcasts will act as a library?

 

By being a channel.

  • Like 1
Posted

Whoo hoo! I got it!

 

f#%k Yeah!

Posted

Hmmm...

 

I can't seem to populate my Channel with anything.

 

I have create a list of ChannelItemInfo under GetChannelItems

            var items = new List<ChannelItemInfo>();
            items.Add(new ChannelItemInfo()
            {
                Name = "Test2",
                Id = "test2",
                Type = ChannelItemType.Folder
            });

            return new ChannelItemResult()
            {
                Items = items
            };

and yet nothing appears in the channel window...

Posted

Well! You have to enable content Downloading... SO if anyone every comes across this thread and cant understand why shit isn't working, make sure you have the Features return something valid.

 

Moving ON!

Posted (edited)

I have some ligit questions and am not sure if I should create a new thread for them.

 

1) if I give the channel a type of podcast, how is it possible to have the button for the ChannelItem be a link? There is a "Path" property.

what I really would like is to have the menu item select a link.

Edited by chef
Posted

changed my workflow.

 

I'm pretty sure the ChannelItem needs to be a folder. However, what I want is the folder to link to an external address when pressed.

 

the only other way I can see how to do this is to trick emby into thinking that the link I want to acquire is "clip" / "video" / "audio" channel item, but really it is telling my Home Automation to trigger a scene.

 

Note: I've added Home Automation to my Home Screen, and each Channel Item under that Channel is a Scene I can trigger with my Home Automation Plugin.

 

Not sure exactly.

 

@@Luke @@snazy2000 is it possible to have a channel item (be it a folder, or media) select a link? I'm pretty sure it is.

Posted

@@Luke @@snazy2000 is it possible to have a channel item (be it a folder, or media) select a link? I'm pretty sure it is.

 

No.  This is something that every single app would have to understand and have some way of travelling to that link (some would not).

  • Like 1
Posted

No. This is something that every single app would have to understand and have some way of travelling to that link (some would not).

That's too bad, at least I know how to create a channel, and have it display on the home screen.

 

So, it wasn't a complete waste of time :)

Posted

Maybe it hasn't been a waste of time at all...

 

As far as I understood, all you need is that a certain http url is executed/queried. In case of home automation (working in a local network), it probably doesn't make much sense anyway if the url would be requested from an Emby client that could reside in any network.

 

So I think that the Emby server (rather your channel plugin) should execute the url, like this:

  • You have to disable caching for your channel items (I forgot the details, but there's a way)
  • Also disable "downloadable channel"
  • You render your scene as a channel folder
  • When "GetChannelItems" is called for your scene folder, you know that a user has clicked it
  • Now you execute the scene url from inside your plugin
  • I don't know, if you're getting any results from that URL, but you could even use these results to visualize the state of certain automated home devices as child channel items and return these items from the "GetChannelItems" call.
  • Understand? The user clicks a channel folder "Party Mode". The server activates the scene, and your plugin returns child items like "Main light: Off", "PA volume: Loud", "Color Led: On", etc...
  • Like 1
Posted (edited)

<p>

 

Maybe it hasn't been a waste of time at all...

 

As far as I understood, all you need is that a certain http url is executed/queried. In case of home automation (working in a local network), it probably doesn't make much sense anyway if the url would be requested from an Emby client that could reside in any network.

 

So I think that the Emby server (rather your channel plugin) should execute the url, like this:

  • You have to disable caching for your channel items (I forgot the details, but there's a way)
  • Also disable "downloadable channel"
  • You render your scene as a channel folder
  • When "GetChannelItems" is called for your scene folder, you know that a user has clicked it
  • Now you execute the scene url from inside your plugin
  • I don't know, if you're getting any results from that URL, but you could even use these results to visualize the state of certain automated home devices as child channel items and return these items from the "GetChannelItems" call.
  • Understand? The user clicks a channel folder "Party Mode". The server activates the scene, and your plugin returns child items like "Main light: Off", "PA volume: Loud", "Color Led: On", etc...
I wonder if i can pass the client name parameter somehow to trigger the proper scene.

 

I will try this straight away. Thank you.

Edited by chef
Posted (edited)
Edited by chef
Posted (edited)

I think that "AutoRefreshLevels" is used to update cache. I still have to test it out.

It

could also have to do with incrementing the DataVersion. But incrementing DataVersion so far is important only for building the solution so it forces the browser to load the newest version of the channel page.

This is why I think it can be used in the channel to invalidate the buttons in the cache once they are pressed.

 

But... I don't see any other plugin doing that, even the Podcast plugin doesn't invalidate itself.

 

There are no examples on GitHub which show clearing caches, or code which shows disabling caches, and I'm pretty sure I have read every plugin channel.cs there is. Lol...

Edited by chef
Posted

AutoRefreshLevels must be 0. This value is to limit traversal of the channel folder tree for automated (server-initiated) refreshing of channel items. I don't know if it is even used, but you don't want this, so set it to 0!

You were asking for a user id to return results for a specific user. The ChannelItemsQuery parameter for GetChannelItems includes a user id.

Also there is a IChannel.IsEnabledFor method to enable the chanell for certain users only.

To invalidate the cache, your channel should implement the IHasCacheKey interface. Each time you want to invalidate the cache, you change the value that you are returning from IHasCacheKey.GetCacheKey

Hope this helps...

  • Like 1
Posted

Okay! I just wanted to mention that in order to clear the cache you can use:

 

DataVersion = DataVersion + 1

 

 

each time you want to reuse tabs.  It might not be right, but it works.

Posted

This is a more radical approach that will have the desired effect, no doubt.

But it causes more changes to the library and I suspect that it might even cause some pollution to the library (leaving dead entries), but I'm not sure about it.

 

I would recommend to try the approach that I described (it's almost the same code) and see if that would work as well...

  • Like 1
Posted

How do you know what requested the channel item be retrieved?

 

I mean, isn't it possible that a library scan or refresh channels task will trigger every one of his scenes...?

Posted (edited)

How do you know what requested the channel item be retrieved?

 

I mean, isn't it possible that a library scan or refresh channels task will trigger every one of his scenes...?

I hadn't thought of that.

 

I haven't tried a channel refresh, so it is possible that it could trigger one scene after another.

 

I could perhaps use the scheduled task interface and condition the routine to ignore requests when the Libraray scan is run.

Edited by chef
Posted

Eric's right. I can fix that.

Posted (edited)

I tied into TaskManager then stopped the scene from running during the Channels refresh. When the channel refresh finishes I allow the scenes to run again.

 

Untested, but it should work :)

        private static void TaskExecuting(object sender, GenericEventArgs<IScheduledTaskWorker> e)
        {
            if (e.Argument.Name.Contains("Channel"))
            {
                AllowScene = false;
            }
        }

        private static void TaskComplete(object sender, TaskCompletionEventArgs e)
        {
            if (e.Task.Name.Contains("Channel"))
            {
                AllowScene = true;
            }
        }

Under GetChannelItems:

            if (query.FolderId != null)
            {
                if (AllowScene)
                {
                    PluginHttpClient.PostStream(sceneTriggerUrl(query.FolderId));
                    // DataVersion = DataVersion + 1;
                }
            }
Edited by chef
Posted

How do you know what requested the channel item be retrieved?

 

I mean, isn't it possible that a library scan or refresh channels task will trigger every one of his scenes...?

 

I don't think that he needs to be concerned about any of these:

  • When "AutoRefreshLevels" is set to 0, the refresh channels (postscan) task shouldn't trigger a refresh of the channel items
  • AFAIK, Library scans or metadata updates are working on the tree that is saved in the library, but do not trigger IChannel.GetChannelItems

@chef: So I don't think you need that hack. It would create service outages anyway and make your service unreliable.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...