fix build and isdirectstream

This commit is contained in:
cvium 2021-03-22 23:08:09 +01:00
parent 210d10400a
commit 5e0f480e48
5 changed files with 10 additions and 14 deletions

View File

@ -943,11 +943,7 @@ namespace Emby.Dlna.PlayTo
request.DeviceId = values.GetValueOrDefault("DeviceId"); request.DeviceId = values.GetValueOrDefault("DeviceId");
request.MediaSourceId = values.GetValueOrDefault("MediaSourceId"); request.MediaSourceId = values.GetValueOrDefault("MediaSourceId");
request.LiveStreamId = values.GetValueOrDefault("LiveStreamId"); request.LiveStreamId = values.GetValueOrDefault("LiveStreamId");
request.IsDirectStream = string.Equals("true", values.GetValueOrDefault("Static"), StringComparison.OrdinalIgnoreCase);
// Be careful, IsDirectStream==true by default (Static != false or not in query).
// See initialization of StreamingRequestDto in AudioController.GetAudioStream() method : Static = @static ?? false.
request.IsDirectStream = !string.Equals("false", values.GetValueOrDefault("Static"), StringComparison.OrdinalIgnoreCase);
request.AudioStreamIndex = GetIntValue(values, "AudioStreamIndex"); request.AudioStreamIndex = GetIntValue(values, "AudioStreamIndex");
request.SubtitleStreamIndex = GetIntValue(values, "SubtitleStreamIndex"); request.SubtitleStreamIndex = GetIntValue(values, "SubtitleStreamIndex");
request.StartPositionTicks = GetLongValue(values, "StartPositionTicks"); request.StartPositionTicks = GetLongValue(values, "StartPositionTicks");

View File

@ -66,7 +66,7 @@ namespace Jellyfin.Api.Controllers
var transcodePath = _serverConfigurationManager.GetTranscodePath(); var transcodePath = _serverConfigurationManager.GetTranscodePath();
file = Path.GetFullPath(Path.Combine(transcodePath, file)); file = Path.GetFullPath(Path.Combine(transcodePath, file));
var fileDir = Path.GetDirectoryName(file); var fileDir = Path.GetDirectoryName(file);
if (string.IsNullOrEmpty(fileDir) || !fileDir.StartsWith(transcodePath)) if (string.IsNullOrEmpty(fileDir) || !fileDir.StartsWith(transcodePath, StringComparison.Ordinal))
{ {
return BadRequest("Invalid segment."); return BadRequest("Invalid segment.");
} }
@ -92,7 +92,7 @@ namespace Jellyfin.Api.Controllers
var transcodePath = _serverConfigurationManager.GetTranscodePath(); var transcodePath = _serverConfigurationManager.GetTranscodePath();
file = Path.GetFullPath(Path.Combine(transcodePath, file)); file = Path.GetFullPath(Path.Combine(transcodePath, file));
var fileDir = Path.GetDirectoryName(file); var fileDir = Path.GetDirectoryName(file);
if (string.IsNullOrEmpty(fileDir) || !fileDir.StartsWith(transcodePath) || Path.GetExtension(file) != ".m3u8") if (string.IsNullOrEmpty(fileDir) || !fileDir.StartsWith(transcodePath, StringComparison.Ordinal) || Path.GetExtension(file) != ".m3u8")
{ {
return BadRequest("Invalid segment."); return BadRequest("Invalid segment.");
} }
@ -146,7 +146,7 @@ namespace Jellyfin.Api.Controllers
file = Path.GetFullPath(Path.Combine(transcodeFolderPath, file)); file = Path.GetFullPath(Path.Combine(transcodeFolderPath, file));
var fileDir = Path.GetDirectoryName(file); var fileDir = Path.GetDirectoryName(file);
if (string.IsNullOrEmpty(fileDir) || !fileDir.StartsWith(transcodeFolderPath)) if (string.IsNullOrEmpty(fileDir) || !fileDir.StartsWith(transcodeFolderPath, StringComparison.Ordinal))
{ {
return BadRequest("Invalid segment."); return BadRequest("Invalid segment.");
} }

View File

@ -82,7 +82,7 @@ namespace Jellyfin.Api.Controllers
return NotFound(); return NotFound();
} }
if (!path.StartsWith(_applicationPaths.GeneralPath)) if (!path.StartsWith(_applicationPaths.GeneralPath, StringComparison.Ordinal))
{ {
return BadRequest("Invalid image path."); return BadRequest("Invalid image path.");
} }
@ -177,7 +177,7 @@ namespace Jellyfin.Api.Controllers
if (!string.IsNullOrEmpty(path) && System.IO.File.Exists(path)) if (!string.IsNullOrEmpty(path) && System.IO.File.Exists(path))
{ {
if (!path.StartsWith(basePath)) if (!path.StartsWith(basePath, StringComparison.Ordinal))
{ {
return BadRequest("Invalid image path."); return BadRequest("Invalid image path.");
} }
@ -196,7 +196,7 @@ namespace Jellyfin.Api.Controllers
if (!string.IsNullOrEmpty(path) && System.IO.File.Exists(path)) if (!string.IsNullOrEmpty(path) && System.IO.File.Exists(path))
{ {
if (!path.StartsWith(basePath)) if (!path.StartsWith(basePath, StringComparison.Ordinal))
{ {
return BadRequest("Invalid image path."); return BadRequest("Invalid image path.");
} }

View File

@ -251,7 +251,7 @@ namespace Jellyfin.Api.Controllers
AudioBitRate = isStatic ? (int?)null : (audioBitRate ?? maxStreamingBitrate), AudioBitRate = isStatic ? (int?)null : (audioBitRate ?? maxStreamingBitrate),
MaxAudioBitDepth = maxAudioBitDepth, MaxAudioBitDepth = maxAudioBitDepth,
AudioChannels = maxAudioChannels, AudioChannels = maxAudioChannels,
CopyTimestamps = true, CopyTimestamps = false,
StartTimeTicks = startTimeTicks, StartTimeTicks = startTimeTicks,
SubtitleMethod = SubtitleDeliveryMethod.Embed, SubtitleMethod = SubtitleDeliveryMethod.Embed,
TranscodeReasons = mediaSource.TranscodeReasons == null ? null : string.Join(",", mediaSource.TranscodeReasons.Select(i => i.ToString()).ToArray()), TranscodeReasons = mediaSource.TranscodeReasons == null ? null : string.Join(",", mediaSource.TranscodeReasons.Select(i => i.ToString()).ToArray()),

View File

@ -412,7 +412,7 @@ namespace Jellyfin.Naming.Tests.Video
@"/movies/John Wick - Kapitel 3 (2019) [imdbid=tt6146586]/John Wick - Kapitel 3 (2019) [imdbid=tt6146586] - Version 2.mkv" @"/movies/John Wick - Kapitel 3 (2019) [imdbid=tt6146586]/John Wick - Kapitel 3 (2019) [imdbid=tt6146586] - Version 2.mkv"
}; };
var result = _videoListResolver.Resolve(files.Select(i => new FileSystemMetadata var result = GetResolver().Resolve(files.Select(i => new FileSystemMetadata
{ {
IsDirectory = false, IsDirectory = false,
FullName = i FullName = i
@ -432,7 +432,7 @@ namespace Jellyfin.Naming.Tests.Video
@"/movies/John Wick - Chapter 3 (2019)/John Wick - Chapter 3 (2019) [Version 2.mkv" @"/movies/John Wick - Chapter 3 (2019)/John Wick - Chapter 3 (2019) [Version 2.mkv"
}; };
var result = _videoListResolver.Resolve(files.Select(i => new FileSystemMetadata var result = GetResolver().Resolve(files.Select(i => new FileSystemMetadata
{ {
IsDirectory = false, IsDirectory = false,
FullName = i FullName = i