mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-08-11 09:13:54 -04:00
commit
52d496386f
@ -18,6 +18,7 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Emby.Common.Implementations.HttpClientManager;
|
using Emby.Common.Implementations.HttpClientManager;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Common;
|
||||||
|
|
||||||
namespace Emby.Common.Implementations.HttpClientManager
|
namespace Emby.Common.Implementations.HttpClientManager
|
||||||
{
|
{
|
||||||
@ -43,6 +44,7 @@ namespace Emby.Common.Implementations.HttpClientManager
|
|||||||
|
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
private readonly IMemoryStreamFactory _memoryStreamProvider;
|
private readonly IMemoryStreamFactory _memoryStreamProvider;
|
||||||
|
private readonly IApplicationHost _appHost;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="HttpClientManager" /> class.
|
/// Initializes a new instance of the <see cref="HttpClientManager" /> class.
|
||||||
@ -257,6 +259,8 @@ namespace Emby.Common.Implementations.HttpClientManager
|
|||||||
|
|
||||||
private void AddRequestHeaders(HttpWebRequest request, HttpRequestOptions options)
|
private void AddRequestHeaders(HttpWebRequest request, HttpRequestOptions options)
|
||||||
{
|
{
|
||||||
|
var hasUserAgent = false;
|
||||||
|
|
||||||
foreach (var header in options.RequestHeaders.ToList())
|
foreach (var header in options.RequestHeaders.ToList())
|
||||||
{
|
{
|
||||||
if (string.Equals(header.Key, "Accept", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(header.Key, "Accept", StringComparison.OrdinalIgnoreCase))
|
||||||
@ -265,11 +269,8 @@ namespace Emby.Common.Implementations.HttpClientManager
|
|||||||
}
|
}
|
||||||
else if (string.Equals(header.Key, "User-Agent", StringComparison.OrdinalIgnoreCase))
|
else if (string.Equals(header.Key, "User-Agent", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
#if NET46
|
SetUserAgent(request, header.Value);
|
||||||
request.UserAgent = header.Value;
|
hasUserAgent = true;
|
||||||
#elif NETSTANDARD1_6
|
|
||||||
request.Headers["User-Agent"] = header.Value;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -280,6 +281,20 @@ namespace Emby.Common.Implementations.HttpClientManager
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hasUserAgent && options.EnableDefaultUserAgent)
|
||||||
|
{
|
||||||
|
SetUserAgent(request, _appHost.Name + "/" + _appHost.ApplicationVersion.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetUserAgent(HttpWebRequest request, string userAgent)
|
||||||
|
{
|
||||||
|
#if NET46
|
||||||
|
request.UserAgent = userAgent;
|
||||||
|
#elif NETSTANDARD1_6
|
||||||
|
request.Headers["User-Agent"] = userAgent;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2627,6 +2627,18 @@ namespace Emby.Server.Implementations.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var map in ConfigurationManager.Configuration.PathSubstitutions)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(map.From))
|
||||||
|
{
|
||||||
|
var substitutionResult = SubstitutePathInternal(path, map.From, map.To);
|
||||||
|
if (substitutionResult.Item2)
|
||||||
|
{
|
||||||
|
return substitutionResult.Item1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,21 +74,20 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
|||||||
return new MusicArtist();
|
return new MusicArtist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_config.Configuration.EnableSimpleArtistDetection)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
//if (_config.Configuration.EnableSimpleArtistDetection)
|
}
|
||||||
//{
|
|
||||||
// return null;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//// Avoid mis-identifying top folders
|
// Avoid mis-identifying top folders
|
||||||
//if (args.Parent.IsRoot) return null;
|
if (args.Parent.IsRoot) return null;
|
||||||
|
|
||||||
//var directoryService = args.DirectoryService;
|
var directoryService = args.DirectoryService;
|
||||||
|
|
||||||
//var albumResolver = new MusicAlbumResolver(_logger, _fileSystem, _libraryManager);
|
var albumResolver = new MusicAlbumResolver(_logger, _fileSystem, _libraryManager);
|
||||||
|
|
||||||
//// If we contain an album assume we are an artist folder
|
// If we contain an album assume we are an artist folder
|
||||||
//return args.FileSystemChildren.Where(i => i.IsDirectory).Any(i => albumResolver.IsMusicAlbum(i.FullName, directoryService, args.GetLibraryOptions())) ? new MusicArtist() : null;
|
return args.FileSystemChildren.Where(i => i.IsDirectory).Any(i => albumResolver.IsMusicAlbum(i.FullName, directoryService, args.GetLibraryOptions())) ? new MusicArtist() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1163,7 +1163,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
};
|
};
|
||||||
|
|
||||||
var isAudio = false;
|
var isAudio = false;
|
||||||
await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, cancellationToken).ConfigureAwait(false);
|
await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, false, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
return new List<MediaSourceInfo>
|
return new List<MediaSourceInfo>
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
|||||||
using MediaBrowser.Controller.MediaEncoding;
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
using MediaBrowser.Model.Dlna;
|
using MediaBrowser.Model.Dlna;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.LiveTv
|
namespace Emby.Server.Implementations.LiveTv
|
||||||
@ -21,7 +22,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task AddMediaInfoWithProbe(MediaSourceInfo mediaSource, bool isAudio, CancellationToken cancellationToken)
|
public async Task AddMediaInfoWithProbe(MediaSourceInfo mediaSource, bool isAudio, bool assumeInterlaced, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var originalRuntime = mediaSource.RunTimeTicks;
|
var originalRuntime = mediaSource.RunTimeTicks;
|
||||||
|
|
||||||
@ -95,6 +96,17 @@ namespace Emby.Server.Implementations.LiveTv
|
|||||||
videoStream.IsAVC = null;
|
videoStream.IsAVC = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (assumeInterlaced)
|
||||||
|
{
|
||||||
|
foreach (var mediaStream in mediaSource.MediaStreams)
|
||||||
|
{
|
||||||
|
if (mediaStream.Type == MediaStreamType.Video)
|
||||||
|
{
|
||||||
|
mediaStream.IsInterlaced = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Try to estimate this
|
// Try to estimate this
|
||||||
mediaSource.InferTotalBitrate(true);
|
mediaSource.InferTotalBitrate(true);
|
||||||
}
|
}
|
||||||
|
@ -246,9 +246,9 @@ namespace Emby.Server.Implementations.LiveTv
|
|||||||
return info.Item1;
|
return info.Item1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Tuple<MediaSourceInfo, IDirectStreamProvider>> GetChannelStream(string id, string mediaSourceId, CancellationToken cancellationToken)
|
public Task<Tuple<MediaSourceInfo, IDirectStreamProvider, bool>> GetChannelStream(string id, string mediaSourceId, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return await GetLiveStream(id, mediaSourceId, true, cancellationToken).ConfigureAwait(false);
|
return GetLiveStream(id, mediaSourceId, true, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetItemExternalId(BaseItem item)
|
private string GetItemExternalId(BaseItem item)
|
||||||
@ -308,7 +308,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||||||
return _services.FirstOrDefault(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase));
|
return _services.FirstOrDefault(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Tuple<MediaSourceInfo, IDirectStreamProvider>> GetLiveStream(string id, string mediaSourceId, bool isChannel, CancellationToken cancellationToken)
|
private async Task<Tuple<MediaSourceInfo, IDirectStreamProvider, bool>> GetLiveStream(string id, string mediaSourceId, bool isChannel, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (string.Equals(id, mediaSourceId, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(id, mediaSourceId, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
@ -319,6 +319,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||||||
bool isVideo;
|
bool isVideo;
|
||||||
ILiveTvService service;
|
ILiveTvService service;
|
||||||
IDirectStreamProvider directStreamProvider = null;
|
IDirectStreamProvider directStreamProvider = null;
|
||||||
|
var assumeInterlaced = false;
|
||||||
|
|
||||||
if (isChannel)
|
if (isChannel)
|
||||||
{
|
{
|
||||||
@ -367,7 +368,12 @@ namespace Emby.Server.Implementations.LiveTv
|
|||||||
|
|
||||||
Normalize(info, service, isVideo);
|
Normalize(info, service, isVideo);
|
||||||
|
|
||||||
return new Tuple<MediaSourceInfo, IDirectStreamProvider>(info, directStreamProvider);
|
if (!(service is EmbyTV.EmbyTV))
|
||||||
|
{
|
||||||
|
assumeInterlaced = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Tuple<MediaSourceInfo, IDirectStreamProvider, bool>(info, directStreamProvider, assumeInterlaced);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Normalize(MediaSourceInfo mediaSource, ILiveTvService service, bool isVideo)
|
private void Normalize(MediaSourceInfo mediaSource, ILiveTvService service, bool isVideo)
|
||||||
|
@ -126,12 +126,14 @@ namespace Emby.Server.Implementations.LiveTv
|
|||||||
var keys = openToken.Split(new[] { StreamIdDelimeter }, 3);
|
var keys = openToken.Split(new[] { StreamIdDelimeter }, 3);
|
||||||
var mediaSourceId = keys.Length >= 3 ? keys[2] : null;
|
var mediaSourceId = keys.Length >= 3 ? keys[2] : null;
|
||||||
IDirectStreamProvider directStreamProvider = null;
|
IDirectStreamProvider directStreamProvider = null;
|
||||||
|
var assumeInterlaced = false;
|
||||||
|
|
||||||
if (string.Equals(keys[0], typeof(LiveTvChannel).Name, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(keys[0], typeof(LiveTvChannel).Name, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var info = await _liveTvManager.GetChannelStream(keys[1], mediaSourceId, cancellationToken).ConfigureAwait(false);
|
var info = await _liveTvManager.GetChannelStream(keys[1], mediaSourceId, cancellationToken).ConfigureAwait(false);
|
||||||
stream = info.Item1;
|
stream = info.Item1;
|
||||||
directStreamProvider = info.Item2;
|
directStreamProvider = info.Item2;
|
||||||
|
assumeInterlaced = info.Item3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -146,7 +148,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, cancellationToken).ConfigureAwait(false);
|
await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, assumeInterlaced, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -119,6 +119,7 @@ namespace MediaBrowser.Api
|
|||||||
config.SkipDeserializationForAudio = true;
|
config.SkipDeserializationForAudio = true;
|
||||||
config.EnableSeriesPresentationUniqueKey = true;
|
config.EnableSeriesPresentationUniqueKey = true;
|
||||||
config.EnableLocalizedGuids = true;
|
config.EnableLocalizedGuids = true;
|
||||||
|
config.EnableSimpleArtistDetection = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Post(UpdateStartupConfiguration request)
|
public void Post(UpdateStartupConfiguration request)
|
||||||
|
@ -100,6 +100,7 @@ namespace MediaBrowser.Common.Net
|
|||||||
|
|
||||||
public int TimeoutMs { get; set; }
|
public int TimeoutMs { get; set; }
|
||||||
public bool PreferIpv4 { get; set; }
|
public bool PreferIpv4 { get; set; }
|
||||||
|
public bool EnableDefaultUserAgent { get; set; }
|
||||||
|
|
||||||
private string GetHeaderValue(string name)
|
private string GetHeaderValue(string name)
|
||||||
{
|
{
|
||||||
|
@ -157,7 +157,7 @@ namespace MediaBrowser.Controller.LiveTv
|
|||||||
/// <param name="mediaSourceId">The media source identifier.</param>
|
/// <param name="mediaSourceId">The media source identifier.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task{StreamResponseInfo}.</returns>
|
/// <returns>Task{StreamResponseInfo}.</returns>
|
||||||
Task<Tuple<MediaSourceInfo, IDirectStreamProvider>> GetChannelStream(string id, string mediaSourceId, CancellationToken cancellationToken);
|
Task<Tuple<MediaSourceInfo, IDirectStreamProvider, bool>> GetChannelStream(string id, string mediaSourceId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the program.
|
/// Gets the program.
|
||||||
|
@ -725,11 +725,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
|
|
||||||
if (video.Protocol != MediaProtocol.File)
|
if (video.Protocol != MediaProtocol.File)
|
||||||
{
|
{
|
||||||
// If it's mpeg based, assume true
|
|
||||||
if ((videoStream.Codec ?? string.Empty).IndexOf("mpeg", StringComparison.OrdinalIgnoreCase) != -1)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,6 +192,10 @@ namespace MediaBrowser.Model.Configuration
|
|||||||
public bool EnableExternalContentInSuggestions { get; set; }
|
public bool EnableExternalContentInSuggestions { get; set; }
|
||||||
|
|
||||||
public int ImageExtractionTimeoutMs { get; set; }
|
public int ImageExtractionTimeoutMs { get; set; }
|
||||||
|
|
||||||
|
public PathSubstitution[] PathSubstitutions { get; set; }
|
||||||
|
public bool EnableSimpleArtistDetection { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
|
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -202,6 +206,8 @@ namespace MediaBrowser.Model.Configuration
|
|||||||
Migrations = new string[] { };
|
Migrations = new string[] { };
|
||||||
ImageExtractionTimeoutMs = 0;
|
ImageExtractionTimeoutMs = 0;
|
||||||
EnableLocalizedGuids = true;
|
EnableLocalizedGuids = true;
|
||||||
|
PathSubstitutions = new PathSubstitution[] { };
|
||||||
|
EnableSimpleArtistDetection = true;
|
||||||
|
|
||||||
DisplaySpecialsWithinSeasons = true;
|
DisplaySpecialsWithinSeasons = true;
|
||||||
EnableExternalContentInSuggestions = true;
|
EnableExternalContentInSuggestions = true;
|
||||||
@ -563,4 +569,10 @@ namespace MediaBrowser.Model.Configuration
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class PathSubstitution
|
||||||
|
{
|
||||||
|
public string From { get; set; }
|
||||||
|
public string To { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
@ -347,7 +347,8 @@ namespace MediaBrowser.Providers.Omdb
|
|||||||
Url = url,
|
Url = url,
|
||||||
ResourcePool = ResourcePool,
|
ResourcePool = ResourcePool,
|
||||||
CancellationToken = cancellationToken,
|
CancellationToken = cancellationToken,
|
||||||
BufferContent = true
|
BufferContent = true,
|
||||||
|
EnableDefaultUserAgent = true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("3.2.0.101")]
|
[assembly: AssemblyVersion("3.2.0.102")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user