From 5aae486aa2af2341da014dd79e55908dbeeaa1f0 Mon Sep 17 00:00:00 2001 From: robelix Date: Mon, 21 Oct 2013 01:18:19 +0200 Subject: [PATCH 01/10] cache and config in .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..6849ea7b --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.kdev4/ +cache/ +config.inc.php +videodb.kdev4 From dc7c5bf0b41d213d0052dbf57fffb3da9d3339b8 Mon Sep 17 00:00:00 2001 From: robelix Date: Mon, 21 Oct 2013 01:42:46 +0200 Subject: [PATCH 02/10] imdb: remove quotes from origtitle --- engines/imdb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/imdb.php b/engines/imdb.php index 034cedd0..817a93e9 100644 --- a/engines/imdb.php +++ b/engines/imdb.php @@ -175,7 +175,7 @@ function imdbData($imdbID) $data['subtitle'] = trim($s); } # orig. title - preg_match('/\s*(.*?)\s*\(original title\)<\/i>\s*\s*"?(.*?)"?\s*\(original title\)<\/i>\s* Date: Mon, 21 Oct 2013 02:20:18 +0200 Subject: [PATCH 03/10] imdb: cast fixed --- engines/imdb.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/imdb.php b/engines/imdb.php index 817a93e9..fdcf224f 100644 --- a/engines/imdb.php +++ b/engines/imdb.php @@ -269,15 +269,15 @@ function imdbData($imdbID) if (!$resp['success']) $CLIENTERROR .= $resp['error']."\n"; // Cast - if (preg_match('#(.*)#si', $resp['data'], $match)) + if (preg_match('#
(.*?)(.*?).*?#si', $match[1], $ary, PREG_PATTERN_ORDER)) + if (preg_match_all('##si', $match[1], $ary, PREG_PATTERN_ORDER)) { for ($i=0; $i < sizeof($ary[0]); $i++) { $actorid = trim(strip_tags($ary[1][$i])); $actor = trim(strip_tags($ary[2][$i])); - $character = trim(strip_tags($ary[3][$i])); + $character = trim( preg_replace('/\s+/', ' ', strip_tags($ary[3][$i]))); $cast .= "$actor::$character::$imdbIdPrefix$actorid\n"; } } From 5b699de735c20f784253f6eb0b3d73dfeba6cca3 Mon Sep 17 00:00:00 2001 From: robelix Date: Mon, 21 Oct 2013 02:58:47 +0200 Subject: [PATCH 04/10] imdb cast: replace   in character --- engines/imdb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/imdb.php b/engines/imdb.php index fdcf224f..030db56b 100644 --- a/engines/imdb.php +++ b/engines/imdb.php @@ -277,7 +277,7 @@ function imdbData($imdbID) { $actorid = trim(strip_tags($ary[1][$i])); $actor = trim(strip_tags($ary[2][$i])); - $character = trim( preg_replace('/\s+/', ' ', strip_tags($ary[3][$i]))); + $character = trim( preg_replace('/\s+/', ' ', strip_tags( preg_replace('/ /', ' ', $ary[3][$i])))); $cast .= "$actor::$character::$imdbIdPrefix$actorid\n"; } } From 96965d107aab2ea4bcb04ee9d030acf2e1bea01f Mon Sep 17 00:00:00 2001 From: robelix Date: Mon, 21 Oct 2013 02:58:47 +0200 Subject: [PATCH 05/10] imdb cast: replace   in character From e90ed6ba092951dee5048a202bc39ca4b89314ea Mon Sep 17 00:00:00 2001 From: robelix Date: Mon, 21 Oct 2013 01:42:46 +0200 Subject: [PATCH 06/10] Revert "cache and config in .gitignore" This reverts commit 5aae486aa2af2341da014dd79e55908dbeeaa1f0. --- .gitignore | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 6849ea7b..00000000 --- a/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.kdev4/ -cache/ -config.inc.php -videodb.kdev4 From 2da63fee052966bf46e88f01cd24def8c29a4166 Mon Sep 17 00:00:00 2001 From: robelix Date: Tue, 22 Oct 2013 02:25:44 +0200 Subject: [PATCH 07/10] imdb: cast now working with very long lists, too (testSeries2) --- engines/imdb.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/imdb.php b/engines/imdb.php index 030db56b..dfa3feeb 100644 --- a/engines/imdb.php +++ b/engines/imdb.php @@ -269,9 +269,13 @@ function imdbData($imdbID) if (!$resp['success']) $CLIENTERROR .= $resp['error']."\n"; // Cast - if (preg_match('#
(.*?)\s+(.*?).*?(.*?)
(.*?)(.*)#si', $resp['data'], $match)) { - if (preg_match_all('##si', $match[1], $ary, PREG_PATTERN_ORDER)) + // no idea why it does not always work with (.*?)
\s+(.*?).*?(.*?)
\s+(.*?).*?(.*?)#si', $casthtml, $ary, PREG_PATTERN_ORDER)) { for ($i=0; $i < sizeof($ary[0]); $i++) { From 666753ddbdbb0b5163ecd4bba601f047e990be89 Mon Sep 17 00:00:00 2001 From: robelix Date: Tue, 22 Oct 2013 02:45:17 +0200 Subject: [PATCH 08/10] test_imdb: modified test to match changed imdb data --- test/test_imdb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_imdb.php b/test/test_imdb.php index e68f91c2..45ab91bf 100644 --- a/test/test_imdb.php +++ b/test/test_imdb.php @@ -235,7 +235,7 @@ function testSeriesEpisode() $this->assertTrue( in_array('Jonathan Frakes::Commander William T. Riker::imdb:nm0000408', $cast) ); $this->assertTrue( in_array('Marina Sirtis::Counselor Deanna Troi::imdb:nm0000642', $cast) ); $this->assertTrue( in_array('John de Lancie::Q (as John deLancie)::imdb:nm0209496', $cast) ); - $this->assertTrue( in_array('Rob Bowman::Borg (voice)::imdb:nm0101385', $cast) ); + $this->assertTrue( in_array('Rob Bowman::Borg (voice) (uncredited)::imdb:nm0101385', $cast) ); $this->assertTrue( sizeof($cast) > 15 ); $this->assertTrue( sizeof($cast) < 30 ); From 734d23a18b03ff8b9823ccefc5198dc00c872715 Mon Sep 17 00:00:00 2001 From: robelix Date: Thu, 24 Oct 2013 00:37:16 +0200 Subject: [PATCH 09/10] imdb: actor image fixed --- engines/imdb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/imdb.php b/engines/imdb.php index dfa3feeb..a771253e 100644 --- a/engines/imdb.php +++ b/engines/imdb.php @@ -414,7 +414,7 @@ function imdbActor($name, $actorid) // now we should have loaded the best match // only search in img_primary - or we get far to many useless images - preg_match('/(.*?)<\/td>/si',$resp['data'], $match); + preg_match('/(.*?)<\/td>/si',$resp['data'], $match); if (preg_match('/.*?\s* Date: Thu, 24 Oct 2013 00:46:07 +0200 Subject: [PATCH 10/10] test_imdb: disabled testMovie6 - IMDB has no longer a runtime for this movie --- test/test_imdb.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/test_imdb.php b/test/test_imdb.php index 45ab91bf..29bcb2b9 100644 --- a/test/test_imdb.php +++ b/test/test_imdb.php @@ -117,6 +117,10 @@ function testMovie5() { $this->assertTrue($data['runtime'] >= 99 && $data['runtime'] <= 101); } + /* + Disabled test. + Runtime of this movie was removed on IMDB + function testMovie6() { // She's Out of My League // http://www.imdb.com/title/tt0815236/ @@ -127,6 +131,7 @@ function testMovie6() { $this->assertEqual($data['runtime'], 104); } + */ function testMovie7() { // Romasanta