示例#1
0
        public async Task <object> Get(GetBifFile request)
        {
            var item        = _libraryManager.GetItemById(request.Id);
            var mediaSource =
                ((IHasMediaSources)item).GetMediaSources(false)
                .FirstOrDefault(i => string.Equals(i.Id, request.MediaSourceId));

            var path = VideoProcessor.GetExistingBifPath(item, mediaSource.Id, request.Width);

            if (path == null)
            {
                path = await new VideoProcessor(_logger, _mediaEncoder, _fileSystem, _appPaths, _libraryMonitor)
                       .GetEmptyBif().ConfigureAwait(false);
            }

            _logger.Info("Returning bif file: {0}", path);
            return(await ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions
            {
                ContentType = "application/octet-stream",
                Path = path
            }).ConfigureAwait(false));
        }
示例#2
0
        public async Task<object> Get(GetBifFile request)
        {
            var item = _libraryManager.GetItemById(request.Id);
            var mediaSource =
                ((IHasMediaSources)item).GetMediaSources(false)
                    .FirstOrDefault(i => string.Equals(i.Id, request.MediaSourceId));

            var path = VideoProcessor.GetExistingBifPath(item, mediaSource.Id, request.Width);

            if (path == null)
            {
                path = await new VideoProcessor(_logger, _mediaEncoder, _fileSystem, _appPaths, _libraryMonitor)
                    .GetEmptyBif().ConfigureAwait(false);
            }

            _logger.Info("Returning bif file: {0}", path);
            return ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions
            {
                ContentType = "application/octet-stream",
                Path = path
            });
        }