Example #1
0
        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);
        }