예제 #1
0
        public List <TagDetails> Details()
        {
            var tags          = All();
            var delayProfiles = _delayProfileService.All();
            var importLists   = _importListFactory.All();
            var notifications = _notificationFactory.All();
            var restrictions  = _releaseProfileService.All();
            var authors       = _authorService.GetAllAuthors();
            var rootFolders   = _rootFolderService.All();

            var details = new List <TagDetails>();

            foreach (var tag in tags)
            {
                details.Add(new TagDetails
                {
                    Id              = tag.Id,
                    Label           = tag.Label,
                    DelayProfileIds = delayProfiles.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
                    ImportListIds   = importLists.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
                    NotificationIds = notifications.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
                    RestrictionIds  = restrictions.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
                    AuthorIds       = authors.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
                    RootFolderIds   = rootFolders.Where(c => c.DefaultTags.Contains(tag.Id)).Select(c => c.Id).ToList()
                });
            }

            return(details);
        }
예제 #2
0
        public override HealthCheck Check()
        {
            var rootFolders = _authorService.AllAuthorPaths()
                              .Select(s => _rootFolderService.GetBestRootFolderPath(s.Value))
                              .Distinct();

            var missingRootFolders = rootFolders.Where(s => !_diskProvider.FolderExists(s))
                                     .ToList();

            missingRootFolders.AddRange(_importListFactory.All()
                                        .Select(s => s.RootFolderPath)
                                        .Distinct()
                                        .Where(s => !_diskProvider.FolderExists(s))
                                        .ToList());

            missingRootFolders = missingRootFolders.Distinct().ToList();

            if (missingRootFolders.Any())
            {
                if (missingRootFolders.Count == 1)
                {
                    return(new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RootFolderCheckSingleMessage"), missingRootFolders.First()), "#missing-root-folder"));
                }

                var message = string.Format(_localizationService.GetLocalizedString("RootFolderCheckMultipleMessage"), string.Join(" | ", missingRootFolders));
                return(new HealthCheck(GetType(), HealthCheckResult.Error, message, "#missing-root-folder"));
            }

            return(new HealthCheck(GetType()));
        }
예제 #3
0
        public override HealthCheck Check()
        {
            var missingRootFolders = _authorService.GetAllAuthors()
                                     .Select(s => _diskProvider.GetParentFolder(s.Path))
                                     .Distinct()
                                     .Where(s => !_diskProvider.FolderExists(s))
                                     .ToList();

            missingRootFolders.AddRange(_importListFactory.All()
                                        .Select(s => s.RootFolderPath)
                                        .Distinct()
                                        .Where(s => !_diskProvider.FolderExists(s)).ToList());

            missingRootFolders = missingRootFolders.Distinct().ToList();

            if (missingRootFolders.Any())
            {
                if (missingRootFolders.Count == 1)
                {
                    return(new HealthCheck(GetType(), HealthCheckResult.Error, "Missing root folder: " + missingRootFolders.First(), "#missing-root-folder"));
                }

                var message = string.Format("Multiple root folders are missing: {0}", string.Join(" | ", missingRootFolders));
                return(new HealthCheck(GetType(), HealthCheckResult.Error, message, "#missing-root-folder"));
            }

            return(new HealthCheck(GetType()));
        }
예제 #4
0
        public List <TagDetails> Details()
        {
            var tags          = All();
            var delayProfiles = _delayProfileService.All();
            var importLists   = _importListFactory.All();
            var notifications = _notificationFactory.All();
            var restrictions  = _restrictionService.All();
            var movies        = _movieService.AllMovieTags();
            var indexers      = _indexerService.All();

            var details = new List <TagDetails>();

            foreach (var tag in tags)
            {
                details.Add(new TagDetails
                {
                    Id              = tag.Id,
                    Label           = tag.Label,
                    DelayProfileIds = delayProfiles.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
                    ImportListIds   = importLists.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
                    NotificationIds = notifications.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
                    RestrictionIds  = restrictions.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
                    MovieIds        = movies.Where(c => c.Value.Contains(tag.Id)).Select(c => c.Key).ToList(),
                    IndexerIds      = indexers.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList()
                });
            }

            return(details);
        }
예제 #5
0
        public void Delete(int id)
        {
            if (_seriesService.GetAllSeries().Any(c => c.LanguageProfileId == id) || _importListFactory.All().Any(c => c.LanguageProfileId == id))
            {
                throw new LanguageProfileInUseException(id);
            }

            _profileRepository.Delete(id);
        }
예제 #6
0
        public void Delete(int id)
        {
            if (_movieService.GetAllMovies().Any(c => c.ProfileId == id) || _importListFactory.All().Any(c => c.ProfileId == id))
            {
                throw new ProfileInUseException(id);
            }

            _profileRepository.Delete(id);
        }
예제 #7
0
        public void Delete(int id)
        {
            if (_seriesService.GetAllSeries().Any(c => c.QualityProfileId == id) || _importListFactory.All().Any(c => c.QualityProfileId == id))
            {
                var profile = _profileRepository.Get(id);
                throw new QualityProfileInUseException(profile.Name);
            }

            _profileRepository.Delete(id);
        }
예제 #8
0
        public void Delete(int id)
        {
            if (_artistService.GetAllArtists().Any(c => c.QualityProfileId == id) ||
                _importListFactory.All().Any(c => c.ProfileId == id) ||
                _rootFolderService.All().Any(c => c.DefaultQualityProfileId == id))
            {
                var profile = _profileRepository.Get(id);
                throw new QualityProfileInUseException(profile.Name);
            }

            _profileRepository.Delete(id);
        }
예제 #9
0
        public void Delete(int id)
        {
            var profile = _profileRepository.Get(id);

            if (profile.Name == NONE_PROFILE_NAME ||
                _authorService.GetAllAuthors().Any(c => c.MetadataProfileId == id) ||
                _importListFactory.All().Any(c => c.MetadataProfileId == id) ||
                _rootFolderService.All().Any(c => c.DefaultMetadataProfileId == id))
            {
                throw new MetadataProfileInUseException(profile.Name);
            }

            _profileRepository.Delete(id);
        }
        public override HealthCheck Check()
        {
            var importLists        = _importListFactory.All();
            var missingRootFolders = new Dictionary <string, List <ImportListDefinition> >();

            foreach (var importList in importLists)
            {
                var rootFolderPath = importList.RootFolderPath;

                if (missingRootFolders.ContainsKey(rootFolderPath))
                {
                    missingRootFolders[rootFolderPath].Add(importList);

                    continue;
                }

                if (!_diskProvider.FolderExists(rootFolderPath))
                {
                    missingRootFolders.Add(rootFolderPath, new List <ImportListDefinition> {
                        importList
                    });
                }
            }

            if (missingRootFolders.Any())
            {
                if (missingRootFolders.Count == 1)
                {
                    var missingRootFolder = missingRootFolders.First();
                    return(new HealthCheck(GetType(), HealthCheckResult.Error, $"Missing root folder for import list(s): {FormatRootFolder(missingRootFolder.Key, missingRootFolder.Value)}", "#import-list-missing-root-folder"));
                }

                var message = string.Format("Multiple root folders are missing for import lists: {0}", string.Join(" | ", missingRootFolders.Select(m => FormatRootFolder(m.Key, m.Value))));
                return(new HealthCheck(GetType(), HealthCheckResult.Error, message, "#import-list-missing-root-folder"));
            }

            return(new HealthCheck(GetType()));
        }
예제 #11
0
        public override HealthCheck Check()
        {
            var importLists        = _importListFactory.All();
            var missingRootFolders = new Dictionary <string, List <ImportListDefinition> >();

            foreach (var importList in importLists)
            {
                var rootFolderPath = importList.RootFolderPath;

                if (missingRootFolders.ContainsKey(rootFolderPath))
                {
                    missingRootFolders[rootFolderPath].Add(importList);

                    continue;
                }

                if (rootFolderPath.IsNullOrWhiteSpace() || !_diskProvider.FolderExists(rootFolderPath))
                {
                    missingRootFolders.Add(rootFolderPath, new List <ImportListDefinition> {
                        importList
                    });
                }
            }

            if (missingRootFolders.Any())
            {
                if (missingRootFolders.Count == 1)
                {
                    var missingRootFolder = missingRootFolders.First();
                    return(new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ImportListMissingRoot"), FormatRootFolder(missingRootFolder.Key, missingRootFolder.Value)), "#import-list-missing-root-folder"));
                }

                var message = string.Format(_localizationService.GetLocalizedString("ImportListMultipleMissingRoots"), string.Join(" | ", missingRootFolders.Select(m => FormatRootFolder(m.Key, m.Value))));
                return(new HealthCheck(GetType(), HealthCheckResult.Error, message, "#import-list-missing-root-folder"));
            }

            return(new HealthCheck(GetType()));
        }
예제 #12
0
        public void Delete(int id)
        {
            if (_artistService.GetAllArtists().Any(c => c.MetadataProfileId == id) || _importListFactory.All().Any(c => c.MetadataProfileId == id))
            {
                var profile = _profileRepository.Get(id);
                throw new MetadataProfileInUseException(profile.Name);
            }

            _profileRepository.Delete(id);
        }