KingOfSat.cs
changeset 4 8372aa8d6292
parent 3 01a00603ec28
child 5 29ccfbf98e54
     1.1 --- a/KingOfSat.cs	Fri May 15 17:28:51 2015 +0200
     1.2 +++ b/KingOfSat.cs	Fri May 15 22:41:33 2015 +0200
     1.3 @@ -65,7 +65,7 @@
     1.4  				common.Bitrate = WebUtility.HtmlDecode(frq.Cq().Find("tbody > tr > td:nth-child(10)").Get(0).InnerText);
     1.5  				if (common.Bitrate.Substring(0, ", ".Length) == ", ")
     1.6  				{
     1.7 -					common.Bitrate = common.Bitrate.Substring(", ".Length, common.Bitrate.Length - ", ".Length);
     1.8 +				  common.Bitrate = common.Bitrate.Substring(", ".Length, common.Bitrate.Length - ", ".Length);
     1.9  				}
    1.10  				//
    1.11  				common.NetworkID = WebUtility.HtmlDecode(frq.Cq().Find("tbody > tr > td:nth-child(11)").Get(0).InnerText);
    1.12 @@ -109,6 +109,9 @@
    1.13  						continue;
    1.14  					}
    1.15  
    1.16 +          //Make sure our channel name looks descent
    1.17 +          channel.Name = CleanChannelName(channel.Name);
    1.18 +
    1.19  					//So we have a channel name get the other properties then
    1.20  					channel.Country = WebUtility.HtmlDecode(row.Cq().Find("td:nth-child(4)").Get(0).InnerText).Trim();
    1.21  					channel.Category = WebUtility.HtmlDecode(row.Cq().Find("td:nth-child(5)").Get(0).InnerText).Trim();
    1.22 @@ -131,5 +134,23 @@
    1.23  
    1.24  			return channels;
    1.25  		}
    1.26 +
    1.27 +    //
    1.28 +    public static string CleanChannelName(string aName)
    1.29 +    {
    1.30 +      aName.Trim();
    1.31 +      string[] remove = { "Germany", "Deutschland", "(Germany)", "(Deutschland)" };
    1.32 +
    1.33 +      foreach (string item in remove)
    1.34 +      {
    1.35 +        if (aName.EndsWith(item))
    1.36 +        {
    1.37 +          aName = aName.Substring(0, aName.LastIndexOf(item));
    1.38 +          break; //only allow one match at most
    1.39 +        }
    1.40 +      }
    1.41 +      aName.Trim();
    1.42 +      return aName;
    1.43 +    }
    1.44  	}
    1.45  }