Skip to content

Commit

Permalink
Merge pull request #56 from hmlendea/dev
Browse files Browse the repository at this point in the history
More data and channel matching
  • Loading branch information
hmlendea authored Oct 29, 2020
2 parents 871ed77 + 7a4f780 commit 55f7d27
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl
liberapay: HMlendea
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://www.paypal.com/donate?hosted_button_id=6YVRGJHDGWGKQ','https://liberapay.com/HMlendea/donate']
custom: ['https://www.paypal.com/donate?hosted_button_id=6YVRGJHDGWGKQ']
7 changes: 7 additions & 0 deletions Data/channels.xml
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,9 @@
<Country>RO</Country>
<GroupId>kids</GroupId>
<LogoUrl>https://raw.githubusercontent.com/hmlendea/tv-logos/master/logos/cartoon_network.png</LogoUrl>
<Aliases>
<string>RO: Cartoon</string>
</Aliases>
</ChannelDefinitionEntity>
<ChannelDefinitionEntity>
<Id>CBSReality.ro</Id>
Expand Down Expand Up @@ -1581,6 +1584,7 @@
<string>RO: H!T</string>
<string>RO: Hit Ch</string>
<string>RO: Hit Channel</string>
<string>RO: Hit Music Channel</string>
<string>RO: Hit Music</string>
<string>RO: Hit</string>
</Aliases>
Expand Down Expand Up @@ -2470,6 +2474,7 @@
<string>RO: Nat Geographic</string>
<string>RO: NG</string>
<string>RO: NGC</string>
<string>RO: NGRO</string>
</Aliases>
</ChannelDefinitionEntity>
<ChannelDefinitionEntity>
Expand Down Expand Up @@ -2992,6 +2997,7 @@
<LogoUrl>https://raw.githubusercontent.com/hmlendea/tv-logos/master/logos/realitatea_plus.png</LogoUrl>
<Aliases>
<string>RO: Realitatea Plus TV</string>
<string>RO: Realitatea TV Plus</string>
</Aliases>
</ChannelDefinitionEntity>
<ChannelDefinitionEntity>
Expand Down Expand Up @@ -3825,6 +3831,7 @@
<GroupId>local-muntenia</GroupId>
<LogoUrl>https://raw.githubusercontent.com/hmlendea/tv-logos/master/logos/valea_prahovei_tv.png</LogoUrl>
<Aliases>
<string>RO: VP</string>
<string>RO: VPTV</string>
<string>VP HD</string>
</Aliases>
Expand Down
6 changes: 2 additions & 4 deletions Service/ChannelMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ public sealed class ChannelMatcher : IChannelMatcher

static readonly IDictionary<string, string> TextReplacements = new Dictionary<string, string>
{
{ "\\[B\\]", "" },

{ "[\\(\\[]]*([Aa]uto|[Bb]ackup|[Ll]ive [Oo]n [Mm]atches|[Mm]ulti-*[Aa]udio|[Mm]ulti-*[Ss]ub|[Nn]ew!*|[Oo]n-[Dd]emand)[\\)\\]]*", "" },
{ "([a-zA-Z0-9_ ]{4})[ _\\|\\[\\(\\]\\)\".:-](Ultra|[FU])*_*[HMS][DQ]", "$1" },
{ "[\\(\\[]]*([Aa]uto|[Bb]|[Bb]ackup|[Ll]ive [Oo]n [Mm]atches|[Mm]ulti-*[Aa]udio|[Mm]ulti-*[Ss]ub|[Nn]ew!*|[Oo]n-[Dd]emand)[\\)\\]]*", "" },
{ "(.)[ \\.:_\\-\\|\\[\\(\\]\\)\"]+(Ultra|Full|[FU])*[_-]*[HMS][DQ]", "$1" },
{ "4[Kk]\\+", "" },

{ "RO\\(L\\) *[\\|\\[\\(\\]\\)\".:-]", "RO:" },
Expand Down
24 changes: 21 additions & 3 deletions UnitTests/Service/ChannelMatcherTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,18 @@ public void ChannelNamesDoMatch_WithAliasWithCountry(
[TestCase("Digi World", "RO: Digi World FHD", "RUMANIA: DigiWorld FHD (Opt-1)")]
[TestCase("Duna", "RO: Duna TV", "RO | Duna Tv")]
[TestCase("Golf Channel", "FR: Golf Channel", "|FR| GOLF CHANNEL FHD")]
[TestCase("H!T Music Channel", "RO: Hit Music Channel", "RO: Hit Music Channel")]
[TestCase("H!T Music Channel", "RO: Hit Music Channel", "RO(L): HIT MUSIC CHANNEL SD")]
[TestCase("H!T Music Channel", "RO: Hit", "RO | HIT")]
[TestCase("HBO 1", "RO: HBO", "RO:HBO HD")]
[TestCase("HD Net Van Damme", "HD NET Jean Claude Van Damme", "HD NET Jean Claude van Damme")]
[TestCase("Hora TV", "RO: Hora TV", "RO(L): HORA TV SD")]
[TestCase("Jurnal TV", "MD: Jurnal TV", "Jurnal TV Moldavia")]
[TestCase("MegaMax", "RO: MegaMax", "RO: MegaMax-HD")]
[TestCase("NCN TV", "RO: NCN", "RO: NCN HD")]
[TestCase("Pro TV News", "RO: Pro News", "Pro News")]
[TestCase("Publika TV", "MD: Publika", "PUBLIKA_TV_HD")]
[TestCase("Realitatea Plus", "RO: Realitatea TV Plus", "RO(L): REALITATEA TV PLUS SD")]
[TestCase("România TV", "România TV", "RO\" Romania TV")]
[TestCase("Somax", "RO: Somax TV", "Somax TV")]
[TestCase("Sundance", "RO: Sundance TV", "RO: Sundance TV FHD (MultiSub)")]
Expand All @@ -83,6 +87,7 @@ public void ChannelNamesDoMatch_WithAliasWithoutCountry(

[TestCase("AMC", "RO: AMC Romania")]
[TestCase("Antena 3", "Antena 3 Ultra_HD")]
[TestCase("Elita TV", "Elita TV")]
[TestCase("HBO 3", "HBO 3 F_HD")]
[TestCase("MTV Europe", "RO: MTV Europe")]
[TestCase("Pro TV", "PRO TV ULTRA_HD")]
Expand Down Expand Up @@ -147,7 +152,7 @@ public void ChannelNamesDoNotMatch_WithoutAliasWithoutCountry(
[TestCase("TVC21", "MD", "MDTVC21")]
[TestCase("TVR Moldova", "MD", "MDTVR")]
[TestCase("TVR Târgu Mureș", "RO", "TVRTARGUMURES")]
[TestCase("VP HD", "RO", "VPHD")]
[TestCase("VP HD", "RO", "VP")]
[TestCase("VSV De Niro", "RO", "VSVDENIRO")]
[Test]
public void NormaliseName_WithCountry_ReturnsExpectedValue(string name, string country, string expectedNormalisedName)
Expand All @@ -164,6 +169,7 @@ public void NormaliseName_WithCountry_ReturnsExpectedValue(string name, string c
[TestCase("|ROM|: Cromtel", "CROMTEL")]
[TestCase("|UK| CHELSEA TV (Live On Matches) HD", "UKCHELSEATV")]
[TestCase("Canal Regional (Moldova)", "MDCANALREGIONAL")]
[TestCase("Cartoon Network FullHD", "CARTOONNETWORK")]
[TestCase("Digi 4K", "DIGI4K")]
[TestCase("DIGI SPORT 4 (RO)", "DIGISPORT4")]
[TestCase("Jurnal TV Moldova", "MDJURNALTV")]
Expand All @@ -173,42 +179,54 @@ public void NormaliseName_WithCountry_ReturnsExpectedValue(string name, string c
[TestCase("MD: MD| Pro TV Chișinău.", "MDPROTVCHISINAU")]
[TestCase("MD: ProTV Chisinau", "MDPROTVCHISINAU")]
[TestCase("MINIMAX ROMANIA HD", "MINIMAXROMANIA")]
[TestCase("Pro Cinema Full-HD", "PROCINEMA")]
[TestCase("Pro TV [B] RO", "PROTV")]
[TestCase("PUBLIKA_TV_HD", "PUBLIKATV")]
[TestCase("RO \" DIGI SPORT 1 HD RO", "DIGISPORT1")]
[TestCase("RO | Travel", "TRAVEL")]
[TestCase("RO-Animal Planet HD", "ANIMALPLANET")]
[TestCase("Ro: 1 HD", "1HD")]
[TestCase("RO: 1HD", "1HD")]
[TestCase("RO: Animal World [768p]", "ANIMALWORLD")]
[TestCase("RO: Bit TV (ROM)", "BITTV")]
[TestCase("RO: Digi24 (România)", "DIGI24")]
[TestCase("RO: HBO 3 RO", "HBO3")]
[TestCase("RO: HBO HD RO", "HBO")]
[TestCase("RO: MiniMax-HD", "MINIMAX")]
[TestCase("RO: Nașul TV (New!)", "NASULTV")]
[TestCase("RO: Nickelodeon (RO)", "NICKELODEON")]
[TestCase("Ro: Pro TV backup", "PROTV")]
[TestCase("Ro: Romania TV backup", "ROMANIATV")]
[TestCase("RO: Tele Moldova", "TELEMOLDOVA")]
[TestCase("RO: Travel", "TRAVEL")]
[TestCase("RO: TVR Moldova", "TVRMOLDOVA")]
[TestCase("RO: U TV [b]", "UTV")]
[TestCase("RO: U TV [B]", "UTV")]
[TestCase("RO: U TV S1-1", "UTV")]
[TestCase("RO:HBO HD", "HBO")]
[TestCase("RO.| DIGI 24", "DIGI24")]
[TestCase("RO(L): E! ENTERTAINMENT FHD", "EENTERTAINMENT")]
[TestCase("RO(L): HIT MUSIC CHANNEL SD", "HITMUSICCHANNEL")]
[TestCase("RO(L): IASI TV SD", "IASITV")]
[TestCase("RO(L): KronehitTV FHD", "KRONEHITTV")]
[TestCase("RO(L): REALITATEA TV PLUS SD", "REALITATEATVPLUS")]
[TestCase("RO(L): VP SD", "VP")]
[TestCase("RO\" Romania TV", "ROMANIATV")]
[TestCase("RO| Antena 3 4K+", "ANTENA3")]
[TestCase("RO| CINEMA RO.", "CINEMARO")]
[TestCase("RO| Digi Life 4K+", "DIGILIFE")]
[TestCase("RO| NGRO", "NGRO")]
[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")]
[TestCase("TV 8 Moldova HD", "MDTV8")]
[TestCase("TV 8 Moldova HD", "MDTV8")]
[TestCase("TV Centrală Moldova", "MDTVCENTRALA")]
[TestCase("TVR 1 (Backup) RO", "TVR1")]
[TestCase("TVR2 [B] RO", "TVR2")]
[TestCase("U TV", "UTV")]
[TestCase("US: NASA TV US", "USNASATV")]
[TestCase("Viasat Explore Full_HD", "VIASATEXPLORE")]
[TestCase("VIP|RO|: Discovery Channel FHD", "DISCOVERYCHANNEL")]
[TestCase("VSV Robert de Niro HD", "VSVROBERTDENIRO")]
[TestCase("VSV Robert de Niro", "VSVROBERTDENIRO")]
Expand Down

0 comments on commit 55f7d27

Please sign in to comment.