Ejemplo n.º 1
0
        public async Task <IEnumerable <RemoteImageInfo> > GetImages(BaseItem item, CancellationToken cancelToken)
        {
            var id = item.GetProviderId("Javlibrary");

            if (string.IsNullOrEmpty(id))
            {
                return new RemoteImageInfo[] { }
            }
            ;

            // probably should be downloading the full size image, and then cropping the front cover
            var client = new Api.JavlibraryClient();
            var video  = await client.LoadVideo(id);

            return(new RemoteImageInfo[]
            {
                new RemoteImageInfo
                {
                    ProviderName = Name,
                    Type = ImageType.Primary,
                    Url = video.Cover
                },
                new RemoteImageInfo
                {
                    ProviderName = Name,
                    Type = ImageType.Thumb,
                    Url = video.BoxArt
                }
            });
        }
Ejemplo n.º 2
0
        public async Task <MetadataResult <Movie> > GetMetadata(MovieInfo info, CancellationToken cancelToken)
        {
            var originalTitle = Utility.GetVideoOriginalTitle(info, libraryManager);

            logger.LogInformation("[JellyfinJav] Javlibrary - Scanning: " + originalTitle);

            Api.Video?result = null;
            if (info.ProviderIds.ContainsKey("Javlibrary"))
            {
                result = await client.LoadVideo(info.ProviderIds["Javlibrary"]);
            }
            else
            {
                result = await client.SearchFirst(
                    Utility.ExtractCodeFromFilename(originalTitle)
                    );
            }

            if (!result.HasValue)
            {
                return(new MetadataResult <Movie>());
            }

            return(new MetadataResult <Movie>
            {
                Item = new Movie
                {
                    OriginalTitle = originalTitle,
                    Name = result.Value.Title,
                    ProviderIds = new Dictionary <string, string> {
                        { "Javlibrary", result.Value.Id }
                    },
                    Studios = new[] { result.Value.Studio }.OfType <string>().ToArray(),
                    Genres = result.Value.Genres.ToArray()
                },
                People = (from actress in result.Value.Actresses
                          select new PersonInfo
                {
                    Name = NormalizeActressName(actress),
                    Type = PersonType.Actor
                }).ToList(),
                HasMetadata = true
            });
        }