Exemple #1
0
        private static WatchlistAuth CreateWatchListAuth(String imdbID, String title, Int16 year)
        {
            WatchlistAuth auth = new WatchlistAuth();

            auth.Movies            = new TraktMovie[1];
            auth.Movies[0]         = new TraktMovie();
            auth.Movies[0].imdb_id = imdbID;
            auth.Movies[0].Title   = title;
            auth.Movies[0].year    = year;
            return(auth);
        }
Exemple #2
0
        private void WatchlistMovie_Click(object sender, RoutedEventArgs e)
        {
            lastModel = (ListItemViewModel)((MenuItem)sender).DataContext;
            var watchlistClient = new WebClient();

            watchlistClient.UploadStringCompleted += new UploadStringCompletedEventHandler(client_UploadMovieWatchlistStringCompleted);
            WatchlistAuth auth = new WatchlistAuth();

            auth.Movies            = new TraktMovie[1];
            auth.Movies[0]         = new TraktMovie();
            auth.Movies[0].imdb_id = lastModel.Imdb;
            auth.Movies[0].Title   = lastModel.Name;
            auth.Movies[0].year    = Int16.Parse(lastModel.SubItemText);
            watchlistClient.UploadStringAsync(new Uri("https://api.trakt.tv/movie/watchlist/9294cac7c27a4b97d3819690800aa2fedf0959fa"), AppUser.createJsonStringForAuthentication(typeof(WatchlistAuth), auth));
        }
Exemple #3
0
        /// <summary>
        /// Removes a movie from the Trakt watchlist through URL https://api.trakt.tv/movie/unwatchlist/[KEY]
        /// </summary>
        /// <param name="IMDBID">The IMDBID of the movie.</param>
        /// <param name="title">The name of the movie. (Attribute is title on trakt.tv).</param>
        /// <param name="year">The year the movie premiered.</param>
        /// <returns>
        /// If the movie was successfully removed from the watchlist on trakt.tv, it will return TRUE. If it
        /// fails FALSE will be returned.
        /// </returns>
        internal async Task <Boolean> removeMovieFromWatchlist(String IMDBID, String title, Int16 year)
        {
            try
            {
                WebClient     watchlistClient = new WebClient();
                WatchlistAuth auth            = CreateWatchListAuth(IMDBID, title, year);
                String        jsonString      = await watchlistClient.UploadStringTaskAsync(new Uri("https://api.trakt.tv/movie/unwatchlist/9294cac7c27a4b97d3819690800aa2fedf0959fa"), AppUser.createJsonStringForAuthentication(typeof(WatchlistAuth), auth));

                TraktMovie movie = await getMovieByIMDB(IMDBID);

                movie.InWatchlist = false;

                return(saveMovie(movie));
            }
            catch (WebException)
            { GoogleAnalytics.EasyTracker.GetTracker().SendException("WebException in removeMovieFromWatchlist(" + IMDBID + ", " + title + ").", false); }
            catch (TargetInvocationException)
            { GoogleAnalytics.EasyTracker.GetTracker().SendException("TargetInvocationException in removeMovieFromWatchlist(" + IMDBID + ", " + title + ").", false); }

            return(false);
        }