コード例 #1
0
ファイル: FollwitAPI.cs プロジェクト: fLaSkin/MPExtended
        public static FollwitResponse UpdateMovieState(FollwitMovie data, FollwitWatchStatus status)
        {
            string url  = String.Format(FollwitConfig.URL.WatchMovie, MapToURL(status));
            string json = CallAPI(url, JSONUtil.ToJSON(data));

            return(JSONUtil.FromJSON <FollwitResponse>(json));
        }
コード例 #2
0
ファイル: FollwitAPI.cs プロジェクト: aredon/MPExtended
 public static FollwitResponse UpdateMovieState(FollwitMovie data, FollwitWatchStatus status)
 {
     string url = String.Format(FollwitConfig.URL.WatchMovie, MapToURL(status));
     string json = CallAPI(url, JSONUtil.ToJSON(data));
     return JSONUtil.FromJSON<FollwitResponse>(json);
 }
コード例 #3
0
        private bool CallFollwitMovie(WebMovieDetailed movie, FollwitWatchStatus state)
        {
            try
            {
                // create movie
                if (movie.ExternalId.Count(x => x.Site == "IMDB") == 0)
                {
                    Log.Info("Follwit: IMDB id of movie {0} unknown, not sending", movie.Title);
                    return false;
                }

                // and send it
                var fm = new FollwitMovie()
                {
                    Username = Configuration["username"],
                    Password = Configuration["passwordHash"],
                    IMDBId = movie.ExternalId.First(x => x.Site == "IMDB").Id
                };

                var ret = FollwitAPI.UpdateMovieState(fm, state);
                if (ret.Response != "success")
                {
                    Log.Warn("Follwit: failed to update watch status of movie '{0}' ({1})", movie.Title, movie.Id);
                    return false;
                }
            }
            catch (Exception ex)
            {
                Log.Warn("Follwit: failed to update movie watch status", ex);
                return false;
            }
            return true;
        }