]> 91.132.146.200 Git - bibliotheca-php.git/commitdiff
some small fixes for metacritic movie stuff
authorBanana <mail@bananas-playground.net>
Sun, 30 Aug 2026 14:30:26 +0000 (16:30 +0200)
committerBanana <mail@bananas-playground.net>
Sun, 30 Aug 2026 14:30:26 +0000 (16:30 +0200)
Signed-off-by: Banana <mail@bananas-playground.net>
upgrade/from-version-1.8.1.md
webclient/config/config-metacritic.php.default
webclient/lib/metacritic.class.php

index f913205c151ec9a5e17dcfe5f2c1b8cefd5526ad..19b3f06906420d4fbb5c0e25f871889bb8581ba9 100644 (file)
@@ -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
index 9ee3c6d114c2fb3939e41e63d2b0c9b546883c02..2404dbe58bbaa17ef397f0d23fb201cdbf168774 100644 (file)
@@ -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.
  * 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
index dcc18e10b7a679f149a5cc999b060463cb21fa85..c4cfbfc98013c6d00a0093ce4fceace9334a4630 100644 (file)
@@ -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