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 2
Plugin Development
Mediasite Plugin For MediaPortal
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="Vic Demented" data-source="post: 992243" data-attributes="member: 137971"><p>Ok @<a href="https://forum.team-mediaportal.com/members/morpheus_xx.48495/" target="_blank">morpheus_xx</a> here are my latest changes:</p><p> </p><p>Fist, I added a new XML document to store the category definitions (I am sure this will change once we give the users the ability to create these categories via the UI).</p><p> </p><p>[CODE=XML]<?xml version="1.0" encoding="utf-8" ?></p><p><Categories></p><p> <Category Name="Math" IconPath="http://files.softicons.com/download/system-icons/windows-8-metro-icons-by-dakirby309/png/512x512/Applications/Calculator.png" BannerPath="http://www.math.siu.edu/Images/chalkboardheader.jpg" KeyWord="Math"/></p><p> <Category Name="Physics" IconPath="http://www.engr.ku.edu/departments/dept_icons/physx_icon_sm.png" BannerPath="http://www.science.uq.edu.au/images/careers/header-physics.jpg" KeyWord="Physics" /></p><p> <Category Name="Chemistry" IconPath="http://cyfallshs.com/wp-content/uploads/119768-matte-grey-square-icon-signs-love-potion.png" BannerPath="http://www.oliveoilsource.com/files/category_pictures/Olive_Chem_header.jpg" KeyWord="Chemistry" /></p><p></Categories>[/CODE]</p><p> </p><p>Next I created a new struct that holds the presentationdetails[] as well as the new attributes from the XML:</p><p> </p><p>[CODE=C#] public struct CategoryCollection</p><p> {</p><p> public string CategoryName;</p><p> public string IconPath;</p><p> public string BannerPath;</p><p> public PresentationDetails[] Presentations;</p><p> </p><p> }[/CODE]</p><p> </p><p>Next I created a new Load method that loads the Collection based on the categories stored in the XML.</p><p> </p><p>[CODE=C#] /// <summary></p><p> /// Populates object with array of presentations where the value of the key "CategoryName" = value</p><p> /// </summary></p><p> public void LoadCategoryCollection()</p><p> {</p><p> XPathDocument document = new XPathDocument(@"Plugins\mediasitePlugin\CategoryDefinition.xml");</p><p> XPathNavigator navigator = document.CreateNavigator();</p><p> XPathNodeIterator nodes = navigator.Select("/Categories/Category");</p><p> </p><p> foreach (XPathNavigator item in nodes)</p><p> {</p><p> var _name = item.GetAttribute("Name", "");</p><p> var _iconPath = item.GetAttribute("IconPath", "");</p><p> var _bannerPath = item.GetAttribute("BannerPath", "");</p><p> </p><p> CategoryCollection _collection = new CategoryCollection();</p><p> _collection.CategoryName = _name;</p><p> _collection.IconPath = _iconPath;</p><p> _collection.BannerPath = _bannerPath;</p><p> </p><p> var _pResponse = _client.QueryMediasiteKeyValuesByCriteria(new QueryMediasiteKeyValuesByCriteriaRequest() { Key = "CategoryName", Value = _collection.CategoryName, Ticket = _requestTicket, ApplicationName = _applicationName });</p><p> </p><p> List<PresentationDetails> _tPresList = new List<PresentationDetails>();</p><p> if (_pResponse.KeyValues.Length > 0)</p><p> {</p><p> string[] pIDList = new string[_pResponse.KeyValues.Length];</p><p> </p><p> for (int i = 0; i < _pResponse.KeyValues.Length; i++)</p><p> {</p><p> pIDList[i] = _pResponse.KeyValues[i].Id;</p><p> }</p><p> var tpresentations = _client.QueryPresentationsById(new QueryPresentationsByIdRequest() { PresentationIdList = pIDList, ApplicationName = _applicationName, Ticket = _requestTicket, IncludeKeyValues = true });</p><p> if (tpresentations.Presentations != null)</p><p> {</p><p> foreach (PresentationDetails _pres in tpresentations.Presentations)</p><p> {</p><p> _pres.VideoUrl = _pres.VideoUrl.Replace("$$NAME$$", GetMP4Content(_pres.Content).FileNameWithExtension).Replace("$$PBT$$", CreateAuthTicket(_pres.Id)).Replace("$$SITE$$", _sofoSite);</p><p> }</p><p> </p><p> </p><p> _collection.Presentations = tpresentations.Presentations;</p><p> _categories.Add(_collection);</p><p> }</p><p> </p><p> }</p><p> }</p><p> }[/CODE]</p><p> </p><p>The presenter image url is accessible via the presenters array attached to the presentation object (Presentation.Presenters[0].ImageUrl). There can be more than one presenter, but you can just use the first one in the array.</p><p> </p><p>I also modified your code to call the new method, however I am sure that will change when you design the new workflow...</p></blockquote><p></p>
[QUOTE="Vic Demented, post: 992243, member: 137971"] Ok @[URL='https://forum.team-mediaportal.com/members/morpheus_xx.48495/']morpheus_xx[/URL] here are my latest changes: Fist, I added a new XML document to store the category definitions (I am sure this will change once we give the users the ability to create these categories via the UI). [CODE=XML]<?xml version="1.0" encoding="utf-8" ?> <Categories> <Category Name="Math" IconPath="http://files.softicons.com/download/system-icons/windows-8-metro-icons-by-dakirby309/png/512x512/Applications/Calculator.png" BannerPath="http://www.math.siu.edu/Images/chalkboardheader.jpg" KeyWord="Math"/> <Category Name="Physics" IconPath="http://www.engr.ku.edu/departments/dept_icons/physx_icon_sm.png" BannerPath="http://www.science.uq.edu.au/images/careers/header-physics.jpg" KeyWord="Physics" /> <Category Name="Chemistry" IconPath="http://cyfallshs.com/wp-content/uploads/119768-matte-grey-square-icon-signs-love-potion.png" BannerPath="http://www.oliveoilsource.com/files/category_pictures/Olive_Chem_header.jpg" KeyWord="Chemistry" /> </Categories>[/CODE] Next I created a new struct that holds the presentationdetails[] as well as the new attributes from the XML: [CODE=C#] public struct CategoryCollection { public string CategoryName; public string IconPath; public string BannerPath; public PresentationDetails[] Presentations; }[/CODE] Next I created a new Load method that loads the Collection based on the categories stored in the XML. [CODE=C#] /// <summary> /// Populates object with array of presentations where the value of the key "CategoryName" = value /// </summary> public void LoadCategoryCollection() { XPathDocument document = new XPathDocument(@"Plugins\mediasitePlugin\CategoryDefinition.xml"); XPathNavigator navigator = document.CreateNavigator(); XPathNodeIterator nodes = navigator.Select("/Categories/Category"); foreach (XPathNavigator item in nodes) { var _name = item.GetAttribute("Name", ""); var _iconPath = item.GetAttribute("IconPath", ""); var _bannerPath = item.GetAttribute("BannerPath", ""); CategoryCollection _collection = new CategoryCollection(); _collection.CategoryName = _name; _collection.IconPath = _iconPath; _collection.BannerPath = _bannerPath; var _pResponse = _client.QueryMediasiteKeyValuesByCriteria(new QueryMediasiteKeyValuesByCriteriaRequest() { Key = "CategoryName", Value = _collection.CategoryName, Ticket = _requestTicket, ApplicationName = _applicationName }); List<PresentationDetails> _tPresList = new List<PresentationDetails>(); if (_pResponse.KeyValues.Length > 0) { string[] pIDList = new string[_pResponse.KeyValues.Length]; for (int i = 0; i < _pResponse.KeyValues.Length; i++) { pIDList[i] = _pResponse.KeyValues[i].Id; } var tpresentations = _client.QueryPresentationsById(new QueryPresentationsByIdRequest() { PresentationIdList = pIDList, ApplicationName = _applicationName, Ticket = _requestTicket, IncludeKeyValues = true }); if (tpresentations.Presentations != null) { foreach (PresentationDetails _pres in tpresentations.Presentations) { _pres.VideoUrl = _pres.VideoUrl.Replace("$$NAME$$", GetMP4Content(_pres.Content).FileNameWithExtension).Replace("$$PBT$$", CreateAuthTicket(_pres.Id)).Replace("$$SITE$$", _sofoSite); } _collection.Presentations = tpresentations.Presentations; _categories.Add(_collection); } } } }[/CODE] The presenter image url is accessible via the presenters array attached to the presentation object (Presentation.Presenters[0].ImageUrl). There can be more than one presenter, but you can just use the first one in the array. I also modified your code to call the new method, however I am sure that will change when you design the new workflow... [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Plugin Development
Mediasite Plugin For MediaPortal
Contact us
RSS
Top
Bottom