Beispiel #1
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);
        }
Beispiel #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));
        }
Beispiel #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);
        }
Beispiel #4
0
        private static string MapToURL(FollwitWatchStatus status)
        {
            switch (status)
            {
            case FollwitWatchStatus.CancelWatching:
                return("unwatching");

            case FollwitWatchStatus.Watching:
                return("watching");

            case FollwitWatchStatus.Watched:
                return("watched");

            default:
                throw new ArgumentException();
            }
        }
Beispiel #5
0
 private static string MapToURL(FollwitWatchStatus status)
 {
     switch (status)
     {
         case FollwitWatchStatus.CancelWatching:
             return "unwatching";
         case FollwitWatchStatus.Watching:
             return "watching";
         case FollwitWatchStatus.Watched:
             return "watched";
         default:
             throw new ArgumentException();
     }
 }
Beispiel #6
0
 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);
 }
        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;
        }
        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;
        }