Exemple #1
0
        public async Task <ActionResult> UploadSubtitle(
            [FromRoute, Required] Guid itemId,
            [FromBody, Required] UploadSubtitleDto body)
        {
            var video = (Video)_libraryManager.GetItemById(itemId);
            var data  = Convert.FromBase64String(body.Data);

            await using var memoryStream = new MemoryStream(data);
            await _subtitleManager.UploadSubtitle(
                video,
                new SubtitleResponse
            {
                Format   = body.Format,
                Language = body.Language,
                IsForced = body.IsForced,
                Stream   = memoryStream
            }).ConfigureAwait(false);

            return(NoContent());
        }
        public async Task <ActionResult> UploadSubtitle(
            [FromRoute, Required] Guid itemId,
            [FromBody, Required] UploadSubtitleDto body)
        {
            var video = (Video)_libraryManager.GetItemById(itemId);
            var data  = Convert.FromBase64String(body.Data);

            await using var memoryStream = new MemoryStream(data);
            await _subtitleManager.UploadSubtitle(
                video,
                new SubtitleResponse
            {
                Format   = body.Format,
                Language = body.Language,
                IsForced = body.IsForced,
                Stream   = memoryStream
            }).ConfigureAwait(false);

            _providerManager.QueueRefresh(video.Id, new MetadataRefreshOptions(new DirectoryService(_fileSystem)), RefreshPriority.High);

            return(NoContent());
        }