fixes #843 - Update Dlna to respect user audio/subtitle language settings
This commit is contained in:
parent
ffc4db4128
commit
0b60e7ca67
|
@ -1,5 +1,9 @@
|
|||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Controller.MediaEncoding;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
|
@ -12,4 +16,53 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <returns>Task{IEnumerable{MediaSourceInfo}}.</returns>
|
||||
IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution);
|
||||
}
|
||||
|
||||
public static class HasMediaSourceExtensions
|
||||
{
|
||||
public static IEnumerable<MediaSourceInfo> GetMediaSources(this IHasMediaSources item, bool enablePathSubstitution, User user)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException("item");
|
||||
}
|
||||
|
||||
if (!(item is Video))
|
||||
{
|
||||
return item.GetMediaSources(enablePathSubstitution);
|
||||
}
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
throw new ArgumentNullException("user");
|
||||
}
|
||||
|
||||
var sources = item.GetMediaSources(enablePathSubstitution).ToList();
|
||||
|
||||
var preferredAudio = string.IsNullOrEmpty(user.Configuration.AudioLanguagePreference)
|
||||
? new string[] { }
|
||||
: new[] { user.Configuration.AudioLanguagePreference };
|
||||
|
||||
var preferredSubs = string.IsNullOrEmpty(user.Configuration.SubtitleLanguagePreference)
|
||||
? new string[] { }
|
||||
: new[] { user.Configuration.SubtitleLanguagePreference };
|
||||
|
||||
foreach (var source in sources)
|
||||
{
|
||||
source.DefaultAudioStreamIndex = MediaStreamSelector.GetDefaultAudioStreamIndex(
|
||||
source.MediaStreams, preferredAudio, user.Configuration.PlayDefaultAudioTrack);
|
||||
|
||||
var defaultAudioIndex = source.DefaultAudioStreamIndex;
|
||||
var audioLangage = defaultAudioIndex == null
|
||||
? null
|
||||
: source.MediaStreams.Where(i => i.Type == MediaStreamType.Audio && i.Index == defaultAudioIndex).Select(i => i.Language).FirstOrDefault();
|
||||
|
||||
source.DefaultSubtitleStreamIndex = MediaStreamSelector.GetDefaultSubtitleStreamIndex(source.MediaStreams,
|
||||
preferredSubs,
|
||||
user.Configuration.SubtitleMode,
|
||||
audioLangage);
|
||||
}
|
||||
|
||||
return sources;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,6 +192,7 @@
|
|||
<Compile Include="MediaEncoding\IMediaEncoder.cs" />
|
||||
<Compile Include="MediaEncoding\InternalMediaInfoResult.cs" />
|
||||
<Compile Include="MediaEncoding\ISubtitleEncoder.cs" />
|
||||
<Compile Include="MediaEncoding\MediaStreamSelector.cs" />
|
||||
<Compile Include="MediaEncoding\VideoEncodingOptions.cs" />
|
||||
<Compile Include="Net\IHasResultFactory.cs" />
|
||||
<Compile Include="Net\IHttpResultFactory.cs" />
|
||||
|
|
|
@ -4,7 +4,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Dto
|
||||
namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
public static class MediaStreamSelector
|
||||
{
|
|
@ -2,7 +2,6 @@
|
|||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Dlna;
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Dlna.Service;
|
||||
|
@ -17,7 +16,6 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
|||
public class ContentDirectory : BaseService, IContentDirectory, IDisposable
|
||||
{
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IDtoService _dtoService;
|
||||
private readonly IImageProcessor _imageProcessor;
|
||||
private readonly IUserDataManager _userDataManager;
|
||||
private readonly IDlnaManager _dlna;
|
||||
|
@ -27,7 +25,6 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
|||
public ContentDirectory(IDlnaManager dlna,
|
||||
IUserDataManager userDataManager,
|
||||
IImageProcessor imageProcessor,
|
||||
IDtoService dtoService,
|
||||
ILibraryManager libraryManager,
|
||||
IServerConfigurationManager config,
|
||||
IUserManager userManager,
|
||||
|
@ -38,7 +35,6 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
|||
_dlna = dlna;
|
||||
_userDataManager = userDataManager;
|
||||
_imageProcessor = imageProcessor;
|
||||
_dtoService = dtoService;
|
||||
_libraryManager = libraryManager;
|
||||
_config = config;
|
||||
_userManager = userManager;
|
||||
|
@ -73,7 +69,6 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
|||
_libraryManager,
|
||||
profile,
|
||||
serverAddress,
|
||||
_dtoService,
|
||||
_imageProcessor,
|
||||
_userDataManager,
|
||||
user,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
|
@ -42,7 +41,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
|||
|
||||
private readonly DeviceProfile _profile;
|
||||
|
||||
public ControlHandler(ILogger logger, ILibraryManager libraryManager, DeviceProfile profile, string serverAddress, IDtoService dtoService, IImageProcessor imageProcessor, IUserDataManager userDataManager, User user, int systemUpdateId, IServerConfigurationManager config)
|
||||
public ControlHandler(ILogger logger, ILibraryManager libraryManager, DeviceProfile profile, string serverAddress, IImageProcessor imageProcessor, IUserDataManager userDataManager, User user, int systemUpdateId, IServerConfigurationManager config)
|
||||
: base(config, logger)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
|
@ -51,7 +50,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
|||
_systemUpdateId = systemUpdateId;
|
||||
_profile = profile;
|
||||
|
||||
_didlBuilder = new DidlBuilder(profile, imageProcessor, serverAddress, dtoService);
|
||||
_didlBuilder = new DidlBuilder(profile, user, imageProcessor, serverAddress);
|
||||
}
|
||||
|
||||
protected override IEnumerable<KeyValuePair<string, string>> GetResult(string methodName, Headers methodParams)
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
|
@ -10,6 +8,7 @@ using MediaBrowser.Model.Dlna;
|
|||
using MediaBrowser.Model.Drawing;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
|
@ -28,14 +27,14 @@ namespace MediaBrowser.Dlna.Didl
|
|||
private readonly DeviceProfile _profile;
|
||||
private readonly IImageProcessor _imageProcessor;
|
||||
private readonly string _serverAddress;
|
||||
private readonly IDtoService _dtoService;
|
||||
private readonly User _user;
|
||||
|
||||
public DidlBuilder(DeviceProfile profile, IImageProcessor imageProcessor, string serverAddress, IDtoService dtoService)
|
||||
public DidlBuilder(DeviceProfile profile, User user, IImageProcessor imageProcessor, string serverAddress)
|
||||
{
|
||||
_profile = profile;
|
||||
_imageProcessor = imageProcessor;
|
||||
_serverAddress = serverAddress;
|
||||
_dtoService = dtoService;
|
||||
_user = user;
|
||||
}
|
||||
|
||||
public string GetItemDidl(BaseItem item, string deviceId, Filter filter)
|
||||
|
@ -99,9 +98,7 @@ namespace MediaBrowser.Dlna.Didl
|
|||
{
|
||||
var res = container.OwnerDocument.CreateElement(string.Empty, "res", NS_DIDL);
|
||||
|
||||
var sources = _dtoService.GetMediaSources(video);
|
||||
|
||||
int? maxBitrateSetting = null;
|
||||
var sources = _user == null ? video.GetMediaSources(true).ToList() : video.GetMediaSources(true, _user).ToList();
|
||||
|
||||
var streamInfo = new StreamBuilder().BuildVideoItem(new VideoOptions
|
||||
{
|
||||
|
@ -109,11 +106,11 @@ namespace MediaBrowser.Dlna.Didl
|
|||
MediaSources = sources,
|
||||
Profile = _profile,
|
||||
DeviceId = deviceId,
|
||||
MaxBitrate = maxBitrateSetting
|
||||
MaxBitrate = _profile.MaxBitrate
|
||||
});
|
||||
|
||||
var url = streamInfo.ToDlnaUrl(_serverAddress);
|
||||
//res.AppendChild(container.OwnerDocument.CreateCDataSection(url));
|
||||
|
||||
res.InnerText = url;
|
||||
|
||||
var mediaSource = sources.First(i => string.Equals(i.Id, streamInfo.MediaSourceId));
|
||||
|
@ -218,7 +215,7 @@ namespace MediaBrowser.Dlna.Didl
|
|||
{
|
||||
var res = container.OwnerDocument.CreateElement(string.Empty, "res", NS_DIDL);
|
||||
|
||||
var sources = _dtoService.GetMediaSources(audio);
|
||||
var sources = _user == null ? audio.GetMediaSources(true).ToList() : audio.GetMediaSources(true, _user).ToList();
|
||||
|
||||
var streamInfo = new StreamBuilder().BuildAudioItem(new AudioOptions
|
||||
{
|
||||
|
@ -229,7 +226,7 @@ namespace MediaBrowser.Dlna.Didl
|
|||
});
|
||||
|
||||
var url = streamInfo.ToDlnaUrl(_serverAddress);
|
||||
//res.AppendChild(container.OwnerDocument.CreateCDataSection(url));
|
||||
|
||||
res.InnerText = url;
|
||||
|
||||
var mediaSource = sources.First(i => string.Equals(i.Id, streamInfo.MediaSourceId));
|
||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller;
|
|||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Dlna;
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
|
@ -32,7 +31,6 @@ namespace MediaBrowser.Dlna.Main
|
|||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IDlnaManager _dlnaManager;
|
||||
private readonly IDtoService _dtoService;
|
||||
private readonly IImageProcessor _imageProcessor;
|
||||
|
||||
private SsdpHandler _ssdpHandler;
|
||||
|
@ -40,7 +38,7 @@ namespace MediaBrowser.Dlna.Main
|
|||
private readonly List<Guid> _registeredServerIds = new List<Guid>();
|
||||
private bool _dlnaServerStarted;
|
||||
|
||||
public DlnaEntryPoint(IServerConfigurationManager config, ILogManager logManager, IServerApplicationHost appHost, INetworkManager network, ISessionManager sessionManager, IHttpClient httpClient, IItemRepository itemRepo, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IDtoService dtoService, IImageProcessor imageProcessor)
|
||||
public DlnaEntryPoint(IServerConfigurationManager config, ILogManager logManager, IServerApplicationHost appHost, INetworkManager network, ISessionManager sessionManager, IHttpClient httpClient, IItemRepository itemRepo, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IImageProcessor imageProcessor)
|
||||
{
|
||||
_config = config;
|
||||
_appHost = appHost;
|
||||
|
@ -51,7 +49,6 @@ namespace MediaBrowser.Dlna.Main
|
|||
_libraryManager = libraryManager;
|
||||
_userManager = userManager;
|
||||
_dlnaManager = dlnaManager;
|
||||
_dtoService = dtoService;
|
||||
_imageProcessor = imageProcessor;
|
||||
_logger = logManager.GetLogger("Dlna");
|
||||
}
|
||||
|
@ -197,7 +194,6 @@ namespace MediaBrowser.Dlna.Main
|
|||
_userManager,
|
||||
_dlnaManager,
|
||||
_appHost,
|
||||
_dtoService,
|
||||
_imageProcessor,
|
||||
_ssdpHandler);
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using MediaBrowser.Controller.Dlna;
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Library;
|
||||
|
@ -13,13 +12,13 @@ using MediaBrowser.Model.Dto;
|
|||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Session;
|
||||
using MediaBrowser.Model.System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.System;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
{
|
||||
|
@ -33,7 +32,6 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
private readonly ILogger _logger;
|
||||
private readonly IDlnaManager _dlnaManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IDtoService _dtoService;
|
||||
private readonly IImageProcessor _imageProcessor;
|
||||
|
||||
private readonly SsdpHandler _ssdpHandler;
|
||||
|
@ -54,7 +52,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
|
||||
private Timer _updateTimer;
|
||||
|
||||
public PlayToController(SessionInfo session, ISessionManager sessionManager, IItemRepository itemRepository, ILibraryManager libraryManager, ILogger logger, IDlnaManager dlnaManager, IUserManager userManager, IDtoService dtoService, IImageProcessor imageProcessor, SsdpHandler ssdpHandler, string serverAddress)
|
||||
public PlayToController(SessionInfo session, ISessionManager sessionManager, IItemRepository itemRepository, ILibraryManager libraryManager, ILogger logger, IDlnaManager dlnaManager, IUserManager userManager, IImageProcessor imageProcessor, SsdpHandler ssdpHandler, string serverAddress)
|
||||
{
|
||||
_session = session;
|
||||
_itemRepository = itemRepository;
|
||||
|
@ -62,7 +60,6 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
_libraryManager = libraryManager;
|
||||
_dlnaManager = dlnaManager;
|
||||
_userManager = userManager;
|
||||
_dtoService = dtoService;
|
||||
_imageProcessor = imageProcessor;
|
||||
_ssdpHandler = ssdpHandler;
|
||||
_serverAddress = serverAddress;
|
||||
|
@ -228,6 +225,8 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
{
|
||||
_logger.Debug("{0} - Received PlayRequest: {1}", this._session.DeviceName, command.PlayCommand);
|
||||
|
||||
var user = string.IsNullOrEmpty(command.ControllingUserId) ? null : _userManager.GetUserById(new Guid(command.ControllingUserId));
|
||||
|
||||
var items = new List<BaseItem>();
|
||||
foreach (string id in command.ItemIds)
|
||||
{
|
||||
|
@ -243,12 +242,12 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
{
|
||||
if (isFirst && command.StartPositionTicks.HasValue)
|
||||
{
|
||||
playlist.Add(CreatePlaylistItem(item, command.StartPositionTicks.Value, serverAddress));
|
||||
playlist.Add(CreatePlaylistItem(item, user, command.StartPositionTicks.Value, serverAddress));
|
||||
isFirst = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
playlist.Add(CreatePlaylistItem(item, 0, serverAddress));
|
||||
playlist.Add(CreatePlaylistItem(item, user, 0, serverAddress));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,10 +266,6 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
|
||||
if (!string.IsNullOrWhiteSpace(command.ControllingUserId))
|
||||
{
|
||||
var userId = new Guid(command.ControllingUserId);
|
||||
|
||||
var user = _userManager.GetUserById(userId);
|
||||
|
||||
await _sessionManager.LogSessionActivity(_session.Client, _session.ApplicationVersion, _session.DeviceId,
|
||||
_session.DeviceName, _session.RemoteEndPoint, user).ConfigureAwait(false);
|
||||
}
|
||||
|
@ -388,15 +383,16 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
}
|
||||
}
|
||||
|
||||
private PlaylistItem CreatePlaylistItem(BaseItem item, long startPostionTicks, string serverAddress)
|
||||
private PlaylistItem CreatePlaylistItem(BaseItem item, User user, long startPostionTicks, string serverAddress)
|
||||
{
|
||||
var deviceInfo = _device.Properties;
|
||||
|
||||
var profile = _dlnaManager.GetProfile(deviceInfo.ToDeviceIdentification()) ??
|
||||
_dlnaManager.GetDefaultProfile();
|
||||
|
||||
var mediaSources = item is Audio || item is Video
|
||||
? _dtoService.GetMediaSources(item)
|
||||
var hasMediaSources = item as IHasMediaSources;
|
||||
var mediaSources = hasMediaSources != null
|
||||
? (user == null ? hasMediaSources.GetMediaSources(true) : hasMediaSources.GetMediaSources(true, user)).ToList()
|
||||
: new List<MediaSourceInfo>();
|
||||
|
||||
var playlistItem = GetPlaylistItem(item, mediaSources, profile, _session.DeviceId);
|
||||
|
@ -404,9 +400,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
|
||||
playlistItem.StreamUrl = playlistItem.StreamInfo.ToUrl(serverAddress);
|
||||
|
||||
var itemXml =
|
||||
new DidlBuilder(profile, _imageProcessor, serverAddress, _dtoService).GetItemDidl(item, _session.DeviceId,
|
||||
new Filter());
|
||||
var itemXml = new DidlBuilder(profile, user, _imageProcessor, serverAddress).GetItemDidl(item, _session.DeviceId, new Filter());
|
||||
|
||||
playlistItem.Didl = itemXml;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ using MediaBrowser.Controller;
|
|||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Dlna;
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Session;
|
||||
|
@ -36,12 +35,11 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
private readonly IDlnaManager _dlnaManager;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
private readonly IDtoService _dtoService;
|
||||
private readonly IImageProcessor _imageProcessor;
|
||||
|
||||
private readonly SsdpHandler _ssdpHandler;
|
||||
|
||||
public PlayToManager(ILogger logger, IServerConfigurationManager config, ISessionManager sessionManager, IHttpClient httpClient, IItemRepository itemRepository, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IServerApplicationHost appHost, IDtoService dtoService, IImageProcessor imageProcessor, SsdpHandler ssdpHandler)
|
||||
public PlayToManager(ILogger logger, IServerConfigurationManager config, ISessionManager sessionManager, IHttpClient httpClient, IItemRepository itemRepository, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IServerApplicationHost appHost, IImageProcessor imageProcessor, SsdpHandler ssdpHandler)
|
||||
{
|
||||
_tokenSource = new CancellationTokenSource();
|
||||
|
||||
|
@ -53,7 +51,6 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
_userManager = userManager;
|
||||
_dlnaManager = dlnaManager;
|
||||
_appHost = appHost;
|
||||
_dtoService = dtoService;
|
||||
_imageProcessor = imageProcessor;
|
||||
_ssdpHandler = ssdpHandler;
|
||||
_config = config;
|
||||
|
@ -284,7 +281,6 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
_logger,
|
||||
_dlnaManager,
|
||||
_userManager,
|
||||
_dtoService,
|
||||
_imageProcessor,
|
||||
_ssdpHandler,
|
||||
serverAddress);
|
||||
|
|
|
@ -21,7 +21,8 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
|
||||
writer.WriteLine(@"{0:hh\:mm\:ss\.fff} --> {1:hh\:mm\:ss\.fff}", TimeSpan.FromTicks(trackEvent.StartPositionTicks), TimeSpan.FromTicks(trackEvent.EndPositionTicks));
|
||||
|
||||
var text = Regex.Replace(trackEvent.Text, @"\\N", "<br />", RegexOptions.IgnoreCase);
|
||||
var text = trackEvent.Text;
|
||||
//text = Regex.Replace(text, @"\\N", "<br />", RegexOptions.IgnoreCase);
|
||||
|
||||
writer.WriteLine(text);
|
||||
writer.WriteLine(string.Empty);
|
||||
|
|
|
@ -49,6 +49,12 @@
|
|||
<PropertyGroup>
|
||||
<RunPostBuildEvent>Always</RunPostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>MediaBrowser.Model.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\SharedVersion.cs">
|
||||
<Link>Properties\SharedVersion.cs</Link>
|
||||
|
@ -325,6 +331,7 @@
|
|||
<Compile Include="Weather\WeatherUnits.cs" />
|
||||
<None Include="Fody.targets" />
|
||||
<None Include="FodyWeavers.xml" />
|
||||
<None Include="MediaBrowser.Model.snk" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
BIN
MediaBrowser.Model/MediaBrowser.Model.snk
Normal file
BIN
MediaBrowser.Model/MediaBrowser.Model.snk
Normal file
Binary file not shown.
|
@ -103,6 +103,22 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
AttachUserSpecificInfo(dto, item, user, fields);
|
||||
}
|
||||
|
||||
var hasMediaSources = item as IHasMediaSources;
|
||||
if (hasMediaSources != null)
|
||||
{
|
||||
if (fields.Contains(ItemFields.MediaSources))
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
dto.MediaSources = hasMediaSources.GetMediaSources(true).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
dto.MediaSources = hasMediaSources.GetMediaSources(true, user).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.Studios))
|
||||
{
|
||||
AttachStudios(dto, item);
|
||||
|
@ -110,33 +126,6 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
|
||||
AttachBasicFields(dto, item, owner, fields);
|
||||
|
||||
if (user != null && dto.MediaSources != null && item is Video)
|
||||
{
|
||||
var preferredAudio = string.IsNullOrEmpty(user.Configuration.AudioLanguagePreference)
|
||||
? new string[] { }
|
||||
: new[] { user.Configuration.AudioLanguagePreference };
|
||||
|
||||
var preferredSubs = string.IsNullOrEmpty(user.Configuration.SubtitleLanguagePreference)
|
||||
? new string[] { }
|
||||
: new[] { user.Configuration.SubtitleLanguagePreference };
|
||||
|
||||
foreach (var source in dto.MediaSources)
|
||||
{
|
||||
source.DefaultAudioStreamIndex = MediaStreamSelector.GetDefaultAudioStreamIndex(
|
||||
source.MediaStreams, preferredAudio, user.Configuration.PlayDefaultAudioTrack);
|
||||
|
||||
var defaultAudioIndex = source.DefaultAudioStreamIndex;
|
||||
var audioLangage = defaultAudioIndex == null
|
||||
? null
|
||||
: source.MediaStreams.Where(i => i.Type == MediaStreamType.Audio && i.Index == defaultAudioIndex).Select(i => i.Language).FirstOrDefault();
|
||||
|
||||
source.DefaultSubtitleStreamIndex = MediaStreamSelector.GetDefaultSubtitleStreamIndex(source.MediaStreams,
|
||||
preferredSubs,
|
||||
user.Configuration.SubtitleMode,
|
||||
audioLangage);
|
||||
}
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.SoundtrackIds))
|
||||
{
|
||||
var hasSoundtracks = item as IHasSoundtracks;
|
||||
|
@ -926,11 +915,6 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
}
|
||||
|
||||
dto.MediaSourceCount = 1;
|
||||
|
||||
if (fields.Contains(ItemFields.MediaSources))
|
||||
{
|
||||
dto.MediaSources = GetMediaSources(audio);
|
||||
}
|
||||
}
|
||||
|
||||
var album = item as MusicAlbum;
|
||||
|
@ -963,11 +947,6 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
dto.PartCount = video.AdditionalPartIds.Count + 1;
|
||||
dto.MediaSourceCount = video.MediaSourceCount;
|
||||
|
||||
if (fields.Contains(ItemFields.MediaSources))
|
||||
{
|
||||
dto.MediaSources = GetMediaSources(video);
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.Chapters))
|
||||
{
|
||||
List<ChapterInfoDto> chapters;
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
if (liveTvItem != null)
|
||||
{
|
||||
return !liveTvItem.HasImage(ImageType.Primary) && (liveTvItem.HasProviderImage ?? true) && (DateTime.UtcNow - date).TotalHours >= 6;
|
||||
return !liveTvItem.HasImage(ImageType.Primary) && (liveTvItem.HasProviderImage ?? true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
if (liveTvItem != null)
|
||||
{
|
||||
return !liveTvItem.HasImage(ImageType.Primary) && (liveTvItem.HasProviderImage ?? true) && (DateTime.UtcNow - date).TotalHours >= 6;
|
||||
return !liveTvItem.HasImage(ImageType.Primary) && (liveTvItem.HasProviderImage ?? true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
if (liveTvItem != null)
|
||||
{
|
||||
return !liveTvItem.HasImage(ImageType.Primary) && (liveTvItem.RecordingInfo.HasImage ?? true) && (DateTime.UtcNow - date).TotalHours >= 6;
|
||||
return !liveTvItem.HasImage(ImageType.Primary) && (liveTvItem.RecordingInfo.HasImage ?? true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,6 @@
|
|||
<Compile Include="Drawing\PlayedIndicatorDrawer.cs" />
|
||||
<Compile Include="Drawing\UnplayedCountIndicator.cs" />
|
||||
<Compile Include="Dto\DtoService.cs" />
|
||||
<Compile Include="Dto\MediaStreamSelector.cs" />
|
||||
<Compile Include="EntryPoints\AutomaticRestartEntryPoint.cs" />
|
||||
<Compile Include="EntryPoints\ExternalPortForwarding.cs" />
|
||||
<Compile Include="EntryPoints\LibraryChangedNotifier.cs" />
|
||||
|
|
|
@ -521,7 +521,7 @@ namespace MediaBrowser.ServerApplication
|
|||
var dlnaManager = new DlnaManager(XmlSerializer, FileSystemManager, ApplicationPaths, LogManager.GetLogger("Dlna"), JsonSerializer);
|
||||
RegisterSingleInstance<IDlnaManager>(dlnaManager);
|
||||
|
||||
var contentDirectory = new ContentDirectory(dlnaManager, UserDataManager, ImageProcessor, DtoService, LibraryManager, ServerConfigurationManager, UserManager, LogManager.GetLogger("UpnpContentDirectory"), HttpClient);
|
||||
var contentDirectory = new ContentDirectory(dlnaManager, UserDataManager, ImageProcessor, LibraryManager, ServerConfigurationManager, UserManager, LogManager.GetLogger("UpnpContentDirectory"), HttpClient);
|
||||
RegisterSingleInstance<IContentDirectory>(contentDirectory);
|
||||
|
||||
var connectionManager = new ConnectionManager(dlnaManager, ServerConfigurationManager, LogManager.GetLogger("UpnpConnectionManager"), HttpClient);
|
||||
|
|
|
@ -61,14 +61,14 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="MediaBrowser.IsoMounter">
|
||||
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.65\lib\net45\MediaBrowser.IsoMounter.dll</HintPath>
|
||||
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.68\lib\net45\MediaBrowser.IsoMounter.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=3.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\NLog.3.0.0.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="pfmclrapi">
|
||||
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.65\lib\net45\pfmclrapi.dll</HintPath>
|
||||
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.68\lib\net45\pfmclrapi.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ServiceStack.Interfaces">
|
||||
<HintPath>..\ThirdParty\ServiceStack\ServiceStack.Interfaces.dll</HintPath>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MediaBrowser.IsoMounting" version="3.0.65" targetFramework="net45" />
|
||||
<package id="MediaBrowser.IsoMounting" version="3.0.68" targetFramework="net45" />
|
||||
<package id="NLog" version="3.0.0.0" targetFramework="net45" />
|
||||
</packages>
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common.Internal</id>
|
||||
<version>3.0.401</version>
|
||||
<version>3.0.405</version>
|
||||
<title>MediaBrowser.Common.Internal</title>
|
||||
<authors>Luke</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.401" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.405" />
|
||||
<dependency id="NLog" version="2.1.0" />
|
||||
<dependency id="SimpleInjector" version="2.5.0" />
|
||||
<dependency id="sharpcompress" version="0.10.2" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common</id>
|
||||
<version>3.0.401</version>
|
||||
<version>3.0.405</version>
|
||||
<title>MediaBrowser.Common</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Server.Core</id>
|
||||
<version>3.0.401</version>
|
||||
<version>3.0.405</version>
|
||||
<title>Media Browser.Server.Core</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.401" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.405" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
|
Loading…
Reference in New Issue
Block a user