private async Task <MetadataResult <Series> > GetDefaultMetadata(SeriesInfo info, CancellationToken cancellationToken)
        {
            var result = new MetadataResult <Series>();
            var series = await ApiManager.GetSeriesInfoByPath(info.Path);

            if (series == null)
            {
                Logger.LogWarning($"Unable to find series info for path {info.Path}");
                return(result);
            }
            Logger.LogInformation($"Found series info for path {info.Path}");

            var tags = await ApiManager.GetTags(series.Id);

            var(displayTitle, alternateTitle) = Text.GetSeriesTitles(series.AniDB.Titles, series.Shoko.Name, info.MetadataLanguage);

            result.Item = new Series {
                Name            = displayTitle,
                OriginalTitle   = alternateTitle,
                Overview        = Text.SanitizeTextSummary(series.AniDB.Description),
                PremiereDate    = series.AniDB.AirDate,
                EndDate         = series.AniDB.EndDate,
                ProductionYear  = series.AniDB.AirDate?.Year,
                Status          = series.AniDB.EndDate == null ? SeriesStatus.Continuing : SeriesStatus.Ended,
                Tags            = tags,
                CommunityRating = series.AniDB.Rating.ToFloat(10),
            };
            result.Item.SetProviderId("Shoko Series", series.Id);
            if (Plugin.Instance.Configuration.AddAniDBId)
            {
                result.Item.SetProviderId("AniDB", series.AniDB.ID.ToString());
            }

            result.HasMetadata = true;
            ApiManager.MarkSeriesAsFound(series.Id);

            result.ResetPeople();
            foreach (var person in await ApiManager.GetPeople(series.Id))
            {
                result.AddPerson(person);
            }

            return(result);
        }
Example #2
0
        public async Task <MetadataResult <BoxSet> > GetDefaultMetadata(BoxSetInfo info, CancellationToken cancellationToken)
        {
            var result = new MetadataResult <BoxSet>();
            var series = await ApiManager.GetSeriesInfoByPath(info.Path);

            if (series == null)
            {
                Logger.LogWarning($"Unable to find series info for path {info.Path}");
                return(result);
            }

            int aniDBId = series.AniDB.ID;

            if (series.Shoko.Sizes.Total.Episodes <= 1)
            {
                Logger.LogWarning($"series did not contain multiple movies! Skipping path {info.Path}");
                return(result);
            }

            var(displayTitle, alternateTitle) = Text.GetSeriesTitles(series.AniDB.Titles, series.AniDB.Title, info.MetadataLanguage);
            var tags = await ApiManager.GetTags(series.Id);

            result.Item = new BoxSet {
                Name            = displayTitle,
                OriginalTitle   = alternateTitle,
                Overview        = Text.SanitizeTextSummary(series.AniDB.Description),
                PremiereDate    = series.AniDB.AirDate,
                EndDate         = series.AniDB.EndDate,
                ProductionYear  = series.AniDB.AirDate?.Year,
                Tags            = tags,
                CommunityRating = series.AniDB.Rating.ToFloat(10),
            };
            result.Item.SetProviderId("Shoko Series", series.Id);
            if (Plugin.Instance.Configuration.AddAniDBId)
            {
                result.Item.SetProviderId("AniDB", series.AniDB.ID.ToString());
            }

            result.HasMetadata = true;

            return(result);
        }