public virtual void Start(ProgressNotification notification, dynamic options) { Logger.Debug("Starting banner download job"); if (options != null) { Series series = _seriesProvider.GetSeries(options.SeriesId); if (series != null && !String.IsNullOrEmpty(series.BannerUrl)) { DownloadBanner(notification, series); } return; } var seriesInDb = _seriesProvider.GetAllSeries(); foreach (var series in seriesInDb.Where(s => !String.IsNullOrEmpty(s.BannerUrl))) { DownloadBanner(notification, series); } Logger.Debug("Finished banner download job"); }
public virtual void Start(ProgressNotification notification, dynamic options) { IList <Series> seriesToUpdate; if (options == null || options.SeriesId == 0) { if (_configProvider.IgnoreArticlesWhenSortingSeries) { seriesToUpdate = _seriesProvider.GetAllSeries().OrderBy(o => o.Title.IgnoreArticles()).ToList(); } else { seriesToUpdate = _seriesProvider.GetAllSeries().OrderBy(o => o.Title).ToList(); } } else { seriesToUpdate = new List <Series> { _seriesProvider.GetSeries(options.SeriesId) }; } //Update any Daily Series in the DB with the IsDaily flag _referenceDataProvider.UpdateDailySeries(); foreach (var series in seriesToUpdate) { try { notification.CurrentMessage = "Updating " + series.Title; _seriesProvider.UpdateSeriesInfo(series.SeriesId); _episodeProvider.RefreshEpisodeInfo(series); notification.CurrentMessage = "Update completed for " + series.Title; } catch (Exception ex) { Logger.ErrorException("Failed to update episode info for series: " + series.Title, ex); } } }
public JsonResult DeleteQualityProfile(int profileId) { if (_seriesProvider.GetAllSeries().Where(s => s.QualityProfileId == profileId).Count() != 0) { return(JsonNotificationResult.Oops("Profile is still in use.")); } _qualityProvider.Delete(profileId); return(Json("ok")); }
public virtual void Start(ProgressNotification notification, dynamic options) { IList <Series> seriesToScan; if (options == null || options.SeriesId == 0) { if (_configProvider.IgnoreArticlesWhenSortingSeries) { seriesToScan = _seriesProvider.GetAllSeries().OrderBy(o => o.Title.IgnoreArticles()).ToList(); } else { seriesToScan = _seriesProvider.GetAllSeries().OrderBy(o => o.Title).ToList(); } } else { seriesToScan = new List <Series>() { _seriesProvider.GetSeries(options.SeriesId) }; } foreach (var series in seriesToScan) { try { notification.CurrentMessage = string.Format("Scanning disk for '{0}'", series.Title); _diskScanProvider.Scan(series); notification.CurrentMessage = string.Format("Disk Scan completed for '{0}'", series.Title); } catch (Exception e) { Logger.ErrorException("An error has occurred while scanning " + series.Title, e); } } }
public void Start(ProgressNotification notification, dynamic options) { List <Series> seriesToRefresh; if (options == null || options.SeriesId <= 0) { seriesToRefresh = _seriesProvider.GetAllSeries().ToList(); } else { seriesToRefresh = new List <Series> { _seriesProvider.GetSeries(options.SeriesId) } }; foreach (var series in seriesToRefresh) { RefreshMetadata(notification, series); } }
private void ScanSeries(ProgressNotification notification) { var syncList = _seriesProvider.GetAllSeries().Where(s => s.LastInfoSync == null && !_attemptedSeries.Contains(s.SeriesId)).ToList(); if (syncList.Count == 0) { return; } foreach (var currentSeries in syncList) { try { _attemptedSeries.Add(currentSeries.SeriesId); notification.CurrentMessage = String.Format("Searching for '{0}'", new DirectoryInfo(currentSeries.Path).Name); _updateInfoJob.Start(notification, new { SeriesId = currentSeries.SeriesId }); _diskScanJob.Start(notification, new { SeriesId = currentSeries.SeriesId }); var updatedSeries = _seriesProvider.GetSeries(currentSeries.SeriesId); AutoIgnoreSeasons(updatedSeries.SeriesId); //Download the banner for the new series _bannerDownloadJob.Start(notification, new { SeriesId = updatedSeries.SeriesId }); //Get Scene Numbering if applicable _xemUpdateJob.Start(notification, new { SeriesId = updatedSeries.SeriesId }); notification.CurrentMessage = String.Format("{0} was successfully imported", updatedSeries.Title); } catch (Exception e) { Logger.ErrorException(e.Message, e); } } //Keep scanning until there no more shows left. ScanSeries(notification); }
public ActionResult Editor() { var profiles = _qualityProvider.All(); ViewData["QualityProfiles"] = profiles; //Create the select lists var masterProfiles = profiles.ToList(); masterProfiles.Insert(0, new QualityProfile { QualityProfileId = -10, Name = "Select..." }); ViewData["MasterProfileSelectList"] = new SelectList(masterProfiles, "QualityProfileId", "Name"); ViewData["BoolSelectList"] = new SelectList(new List <KeyValuePair <int, string> > { new KeyValuePair <int, string>(-10, "Select..."), new KeyValuePair <int, string>(1, "True"), new KeyValuePair <int, string>(0, "False") }, "Key", "Value" ); var backlogSettingTypes = new List <KeyValuePair <int, string> >(); foreach (BacklogSettingType backlogSettingType in Enum.GetValues(typeof(BacklogSettingType))) { backlogSettingTypes.Add(new KeyValuePair <int, string>((int)backlogSettingType, backlogSettingType.ToString())); } ViewData["BacklogSettingTypes"] = backlogSettingTypes; var masterBacklogList = backlogSettingTypes.ToList(); masterBacklogList.Insert(0, new KeyValuePair <int, string>(-10, "Select...")); ViewData["MasterBacklogSettingSelectList"] = new SelectList(masterBacklogList, "Key", "Value"); var series = GetSeriesModels(_seriesProvider.GetAllSeries()); return(View(series)); }
public void Start(ProgressNotification notification, dynamic options) { List <Series> seriesToRename; if (options == null || options.SeriesId <= 0) { seriesToRename = _seriesProvider.GetAllSeries().ToList(); } else { seriesToRename = new List <Series> { _seriesProvider.GetSeries(options.SeriesId) }; } foreach (var series in seriesToRename) { notification.CurrentMessage = String.Format("Renaming episodes for '{0}'", series.Title); Logger.Debug("Getting episodes from database for series: {0}", series.SeriesId); var episodeFiles = _mediaFileProvider.GetSeriesFiles(series.SeriesId); if (episodeFiles == null || episodeFiles.Count == 0) { Logger.Warn("No episodes in database found for series: {0}", series.SeriesId); return; } var newEpisodeFiles = new List <EpisodeFile>(); var oldEpisodeFiles = new List <EpisodeFile>(); foreach (var episodeFile in episodeFiles) { try { var oldFile = new EpisodeFile(episodeFile); var newFile = _diskScanProvider.MoveEpisodeFile(episodeFile); if (newFile != null) { newEpisodeFiles.Add(newFile); oldEpisodeFiles.Add(oldFile); } } catch (Exception e) { Logger.WarnException("An error has occurred while renaming file", e); } } //Remove & Create Metadata for episode files _metadataProvider.RemoveForEpisodeFiles(oldEpisodeFiles); _metadataProvider.CreateForEpisodeFiles(newEpisodeFiles); //Start AfterRename var message = String.Format("Renamed: Series {0}", series.Title); _externalNotificationProvider.AfterRename(message, series); notification.CurrentMessage = String.Format("Rename completed for {0}", series.Title); } }