Skip to content

Commit

Permalink
Improved a channel matching rule
Browse files Browse the repository at this point in the history
  • Loading branch information
hmlendea committed Feb 9, 2020
1 parent f11a9c3 commit 5db4470
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Service/ChannelMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public sealed class ChannelMatcher : IChannelMatcher
static readonly IDictionary<string, string> TextReplacements = new Dictionary<string, string>
{
{ "RUMANIA", "Romania" },
{ "^Romania[\"\\|:]", "RO:" },
{ "^[\\|\":]* *Romania *[\"\\|:]", "RO:" },

{ "^[\\|\":]*([A-Z][A-Z])[\\|\":] *", "$1:" },
{ "^[\\|\":]* *([A-Z][A-Z]) *[\\|\":] *", "$1:" },
{ "^([A-Z][A-Z]): *(.*) \\1$", "$1: $2" },

{ " HEVC$", "" },
Expand Down
3 changes: 3 additions & 0 deletions UnitTests/Service/ChannelMatcherTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void SetUp()
[TestCase("Digi Sport 2", "RO: Digi Sport 2", "RO: DIGI Sport 2")]
[TestCase("Digi World", "RO: Digi World FHD", "RUMANIA: DigiWorld FHD (Opt-1)")]
[TestCase("Golf Channel", "FR: Golf Channel", "|FR| GOLF CHANNEL FHD")]
[TestCase("MTV Europe", null, "RO: MTV Europe")]
[TestCase("Realitatea Plus", null, "Realitatea Plus")]
[TestCase("România TV", "România TV", "RO\" Romania TV")]
[TestCase("Somax", "RO: Somax TV", "Somax TV")]
Expand Down Expand Up @@ -72,8 +73,10 @@ public void DoesMatch_CompareWithDifferentValue_ReturnsFalse()
[TestCase("|RO| Ardeal TV", "ARDEALTV")]
[TestCase("|ROM|: Cromtel", "CROMTEL")]
[TestCase("|UK| CHELSEA TV (Live On Matches) HD", "UKCHELSEATV")]
[TestCase("RO \" DIGI SPORT 1 HD RO", "DIGISPORT1")]
[TestCase("RO: Animal World [768p]", "ANIMALWORLD")]
[TestCase("RO: Bit TV (ROM)", "BITTV")]
[TestCase("RO: HBO 3 RO", "HBO3")]
[TestCase("RO: HBO HD RO", "HBO")]
[TestCase("RO: Nașul TV (New!)", "NASULTV")]
[TestCase("RO: U TV S1-1", "UTV")]
Expand Down

0 comments on commit 5db4470

Please sign in to comment.