From: <nor...@us...> - 2007-06-12 23:05:08
|
Revision: 527 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=527&view=rev Author: northern_sky Date: 2007-06-12 16:05:03 -0700 (Tue, 12 Jun 2007) Log Message: ----------- genrebug fixed Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/AllGameScraper.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/AllGameScraper.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/AllGameScraper.cs 2007-06-12 22:59:18 UTC (rev 526) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/AllGameScraper.cs 2007-06-12 23:05:03 UTC (rev 527) @@ -169,12 +169,12 @@ match = Regex.Match(tableData[4], regexpYear, RegexOptions.IgnoreCase); newGame.Year = match.Groups["year"].Value; - match = Regex.Match(tableData[5], regexpGameStyle, RegexOptions.IgnoreCase); - newGame.Style = match.Groups["style"].Value; - - match = Regex.Match(tableData[6], regexpGenre, RegexOptions.IgnoreCase); + match = Regex.Match(tableData[5], regexpGenre, RegexOptions.IgnoreCase); newGame.MainGenre = match.Groups["genre"].Value; + match = Regex.Match(tableData[6], regexpGameStyle, RegexOptions.IgnoreCase); + newGame.SubGenre = match.Groups["style"].Value; + match = Regex.Match(tableData[7], regexpPlatform, RegexOptions.IgnoreCase); newGame.Platform = match.Groups["platform"].Value; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-06-27 21:50:42
|
Revision: 645 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=645&view=rev Author: northern_sky Date: 2007-06-27 14:50:31 -0700 (Wed, 27 Jun 2007) Log Message: ----------- fixed " and rating. Adda basic lexicon method for htmlconvert char that we will fill with some more later Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/AllGameScraper.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/AllGameScraper.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/AllGameScraper.cs 2007-06-27 15:10:29 UTC (rev 644) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/AllGameScraper.cs 2007-06-27 21:50:31 UTC (rev 645) @@ -48,10 +48,10 @@ #region Variables List<FileItemInfo> gameList = new List<FileItemInfo>(); //list of games - + string allGameUrlStart = "http://www.allgame.com/cg/agg.dll"; //first part of url string allGameUrlEnd = "P=agg&opt1=31&sql="; - + string regexpTableRow = @"((<tr\sclass=""visible""\sid=""trlink"").*?</tr>)"; string regexpTableCell = @"<td\s.*?</td>"; string regexpRelevance = @"width:(?<relevance>\d+)p"; @@ -61,7 +61,8 @@ string regexpGameStyle = @">(?<style>.*?)<"; string regexpGenre = @">(?<genre>.*?)<"; string regexpPlatform = @">(?<platform>.*?)<"; - string regexpRating = @"st_r(?<rating>\d)"; + //string regexpRating = @"st_r(?<rating>\d)"; + string regexpRating = @"title="""+@"(?<rating>((\d\.\d)|(\d)))"; string regexpDeveloper = @"(developer).*?<a(.*?)>(?<developer>.*?)</a>"; string regexpBoxart = @"http://166.90.203.162/00/agg/cov200/.*?jpg"; string regexpSynopsis = @"synopsis.*?<p>(?<synopsis>.*?)</p>"; @@ -129,7 +130,7 @@ while (match.Success) { - tableCell[z] = match.Value; + tableCell[z] = ConvertHtmlSpecialChar(match.Value); z++; match = match.NextMatch(); } @@ -181,6 +182,21 @@ match = Regex.Match(tableData[8], regexpRating, RegexOptions.IgnoreCase); newGame.RatingOrig = match.Groups["rating"].Value; + //the rating can be 0-5 , but also in halfstepmodes... so to fit into old model + //with 10 rating and no decimals, we just double the value. + + if (newGame.RatingOrig != "") + { + newGame.RatingOrig = (newGame.RatingOrig).Replace('.', ','); + } + else + { + newGame.RatingOrig = "0"; + } + + newGame.RatingNorm = (int)(Convert.ToDouble(newGame.RatingOrig) * 2); + + newGame.RelevanceNorm = (ProgramUtils.StringToInteger(newGame.RelevanceOrig, -1) + 44); gameList.Add(newGame); @@ -264,6 +280,26 @@ #region Private Methods + /// <summary> + /// Supposed to be an ever growing lexicon for replacing html special chars.. + /// Fill out this methtod as needed. + /// </summary> + /// <param name="inputString"></param> + /// <param name="outputString"></param> + /// <returns></returns> + private string ConvertHtmlSpecialChar(string inputString) + { + + //" + inputString = Regex.Replace(inputString, """, "\""); + + //& + inputString = Regex.Replace(inputString, "&", "&"); + //..add some more if needed... + return inputString; + } + + private string PostHTTP(string strURL, string strData) { string page = string.Empty; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |