chef 3750 Posted March 11, 2017 Share Posted March 11, 2017 In my plugin I need to get the Latest Episode added to the library for a Series. Weather it's been played by a user or not. (Strange I know...) Is there an easy way, I might be missing, to get it without using Date Created, with the InternalItemQuery? Thanks guys, it's holding me up, and I'm confused... again. Link to comment Share on other sites More sharing options...
Luke 37272 Posted March 11, 2017 Share Posted March 11, 2017 What have you tried? Link to comment Share on other sites More sharing options...
chef 3750 Posted March 11, 2017 Author Share Posted March 11, 2017 (edited) This is what I've just come up with. Not completely tested yet. logger.Info("TV TITLE " + " Big Bang Theory"); var result = libraryManager.GetItemIds(new InternalItemsQuery { Name = " Big Bang Theory", IncludeItemTypes = new[] { "Series" }, }); if (!result.Any()) { logger.Info("Inital search for " + " Big Bang Theory" + " had no results."); logger.Info("Starting result search for closest comparison: " + "Big Bang Theory"); result = libraryManager.GetItemIds(new InternalItemsQuery { NameContains = "Big Bang Theory" IncludeItemTypes = new[] { "Series" }, }); } // Hard coding User Name for now until it works. var episodes = new MediaBrowser.Model.Querying.LatestItemsQuery { UserId = userManager.GetUserByName("Admin").Id, IncludeItemTypes = new [] {"Episodes"}, ParentId = result.FirstOrDefault().ToString() }; // Client is the IApiClient Interface object var test = Client.GetLatestItems(episodes); var thisShouldBeTheItemIWant = libraryManager.GetItemById(test.Result.FirstOrDefault().Id); This might work. I haven't used the IApiClient object in a plugin before. Plus it becomes user defined once the Recent items are requested.Ah.... Edited March 11, 2017 by chef Link to comment Share on other sites More sharing options...
Luke 37272 Posted March 11, 2017 Share Posted March 11, 2017 In the first query why do you have the leading space? Link to comment Share on other sites More sharing options...
chef 3750 Posted March 11, 2017 Author Share Posted March 11, 2017 In the first query why do you have the leading space? Not on purpose. I had cut and pasted the series name throughout the code for testing. It originally had been a variable string which is passed into the function. Link to comment Share on other sites More sharing options...
Luke 37272 Posted March 12, 2017 Share Posted March 12, 2017 once you have the series object, try calling GetEpisodes() Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now