Bug 401894 - IMBD Rating not parsed from IMBD website
Summary: IMBD Rating not parsed from IMBD website
Status: RESOLVED FIXED
Alias: None
Product: tellico
Classification: Applications
Component: general (show other bugs)
Version: 3.1.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Robby Stephenson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-08 18:02 UTC by Alessandro Russo
Modified: 2019-01-05 02:06 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 3.1.5


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Russo 2018-12-08 18:02:25 UTC
SUMMARY


STEPS TO REPRODUCE
1. Search a film on IMBD
2. Select one result
3. Add element. In the database the IMDB rating field remains empty

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
MacOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Robby Stephenson 2018-12-09 02:43:18 UTC
The handful of searches I just did seemed to work correctly. Can you confirm that you have "IMDB Rating" checked in the IMDB data source settings to include in results? If you do, could you tell me a specific search and result that is failing?
Comment 2 Alessandro Russo 2018-12-23 16:32:33 UTC
Sorry, I replied to the email but didn't add a comment on bugs.kde.org.
I'll do it now.

Yes, it's set.

I tried to debug a bit the problem.
I wrote the following lines after "bool ok;" (the line 1117 of imdbfetcher.cpp)

      myWarning() << ratingRx.cap(1) <<"\n";
      myWarning() << ratingRx.cap(1).toFloat() <<"\n";

And for the film Mission Impossible Fallot ( https://www.imdb.com/title/tt4912910/?ref_=nv_sr_1 ) I get:

"7,9"
0

I don't know why the number is 7,9 instead of 7.9. When I go directly to the imdb webpage I see only 7.9
Can this be a locale problem? My locale is set to italian/italy and here the numbers are written with the comma (7.9 -> 7,9)

For the moment I fixed it with:
      QLocale italian(QLocale::Italian);
      float value = italian.toFloat(ratingRx.cap(1),&ok);
Comment 3 Robby Stephenson 2018-12-24 13:37:28 UTC
Ah, locale would explain it. Thanks for the follow-up details. I'll check into it.
Comment 4 Robby Stephenson 2019-01-05 02:06:07 UTC
Git commit 509d339f81d05a00e73d037102db20c56c8db42a by Robby Stephenson.
Committed on 05/01/2019 at 02:01.
Pushed by rstephenson into branch '3.1'.

Fallback to user's locale for setting IMDB rating

The IMDB fetcher assumed the decimal point would always be '.' which is
obviously incorrect in many locales. While the IMDB website apparently
always uses the period, fall back to using the default locale to convert
to a float.
FIXED-IN: 3.1.5

M  +4    -0    ChangeLog
M  +3    -0    src/fetch/imdbfetcher.cpp
M  +7    -0    src/tests/imdbfetchertest.cpp
M  +1    -1    src/tests/tellicotest.config

https://commits.kde.org/tellico/509d339f81d05a00e73d037102db20c56c8db42a