Skip to content

Commit

Permalink
Merge pull request #46 from hmlendea/dev
Browse files Browse the repository at this point in the history
Improved channel matching
  • Loading branch information
hmlendea authored Oct 5, 2020
2 parents f87bd30 + 9ebcd4c commit 414d069
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Service/ChannelMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public sealed class ChannelMatcher : IChannelMatcher
{
{ "[\\(\\[]]*([Aa]uto|[Bb]ackup|[Ll]ive [Oo]n [Mm]atches|[Mm]ulti-*[Aa]udio|[Mm]ulti-*[Ss]ub|[Nn]ew!*|[Oo]n-[Dd]emand)[\\)\\]]*", "" },
{ "[ _\\|\\[\\(\\]\\)\".:-](Ultra|[FU])*_*[HMS][DQ]", "" },
{ "4[Kk]\\+*", "" },

{ "^[\\|\\[\\(\\]\\)\".:-]* *([A-Z][A-Z]) *[\\|\\[\\(\\]\\)\".:-] *", "$1:" },
{ "^([A-Z][A-Z]): *(.*) \\(*\\1\\)*$", "$1: $2" },
Expand All @@ -31,6 +32,7 @@ public sealed class ChannelMatcher : IChannelMatcher
{ "^((?!RO).*) *Moldova$", "MD: $1" },
{ "(.*) *\\(Moldova\\)$", "MD: $1" },
{ "(.*) *\\(Romania\\)$", "RO: $1" },
{ "(.*) *\\((RO|MD)\\)$", "$2: $1" },
{ "^RO *[\\|\\[\\(\\]\\)\".:-] *(.*) *\\(*Romania\\)*$", "RO: $1" },

{ "^[\\|\\[\\(\\]\\)\".:-]* *Romania *[\\|\\[\\(\\]\\)\".:-]", "RO:" },
Expand All @@ -44,6 +46,7 @@ public sealed class ChannelMatcher : IChannelMatcher
{ " HEVC$", "" },
{ " HEVC ", "" },

{ "^RO ", "RO: " },
{ " \\(*ROM\\)*$", "" },
{ "[\\|\\()]*ROM*[\\|\\):]", "RO:" },
{ "^Romania[n]*:", "RO:" },
Expand Down
6 changes: 6 additions & 0 deletions UnitTests/Service/ChannelMatcherTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void SetUp()
[TestCase("Sundance", "RO: Sundance TV", "RO: Sundance TV FHD [Multi-Sub]")]
[TestCase("Travel Channel", "RO: Travel", "RO | Travel")]
[TestCase("Travel Mix", "RO: Travel Mix TV", "Travel Mix TV RO")]
[TestCase("TV Paprika", "RO: Paprika TV", "RO TV Paprika")]
[TestCase("TV8", "MD: TV8", "TV 8 Moldova HD")]
[TestCase("TVC21", "MD: TVC21", "TVC 21 Moldova")]
[TestCase("TVR Târgu Mureș", "RO: TVR T?rgu-Mure?", "TVR: Targu Mureș")]
Expand Down Expand Up @@ -85,6 +86,7 @@ public void DoesMatch_NamesDoNotMatch_ReturnsFalse(
[TestCase("|ROM|: Cromtel", "CROMTEL")]
[TestCase("|UK| CHELSEA TV (Live On Matches) HD", "UKCHELSEATV")]
[TestCase("Canal Regional (Moldova)", "MDCANALREGIONAL")]
[TestCase("DIGI SPORT 4 (RO)", "DIGISPORT4")]
[TestCase("Jurnal TV Moldova", "MDJURNALTV")]
[TestCase("MD: Canal Regional (Moldova)", "MDCANALREGIONAL")]
[TestCase("MINIMAX ROMANIA HD", "MINIMAXROMANIA")]
Expand All @@ -101,7 +103,11 @@ public void DoesMatch_NamesDoNotMatch_ReturnsFalse(
[TestCase("RO: U TV S1-1", "UTV")]
[TestCase("RO.| DIGI 24", "DIGI24")]
[TestCase("RO\" Romania TV", "ROMANIATV")]
[TestCase("RO| Antena 3 4K+", "ANTENA3")]
[TestCase("RO| CINEMA RO.", "CINEMARO")]
[TestCase("RO| Digi Life 4K+", "DIGILIFE")]
[TestCase("RO| TARAF:HD", "TARAF")]
[TestCase("RO|DISOVERY_SCIENCE_HD", "DISOVERYSCIENCE")]
[TestCase("RTR Moldova HD", "MDRTR")]
[TestCase("RUMANIA: DigiWorld FHD (Opt-1)", "DIGIWORLD")]
[TestCase("TV 8 HD (Auto)", "TV8")]
Expand Down

0 comments on commit 414d069

Please sign in to comment.