• Stars
    star
    221
  • Rank 179,773 (Top 4 %)
  • Language
    Ruby
  • Created over 11 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🎩 A Ruby wrapper for the The Movie Database API.

Information

themoviedb Code Climate Gem Version

A Ruby wrapper for the The Movie Database API.

Ruby >= 1.9.3

Provides a simple, easy to use interface for the Movie Database API.

Get your API key here.

Getting started

$ gem install themoviedb

Example usage of the 'themovedb' gem

http://themoviedb.herokuapp.com/

https://github.com/ahmetabdi/themoviedb-example

Configuration

Tmdb::Api.key("KEY_HERE")

You can change the language for the returned data with this:

Tmdb::Api.language("de")

The default language is english. The API supports translations just be aware that it does not fall back to English in the event that a field hasn't been translated.

Resources

Current available resources:

Missing resources:

  • Account
  • Authentication
  • Changes
  • Collections
  • Credits
  • Discover
  • Keywords
  • Lists
  • Networks
  • Reviews

Example

Tmdb::Movie.find("batman")
Tmdb::TV.find("fringe")
Tmdb::Collection.find("spiderman")
Tmdb::Person.find("samuel jackson")
Tmdb::Company.find("lucas")
Tmdb::Genre.find("drama")

Search

Usage

resources => person, movie, tv, collection, company, multi

@search = Tmdb::Search.new
@search.resource('person') # determines type of resource
@search.query('samuel jackson') # the query to search against
@search.fetch # makes request

Find

The supported external sources for each object are as follows: Movies: imdb_id People: imdb_id, freebase_mid, freebase_id, tvrage_id TV Series: imdb_id, freebase_mid, freebase_id, tvdb_id, tvrage_id

Tmdb::Find.imdb_id('id')
Tmdb::Find.freebase_mid('id')
Tmdb::Find.freebase_id('id')
Tmdb::Find.tvrage_id('id')
Tmdb::Find.tvdb_id('id')

The responses are in the hash with movie_results, person_results and tv_results

Configuration

Get the system wide configuration information. Some elements of the API require some knowledge of this configuration data. The purpose of this is to try and keep the actual API responses as light as possible. This method currently holds the data relevant to building image URLs as well as the change key map. To build an image URL, you will need 3 pieces of data. The base_url, size and file_path. Simply combine them all and you will have a fully qualified URL. Here’s an example URL: http://cf2.imgobject.com/t/p/w500/8uO0gUM8aNqYLs1OsTBQiXu0fEv.jpg

configuration = Tmdb::Configuration.new
configuration.base_url
configuration.secure_base_url
configuration.poster_sizes
configuration.backdrop_sizes
configuration.profile_sizes
configuration.logo_sizes

Detail

Every example documented below uses the movie Fight Club (id 550), the TV show Breaking Bad (id 1396), and every person uses Brad Pitt (id 287). These are only used as examples to show what a real world request looks like.

Movie

movie = Tmdb::Movie.detail(550)
movie.adult => false
movie.backdrop_path => "/8uO0gUM8aNqYLs1OsTBQiXu0fEv.jpg"
movie.belongs_to_collection => nil
movie.budget => 63000000
movie.genres => [{"id"=>28, "name"=>"Action"}, {"id"=>18, "name"=>"Drama"}, {"id"=>53, "name"=>"Thriller"}]
movie.homepage => ""
movie.id => 550
movie.imdb_id => "tt0137523"
movie.original_title => "Fight Club"
movie.overview => "A ticking-time-bomb insomniac and a slippery soap salesman channel primal male aggression into a shocking new form of therapy. Their concept catches on, with underground \"fight clubs\" forming in every town, until an eccentric gets in the way and ignites an out-of-control spiral toward oblivion."
movie.popularity => 7.4
movie.poster_path => "/2lECpi35Hnbpa4y46JX0aY3AWTy.jpg"
movie.production_companies => [{"name"=>"20th Century Fox", "id"=>25}, {"name"=>"Fox 2000 Pictures", "id"=> 711}, {"name"=>"Regency Enterprises", "id"=>508}]
movie.production_countries => [{"iso_3166_1"=>"DE", "name"=>"Germany"}, {"iso_3166_1"=>"US", "name"=>"United States of America"}]
movie.release_date => "1999-10-14"
movie.revenue => 100853753
movie.runtime => 139
movie.spoken_languages => [{"iso_639_1"=>"en", "name"=>"English"}]
movie.status => "Released"
movie.tagline => "How much can you know about yourself if you've never been in a fight?"
movie.title => "Fight Club"
movie.vote_average => 8.8
movie.vote_count => 234

Get the latest movie id.

Tmdb::Movie.latest

Get the list of upcoming movies. This list refreshes every day. The maximum number of items this list will include is 100.

Tmdb::Movie.upcoming

Get the list of movies playing in theatres. This list refreshes every day. The maximum number of items this list will include is 100.

Tmdb::Movie.now_playing

Get the list of popular movies on The Movie Database. This list refreshes every day.

Tmdb::Movie.popular

Get the list of top rated movies. By default, this list will only include movies that have 10 or more votes. This list refreshes every day.

Tmdb::Movie.top_rated

Movie - Alternative Titles

Get the alternative titles for a specific movie id.

Tmdb::Movie.alternative_titles(22855)

Movie - Images

Get the images (posters and backdrops) for a specific movie id.

@movie = Tmdb::Movie.images(22855)

Grab Backdrops

@movie['backdrops']

Grab Posters

@movie['posters']

Movie - Casts

Get the cast information for a specific movie id.

Tmdb::Movie.casts(22855)

Movie - Crew

Get the crew information for a specific movie id.

Tmdb::Movie.crew(22855)

Movie - Keywords

Get the plot keywords for a specific movie id.

Tmdb::Movie.keywords(22855)

Movie - Releases

Get the release date by country for a specific movie id.

Tmdb::Movie.releases(22855)

Movie - Trailers

Get the trailers for a specific movie id.

Tmdb::Movie.trailers(22855)

Movie - Translations

Get the translations for a specific movie id.

Tmdb::Movie.translations(22855)

Movie - Similar Movies

Get the similar movies for a specific movie id.

Tmdb::Movie.similar_movies(22855)

Movie - Lists

Get the lists that the movie belongs to.

Tmdb::Movie.lists(22855)

Movie - Changes

Get the changes for a specific movie id.

Tmdb::Movie.changes(22855)

Movie - Credits

Get the credits for a specific movie id.

Tmdb::Movie.credits(22855)

TV

show = Tmdb::TV.detail(1396)

Get the list of popular TV shows. This list refreshes every day.

Tmdb::TV.popular

Get the list of top rated TV shows. By default, this list will only include TV shows that have 2 or more votes. This list refreshes every day.

Tmdb::TV.top_rated

TV - Images

Get the images (posters and backdrops) for a TV series.

@show = Tmdb::TV.images(1396)

Grab Backdrops

@show['backdrops']

Grab Posters

@show['posters']

TV - Cast

Get the cast information about a TV series.

Tmdb::TV.cast(1396)

TV - Crew

Get the crew information about a TV series.

Tmdb::TV.crew(1396)

TV - External IDs

Get the external ids that we have stored for a TV series.

Tmdb::TV.external_ids(1396)

Season

show = Tmdb::Season.detail(1396, 1)

Season - Images

Get the images (posters) that we have stored for a TV season by season number.

@season = Tmdb::Season.images(1396, 1)

Grab Posters

@season['posters']

Season - Cast

Get the cast credits for a TV season by season number.

Tmdb::Season.cast(1396, 1)

Season - Crew

Get the crew credits for a TV season by season number.

Tmdb::Season.crew(1396, 1)

Season - External IDs

Get the external ids that we have stored for a TV season by season number.

Tmdb::Season.external_ids(1396, 1)

Episode

episode = Tmdb::Episode.detail(1396, 1, 1)

Episode - Images

Get the images (episode stills) for a TV episode by combination of a season and episode number.

@episode = Tmdb::Episode.images(1396, 1, 1)

Grab Stills

@episode['stills']

Episode - Cast

Get the TV episode cast credits by combination of season and episode number.

Tmdb::Episode.cast(1396, 1, 1)

Episode - Crew

Get the TV episode crew credits by combination of season and episode number.

Tmdb::Episode.crew(1396, 1, 1)

Episode - External IDs

Get the external ids for a TV episode by comabination of a season and episode number.

Tmdb::Episode.external_ids(1396, 1, 1)

Company

company = Tmdb::Company.detail(1)
company.id => 1
company.description => nil
company.homepage => "http://www.lucasfilm.com"
company.logo_path => "/8rUnVMVZjlmQsJ45UGotDOUznxj.png"
company.name => "Lucasfilm"
company.parent_company => nil

Get the list of movies associated with a particular company.

Tmdb::Company.movies(1)

Collection

collection = Tmdb::Collection.detail(51845)
collection.id => 51845
collection.backdrop_path => "..."
collection.parts => "..."
collection.poster_path => "..."
collection.name => "DC Universe Animated Original Movies"

Get all of the images for a particular collection by collection id.

Tmdb::Collection.images(51845)

Person

person = Tmdb::Person.detail(287)
person.id => 287
person.name => "Brad Pitt"
person.place_of_birth => "Shawnee, Oklahoma, United States"
person.also_known_as => []
person.adult => false
person.biography => "From Wikipedia, the free"..
person.birthday => "1963-12-18"
person.deathday => ""
person.homepage => "http://simplybrad.com/"
person.profile_path => "w8zJQuN7tzlm6FY9mfGKihxp3Cb.jpg"

Get the list of popular people on The Movie Database. This list refreshes every day.

Tmdb::Person.popular

Get the latest person id.

Tmdb::Person.latest

Get the credits for a specific person id.

Tmdb::Person.credits(287)

Get the images for a specific person id.

Tmdb::Person.images(287)

Get the changes for a specific person id.

Tmdb::Person.changes(287)

Genre

genre = Tmdb::Genre.detail(18)
genre.id => 18
genre.name => "Drama"
genre.page => 1
genre.total_pages => 45
genre.total_results => 883
genre.results => [...]
genre.get_page(page_number) => Returns next set of movies.

Get a list of all genres.

Tmdb::Genre.list

Job

Get a list of all jobs.

Tmdb::Job.list

License

themoviedb - A ruby wrapper for the movie database API

Copyright (C) 2016 Ahmet Abdi

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.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

More Repositories

1

OverwatchCV

Overwatch OpenCV Image Detection
C++
43
star
2

DeusExMachina

C++ Poker Stars bot that doesn't use OCR but reads directly from game memory instantly
C
19
star
3

igdb

🎮 Ruby wrapper for the Internet Game Database API.
Ruby
18
star
4

atom-bitcoin

Watch the latest selling price for bitcoin while you code!
CoffeeScript
7
star
5

alluc

🌟 Wrapper for the alluc.com API
Ruby
7
star
6

atom-objc-2-rubymotion

Objective-C to RubyMotion converter for atom the hackable text editor
CoffeeScript
6
star
7

tmdb

🔮 Crystal wrapper for TMDB Api
Crystal
6
star
8

GGPoker

Proof of Concept for calling the AppModule retrieval function in PokerStars
C++
6
star
9

deflow

💎 Rubymotion OS X App which changes your wallpaper randomly in intervals.
Ruby
6
star
10

ahmetabdi.github.io

💎 My blog that needs articles :)
CSS
5
star
11

viner

🐧 Wrapper to access the unofficial Vine API.
Ruby
5
star
12

birdman

🎬 A Ruby Wrapper for the Trakt.tv API
Ruby
4
star
13

CreateProcessW_EAC_Hook

Hook CreateProcessW in EAC games and retrieve HANDLE to access memory :)
C++
4
star
14

colocator

Objective-C
3
star
15

home

Portfolio & Blog written in Elixir
HTML
3
star
16

joybox-helicopter

Joybox Helicopter Game using Ruby Motion - Based off http://www.helicoptergame.net/
Objective-C
3
star
17

ahmetabdi

3
star
18

odeon_api

Ruby
3
star
19

MagicBuddy

Magic The Gathering Mobile App in react-native
JavaScript
3
star
20

osx-CryptoBar

💵 MenuBar OS X App to constantly get the latest selling price for cryptocurrencys, written in RubyMotion.
Objective-C
3
star
21

joybox-shooter

Joybox Shooter using Ruby Motion
Objective-C
3
star
22

SkyPig

Wiki on Rails
JavaScript
3
star
23

comics

CSS
3
star
24

GreenBase

Direct3D Base for any DirectX 9 game written in C++
C++
2
star
25

ahmet.plugins

2
star
26

sublime-text-3

Sublime Setup on Mac for Ruby/Rails & RubyMotion development.
Python
2
star
27

scraper

scraper
Ruby
2
star
28

sockets

C++ Example of UDP Client and Server over socket connection
C++
2
star
29

winkapp

winkapp
Ruby
2
star
30

.atom

C
2
star
31

primes

Prime Number Multiplication Table Generator
Ruby
2
star
32

emerald

Elixir
2
star
33

E-Store

E-commerce Clothes Store
Ruby
2
star
34

garrysmod-paydayhud

Payday 2 HUD for Garrys mod
Lua
2
star
35

ball-game

Playing around with Unity, this happened.
C#
2
star
36

anagram_finder

Anagram finder in Rails
Ruby
2
star
37

PathFindingTest

PathFinding in Cocos2d-swift
Objective-C
1
star
38

kh_runner

Kingdom Hearts runner
Ruby
1
star
39

tower_defence

Tower Defence SpriteKit
Ruby
1
star
40

watchkit-app

Ruby
1
star
41

notes

1
star
42

trollscript

Because why not? https://news.ycombinator.com/item?id=2975898
Ruby
1
star
43

phaser-jump

JavaScript
1
star
44

viner-app

Viner Sinatra App
CSS
1
star
45

trackr

Ruby
1
star
46

Guard

C++
1
star
47

dotdotdot

1
star
48

SwiftCrunch

Swift
1
star
49

qualityexpressdrycleaners

qualityexpressdrycleaners.co.uk
HTML
1
star
50

pig_dll

C++
1
star
51

tmdb_elixir

Elixir
1
star
52

hello_phoenix

CSS
1
star
53

freetrade

Automate referrals @ freetrade
JavaScript
1
star
54

mirai

C
1
star
55

unity-spaceshooter

Work through of tutorial from http://unity3d.com/learn/tutorials/projects/space-shooter using Unity 5
C#
1
star
56

amethyst

Elixir
1
star
57

cpp_playground

C++
1
star
58

cube-base

C++
1
star
59

d2d1

https://msdn.microsoft.com/en-us/library/windows/desktop/dd370990(v=vs.85).aspx
C++
1
star
60

errors

Handles HTTP status codes to give more detailed information.
Ruby
1
star
61

joybox-ElementalTowerDefence

Joybox Tower Defence Game for IPhones
Objective-C
1
star
62

vm

Read information from VM and send data over socket using UDP via vmread library
C++
1
star
63

dashboard

JavaScript
1
star
64

Roto

Python
1
star
65

gmod-o-poly

💰 Monopoly gamemode for Garry's Mod. Written in LUA
Lua
1
star
66

SkyPig-LogBook

Log book for final year project
JavaScript
1
star
67

opal-three.js

1
star
68

setup

My setup config files etc.
Shell
1
star
69

injectHelper

A command line DLL injector written in C.
C
1
star