Пример #1
0
        public void RemoveMovie(TmdbMovie movie, string sessionId)
        {
            if (null == movie)
            {
                throw new ArgumentNullException(nameof(movie));
            }
            if (null == sessionId)
            {
                throw new ArgumentNullException(nameof(sessionId));
            }
            if (0 == sessionId.Length)
            {
                throw new ArgumentException(nameof(sessionId) + " must not be empty.", nameof(sessionId));
            }
            var movieId = movie.Id;
            var args    = new JsonObject();

            args.Add("session_id", sessionId);
            var payload = new JsonObject();

            payload.Add("media_id", movieId);
            var id = GetField("id", -1);

            if (-1 < id)
            {
                Tmdb.Invoke(string.Concat("/list/" + id.ToString() + "/remove_item"), args, payload);
            }
        }
Пример #2
0
        // this isn't really a great idea since it sends a web request to get one bit of info
        // you can get all at once using the Movies property, albeit indirectly
        public bool ContainsMovie(TmdbMovie movie)
        {
            var args = new JsonObject();

            args.Add("movie_id", movie.Id);
            var id = GetField("id", -1);             // optimization
            IDictionary <string, object> d = null;

            if (-1 != id)
            {
                d = Tmdb.Invoke(string.Concat("/list/", id.ToString(), "/item_status", args));
            }
            if (null != d)
            {
                object o;
                if (d.TryGetValue("item_present", out o) && o is bool && (bool)o)
                {
                    return(true);
                }
            }
            return(false);
        }