Project

trakt

0.02
No commit activity in last 3 years
No release in over 3 years
API for trakt.tv service
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
 Project Readme

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