revalabdillah / phptvdb

Automatically exported from code.google.com/p/phptvdb
0 stars 0 forks source link

TV_Shows::search #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently the search can take a long time and puts extra strain on
thetvdb.com by getting the data multiple times here:

    $xml = simplexml_load_string($data);

    foreach($xml->Series as $show) {
        $shows[] = self::findById((string)$show->seriesid);
    }

This is the different pages it downloads of thetvdb
http://thetvdb.com/api/GetSeries.php?seriesname=24
http://thetvdb.com/api/################/series/76290
http://thetvdb.com/api/################/series/79848
http://thetvdb.com/api/################/series/73012
http://thetvdb.com/api/################/series/76047
http://thetvdb.com/api/################/series/74238
http://thetvdb.com/api/################/series/84312

In my case I had the error:
Show Not Found! 
Cause

but that's caused because it seems to use
http://thetvdb.com/data/series/76290/
now

But if it was changed to:

    $xml = simplexml_load_string($data);

    foreach($xml->Series as $show) {
        $shows[] = new TV_Show($show);
    }

It only has to get 
http://thetvdb.com/api/GetSeries.php?seriesname=24

Ok it misses some data but for selection you shouldn't need all the data

At least change it so you have to enable getting all data eg:

search($showName, true) which would get all data

Original issue reported on code.google.com by benswans...@gmail.com on 13 Mar 2009 at 1:42

GoogleCodeExporter commented 9 years ago
Hi, I just found out that people are filing issues, I wasn't receiving any 
emails.
I'll look into this problem. 

Original comment by ryan.doherty on 27 Mar 2009 at 5:14

GoogleCodeExporter commented 9 years ago
I'm not convinced defaulting to the suggested format is a good idea. It would be
changing the API for existing users. They would use the next release expecting 
full
show details and not get them. 

I'm more open to the idea of a configuration option to turn the current 
functionality
off. Then if someone needed full information they could use TV_Shows::findById 
later
on if needed.

Original comment by ryan.doherty on 27 Mar 2009 at 6:39

GoogleCodeExporter commented 9 years ago
Is there a way to fix this? It doesn't work for me, I get a 301 message back 
from 
thetvdb server saying moved permanently.

Thanks

Original comment by pierre.d...@gmail.com on 15 Apr 2009 at 7:53

GoogleCodeExporter commented 9 years ago
Here is mine which is working, don't ask me what I have done.... 

I think there is a extra function for downloading show images.

Original comment by benswans...@gmail.com on 15 Apr 2009 at 8:01

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Works like a charm, Thanks

Original comment by pierre.d...@gmail.com on 16 Apr 2009 at 3:26

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Ok, I have figured it out. 

I modified the TVDB.class.php to use different urls for :
show_by_id
get_episode
search_tv_shows

And now everything works with the original code
    $xml = simplexml_load_string($data);

    foreach($xml->Series as $show) {
        $shows[] = self::findById((string)$show->seriesid);
    }

I have attached the modified file. 

Original comment by pierre.d...@gmail.com on 16 Apr 2009 at 6:54

Attachments:

GoogleCodeExporter commented 9 years ago
I was having this same problem, the best fix in my opinion is to just allow 
CURL to
follow the redirects that TheTVDB has created. 

Just add the following lines after line 36 in TVDB/TVDB.class.php

            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
            curl_setopt($ch, CURLOPT_MAXREDIRS, 5);

Cheers!

Original comment by bigto...@gmail.com on 26 Apr 2009 at 9:13

GoogleCodeExporter commented 9 years ago
Problems in comments 3-8 were fixed in 1.0.2. 

Original feature request stated will be in 1.0.3

Original comment by ryan.doherty on 3 May 2009 at 8:31