GithubHelp home page GithubHelp logo

tvdb's Introduction

Hi 👋, I'm Jérôme Poskin

A passionate freelancer, always looking for new challenges

moinax

moinax

moinax

Connect with me:

moinax moinax moinax moinax

Languages and Tools:

babel backbonejs bash bootstrap circleci codeigniter css3 cypress django docker elasticsearch electron express figma firebase flask framer gatsby git graphql gulp heroku html5 ifttt illustrator invision jasmine javascript jekyll jenkins jest kubernetes laravel linux mariadb mocha mongodb mssql mysql nestjs nextjs nginx nodejs photoshop php postgresql postman puppeteer python rabbitMQ rails react reactnative redis redux sass selenium sketch sqlite svelte symfony tailwind travisci typescript vagrant webpack xd zapier

moinax

 moinax

moinax

tvdb's People

Contributors

canihavesomecoffee avatar dariusiii avatar darkheir avatar fbourigault avatar gbirke avatar gitter-badger avatar hazcod avatar jamesfairhurst avatar johannesx75 avatar lucasperso avatar moinax avatar robinhoutevelts avatar wrnx avatar xantios avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

tvdb's Issues

interface Cache not found

I get an error when using cache mode

Fatal error: Interface 'Moinax\TvDb\Http\Cache\Cache' not found in F:\xampp\htdocs\anjing\src\Moinax\TvDb\Http\Cache\FilesystemCache.php on line 5

Update Function - Logic and Documentation

First of all: great work!! Your API is extraordinary!!
There si only one thing I can't understand completely: which is the best way to use the $data["series"] and $data["episodes"] arrays that are returned by the function getUpdates($previousTime)?

This is the context:
Two tables in my local database ("Series" and "Episodes"). Each record in "Episodes" table has a "thetvdb_episode_id" field and a "thetvdb_series_id" field that corresponds to the field "thetvdb_id" of table "Series". This way I know to which series the episodes belong.

Finally, my database does NOT contain all the series/episodes that are present in the thetvdb database. Only the most popular ones, and I would like to keep it that way.

What should I do now to update my database? Which is the best way (to minimize the number of requests to thetvdb and to my database)? Of course I only need to know the logic, not the actual code.

This is what I think:

FIRST APPROACH:

  • cycle through the "series" array with a foreach
  • for each record, check if the series_id is present in my database (with a normal select query)
  • if so, request the series data to thetvdb and update my database

First problem:
when only an episode of a series is updated on thetvdb, will the series_id be present in $data["series"] or does $data["series"] reflect only the changes to the series details?

Second problem:
Now I would be forced to replace all the series data in my database with the ones downloaded from thetvdb. That is of course wrong. There is no need to replace old/unchanged data along with the new ones. Maybe I could do a count and compare the total number of episodes or look at the "lastUpdated" field.

SECOND APPROACH:

  • cycle through the "episodes" array with a foreach
  • for each record, request the episode data (including the series_id) to thetvdb
  • check if the series_id is present in my database (with a normal select query)
  • if so, add/update the episode data in my database

Problem: almost 1000 request (one for each episode)... only 60 really useful.

FINAL CONSIDERATION:
Everything would be much easier if (in the $data["episodes"] array) there was also a "seriesId" value for each episode. This way, I would cycle through the array, check if the seriesId is present in my database and (if so) retrive the episode data from thetvdb.

about cache feature

hey I am new in using tvdb API and PHP, I wanna ask, when I use cache feature I got this warning:
E:\local_jack\LP-tvdb-a\includes/cache/api/Updates.php?type=all&time=1488409200): failed to open stream: No such file or directory in E:\local_jack\LP-tvdb-a\includes\Moinax\TvDb\Http\Cache\FilesystemCache.php on line 55

and also I wanna ask, how to get a categorized tv data? such as in ur nextepisode.tv? U used in "trend" and "newest".

please comment, thanks.

TvDb\Client::getEpisode is broken

Well, it's broken.
$data = $this->fetchXml('series/' . $serieId . '/default/' . $season . '/' . $episode . '.xml');
should be
$data = $this->fetchXml('series/' . $serieId . '/default/' . (int) $season . '/' . (int) $episode . '/' . $language . '.xml');

(ofcourse, $language should be added in the parameters)

Add more information about Cache TTL

First of all, thank you for your library!
Some more documentation about the ttl setting in your CacheClient would be appropriate.
Is this seconds, ms, ... ?

Thank you.

XML Error

Moinax\TvDb\CurlException: Cannot fetch http://thetvdb.com/api//mirrors.xml in /var/www/html/vendor/moinax/tvdb/src/Moinax/TvDb/Http/CurlClient.php:33

Can't get Actors

For some reason when I try to get the actors details using:
$actors = $tvdb->getActors($showId);

I get the following error:
Fatal error: Class 'Moinax\TvDb\Actor' not found in C:\laragon\www\src\Moinax\TvDb\Client.php on line 226

This is the line it seems to have the problem with:
$actors[] = new Actor($actor);

I didn't edit the Actor file or the getActors function in the Client class. I had no problem with the getBanners function. I checked the $actor variable and it's seems to have the necessary data (it's not null).

It seems that the Client class doesn't seem to recognise the Actor class.

Can you help please?

Thanks!

Property rating as float instead of string

Hi,

I noticed you explicitly set the rating ( and sometimes ratingCount ) property as a string.
Is there any specific reason? I'd expect this to be a float and integer respectively.

In Episode.php you set ratingCount as an integer. But in Serie.php you don't.

Furthermore I'd expect all rating properties to be a float.
But I see that's not the case:

If there's a reason behind this could you let me know?

Regards,
Robin

Ordering episode results by season

Currently I am fetching my results like so

$episodes = $tvdb->getEpisodes($searchTerm);

and displaying them inside a view with blade

<ul>
    @foreach($episodes as $episode)
        <li class="item">
            <p>
                {!! $episode->number !!}: {!! $episode->name !!}
           </p>
        </li>
    @endforeach
</ul>

my goal is to somehow create a season title and group the episodes, the closest ive come is adding

<h4>{!! $episode->season !!}</h4>

however this adds it above each episode does anyone have an approach to acomplish this?

Ex.

Season 1

  • ep 1
  • ep 2
  • ep 3

Season 2

  • ep 1
  • ep 2
  • ep 3

Behaviour when no broadcast date is known

Hello,

first of all I'd like to thank you for this nice maintained PHP library for accessing theTVDB.

I'm wondering however, if the current behaviour for creating a DateTime object based on the FirstAired field for episodes is correct. If there is a FirstAired, it creates the DateTime object just fine, but in my case I have a couple of series where the FirstAired field in xml is just empty...

This results in the DateTime object being initialized at the current time, which makes it rather annoying to compare against a previously stored value...

So my question is if this shouldn't be changed to something which indicates that there is no known value for this yet.

An example of the XML which doesn't contain an FirstAired element:

<?xml version="1.0" encoding="UTF-8" ?>
<Data>
  <Series>
    <id>300472</id>
    <Actors>Snipped for brevity</Actors>
    <Airs_DayOfWeek></Airs_DayOfWeek>
    <Airs_Time></Airs_Time>
    <ContentRating></ContentRating>
    <FirstAired></FirstAired>
    <Genre>|Adventure|Drama|Fantasy|Horror|</Genre>
    <IMDB_ID>tt1316546</IMDB_ID>
    <Language>en</Language>
    <Network>AMC</Network>
    <NetworkID></NetworkID>
    <Overview>Snipped for brevity</Overview>
    <Rating></Rating>
    <RatingCount>0</RatingCount>
    <Runtime>40</Runtime>
    <SeriesID></SeriesID>
    <SeriesName>Preacher</SeriesName>
    <Status>Continuing</Status>
    <added>2015-09-09 13:23:34</added>
    <addedBy>417533</addedBy>
    <banner>graphical/300472-g2.jpg</banner>
    <fanart>fanart/original/300472-1.jpg</fanart>
    <lastupdated>1452903959</lastupdated>
    <poster>posters/300472-1.jpg</poster>
    <tms_wanted_old>0</tms_wanted_old>
    <zap2it_id></zap2it_id>
  </Series>
</Data>

Spelling: serie vs series

Quibble, but the singular of "series" is "series", not "serie". This causes some confusion with the differently named methods like getSeries() vs getSerie(), getSerieByRemoteId(), when the endpoint is actually GetSeriesByRemoteID.php, for instance.

Otherwise nice library with handy caching functions, good work.

I always get an Exception when running my scripts

Hi,

I'm using this library to programmatically get information from TheTvDb about some tv series.
I run my scripts and everything starts to work so I succeed in getting informations about some series, but after some minutes an Exception is always thrown. Here is the error:

Uncaught exception 'Moinax\TvDb\XmlException' with message 'Error in file on line 47 with message : Opening and ending tag mismatch: meta line 11 and head Error in file on line 118 with message : Entity 'bull' not defined Error in file on line 120 with message : Entity 'bull' not defined Error in file on line 129 with message : Premature end of data in tag body line 48 Error in file on line 129 with message : Premature end of data in tag meta line 9 Error in file on line 129 with message : Premature end of data in tag meta line 7 Error in file on line 129 with message : Premature end of data in tag head line 6 Error in file on line 129 with message : Premature end of data in tag html line 5 ' in /myApp/Moinax/TvDb/Client.php:396 Stack trace: #0 /myApp/Moinax/TvDb/Client.php(354): Moinax\TvDb\Client->getXml('<!DOCTYPE html>...' in /myApp/Moinax/TvDb/Client.php:396

The error comes from throw new XmlException(implode("\n\n<br/><br/>", $errors)); in getXml() function that is called in fetchXml() function in Client.php
I also print the error code from fetch() function in CurlClient.php, it is 502 or 522.

What I do in my scripts is:
-- call getSeries() to find the series ID by name
-- call getSerie( ID )
-- call getSerieEpisodes( ID, "en" )
-- call getBanners ( ID )

Any idea about the reason of my problem? I also don't understand those errors and I don't know what lines it refers.

Thanks

getSeries() @internal?

Hi, is there any reason that the getSeries() method is marked as internal? My IDE marks this as "do not use" but the api endpoint behind the getSeries() method is publicly available so should the method be.

Are there any reasons against the public usage of this method?

Getting error on trying the examples/index.php

Dear Mr,

Well, I got this error line while trying the examples. I am a learner :) Did I need to configure something in the php or somewhere?

Fatal error: Class 'Moinax\TvDb\Http\CurlClient' not found in D:\Local_Jack\TvDb-master\src\Moinax\TvDb\Client.php on line 79

Please help :)
Thank you.

Regards.
Jack.

Documentation

Add documentation for cached and non-cached uses.

Tagging !

Could you tag a 1.0.0 version of the library ? It will make my life easier because I'm building a Symfony2 bundle for this library and I prefer stable versions instead using dev-master.

Thanks

APi v2?

APIv2

A new version of the API has been written which uses JSON instead of XML files. Documentation for this version can be found at https://api.thetvdb.com/swagger. It is highly recommended that any new development be done using the new API. This version of the API will continue to function until October 1st, 2017 at which time it will be discontinued.

https://api.thetvdb.com/swagger

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.