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
Development
Submit: Movie Info Grabbers
Fix to "IMDB with AKA grabber"
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="NightOwl69" data-source="post: 632531" data-attributes="member: 56014"><p><img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" /> for all your hard work Deda.</p><p></p><p>I personally didn't want all the countries ratings but thanks to your rewrite it showed me how I could get just my country's rating which is what I've wanted for a long time. So <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" /> again.</p><p></p><p>Here's my code just in case anyone else wants to do the same...</p><p></p><p>Replace the existing code to get the rating with the following in the GetDetails method in IMDB.csscript.</p><p></p><p>[CODE] movieDetails.MPARating = GetCert(url.URL);[/CODE]</p><p></p><p>Add the following methods to IMDB.csscript.</p><p></p><p>[CODE] private string GetCountryName()</p><p> {</p><p> //One day I should write this so it gets the system's country name according to regional settings;</p><p> return "Australia";</p><p> }</p><p></p><p> private string GetCountryCode()</p><p> {</p><p> //One day I should write this so it gets the system's country code according to regional settings;</p><p> return "au";</p><p> }</p><p></p><p> private string GetCert(string strURL)</p><p> {</p><p></p><p> // ***Grab My Country's Rating***</p><p> // Example of the HTML we're looking for:</p><p> // <a href="/search/title?certificates=au|ma">Australia:MA</a></p><p></p><p> string strReturn = "";</p><p></p><p> // Get system's country values</p><p> string strMyCountryName = GetCountryName();</p><p> string strMyCountryCode = GetCountryCode();</p><p></p><p> string strAbsURL = "";</p><p></p><p> // Get the parental advisory page</p><p> string strBody = GetPage(strURL + "parentalguide#certification", "utf-8", out strAbsURL);</p><p></p><p> // Get my country's rating address element</p><p> string strCertBlock = "<a\\shref=\"/search/title\\?certificates=" + strMyCountryCode + ".*?</a>";</p><p> Match mCert = Regex.Match(HttpUtility.HtmlDecode(strBody), strCertBlock, RegexOptions.Singleline);</p><p></p><p> // Strip out the html, country name, and delimiter to leave just the rating</p><p> string strCert = MediaPortal.Util.Utils.stripHTMLtags(mCert.Value);</p><p> int iRatingStart = strCert.IndexOf(strMyCountryName);</p><p> if (iRatingStart >= 0)</p><p> {</p><p> iRatingStart += strMyCountryName.Length + 1;</p><p> int iRatingEnd = strCert.Length;</p><p> if (iRatingEnd > 0)</p><p> {</p><p> strReturn = strCert.Substring(iRatingStart, iRatingEnd - iRatingStart);</p><p> }</p><p> }</p><p> return strReturn;</p><p> }[/CODE]</p><p></p><p>Change GetCountryName and GetCountryCode to return your country's values and test it out. If you have any probs make sure your country values match the values used on IMDB's parental advisory page.</p></blockquote><p></p>
[QUOTE="NightOwl69, post: 632531, member: 56014"] :thx: for all your hard work Deda. I personally didn't want all the countries ratings but thanks to your rewrite it showed me how I could get just my country's rating which is what I've wanted for a long time. So :thx: again. Here's my code just in case anyone else wants to do the same... Replace the existing code to get the rating with the following in the GetDetails method in IMDB.csscript. [CODE] movieDetails.MPARating = GetCert(url.URL);[/CODE] Add the following methods to IMDB.csscript. [CODE] private string GetCountryName() { //One day I should write this so it gets the system's country name according to regional settings; return "Australia"; } private string GetCountryCode() { //One day I should write this so it gets the system's country code according to regional settings; return "au"; } private string GetCert(string strURL) { // ***Grab My Country's Rating*** // Example of the HTML we're looking for: // <a href="/search/title?certificates=au|ma">Australia:MA</a> string strReturn = ""; // Get system's country values string strMyCountryName = GetCountryName(); string strMyCountryCode = GetCountryCode(); string strAbsURL = ""; // Get the parental advisory page string strBody = GetPage(strURL + "parentalguide#certification", "utf-8", out strAbsURL); // Get my country's rating address element string strCertBlock = "<a\\shref=\"/search/title\\?certificates=" + strMyCountryCode + ".*?</a>"; Match mCert = Regex.Match(HttpUtility.HtmlDecode(strBody), strCertBlock, RegexOptions.Singleline); // Strip out the html, country name, and delimiter to leave just the rating string strCert = MediaPortal.Util.Utils.stripHTMLtags(mCert.Value); int iRatingStart = strCert.IndexOf(strMyCountryName); if (iRatingStart >= 0) { iRatingStart += strMyCountryName.Length + 1; int iRatingEnd = strCert.Length; if (iRatingEnd > 0) { strReturn = strCert.Substring(iRatingStart, iRatingEnd - iRatingStart); } } return strReturn; }[/CODE] Change GetCountryName and GetCountryCode to return your country's values and test it out. If you have any probs make sure your country values match the values used on IMDB's parental advisory page. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
Submit: Movie Info Grabbers
Fix to "IMDB with AKA grabber"
Contact us
RSS
Top
Bottom