tboothman / imdbphp

PHP library for retrieving film and tv information from IMDb
253 stars 84 forks source link

mpaa() incorrect on series if multiple values exists #196

Closed paxter closed 3 years ago

paxter commented 4 years ago

Steps to reproduce:

$obj = new \Imdb\Title(436992);
print_r($obj->mpaa());

Result:

Array ( [Argentina] => 13 [Australia] => M [Brazil] => 12 [Canada] => G [Finland] => K-11 [France] => Tous publics [Germany] => 16 [Ireland] => G [Italy] => T [Netherlands] => 6 [New Zealand] => M [Norway] => 12 [Russia] => 16+ [Singapore] => NC16 [South Africa] => 13 [South Korea] => 15 [Spain] => 13 [United Kingdom] => 12 [United States] => TV-Y7-FV ) 

But there are multiple values for some countries: https://www.imdb.com/title/tt0436992/parentalguide The current mpaa() function overrides the previous value if there are multiple available.

Possible solutions: 1.) Always take the lowest certification as IMDb shows on the detailpage. But this will need a list for non numeric certifications to know whats lower or higher. For countries like germany it's easy to implement. 2.) List all available certifications.

Thanks for keeping this project alive!

jreklund commented 4 years ago

Thanks for the bug rapport.

1) wouldn't be a viable solution as it's hard to maintain and verify. I have made it in another project, but it's not perfect. See. 2) If it's okay by you if we can introduce mpaa(true) as it would be a breaking change otherwise.

paxter commented 4 years ago

Thanks for the bug rapport.

You're welcome.

  1. wouldn't be a viable solution as it's hard to maintain and verify. I have made it in another project, but it's not perfect. See.

Hm yes, you're right. It's not so easy.

  1. If it's okay by you if we can introduce mpaa(true) as it would be a breaking change otherwise.

Would be ok for me, but it's up to you. But it's the best solution I think.

I just fixed it for myself by simply prevent overriding if the numeric certification is higher. Works for me, because I only need german certifications.

PoLaKoSz commented 4 years ago

I made a PR to resolve this issue. Can You please review it? Thanks.