public EpisodeInfo GetSeriesFromTags(Argus.Recording recording)
        {
            EpisodeInfo episodeInfo = new EpisodeInfo {
                SeriesName = recording.Title
            };

            if (recording.SeriesNumber.HasValue)
            {
                episodeInfo.SeasonNumber = recording.SeriesNumber.Value;
            }

            if (recording.EpisodeNumber.HasValue)
            {
                episodeInfo.EpisodeNumbers.Add(recording.EpisodeNumber.Value);
            }

            if (!episodeInfo.IsBaseInfoPresent)
            {
                // Check for formatted display value, i.e.:
                // <EpisodeNumberDisplay>1.4</EpisodeNumberDisplay>
                if (!string.IsNullOrWhiteSpace(recording.EpisodeNumberDisplay))
                {
                    var parts = recording.EpisodeNumberDisplay.Split('.');
                    if (parts.Length == 2)
                    {
                        int val;
                        if (int.TryParse(parts[0], out val))
                        {
                            episodeInfo.SeasonNumber = val;
                        }
                        if (int.TryParse(parts[1], out val))
                        {
                            episodeInfo.EpisodeNumbers.Add(val);
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(recording.Category?.Trim()))
            {
                episodeInfo.Genres.Add(new GenreInfo {
                    Name = recording.Category.Trim()
                });
                IGenreConverter converter = ServiceRegistration.Get <IGenreConverter>();
                foreach (var genre in episodeInfo.Genres)
                {
                    if (!genre.Id.HasValue && converter.GetGenreId(genre.Name, GenreCategory.Series, null, out int genreId))
                    {
                        genre.Id = genreId;
                    }
                }
            }

            episodeInfo.HasChanged = true;
            return(episodeInfo);
        }
        public EpisodeInfo GetSeriesFromTags(Argus.Recording recording)
        {
            EpisodeInfo episodeInfo = new EpisodeInfo {
                SeriesName = recording.Title
            };

            if (recording.SeriesNumber.HasValue)
            {
                episodeInfo.SeasonNumber = recording.SeriesNumber.Value;
            }

            if (recording.EpisodeNumber.HasValue)
            {
                episodeInfo.EpisodeNumbers.Add(recording.EpisodeNumber.Value);
            }

            if (!episodeInfo.IsBaseInfoPresent)
            {
                // Check for formatted display value, i.e.:
                // <EpisodeNumberDisplay>1.4</EpisodeNumberDisplay>
                if (!string.IsNullOrWhiteSpace(recording.EpisodeNumberDisplay))
                {
                    var parts = recording.EpisodeNumberDisplay.Split('.');
                    if (parts.Length == 2)
                    {
                        int val;
                        if (int.TryParse(parts[0], out val))
                        {
                            episodeInfo.SeasonNumber = val;
                        }
                        if (int.TryParse(parts[1], out val))
                        {
                            episodeInfo.EpisodeNumbers.Add(val);
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(recording.Category))
            {
                episodeInfo.Genres.Add(new GenreInfo {
                    Name = recording.Category
                });
                OnlineMatcherService.Instance.AssignMissingSeriesGenreIds(episodeInfo.Genres);
            }

            episodeInfo.HasChanged = true;
            return(episodeInfo);
        }
Пример #3
0
        public SeriesInfo GetSeriesFromTags(Argus.Recording recording)
        {
            SeriesInfo seriesInfo = new SeriesInfo {
                Series = recording.Title
            };

            if (recording.SeriesNumber.HasValue)
            {
                seriesInfo.SeasonNumber = recording.SeriesNumber.Value;
            }

            if (recording.EpisodeNumber.HasValue)
            {
                seriesInfo.EpisodeNumbers.Add(recording.EpisodeNumber.Value);
            }

            if (!seriesInfo.IsCompleteMatch)
            {
                // Check for formatted display value, i.e.:
                // <EpisodeNumberDisplay>1.4</EpisodeNumberDisplay>
                if (!string.IsNullOrWhiteSpace(recording.EpisodeNumberDisplay))
                {
                    var parts = recording.EpisodeNumberDisplay.Split('.');
                    if (parts.Length == 2)
                    {
                        int val;
                        if (int.TryParse(parts[0], out val))
                        {
                            seriesInfo.SeasonNumber = val;
                        }
                        if (int.TryParse(parts[1], out val))
                        {
                            seriesInfo.EpisodeNumbers.Add(val);
                        }
                    }
                }
            }
            return(seriesInfo);
        }