Пример #1
0
        public static FollwitResponse UpdateEpisodeState(FollwitEpisode data, FollwitWatchStatus status)
        {
            string url  = String.Format(FollwitConfig.URL.WatchEpisode, MapToURL(status));
            string json = CallAPI(url, JSONUtil.ToJSON(data));

            return(JSONUtil.FromJSON <FollwitResponse>(json));
        }
Пример #2
0
 public static FollwitResponse UpdateEpisodeState(FollwitEpisode data, FollwitWatchStatus status)
 {
     string url = String.Format(FollwitConfig.URL.WatchEpisode, MapToURL(status));
     string json = CallAPI(url, JSONUtil.ToJSON(data));
     return JSONUtil.FromJSON<FollwitResponse>(json);
 }
Пример #3
0
        private bool CallFollwitEpisode(WebTVEpisodeDetailed episode, FollwitWatchStatus state)
        {
            try
            {
                if (episode.ExternalId.Count(x => x.Site == "TVDB") == 0)
                {
                    Log.Info("Follwit: TVDB id of episode {0} unknown, not sending", episode.Title);
                    return false;
                }

                var fm = new FollwitEpisode()
                {
                    Username = Configuration["username"],
                    Password = Configuration["passwordHash"],
                    TVDBId = episode.ExternalId.First(x => x.Site == "TVDB").Id
                };

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