Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tmdb-api.php #85

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 39 additions & 16 deletions tmdb-api.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* TMDB API v3 PHP class - wrapper to API version 3 of 'themoviedb.org
* API Documentation: http://help.themoviedb.org/kb/api/about-3
Expand Down Expand Up @@ -99,21 +98,20 @@
* Person images http://api.themoviedb.org/3/person/287/images
*/

require ("controller/classes/data/ApiBaseObject.php");
require ("controller/classes/data/Collection.php");
require ("controller/classes/data/Company.php");
require ("controller/classes/data/Episode.php");
require ("controller/classes/data/Genre.php");
require ("controller/classes/data/Movie.php");
require ("controller/classes/data/Person.php");
require ("controller/classes/data/Role.php");
require ("controller/classes/data/Season.php");
require ("controller/classes/data/TVShow.php");
require ("controller/classes/roles/MovieRole.php");
require ("controller/classes/roles/TVShowRole.php");
require ("controller/classes/config/APIConfiguration.php");
require ("controller/classes/config/Configuration.php");

include("controller/classes/data/ApiBaseObject.php");
include("controller/classes/data/Collection.php");
include("controller/classes/data/Company.php");
include("controller/classes/data/Episode.php");
include("controller/classes/data/Genre.php");
include("controller/classes/data/Movie.php");
include("controller/classes/data/Person.php");
include("controller/classes/data/Role.php");
include("controller/classes/data/Season.php");
include("controller/classes/data/TVShow.php");
include("controller/classes/roles/MovieRole.php");
include("controller/classes/roles/TVShowRole.php");
include("controller/classes/config/APIConfiguration.php");
include("controller/classes/config/Configuration.php");

class TMDB {

Expand Down Expand Up @@ -966,5 +964,30 @@ public function getMoviesByGenre($idGenre, $page = 1) {

return $movies;
}
public function searchMoviesByYear($year, $page = 1) {

$movies = array();

$result = $this->_call('discover/movie', '&page='. $page."&year=".$year);

foreach($result['results'] as $data){
$movies[] = new Movie($data);
}

return $movies;
}
public function searchTVShowsByYear($year,$page = 1) {

$tvShows = array();

$result = $this->_call('discover/tv', '&page='. $page."&first_air_date_year=".$year);

foreach($result['results'] as $data){
$tvShows[] = new TVShow($data);
}

return $tvShows;
}

}
?>