Esempio n. 1
0
            private static DirectTorrent.Data.Yify.Models.Order orderToOrder(DirectTorrent.Logic.Models.Order order)
            {
                switch (order)
                {
                case Logic.Models.Order.Ascending:
                    return(Data.Yify.Models.Order.Ascending);

                case Logic.Models.Order.Descending:
                    return(Data.Yify.Models.Order.Descending);
                }
                throw new ArgumentException("Order is valid.", "order");
            }
Esempio n. 2
0
            /// <summary>
            /// Reads information about specific movies based on the query parameters.
            /// </summary>
            /// <param name="limit">The amount of movies to be returned by the query.</param>
            /// <param name="page">The set of movies to display (eg limit=15 and set=2 will show you movies 15-30).</param>
            /// <param name="quality">The quality type to filter by.</param>
            /// <param name="minimumRating">The minimum movie rating for display (0-9, inclusive).</param>
            /// <param name="queryTerm">The keywords to search by (maybe be multiple keywords, eg. britney, spears).</param>
            /// <param name="genre">The genre from which to display movies from.</param>
            /// <param name="sortBy">The sorting parameter.</param>
            /// <param name="orderBy">The order in which the movies will be displayed.</param>
            /// <returns>A list of movies that match the query parameters.</returns>
            public static List <Movie> ListMovies(byte limit = 20, uint page = 1,
                                                  DirectTorrent.Logic.Models.Quality quality = DirectTorrent.Logic.Models.Quality.ALL, byte minimumRating = 0, string queryTerm = "", string genre = "ALL",
                                                  DirectTorrent.Logic.Models.Sort sortBy     = DirectTorrent.Logic.Models.Sort.DateAdded, DirectTorrent.Logic.Models.Order orderBy = DirectTorrent.Logic.Models.Order.Descending)
            {
                var temp = new List <Movie>();
                // Queries Yify for movies
                var source = ApiWrapper.ListMovies(Format.JSON, limit, page, qualityToQuality(quality), minimumRating, queryTerm, genre,
                                                   sortToSort(sortBy), orderToOrder(orderBy));

                // Maps DTOs to business models
                source.Data.Movies.ForEach(x =>
                {
                    var tempMov = new Movie(x);
                    temp.Add(tempMov);
                });
                return(temp);
            }