From: Banana Date: Sun, 30 Aug 2026 14:30:26 +0000 (+0200) Subject: some small fixes for metacritic movie stuff X-Git-Tag: 1.9.0~1 X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=85351d3f4f819a26fe428be256cc51392b8031d6;p=bibliotheca-php.git some small fixes for metacritic movie stuff Signed-off-by: Banana --- diff --git a/upgrade/from-version-1.8.1.md b/upgrade/from-version-1.8.1.md index f913205..19b3f06 100644 --- a/upgrade/from-version-1.8.1.md +++ b/upgrade/from-version-1.8.1.md @@ -9,7 +9,7 @@ Run each line against your bibliotheca DB. Replace `#REPLACEME#` with your table prefix. Default is bib ``` -UPDATE `#REPLACEME#_tool` SET `name` = 'Metacritic Movie', `action` = 'metacriticMovie' WHERE `bib_tool`.`id` = 1; +UPDATE `#REPLACEME#_tool` SET `name` = 'Metacritic Movie', `action` = 'metacriticMovie' WHERE `#REPLACEME#_tool`.`id` = 1; ``` ``` @@ -25,10 +25,10 @@ config/config-imdbweb.php config/config-imdbweb.php.default lib/imdbweb.class.php systemout/imdb -view/default/tool-imdbweb.html -view/default/tool-imdbweb.php -view/98/tool-imdbweb.html -view/98/tool-imdbweb.php +view/default/tool/tool-imdbweb.html +view/default/tool/tool-imdbweb.php +view/98/tool/tool-imdbweb.html +view/98/tool/tool-imdbweb.php ``` # Tool changes diff --git a/webclient/config/config-metacritic.php.default b/webclient/config/config-metacritic.php.default index 9ee3c6d..2404dbe 100644 --- a/webclient/config/config-metacritic.php.default +++ b/webclient/config/config-metacritic.php.default @@ -22,8 +22,9 @@ * Options for the metacritic grabber * * TOOL_METACRITIC_ATTRIBUTES_MOVIE is an array to define which fields from Metracitic are displayed for selection + * description2 is a workaround to write the data not truncated into the content field. * an empty array() shows all. - * 'description', 'datePublished', 'ratingValue', 'genre', 'name', 'actor', 'duration', 'director + * 'description', 'description2', 'datePublished', 'ratingValue', 'genre', 'name', 'actor', 'duration', 'director * * TOOL_METACRITIC_FIELDS_TO_MOVIE is a array to define which attribute (see TOOL_METACRITIC_ATTRIBUTES_MOVIE) should be saved into * a bibliotheca field. Those or the fields a collection can have. Use the identifier of a field. @@ -35,12 +36,13 @@ * TOOL_METACRITIC_CACHE_STORAGE Cache storage path */ const TOOL_METACRITIC_ATTRIBUTES_MOVIE = array( - 'description', 'datePublished', 'ratingValue', 'genre', 'name', 'actor', 'duration', 'director' + 'description', 'datePublished', 'ratingValue', 'genre', 'name', 'actor', 'duration', 'director', + 'description2' ); const TOOL_METACRITIC_FIELDS_TO_MOVIE = array( 'actor' => 'actors', 'director' => 'directors', 'genre' => 'genres', - 'description' => 'description', 'ratingValue' => 'metacritic', 'duration' => 'runtime', - 'name' => 'title', 'datePublished' => 'year' + 'description' => 'content', 'ratingValue' => 'metacritic', 'duration' => 'runtime', + 'name' => 'title', 'datePublished' => 'year', 'description2' => 'description' ); // reuse existing constants but define it to the tool diff --git a/webclient/lib/metacritic.class.php b/webclient/lib/metacritic.class.php index dcc18e1..c4cfbfc 100644 --- a/webclient/lib/metacritic.class.php +++ b/webclient/lib/metacritic.class.php @@ -268,7 +268,13 @@ class Metacritic { return $ret; } - + private function _get_description2(array $data): string { + $ret = ''; + if(isset($data['description'])) { + $ret = strlen($data['description']) > 110 ? substr( $data['description'], 0, 110 ) . "..." : $data['description']; + } + return $ret; + } /** * The duration something like this: PT2M11S