home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
OnlineVideos
OnlineVideos JSON parsing
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="howudodat" data-source="post: 1186785" data-attributes="member: 46799"><p>ok, I am getting further along. I can get the main categories (and add my static category for language) but when I select one of the categories, I get "No videos" error message in MP.</p><p>I have confirmed that Settings.Categories[category].SubCategories contains the sub categories (12 are found) and that HasSubCategories is true</p><p>[code] public override int DiscoverDynamicCategories()</p><p> {</p><p> Settings.Categories.Clear();</p><p></p><p> JObject jo = GetWebData<JObject>(sBaseUrl + sLanguage);</p><p> JArray jo2 = (JArray)jo["categories"];</p><p> foreach (JObject jEntry in jo2)</p><p> {</p><p> JArray jTags = jEntry.Value<JArray>("tags");</p><p> bool bAdd = true;</p><p> foreach (string sEntry in jTags)</p><p> {</p><p> if (sEntry.Equals("WebExclude"))</p><p> {</p><p> bAdd = false;</p><p> break;</p><p> }</p><p> }</p><p> if (bAdd)</p><p> {</p><p> Category cat = new Category();</p><p> cat.Name = jEntry.Value<string>("name");</p><p> cat.Description = jEntry.Value<string>("description");</p><p> cat.Other = jEntry.Value<string>("key");</p><p> Settings.Categories.Add(cat);</p><p> }</p><p></p><p></p><p> }</p><p> Settings.Categories.Add(new Category()</p><p> {</p><p> Name = "Language",</p><p> Description = "Change Language"</p><p> });</p><p> Settings.DynamicCategoriesDiscovered = Settings.Categories.Count > 0;</p><p> return Settings.Categories.Count;</p><p> }</p><p> public override int DiscoverSubCategories(Category parentCategory)</p><p> {</p><p> JObject jo = GetWebData<JObject>(sBaseUrl + sLanguage + "/" + parentCategory.Other + "?&detailed=1");</p><p> JObject jo1 = (JObject)jo["category"];</p><p> if (jo1["subcategories"].HasValues)</p><p> {</p><p> List<Category> cats = new List<Category>();</p><p> JArray jEntries = (JArray)jo1["subcategories"];</p><p> foreach (JObject jEntry in jEntries)</p><p> {</p><p> bool bAdd = true;</p><p> if (bAdd)</p><p> {</p><p> Category cat = new Category();</p><p> cat.Name = jEntry.Value<string>("name");</p><p> cat.Description = jEntry.Value<string>("description");</p><p> cat.Other = jEntry.Value<string>("key");</p><p> cat.ParentCategory = parentCategory;</p><p> cats.Add(cat);</p><p> }</p><p> }</p><p> parentCategory.HasSubCategories = true;</p><p> parentCategory.SubCategories = cats;</p><p> parentCategory.SubCategoriesDiscovered = true;</p><p> }</p><p> return parentCategory.SubCategories.Count;</p><p> }</p><p> }[/code]</p><p></p><p>PS. I know I have some superfluous code (unneeded variables, but they are there for debugging)</p></blockquote><p></p>
[QUOTE="howudodat, post: 1186785, member: 46799"] ok, I am getting further along. I can get the main categories (and add my static category for language) but when I select one of the categories, I get "No videos" error message in MP. I have confirmed that Settings.Categories[category].SubCategories contains the sub categories (12 are found) and that HasSubCategories is true [code] public override int DiscoverDynamicCategories() { Settings.Categories.Clear(); JObject jo = GetWebData<JObject>(sBaseUrl + sLanguage); JArray jo2 = (JArray)jo["categories"]; foreach (JObject jEntry in jo2) { JArray jTags = jEntry.Value<JArray>("tags"); bool bAdd = true; foreach (string sEntry in jTags) { if (sEntry.Equals("WebExclude")) { bAdd = false; break; } } if (bAdd) { Category cat = new Category(); cat.Name = jEntry.Value<string>("name"); cat.Description = jEntry.Value<string>("description"); cat.Other = jEntry.Value<string>("key"); Settings.Categories.Add(cat); } } Settings.Categories.Add(new Category() { Name = "Language", Description = "Change Language" }); Settings.DynamicCategoriesDiscovered = Settings.Categories.Count > 0; return Settings.Categories.Count; } public override int DiscoverSubCategories(Category parentCategory) { JObject jo = GetWebData<JObject>(sBaseUrl + sLanguage + "/" + parentCategory.Other + "?&detailed=1"); JObject jo1 = (JObject)jo["category"]; if (jo1["subcategories"].HasValues) { List<Category> cats = new List<Category>(); JArray jEntries = (JArray)jo1["subcategories"]; foreach (JObject jEntry in jEntries) { bool bAdd = true; if (bAdd) { Category cat = new Category(); cat.Name = jEntry.Value<string>("name"); cat.Description = jEntry.Value<string>("description"); cat.Other = jEntry.Value<string>("key"); cat.ParentCategory = parentCategory; cats.Add(cat); } } parentCategory.HasSubCategories = true; parentCategory.SubCategories = cats; parentCategory.SubCategoriesDiscovered = true; } return parentCategory.SubCategories.Count; } }[/code] PS. I know I have some superfluous code (unneeded variables, but they are there for debugging) [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
OnlineVideos
OnlineVideos JSON parsing
Contact us
RSS
Top
Bottom