Esempio n. 1
0
        public object Get(Search request)
        {
            if (request.MediaType == "show")
            {
                if (request.Local == "true")
                {
                    Console.WriteLine("Local show search request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                    return(JsonSerializer.SerializeToString(RestUtils.GetLocalSearch(true, request.Query)));
                }

                else
                {
                    Console.WriteLine("External show search request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                    //TODO: Implement this funationality
                    return(JsonSerializer.SerializeToString(new ReturnClass()
                    {
                        Key = "response", Value = "I don't understand your request... yet"
                    }));
                }
            }
            else
            {
                if (request.Local == "true")
                {
                    Console.WriteLine("Local movie search request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                    return(JsonSerializer.SerializeToString(RestUtils.GetLocalSearch(false, request.Query)));
                }

                else
                {
                    Console.WriteLine("IMDB search request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                    return(JsonSerializer.SerializeToString(RestUtils.GetSearchImdbMovies(request.Query)));
                }
            }
        }
Esempio n. 2
0
        public object Get(GetInfoRequest request)
        {
            //get/{MediaType}/{All}/{Pending}/{Downloaded}
            if (request.MediaType == "show")
            {
                if (request.Pending == "true")
                {
                    Console.WriteLine("Pending shows request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                    return(JsonSerializer.SerializeToString(RestUtils.GetPendingDownloaded(true, true)));
                }
                else if (request.Downloaded == "true")
                {
                    Console.WriteLine("Downloaded shows request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                    return(JsonSerializer.SerializeToString(RestUtils.GetPendingDownloaded(true, false)));
                }
                else
                {
                    if (request.All == "true")
                    {
                        Console.WriteLine("All shows request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                        return(JsonSerializer.SerializeToString(RestUtils.GetShows(true)));
                    }
                    else
                    {
                        Console.WriteLine("My shows request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                        return(JsonSerializer.SerializeToString(RestUtils.GetShows(false)));
                    }
                }
            }

            else
            {
                if (request.Pending == "true")
                {
                    Console.WriteLine("Pending movies request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                    return(JsonSerializer.SerializeToString(RestUtils.GetPendingDownloaded(false, true)));
                }
                else if (request.Downloaded == "true")
                {
                    Console.WriteLine("Downloaded movies request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                    return(JsonSerializer.SerializeToString(RestUtils.GetPendingDownloaded(false, false)));
                }
                else
                {
                    if (request.All == "true")
                    {
                        Console.WriteLine("All movies request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                        return(JsonSerializer.SerializeToString(RestUtils.GetMovies(true)));
                    }
                    else
                    {
                        Console.WriteLine("My movies request: " + DateTime.Now.ToString("M/d/yyyy H:mm:ss:ff"));
                        return(JsonSerializer.SerializeToString(RestUtils.GetMovies(false)));
                    }
                }
            }
        }