Jump to content

Channel of Tv Shows


bakes82

Recommended Posts

I wouldn't create channel content based on library content. It is going to duplicate items in the database, degrade performance, lead to more troubleshooting, etc. I would just have your plugin create collections based on existing items.

Link to comment
Share on other sites

1 hour ago, Luke said:

I wouldn't create channel content based on library content. It is going to duplicate items in the database, degrade performance, lead to more troubleshooting, etc. I would just have your plugin create collections based on existing items.

Sure, let me know when collections will be displayable like a library and can be put on the home screen or library screens like libraries/channels ;)  I'm trying to get around the current limitations.  How do the "latest" xyz" things work, they duplicating stuff?  Can we make those?  How do I find the collections?  Like the CollectionManager has a way to make collections and add items to existing collections, but not a way to find a collection to see if it exists....  This is whats kind of frustrating, its like you have to be a master at knowing how to work the libraryManager search thing and well its not really documented, where if you just had more fully implemented "managers" it would make life alot easier.  EX: SeriesManager has one method GetUpNext.  Im sure this is "basic" but I also see my self wrting a bunch of duplicate code, where if I could just inject the manager and it has some basics, create/get that could be reduced.  Also for the createCollection I need to know the parentId.  I assume thats the libraryId so how do I get a list of libraries so I can show those.  I will say the new pluginUI stuff is way nicer now and not having to deal with JS

Link to comment
Share on other sites

 Right I understand. What I would say is that I would expect users will be able to pin individual items to the home screen in future updates, or have a collection as an entire section, smart view, etc.

Link to comment
Share on other sites

1 hour ago, bakes82 said:

I'm trying to get around the current limitations.  How do the "latest" xyz" things work, they duplicating stuff?  Can we make those?  How do I find the collections?  Like the CollectionManager has a way to make collections and add items to existing collections, but not a way to find a collection to see if it exists....  This is whats kind of frustrating, its like you have to be a master at knowing how to work the libraryManager search thing and well its not really documented

You are not alone.... Even I don't know very well how these things are supposed to work. I think the problem is that nobody has ever sat down and thought about how to create a good API for accessing the libraries. This has solely been driven forward by what the clients needed. Also, there's no n-tier (multi-layer) architecture in place, which makes things very direct, so that the APIs you are seeing are mostly just a thin layer on top of the SQL statements being executed. In this regard I'd say, "asking @Luke" is the best possible recipe 🙂 

1 hour ago, bakes82 said:

Also for the createCollection I need to know the parentId.  I assume thats the libraryId so how do I get a list of libraries so I can show those.

This has changed just recently in some way, so I better let @Lukeanswer this.

1 hour ago, bakes82 said:

I will say the new pluginUI stuff is way nicer now and not having to deal with JS

I'm glad to hear that 🙂 
I know, that a few things are not immediately clear, so feel free to ask when in doubt.

Link to comment
Share on other sites

Is the watch history plugin yours? It doesn't really matter, but this is an example of the kind of troubleshooting that we end up having to deal with when you duplicate content:

There was another identical topic as well recently, I just can't find it right now.

Link to comment
Share on other sites

3 hours ago, Luke said:

Is the watch history plugin yours? It doesn't really matter, but this is an example of the kind of troubleshooting that we end up having to deal with when you duplicate content:

There was another identical topic as well recently, I just can't find it right now.

So why not admit your software has an issue and offer a resolution on fixing it?  This isn't my plugin, but your SDK allows for this behavior, so if people are using it and its causing issues then you can remove the option or fix it.  Obviously people are looking for this functionality and while you said collections might do it in a future update "Soon" (TM) with no actual release info isn't helpful.  I'm still waiting for the "Soon" (TM) on being able to prevent users from transcoding certain libraries or at all, this has been idk numerous years now, but hey we can change some colors on the UI.

You also didnt answer if the "Latest XYZ" widget things duplicate DB entries, can we make those?  Also the continue watching should really have a toggle to show the series poster/season poster instead of the larger image, its like 2-3x the size.  Also toggling on off what "latest" things show would be huge improvement to UI rendering as well.

The plugin for the channels want to make are basically simple filters: Pilots, show me all the S01E01 episodes for the past xx days.  2nd - show me all the returning shows for the past xx days ie S03E01, Ideally this would be per user if they watched the previous season fully, yes I know it could also be in continue watching, but I know in plex the sort order was always by last episode playe so if the last season ended last year the new season wouldnt show up front with the most recntly played stuff it, it would be lost in the jumble of my like 100 continue watching stuff.  3rd - collections to home page but you said that might be coming soon tm

Link to comment
Share on other sites

The nature of the modularity of the internal api's allows for a lot of things to be done that we haven't thought of or had a chance to look at. Sometimes that leads to nice surprises of what things people come up with, and other times it leads to situations like this.

Having the ability to create views of existing content is ultimately the job for the smart views and playlists feature that we want to do, as well as being able to pin other things to the home screen. We haven't' gotten there yet. but we're going as fast as we can.

Until then I don't think there's anything to fix regarding the duplication. It's just going to be a consequence of importing this way and the plugin developers will need to make sure that users are aware of it before they enable it.

Link to comment
Share on other sites

9 minutes ago, Luke said:

Until then I don't think there's anything to fix regarding the duplication.

Maybe we could introduce a ChannelItemType of ItemLink?

A channel plugin would only supply the actual item ID instead of any other data, and the server would return the actual items when queried.

Link to comment
Share on other sites

12 minutes ago, softworkz said:

Maybe we could introduce a ChannelItemType of ItemLink?

A channel plugin would only supply the actual item ID instead of any other data, and the server would return the actual items when queried.

To have full support for something like this all throughout the system would not come easy, because in order for the data to be able to come back quickly, it needs to be handled in the database.

However, off the top of my head, maybe some kind of localized approach in Channels could be possible. If a Channel class finds it's own place to store the associations, then it can override it's GetItemsXXX methods and return whatever it wants. How far you'd be able to take that without requiring more core support though, I don't know.

So while I don't think there's anything wrong with the idea, I see it as a duplication of effort since we already know we're going to have a smart views feature.

 

Link to comment
Share on other sites

1 hour ago, bakes82 said:

So why not admit your software has an issue and offer a resolution on fixing it?  This isn't my plugin, but your SDK allows for this behavior, so if people are using it and its causing issues then you can remove the option or fix it. 

This is really not a valid point. A channel plugin allows you to provide any kind of content you want to. You can use it to provide a weather forecast for selectable regions (subfolders) and with different images (items), textual information and satellite videos. Or you could also implement a simple game or quiz (generating a static tree with subfolders). 

But when you choose to read existing items and provide copies of those items in your channel, then you get exactly that result: copies of existing items. It might not be what you want, but that's how it is working and this is not an issue in the software.

Link to comment
Share on other sites

6 minutes ago, Luke said:

However, off the top of my head, maybe some kind of localized approach in Channels could be possible. If a Channel class finds it's own place to store the associations, then it can override it's GetItemsXXX methods and return whatever it wants. How far you'd be able to take that without requiring more core support though, I don't know.

Why would the channel class need to store the associations? It would return the linked item IDs directly as property of the ChannelItemInfo. Then the server might not even need to create items - just additional item links (and folders as actual items, though).

Link to comment
Share on other sites

Just now, softworkz said:

Why would the channel class need to store the associations? It would return the linked item IDs directly as property of the ChannelItemInfo. Then the server might not even need to create items - just additional item links (and folders as actual items, though).

Because this idea:

Quote

It would return the linked item IDs directly as property of the ChannelItemInfo. Then the server might not even need to create items - just additional item links (and folders as actual items, though).

requires full support for a linking feature all the way up and down our whole stack. That creates the question of not just what kind effort that's going to be, but if even think that's a good idea.

So then the next idea that comes to mind is some kind of approach where the channel just owns the whole implementation. In other words thinking of it from the standpoint of what would I do if I were the plugin developer and I wanted to do this right now, that's how I may start it.

Link to comment
Share on other sites

9 minutes ago, Luke said:

requires full support for a linking feature all the way up and down our whole stack. That creates the question of not just what kind effort that's going to be, but if even think that's a good idea.

Wouldn't it be possible to create only ItemLinks entries at the moment when ChannelManager retrieves the ChannelItemInfos from the IChannel implementation?

 

9 minutes ago, Luke said:

So then the next idea that comes to mind is some kind of approach where the channel just owns the whole implementation. In other words thinking of it from the standpoint of what would I do if I were the plugin developer and I wanted to do this right now, that's how I may start it.

Ah, so you mean more like the earlier IChannel implementation where a channel could return items dynamically?

Link to comment
Share on other sites

20 minutes ago, bakes82 said:

@softworkzDo you have code for a library picker?

What's your concern - retrieving a list of all libraries or the UI side where it's about the selection?

For the latter case, you need to retrieve the list of libraries already before the PluginView is shown for the first time. Even when the user would not choose a library, you still need the list in order to resolve the name (as you would typically store just the library id in the config, not the name).

The PluginUiDemo contains a number of examples for using dropdown/select controls - also for multi-select scenarios.
Using enums is just one way to provide dropdown items. There's also an example for the other way, using Lists of EditorSelectOption items (providing Name and Value is sufficient).
Then you add a Emby SDK Reference: SelectItemsSourceAttribute to the property representing the dropdown.

Link to comment
Share on other sites

4 minutes ago, softworkz said:

What's your concern - retrieving a list of all libraries or the UI side where it's about the selection?

For the latter case, you need to retrieve the list of libraries already before the PluginView is shown for the first time. Even when the user would not choose a library, you still need the list in order to resolve the name (as you would typically store just the library id in the config, not the name).

The PluginUiDemo contains a number of examples for using dropdown/select controls - also for multi-select scenarios.
Using enums is just one way to provide dropdown items. There's also an example for the other way, using Lists of EditorSelectOption items (providing Name and Value is sufficient).
Then you add a Emby SDK Reference: SelectItemsSourceAttribute to the property representing the dropdown.

Im not all about making a new wheel when Im sure one has already been created.  You have a "file/folder" picker, so Im wondering what other code I can steal to copy/paste you know to make dev faster, why should I go about making a new one.  You said you had like 70 plugins in the new framework, would be great to see some commonly used fragments Id assume library picker would be one, is it used in Trakt?  Whats the code to get a list of libraries?

Link to comment
Share on other sites

I don't remember whether I've done a "library picker" somewhere. Anyway, it's really not something special.

6 minutes ago, bakes82 said:

Whats the code to get a list of libraries?

Emby SDK Reference: ILibraryManager.GetVirtualFolders()

 

7 minutes ago, bakes82 said:

so Im wondering what other code I can steal to copy/paste you know to make dev faster,

As said, look at PluginUiDemo and find the place(s) where EditorSelectOption is used. Then you should have all you need.

Link to comment
Share on other sites

10 hours ago, softworkz said:

I don't remember whether I've done a "library picker" somewhere. Anyway, it's really not something special.

Emby SDK Reference: ILibraryManager.GetVirtualFolders()

 

As said, look at PluginUiDemo and find the place(s) where EditorSelectOption is used. Then you should have all you need.

Sure, if you want basic stuff.  So I have an IEditableObjectCollection, so every time they add a new "collection" its doing postback and then allowing them to add another one.  So should I create the EditorSelectOptions on the Plugin View Page and then in the "run command" pass the list of objects to the CTOR of the new IEditableObjectCollection, or should I pass the library manager?  Whats the propery way, dont want it to fubar your stuff like channels do.

Link to comment
Share on other sites

In a button how do I pass over data?  Data seems to be the entire object, eventhough Im passing over a GUID Id?

 

The data is {"EditorTitle":"MDBList to Collections Plugin Options","AddNew":{"Caption":"Add Collection","Icon":"add","IsEnabled":true,"IsVisible":true,"Data1":"AddCollection","CreateInBottomPanel":false,"CanShowAsPageButton":false,"CanHideInCompactView":false},"ListCollections":[{"EditorTitle":"Collection Name Configuration","Title":{"Caption":"Collection Name Configuration","IsVisible":true,"CanHideInCompactView":false},"CollectionName":"Collection Name","ListId":"0","ListMediaType":"Movie","LibraryId":"0","CollectionId":0,"Delete":{"Caption":"Delete","Icon":"delete_forever","IsEnabled":true,"IsVisible":true,"Data1":"DeleteCollection","Data2":"00000000-0000-0000-0000-000000000000","CreateInBottomPanel":false,"CanShowAsPageButton":false,"CanHideInCompactView":false}}]}
public ButtonItem Delete =>
    new ButtonItem
    {
        Icon    = IconNames.delete_forever,
        Caption = "Delete",
        Data1   = "DeleteCollection",
        Data2 = Id.ToString()
    };
public override Task<IPluginUIView> RunCommand(string itemId, string commandId, string data)

 

Link to comment
Share on other sites

10 hours ago, bakes82 said:
22 hours ago, softworkz said:

I don't remember whether I've done a "library picker" somewhere. Anyway, it's really not something special.

Emby SDK Reference: ILibraryManager.GetVirtualFolders()

 

As said, look at PluginUiDemo and find the place(s) where EditorSelectOption is used. Then you should have all you need.

Sure, if you want basic stuff.  So I have an IEditableObjectCollection, so every time they add a new "collection" its doing postback and then allowing them to add another one.  So should I create the EditorSelectOptions on the Plugin View Page and then in the "run command" pass the list of objects to the CTOR of the new IEditableObjectCollection, or should I pass the library manager?  Whats the propery way, dont want it to fubar your stuff like channels do.

Why not just use a multi-select element like this?

image.png.297cd8070edf81cb6f427127d09bdb30.png

Link to comment
Share on other sites

8 hours ago, bakes82 said:

In a button how do I pass over data?  Data seems to be the entire object, eventhough Im passing over a GUID Id?

 

The data is {"EditorTitle":"MDBList to Collections Plugin Options","AddNew":{"Caption":"Add Collection","Icon":"add","IsEnabled":true,"IsVisible":true,"Data1":"AddCollection","CreateInBottomPanel":false,"CanShowAsPageButton":false,"CanHideInCompactView":false},"ListCollections":[{"EditorTitle":"Collection Name Configuration","Title":{"Caption":"Collection Name Configuration","IsVisible":true,"CanHideInCompactView":false},"CollectionName":"Collection Name","ListId":"0","ListMediaType":"Movie","LibraryId":"0","CollectionId":0,"Delete":{"Caption":"Delete","Icon":"delete_forever","IsEnabled":true,"IsVisible":true,"Data1":"DeleteCollection","Data2":"00000000-0000-0000-0000-000000000000","CreateInBottomPanel":false,"CanShowAsPageButton":false,"CanHideInCompactView":false}}]}
public ButtonItem Delete =>
    new ButtonItem
    {
        Icon    = IconNames.delete_forever,
        Caption = "Delete",
        Data1   = "DeleteCollection",
        Data2 = Id.ToString()
    };
public override Task<IPluginUIView> RunCommand(string itemId, string commandId, string data)

 

Data2 is the right way, but it seems that in your example, Id is an empty Guid (all zeroes).

Link to comment
Share on other sites

22 minutes ago, softworkz said:

Data2 is the right way, but it seems that in your example, Id is an empty Guid (all zeroes).

It is all zeros because I didnt set it yet I wanted to see it being passed over

 

, but data is the ENTIRE Plugin data object, so if I have 10 objects in the collection I see 10x:  EX

{
  "EditorTitle": "MDBList to Collections Plugin Options",
  "AddNew": {
    "Caption": "Add Collection",
    "Icon": "add",
    "IsEnabled": true,
    "IsVisible": true,
    "Data1": "AddCollection",
    "CreateInBottomPanel": false,
    "CanShowAsPageButton": false,
    "CanHideInCompactView": false
  },
  "ListCollections": [
    {
      "EditorTitle": "Collection Name Configuration",
      "Title": {
        "Caption": "Collection Name Configuration",
        "IsVisible": true,
        "CanHideInCompactView": false
      },
      "CollectionName": "Collection Name",
      "ListId": "0",
      "ListMediaType": "Movie",
      "LibraryId": "0",
      "CollectionId": 0,
      "Delete": {
        "Caption": "Delete",
        "Icon": "delete_forever",
        "IsEnabled": true,
        "IsVisible": true,
        "Data1": "DeleteCollection",
        "Data2": "00000000-0000-0000-0000-000000000000",
        "CreateInBottomPanel": false,
        "CanShowAsPageButton": false,
        "CanHideInCompactView": false
      }
    },
    {
      "EditorTitle": "Collection Name Configuration",
      "Title": {
        "Caption": "Collection Name Configuration",
        "IsVisible": true,
        "CanHideInCompactView": false
      },
      "CollectionName": "Collection Name",
      "ListId": "0",
      "ListMediaType": "Movie",
      "LibraryId": "0",
      "CollectionId": 0,
      "Delete": {
        "Caption": "Delete",
        "Icon": "delete_forever",
        "IsEnabled": true,
        "IsVisible": true,
        "Data1": "DeleteCollection",
        "Data2": "00000000-0000-0000-0000-000000000000",
        "CreateInBottomPanel": false,
        "CanShowAsPageButton": false,
        "CanHideInCompactView": false
      }
    }
  ]
}
26 minutes ago, softworkz said:

Why not just use a multi-select element like this?

 

I am?  But I still need to generate the items for the list from the GetVirtual thing.
image.png.9bb1da17a7c8c9764173ce562c5ff318.pngimage.thumb.png.b9d1f167a47d5e35ed041415a47e5eeb.png

Link to comment
Share on other sites

11 minutes ago, bakes82 said:

, but data is the ENTIRE Plugin data object, so if I have 10 objects in the collection I see 10x:  EX

The Data2 value is provided as itemId:

image.png.b02ba1830d74114250e802488ac23997.png

 

You (almost) never need to use the data parameter, because at this point, your typed data object (this.ContentData as YourUiClass) has already been updated to reflect the client state.

Link to comment
Share on other sites

4 minutes ago, softworkz said:

The Data2 value is provided as itemId

Makes 0 sense lol …..  but I’ll give it a try.  And for generating the items. Should I do in the ctor of the eo class or pass it from the plugin?

Link to comment
Share on other sites

2 minutes ago, bakes82 said:

Makes 0 sense lol …..  but I’ll give it a try.  

Granted! Sorry for the confusion..

 

2 minutes ago, bakes82 said:

And for generating the items. Should I do in the ctor of the eo class or pass it from the plugin?

I'd need to see the full code in order to make a good suggestion. 

What I usually do is to keep everything UI related in the UI class, which means for example, I would add a method like

BuildLibrarySelectList(IList<BaseItem> libraries)

to the UI class which creates a list of EditorSelectOption items.

For retrieving the list or library items from Emby SDK Reference: ILibraryManager , you might want to do that at an earlier point in time, because you can't make async calls in a constructor.

Link to comment
Share on other sites

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