German Search?

Please use this forum to post feedback and suggestions related to VCD-db.
You can also post any questions here that are on your mind.

Moderators: Carpo, Saviq

German Search?

Postby darkside40 » Fri Mar 09, 2007 11:18 am

Hi there,
i realy like VCD-db and installe it on my Homeserver.

There is only oe thing i am missing and that is a german search engine like ofdb.de or the german Version of the imdb.

Is there any way to add something like this?
darkside40
Power user
 
Posts: 62
Joined: Fri Mar 09, 2007 11:14 am

Postby Saviq » Fri Mar 09, 2007 11:55 pm

Yes you can write one yourself, the easiest would be to modify the imdb fetch class accordingly to Your site.
Saviq
Site Admin
 
Posts: 401
Joined: Mon May 30, 2005 12:39 pm
Location: Poland

Postby darkside40 » Sat Mar 10, 2007 9:18 am

O.K. i willsee what i can do.
darkside40
Power user
 
Posts: 62
Joined: Fri Mar 09, 2007 11:14 am

Postby Schorsch0815 » Tue Mar 20, 2007 6:59 pm

Hey darkside40,

I've written a Fetch class for ofdb. And for me it works :D.

There is only a problem when a film has more than one director. In this case the 2nd director will be added to the actor list. But may be you can find a better solution.

I've got no web-space and I didn't find a way to upload it here. I can send it to you if you send me your e-mail address via a PM.

If someone else is interested no problem, just ask!

Regards,

Schorsch
Schorsch0815
 
Posts: 3
Joined: Wed Nov 22, 2006 8:50 am
Location: Germany

Postby konni » Wed Mar 21, 2007 12:22 pm

Hey Schorsch0815 ..
Mail the class to me (konni@konni.com) so i can include it in next release.
Cheers,
Konni.
konni
Site Admin
 
Posts: 890
Joined: Wed Nov 24, 2004 12:41 am
Location: Reykjavík, Iceland

Postby Schorsch0815 » Wed Mar 21, 2007 3:32 pm

@Konni, done!
Schorsch0815
 
Posts: 3
Joined: Wed Nov 22, 2006 8:50 am
Location: Germany

Postby konni » Mon Mar 26, 2007 11:41 pm

Thanks alot for the mail ..
It will be added to next release ..

When and if you make updates on the fetch class ..
feel free to send me the updated class.
Cheers,
Konni.
konni
Site Admin
 
Posts: 890
Joined: Wed Nov 24, 2004 12:41 am
Location: Reykjavík, Iceland

Postby konni » Wed May 09, 2007 3:05 pm

Update:
For those who do not want to wait for next relase and want to tryout the fetch class contributed by Schorsch can d/l it here => http://trac.konni.com/trac.cgi/ticket/15
Cheers,
Konni.
konni
Site Admin
 
Posts: 890
Joined: Wed Nov 24, 2004 12:41 am
Location: Reykjavík, Iceland

Postby moh » Sat May 19, 2007 2:01 pm

Hm, i have this problem when adding a movie.

Code: Select all
Fatal error: Call to undefined function iconv() in .../vcddb/classes/fetch/VCDFetch_ofdb.php on line 59
moh
 
Posts: 1
Joined: Sat May 19, 2007 1:59 pm

Postby darkside40 » Sat Sep 08, 2007 3:20 pm

Could it be that OFDB has changed something on their site?

In every movie i enter there is the plot missing.
darkside40
Power user
 
Posts: 62
Joined: Fri Mar 09, 2007 11:14 am

Postby donsenilo » Fri Feb 22, 2008 7:03 pm

I'm sure, ofdb has changed something, because on EVERY search vcddb find nothing ...

Can anyone help with that ?
If not, we have a big problem :(

Edit: Ok, I see there is a trouble-ticket about that (#220). I hope, someone can fix this problem, because at this time ofdb is the only german-site we can use.

darkside40 wrote:Could it be that OFDB has changed something on their site?

In every movie i enter there is the plot missing.
donsenilo
 
Posts: 13
Joined: Sat Jan 19, 2008 7:28 pm

Postby Schorsch0815 » Fri Feb 22, 2008 9:55 pm

I'm working on the ofdb issue. They have changed their search syntax and result so I have to overwork the fetch class.

Please be patient, it will take a while. When I've finished this thing, I will add the changed class to ticket #220.


Regards,

Schorsch
Schorsch0815
 
Posts: 3
Joined: Wed Nov 22, 2006 8:50 am
Location: Germany

Got it Fixed.

Postby peterk-de » Thu Mar 13, 2008 8:33 pm

Hello Guys,

because I've got much new movies recently, I've just fixed the fetch class by myself. Since I'm using an older version and I don't really like to bother with updating, I don't know whether it will work for you. Here is my classes/fetch/VCDfetch_ofdb.php:

Code: Select all
<?php
/**
* VCD-db - a web based VCD/DVD Catalog system
* Copyright (C) 2003-2006 Konni - konni.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* @author  Jochen Schales <Jochen.Schales_at_gmx.de>
* @package Kernel
* @subpackage WebFetch
* @version $Id: VCDFetch_ofdb.php,v 1.0 15/10/2006
*/
?>
<?php
class VCDFetch_ofdb extends VCDFetch {

   protected $regexArray = array(
      'title'    => '<title>OFDb - ([^\(]*)\(([0-9]{4})\)</title>',
      'year'     => '<title>OFDb - ([^\(]*)\(([0-9]{4})\)</title>',
      'poster'    => '<img src="(http://images.ofdb.de/film/[0-9]{1,4}/[0-9]{4,7}\.jpg)" ',
      'director'    => '#class="Normal">Regie:.*\n.*\n.*\n[^<]*<td><font [^>]*><b><a href="view.php.page=liste.Name[^>]*>([^<]*)</a>#i',
      'genre'    => '<a href="view.php.page=genre.Genre=[^"]*">([^<]*)</a>',
      'rating'    => '<br>Note: ([0-9].[0-9]{2}).nbsp;',
      'cast'       => '<a href="view.php.page=liste.Name[^>]*>([^<]*)</a>',
      'runtime'    => '#<b class="ch">Runtime:</b>\n([0-9]+) min#i',
      'akas'       => 'Also Known As</b>:</b><br>(.*)<b class="ch"><a href="/mpaa">MPAA</a>',
      'country'    => '<a href="view.php.page=blaettern.Kat=Land&Text=[^>]*>([^<]*)</a>',
      'plotshort'   => '<b>Inhalt:</b> *([^<]*)<a href="plot/[0-9]{1,10},[0-9]{1,10},[^>]*"><b>\[mehr\]</b></a>',
      'linkplot'   => '<b>Inhalt:</b> *[^<]*<a href="(plot/[0-9]{1,10},[0-9]{1,10},[^>]*)"><b>\[mehr\]</b></a>',
      'plot'      => 'Eine Inhaltsangabe von <a href="usercenter/info.php[^<]*</a></b><br><br>([^<]*)((</font></p>)|(<br />))'
      );

   protected $multiArray = array(
      'genre', 'cast', 'akas', 'country'
   );



   private $servername = 'www.ofdb.de';
   private $searchpath = '/view.php?page=suchergebnis&Kat=DTitel&SText=[$]';
   private $itempath   = '/film/[$],Dummy';

   private $serverCharset = 'iso-8859-1';

   public function __construct() {
      $this->setSiteName("ofdb");
      $this->setFetchUrls($this->servername, $this->searchpath, $this->itempath);
   }


   public function search($title) {
   
      if (strcasecmp(VCDUtils::getCharSet(), $this->serverCharset)!= 0)
         $title = mb_convert_encoding($title, $this->serverCharset, VCDUtils::getCharSet());
      return parent::search($title);
   }

   public function showSearchResults() {
      $this->setMaxSearchResults(50);
      //$regx = 'fid=([0-9]+)\" onmouseover=\"Tip\(.{1,120}SHADOW.true\)\"..(.{1,64})\<font size=\"1\"';
      $regx = 'a href=\"film/([0-9]+),.{1,64} onmouseover=\"Tip\(.{1,120}SHADOW.true\)\".(.{1,64})\<font size=\"1\"';
                                                                 // id title year
      $results = parent::generateSimpleSearchResults($regx, 1, 2);
      parent::generateSearchSelection($results);
   }


   protected function processResults() {
      if (!is_array($this->workerArray) || sizeof($this->workerArray) == 0) {
         $this->setErrorMsg("No results to process.");
         return;
      }
              echo $fetchContents;


      $obj = new imdbObj();
      $obj->setIMDB($this->getItemID());

      foreach ($this->workerArray as $key => $data) {

         $entry = $data[0];
         $arrData = $data[1];

         switch ($entry) {
            case 'title':
               $title = $arrData[1];
               $obj->setTitle($title);
               break;

            case 'year':
               $year = $arrData[2];
               $obj->setYear($year);
               break;

            case 'poster':
               $poster = $arrData[1];
               $obj->setImage($poster);
               break;

            case 'director':
               $director = $arrData[1];
               $obj->setDirector($director);
               break;

            case 'genre':

               $arr = array();
               foreach ($arrData as $item) {
                  array_push($arr, $item[1]);
               }
               $obj->setGenre($arr);
               break;

            case 'rating':
               $rating = $arrData[1];
               $obj->setRating($rating);
               break;

            case 'cast':
               $arr = null;
               $arr = array();
               # remove director
               if (sizeof( $arrData ) > 0)
                  array_shift( $arrData );
                  
               foreach ($arrData as $itemArr) {
                  $actor = $itemArr[1];
#                  $role = $itemArr[3];
                  $result = $actor;
                  array_push($arr, $result);
               }
               $obj->setCast($arr);
               break;

            case 'runtime':
               $runtime = $arrData[1];
               $obj->setRuntime($runtime);
               break;

            case 'akas':
               $akaTitles = implode(',', $arrData);
               $obj->setAltTitle($akaTitles);
               break;

#            case 'plotshort':
#               $plot = $arrData[1];
#               $obj->setPlot($plot);
               break;

            case 'plot':
               $plot = $arrData;
               $obj->setPlot($plot);
               break;

            case 'country':
               if (sizeof($arrData) > 0) {
                  $arrCountries = array();
                  foreach ($arrData as $itemArr) {
                     array_push($arrCountries, $itemArr[1]);
                  }
                  $obj->setCountry($arrCountries);
               }

               break;



            default:
               break;
         }

      }

      $this->fetchedObj = $obj;


   }

   protected function fetchDeeper($entry) {
      switch ($entry) {

         case 'poster':
            $regx = '<a name="poster" href="photogallery" title="([^<]*)"><img border="0" alt="([^<]*)" title="([^<]*)" src="([^<]*)" height="([0-9]{2,3})" width="([0-9]{2,3})"></a>';

            if ($this->getItem($regx) == self::ITEM_OK) {
               $res = $this->getFetchedItem();
            }

            break;


         case 'akas':

            $ret = array();
            $contents = $this->getContents();
              if(eregi('Also Known As:</b><br>(.*)<b class="ch"><a href="/mpaa">MPAA</a>',$contents, $y)) {
                  $contents = $y[0];
                  while(eregi('<br>([^<]*)', $contents, $x)) {
                     if (isset($x[1]) && strcmp(trim($x[1]),"") != 0) {
                        $ret[] = trim($x[1]);
                     }
                     $contents = substr($contents,strpos($contents,$x[0])+strlen($x[0]));
                  }
              }
              array_push($this->workerArray, array($entry, $ret));

            break;


         case 'plot':
            // Save the old buffer
            $itemBuffer = $this->getContents();
            // Generate urls
            $linkPlot = $this->workerArray[10][1][1];
            
            $plotUrl = "http://$this->servername/$linkPlot";
            
            
            $referer = "http://".$this->servername.str_replace('[$]', $this->getItemID(), $this->itempath);
            $isPlot =  $this->fetchPage($this->servername, $plotUrl, $referer);
            if ($isPlot) {
               if ($this->getItem($this->regexArray['plot']) == self::ITEM_OK) {
                  
                  $plotArr = $this->getFetchedItem();
                  $plotText = $plotArr[1];
                  array_push($this->workerArray, array($entry, $plotText));

               } else {
                  // Plot not found, use the Tagline instead and use the old buffer again
                  $regExTagline = '#Tagline:</b>([^<]*)#';
                  $this->setContents($itemBuffer);
                  if ($this->getItem($regExTagline) == self::ITEM_OK ) {
                     $plotArr = $this->getFetchedItem();
                     $plotText = $plotArr[1];
                     array_push($this->workerArray, array($entry, $plotText));
                  }
               }
            }

            break;

         default:
            break;
      }
   }

}

?>



Works fine for me (0.986). Schorsch, could you be so kind of checking the changes + adding them to the repository or whatever? Thx

Peter
peterk-de
 
Posts: 3
Joined: Thu Mar 13, 2008 8:18 pm

Postby donsenilo » Fri Mar 14, 2008 7:19 am

thanks for your great work peter.

but in version 0.991 it works only with the movie-number. the title-search don't.

but anyway ... good work and it helps :)
thank you.
donsenilo
 
Posts: 13
Joined: Sat Jan 19, 2008 7:28 pm

Postby peterk-de » Sat Mar 15, 2008 10:27 pm

hi donsenilo, as I just have noticed, some searches don't work for me too ... probably the following might work for you:

replace

Code: Select all
      $regx = 'a href=\"film/([0-9]+),.{1,64} onmouseover=\"Tip\(.{1,120}SHADOW.true\)\".(.{1,64})\<font size=\"1\"';
                                                                 // id title year
      $results = parent::generateSimpleSearchResults($regx, 1, 2);


with

Code: Select all
      $regx = 'film.(fid=)?([0-9]+).{1,64} onmouseover=\"Tip\(.{1,120}SHADOW.true\)\".(.{1,64})\<font size=\"1\"';
                                                                 // id title year
      $results = parent::generateSimpleSearchResults($regx, 2, 3);


Just another dirty hack :-D ... Did that fix your problems?
peterk-de
 
Posts: 3
Joined: Thu Mar 13, 2008 8:18 pm

Next

Return to General discussion, Suggestions and Feedback

Who is online

Users browsing this forum: No registered users and 1 guest

cron