Opened 7 years ago

Closed 6 years ago

Last modified 5 years ago

#11088 closed Patch - Bug Fix (fixed)

nearestName is case sensitive and too restrictive.

Reported by: drwyrm@… Owned by: Karl Egly
Priority: trivial Milestone: 0.27.1
Component: MythTV - General Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Not sure why it was comparing the first char of both strings, also think it shouldn't be case sensitive at all.

diff --git a/mythtv/libs/libmythmetadata/metadatacommon.cpp b/mythtv/libs/libmythmetadata/metadatacommon.cpp
index 8a5d29f..6cc1b36 100644
--- a/mythtv/libs/libmythmetadata/metadatacommon.cpp
+++ b/mythtv/libs/libmythmetadata/metadatacommon.cpp
@@ -1374,9 +1374,8 @@ QString nearestName(const QString& actual, const QStringList& candidates)
     QStringList::ConstIterator i = candidates.begin();
     while ( i != candidates.end() )
     {
-        if ( (*i)[0] == actual[0] )
-        {
-            int delta = editDistance( actual, *i );
+	    QString candidate = *i;
+            int delta = editDistance( actual.toLower(), candidate.toLower() );
             if ( delta < deltaBest )
             {
                 deltaBest = delta;
@@ -1387,7 +1386,6 @@ QString nearestName(const QString& actual, const QStringList& candidates)
             {
                 numBest++;
             }
-        }
         ++i;
     }
 

Change History (4)

comment:1 Changed 6 years ago by stuartm

Milestone: unknown0.27
Type: Bug Report - GeneralPatch - Bug Fix

comment:2 Changed 6 years ago by Karl Dietz <dekarl@…>

Owner: set to Karl Dietz <dekarl@…>
Resolution: fixed
Status: newclosed

In 18f6412f73cffc751931dc688d57ea3d7708c7f1/mythtv:

Make metadata title matching more permissive

From the ticket: Not sure why it was comparing the first char of both
strings, also think it shouldn't be case sensitive at all.

I think so, too

Fixes #11088
Patch by Daniel Ribeiro

comment:3 Changed 5 years ago by Karl Dietz <dekarl@…>

In 55e7ed5e16221e9042b68b335ed11dd8dd0c6703/mythtv:

Make metadata title matching more permissive

From the ticket: Not sure why it was comparing the first char of both
strings, also think it shouldn't be case sensitive at all.

I think so, too

Fixes #11088
Patch by Daniel Ribeiro
(cherry picked from commit 18f6412f73cffc751931dc688d57ea3d7708c7f1)

comment:4 Changed 5 years ago by Karl Egly

Milestone: 0.270.27.1
Owner: changed from Karl Dietz <dekarl@…> to Karl Egly
Note: See TracTickets for help on using tickets.