Skip to content

Commit

Permalink
add trakt. Closes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
silsha committed Feb 20, 2013
1 parent 26297c1 commit 5aabf70
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "lib/cosm"]
path = lib/cosm
url = git://github.com/MunGell/PachubeAPI.git
[submodule "lib/trakt"]
path = lib/trakt
url = git://github.com/wnielson/php-trakt.git
20 changes: 20 additions & 0 deletions trakt.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

require_once 'config.php';
require_once 'lib/trakt/trakt.php';
require_once 'lib/cosm/PachubeAPI.php';

$pachube = new PachubeAPI($cosm["apikey"]);

$traktapi = new Trakt($trakt["apikey"]);
$traktapi->setAuth($trakt["username"], $trakt["password"]);

$episodesWatched = $traktapi->userProfile($trakt["username"])["stats"]["episodes"]["watched"];
$showsWatched = $traktapi->userProfile($trakt["username"])["stats"]["shows"]["watched"];
$moviesWatched = $traktapi->userProfile($trakt["username"])["stats"]["movies"]["watched"];
$friends = $traktapi->userProfile($trakt["username"])["stats"]["friends"];

$pachube->updateDatastream("csv", $trakt["feedid"], "episodes_watched", $episodesWatched);
$pachube->updateDatastream("csv", $trakt["feedid"], "shows_watched", $showsWatched);
$pachube->updateDatastream("csv", $trakt["feedid"], "movies_watched", $moviesWatched);
$pachube->updateDatastream("csv", $trakt["feedid"], "friends", $friends);

0 comments on commit 5aabf70

Please sign in to comment.