Jump to content

Help First Emby Plugin Development Issues


Recommended Posts

bwarthen
Posted (edited)

I'm working on my first plugin for Emby.  I'm working on a multiple channel plugin that will pull in the similar items to the last 3 things you watched.

On initial load everything is working as expected but after I rerun the "Refresh Internet Channels" Job all the libraries contain the same thing.  How can I fix this?  

Screenshot 2024-05-26 095320.png

Edited by bwarthen
Posted

HI, yes that is odd. Do all of those entries have accurate data for things like genres, cast members, studios, external ids, etc?

bwarthen
Posted

Yes the data is there and accurate.  When I try to go into a library though it never loads.

Screenshot 2024-05-27 093731.png

Posted

What never loads?

bwarthen
Posted

When you click to go into the library to view everything inside.  Nothing ever loads.

 

Posted

Screenshot example of that?

bwarthen
Posted

Here is all that loads.  

Screenshot 2024-05-28 094208.png

Posted

And the server log from when that happens?

bwarthen
Posted

Ok I've figured something out.  I has to do with the dynamic channel name "Because you watched Movie x".  I have narrowed it to just 2 channels 1 for movies and 1 for Series.  With a static name the content comes in fine after multiple refreshes.  My next question would be for Series.  Is there a way to pull the Series folder and the episodes under it?

 

Posted
Quote

I has to do with the dynamic channel name

Hi, what do you mean? What exactly is dynamic?

bwarthen
Posted

I mean that I'm making the names based off of which movies or shows have been watched the last 3 of each to be precise and when I set the name the way I was the result was a mixture of shows and movies as seen in my screenshot.  I've figured that part out I believe but I need to figure out how to display tv series with the episodes that belong to that series.

Posted

You mean the name of the entire channel? If so, that's never been done before so I'm not sure if that will be a problem or not. But you can do that for content underneath the channel.

bwarthen
Posted

Can someone supply some sample code on how I would get the series/seasons to display like show and a number for unwatched episodes like a tv show library?  I know it has something to do with using folder at the series level then same for season level and finally listing out the episodes.  Any time I'm using folder though it just never finished the internet channel refresh.  Any help on this would be greatly appreciated.  The alternative would be to copy and create a new library then delete that library when I refresh the channels.  I definitely don't want to do that workaround.

 

bakes82
Posted

Are you using your media as the source. If so you will have duplicate database entries to worry about.  If I recall the “names” are also only set on server load, but it’s been a few since I worked with channels because of the db duplication.  In order to show series -> seasons -> episodes you need to handle it in the getchannelitems. The method gets called for each level so you need to handle the logic for series, then it called the method again when you click the series so you need to show all the seasons, when you click a season you then need to return all the episodes.

when using the items on your server as the source you need to also get the currents in the channel so you don’t readd the same items becuse channel items will be returned back as part of the dataset. You should also cache the return items per level so you’re not querying the db constantly. 
 

you’re better off just putting the items in a collection and hoping they allow pinning them to the Home Screen. They said it was “coming” but that’s been a year or so now so you know how that goes.

bwarthen
Posted

I've decide to just create new libraries with steam files.  Just have to go through and figure out how to create the libraries through code.  Just haven't had a lot of time lately.  

  • Thanks 1
Posted

Thanks for following up.

bwarthen
Posted

Would it be possible to trigger a scheduled task on items being marked as played?

 

Posted

There is no task trigger for that but you could listen for events and then do your own operations.

bwarthen
Posted

Thanks for the reply.  That is what I will do then.

 

  • Thanks 1
  • 3 weeks later...
bwarthen
Posted

Finally got the chance to work on this again and I have one thing left to get ironed out I believe.

I have a code snippet that I believe should be granting access to the newly created libraries.  However that doesn't seem to be happening.

        public void grantUserAccess(User user)
        {

            user.Policy.EnableAllFolders = false;
            var enabledFolders = user.Policy.EnabledFolders != null ? user.Policy.EnabledFolders.ToList() : new List<string>();
            var libraries = LibraryManager.GetItemList(new InternalItemsQuery
            {
                NameStartsWith = "Because You Watched",
            });
            foreach(var library in libraries)
            {
                enabledFolders.Add(library.Id.ToString().Replace("-",string.Empty));
            }
            user.Policy.EnabledFolders = enabledFolders.ToArray();
            UserManager.UpdateUser(user);
        }

I've stepped through the code and the folder guid is being added to the list but still not granting access to the user.  I also looked at the logs and there is nothing there that I can see but I've attached them just in case.  I'm probably missing something simple here.  Please point me in the right direction.

embyserver (1).txt

Posted

Hi, try using UpdateUserPolicy instead of UpdateUser. 

  • 4 weeks later...
bwarthen
Posted

I am very close to having this plugin ready for prime time.  I've been testing for some time locally and working out any bugs that come up.  I see that I need some credentials to include the plugin in the catalogue.  Would I do that here or some other location?

Posted
1 hour ago, bwarthen said:

I am very close to having this plugin ready for prime time.  I've been testing for some time locally and working out any bugs that come up.  I see that I need some credentials to include the plugin in the catalogue.  Would I do that here or some other location?

Hi.  Before making a plug-in available in the catalog, we like to have you publish it in the forum to garner interest from users and do some initial testing.  You can create a thread in the Plugins forum to do this.

Thanks.

bwarthen
Posted

Great that sounds good when I have it ready for prime time I will do that.

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