Jump to content

Channel Plugin Example: File Browser


Recommended Posts

Posted (edited)

image.png.6e335f29eb09dc284c72bdab58906a28.png

Hi, 

this is a preview for a new Channel Plugin Example - including source code of course:

ChannelPluginFileBrowser.zip

It will eventually be included in the Emby SDK (https://dev.emby.media/home/sdk/index.html)

What does it do?

Usually, channel plugins are used for integrating some remote content. To keep it minimal and focused, this sample does something different, though:

It allows you to "browse" your local file system and also playback audio and video files. 

How does it work?

After installing, go to plugins and click the "File Browser Plugin". You will see this:

 

image.png.f8b0765d0424543c568ad0eb4980ff9c.png

Next Step

After saving, run the task "Refresh Internet Channels".

Then you will see a "File Browser" in Emby and you can browse down all the hierarchy of the folders you have chosen.

It makes sense to choose "List" as view type.

image.png.58bd1f48a2e87e7f02afc3b4e2d9421c.png

 

I hope it might be helpful to some of you. 
Please let me know when you find any issues as this was done in 1.5h only.

Edited by softworkz
  • Like 3
  • Thanks 3
Posted

There's a bunch of techniques I have worked out in the past which allow to enhance the experience and functionality of channel plugins. I cannot put all of this into the sample plugin as it wouldn't be a simple and useful example anymore, but when there's special interest in a certain topic I can add it to. So here's a list:

  • How to update your channel without running the schedules task (which updates all channel plugins)
  • How to update only a partial subtree of your channel items
  • How to change the images of your root folders with a custom ImageProvider
  • How to generate collage images for channel folders (like Emby does for libaries) with a custom CollageImageProvider
  • How to work with Metadata for Channel Items
  • How to achieve series/season/episode grouping with channel items
  • How to provide ThemeVideos and ThemeSounds for channel items
  • How to provide data for item fields which are not included in ChannelItemInfo
  • How to provide MediaSource information for channel items with a custom MediaSourceProvider
    (currently, Emby just takes the 'Path' and ignores everything else you specify in the ChannelItemInfo)
  • How to lock item properties from being overwritten by Emby
    (there's an unresolved bug in Emby Server which causes many the item fields to be overwritten on first playback)
  • Like 1
  • Thanks 1
Cheesegeezer
Posted

These are pretty cool customisations. I have figured the custom root folder images one.

Running channels update i think i can do also pretty easily, from past plugins. 

for some reason, I can’t get the actual channel image to show by getting the resources for DynamicImageResource, just as you shown in your example. Is there something in your CommonBase that forces the image to be loaded. I wouldn’t have thought so because IChannel interface requires the GetChannelImage. Hmmm i shall persevere lol 😂 
 

I cant tell you how much your example has put me on the right track. Thanks again!!

 

Posted
1 hour ago, Cheesegeezer said:

I have figured the custom root folder images one

I didn't mean folders at root of your channel plugin but at the user view root (the topmost level). This is a new feature, even though it's not meant for general use and should be limited to certain cases only.

An example for such case it the "Emby Show" channel plugin. It has a single series item and underneath one or more "seasons" (which are used for different kinds of episodes, currently just a single season "News from the Devs") and the actual episodes another level below.
Normally, you would see the channel item at the user-view root, when you go there, you would see another items view which contains just a single item (the series item) and there will never be another series item shown there, which makes that level pretty much redundant and it's much nicer when you can get into the series view directly. from the user-view root.
When you use that feature, the image from ChannelItemInfo isn't being used and you need a custom image provider to supply an image for that folder. That's what I meant.

1 hour ago, Cheesegeezer said:

Running channels update i think i can do also pretty easily, from past plugins. 

I mentioned it, because the example plugin doesn't do it yet (when configuration is saved).

But yes, it's easy: https://dev.emby.media/reference/pluginapi/MediaBrowser.Controller.Channels.IChannelManager.html?q=RefreshChannelContent#MediaBrowser_Controller_Channels_IChannelManager_RefreshChannelContent_MediaBrowser_Controller_Channels_IChannel_System_Int32_System_String_System_Threading_CancellationToken_

For partial updating, you can supply something for the restrictTopLevelFolderId parameter.

1 hour ago, Cheesegeezer said:

for some reason, I can’t get the actual channel image to show by getting the resources for DynamicImageResource, just as you shown in your example. Is there something in your CommonBase that forces the image to be loaded. I wouldn’t have thought so because IChannel interface requires the GetChannelImage.

It takes that image only once after installation. You need to uninstall the plugin - restart the server once (wihout your plugin being loaded) - add the plugin again and restart once again.

1 hour ago, Cheesegeezer said:

I cant tell you how much your example has put me on the right track. Thanks again!!

You're welcome.

Probably you got the following set up already - but for other readers: 

  • Like 1
Cheesegeezer
Posted

@softworkz as always an very detailed reply and thanks again for explaining.  
 

user-root views are basically what you would call from API to get libraries? TV, Movies, channels, Collections etc

the level underneath would be in my case categories or in your case season. Then the level under that are category items or season episodes. im just checking we on the same page.

The debugging setup is something i been wanting a long time lol!! 
 

awesome 🤩 thanks again!!

Cheesegeezer
Posted

One other thing you me tion which would be very handy is to add extra properties to the ChannelItemInfo.  However i’m not sure it would help me. I would like these properties displayed on the UI and currently i would need to steal a current Display option to show the info i wanted. 
for example. Datelastplayed -  i cant display because there is no datetime type UI option. 
 

Posted
16 minutes ago, Cheesegeezer said:

user-root views are basically what you would call from API to get libraries? TV, Movies, channels, Collections etc

Yes exactly. 

17 minutes ago, Cheesegeezer said:

the level underneath would be in my case categories or in your case season. Then the level under that are category items or season episodes. im just checking we on the same page.

In my case, it's the series view - like when you click on a tv series elsewhere. I just wanted to be able to get there directly.

But you don't need that for your case. The channel top folder will show at the user-view top-level (like a library). When a user clicks on it, it will see your categories and clicking on a category will lead to an items view.

To achieve that, just forget everything I mentioned above! When the your channel is queried with an empty folderId, you return your categories and when it's queried with a folder id, you return those items that belong to that category.

22 minutes ago, Cheesegeezer said:

The debugging setup is something i been wanting a long time lol!! 

It's nothing new, it has always been working like that. I don't know who had written that comment in the earlier docs, suggesting to test plugins without debugger, but I thought everybody would know at least that you can attach the debugger to the process. You're not the only one - I realized that many didn't know...
The one thing that is really not commonly known is that when you do not attach the debugger but specify the EmbyServer.exe for the debugger to start, then can also use Edit-and-Continue - i.e. change your plugin code while running.

Posted
25 minutes ago, Cheesegeezer said:

One other thing you me tion which would be very handy is to add extra properties to the ChannelItemInfo.

What I meant here is about creating a custom metadata provider which allows you to fill item (BaseItem and derivatives) fields that are not in ChannelItemInfo.

29 minutes ago, Cheesegeezer said:

 However i’m not sure it would help me. I would like these properties displayed on the UI and currently i would need to steal a current Display option to show the info i wanted. 
for example. Datelastplayed -  i cant display because there is no datetime type UI option. 

I don't get that. Could you elaborate a bit more?

Cheesegeezer
Posted
33 minutes ago, softworkz said:

The one thing that is really not commonly known is that when you do not attach the debugger but specify the EmbyServer.exe for the debugger to start, then can also use Edit-and-Continue - i.e. change your plugin code while running.

Hahaha, yeah i use that with netMaui a lot and it's such a good feature.

For anyone needing to know how to enable this 

Click on Debug and Select Options

Then ensure this is enabled... after you change any code, you can hit CTRL + S and it will hot reload your code for debugging

image.png.c4a3f6e34d432ec53f0664de11a3ea9b.png

  • Like 1
Cheesegeezer
Posted
30 minutes ago, softworkz said:

I don't get that. Could you elaborate a bit more?

A picture paints a thousand words

So if I wanna display some custom property in the UI I would need to use a UI control such as a Label that is available so I can set the property to soemthing else.

Lets say i wanna use the Year field to display LastPlayedDate.  year is an int and i would wanna display a string or DateTime type.

image.thumb.png.12fedb9a9a7eea31f41d539f6861aa58.png

  • Like 1
Cheesegeezer
Posted

I'm just having a play with a channel i know the community has been asking for which is Watch history across all users, i guess at admin level.  But would want to wait until 4.8 is released before moving to user specific configs.

Oh and your tip for removing plugin and reloading did the trick for displaying the Channel Thumb - Thanks

image.thumb.png.d93f1dd00fe59159517342132f60de51.png

Posted
28 minutes ago, Cheesegeezer said:

So if I wanna display some custom property in the UI I would need to use a UI control such as a Label that is available so I can set the property to soemthing else.

Lets say i wanna use the Year field to display LastPlayedDate.  year is an int and i would wanna display a string or DateTime type.

No, that can't be changed. It's all hardcoded.

  • Thanks 1
Cheesegeezer
Posted
33 minutes ago, softworkz said:

No, that can't be changed. It's all hardcoded.

Good To know, at least i wont waste any time on it then!

 

  • Agree 1
  • 1 year later...
lsfranco
Posted (edited)

 

how to install please?

Edited by lsfranco
  • 1 month later...
Posted

@softworkzattached sources from the first post are the latest version? If not, where I can download them? 

In the second post you mentioned several interesting how-tos, where I can peek on them?

I check emby sdk, but didn't find a link on the ChannelExample plugin. If it's there - where to search?

Thanks in advance

Posted (edited)

Just download the SDK, it's included, only the doc pages don't mention it (yet).

Edited by softworkz
  • Thanks 1
Posted

@softworkzand what about

Quote

here's a bunch of techniques I have worked out in the past which allow to enhance the experience and functionality of channel plugins. I cannot put all of this into the sample plugin as it wouldn't be a simple and useful example anymore, but when there's special interest in a certain topic I can add it to. So here's a list:

  • How to update your channel without running the schedules task (which updates all channel plugins)
  • How to update only a partial subtree of your channel items
  • How to change the images of your root folders with a custom ImageProvider
  • How to generate collage images for channel folders (like Emby does for libaries) with a custom CollageImageProvider
  • How to work with Metadata for Channel Items
  • How to achieve series/season/episode grouping with channel items
  • How to provide ThemeVideos and ThemeSounds for channel items
  • How to provide data for item fields which are not included in ChannelItemInfo
  • How to provide MediaSource information for channel items with a custom MediaSourceProvider
    (currently, Emby just takes the 'Path' and ignores everything else you specify in the ChannelItemInfo)
  • How to lock item properties from being overwritten by Emby
    (there's an unresolved bug in Emby Server which causes many the item fields to be overwritten on first playback)

 

VicMoore
Posted

@softworkzI am glad to see that your work has progressed so far.  Do I need to do anything to bring PseudoTV up to date with Emby?  Should I switch over to your platform now? I will attach my TV Tuner code below so you can see what I am currently doing.

Vic

 

PseudoTVTuner.cs

Posted
5 hours ago, jelum said:

@softworkzand what about

What's your question?

Posted
4 hours ago, VicMoore said:

@softworkzI am glad to see that your work has progressed so far.  Do I need to do anything to bring PseudoTV up to date with Emby?  Should I switch over to your platform now? I will attach my TV Tuner code below so you can see what I am currently doing.

We'll get you into the group once we restart the TVnext beta and then we'll figure that out.

Posted
15 hours ago, softworkz said:

What's your question?

where can I find the information from the list? you wrote that the info will not be included in the channel demo plugin so as not to make the demo too complicated. any chance you published it anywhere?

Posted
37 minutes ago, jelum said:

where can I find the information from the list? you wrote that the info will not be included in the channel demo plugin so as not to make the demo too complicated. any chance you published it anywhere?

No. I said

On 1/23/2023 at 1:08 AM, softworkz said:

when there's special interest in a certain topic

I have no time for doing all of this. It's really meant for when you have already gotten to a certain point where you need any of that information.

Thanks

  • Thanks 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...