This is a Ruby API for trakt, a TV show and movie recommendation service. http://trakt.tv
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
LICENSE.txt
README.rdoc
Rakefile
trakt.gemspec

README.rdoc

Trakt

This is a Ruby API for the trakt.tv movie, tvshow service.

NOTE: This is for the old API. New API uses oauth and such. Feel free to submit a PR to make things work here.

Installation

Add this line to your application's Gemfile:

gem 'trakt'

And then execute:

$ bundle

Or install it yourself as:

$ gem install trakt

Usage

All calls return an JSON structure.

This is a typical default setup

require 'trakt'
trakt = Trakt.new
trakt.apikey = 'your_api_key'
trakt.username = 'your_username'
trakt.password = 'your_password'

Settings

trakt.account.settings

Searching

trakt.search.movies "the shawshank redemption"
trakt.search.shows "death note"

And wait, there's more!

Check the spec directory for the rest of the functionality and how to use it. I got lazy with documentation it seems.

Examples

Adding all your seen movies from a text file.

Adding movies from a text file is a bit hit and miss, so it's best if you create a list to add the movies to. You'll have to make a list manually in advance since creation isn't supported yet. The list takes a rather odd name. The one in the exaple here was created as “From my file”.

list = trakt.list.add('from-my-file');
IO.readlines(ENV['HOME']+"/misc/movies.txt").each do |movie|
  result = trakt.search.movies(movie)
  next unless result
  movie = result.first
  next unless movie
  list.add_item(type: :movie, imdb_id: movie['imdb_id'])
end

Marking shows unseen

Example making all episodes of season 4 of winnie the pooh unseen. (You can use Trakt::Search.shows(“the new adventures of winnie the pooh”).first to get the imdb_id)

episodes = []
1.upto(11) { |n|
  episodes << { "season" =>  4, "episode" => n }
}
Trakt::Show.episode_unseen("imdb_id" => "tt0165052", episodes: episodes)

Contributing

  1. Fork it

  2. Create your feature branch (`git checkout -b my-new-feature`)

  3. Commit your changes (`git commit -am 'Add some feature'`)

  4. Push to the branch (`git push origin my-new-feature`)

  5. Create new Pull Request