public JsonResult SaveRootDir(string path)
        {
            if (String.IsNullOrWhiteSpace(path))
            {
                JsonNotificationResult.Error("Can't add root folder", "Path can not be empty");
            }

            _rootFolderProvider.Add(new RootDir {
                Path = path
            });

            return(JsonNotificationResult.Info("Root Folder saved", "Root folder saved successfully."));
        }
        public JsonResult AddNewSeries(string path, string seriesName, int seriesId, int qualityProfileId, string startDate)
        {
            if (string.IsNullOrWhiteSpace(path) || String.Equals(path, "null", StringComparison.InvariantCultureIgnoreCase))
            {
                return(JsonNotificationResult.Error("Couldn't add " + seriesName, "You need a valid root folder"));
            }

            path = Path.Combine(path, MediaFileProvider.CleanFilename(seriesName));

            //Create the folder for the new series
            //Use the created folder name when adding the series
            path = _diskProvider.CreateDirectory(path);

            return(AddExistingSeries(path, seriesName, seriesId, qualityProfileId, startDate));
        }
Exemple #3
0
        public JsonResult AutoConfigureSab()
        {
            try
            {
                var info = _autoConfigureProvider.AutoConfigureSab();

                if (info != null)
                {
                    return(Json(info, JsonRequestBehavior.AllowGet));
                }
            }

            catch (Exception)
            {
            }

            return(JsonNotificationResult.Error("Auto-Configure Failed", "Please enter your SAB Settings Manually"));
        }
        public JsonResult AddExistingSeries(string path, string seriesName, int seriesId, int qualityProfileId, string startDate)
        {
            if (seriesId == 0 || String.IsNullOrWhiteSpace(seriesName))
            {
                return(JsonNotificationResult.Error("Add Existing series failed.", "Invalid Series information"));
            }

            DateTime?date = null;

            if (!String.IsNullOrWhiteSpace(startDate))
            {
                date = DateTime.Parse(startDate, null, DateTimeStyles.RoundtripKind);
            }

            _seriesProvider.AddSeries(seriesName, path, seriesId, qualityProfileId, date);
            _jobProvider.QueueJob(typeof(ImportNewSeriesJob));

            return(JsonNotificationResult.Info(seriesName, "Was added successfully"));
        }