Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

yoris/trakt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

61 Commits

Repository files navigation

Trakt

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

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

About

This is a Ruby API for trakt, a TV show and movie recommendation service. http://trakt.tv

Resources

Readme

License

MIT license

Stars

Watchers

Forks

Packages

Contributors

Languages

  • Ruby 100.0%