update javascript connection manager to latest feature set
This commit is contained in:
parent
18ff8aba74
commit
8051ea9b1b
|
@ -67,6 +67,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
_dlna.GetDefaultProfile();
|
_dlna.GetDefaultProfile();
|
||||||
|
|
||||||
var serverAddress = request.RequestedUrl.Substring(0, request.RequestedUrl.IndexOf("/dlna", StringComparison.OrdinalIgnoreCase));
|
var serverAddress = request.RequestedUrl.Substring(0, request.RequestedUrl.IndexOf("/dlna", StringComparison.OrdinalIgnoreCase));
|
||||||
|
string accessToken = null;
|
||||||
|
|
||||||
var user = GetUser(profile);
|
var user = GetUser(profile);
|
||||||
|
|
||||||
|
@ -75,6 +76,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
_libraryManager,
|
_libraryManager,
|
||||||
profile,
|
profile,
|
||||||
serverAddress,
|
serverAddress,
|
||||||
|
accessToken,
|
||||||
_imageProcessor,
|
_imageProcessor,
|
||||||
_userDataManager,
|
_userDataManager,
|
||||||
user,
|
user,
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
|
|
||||||
private readonly DeviceProfile _profile;
|
private readonly DeviceProfile _profile;
|
||||||
|
|
||||||
public ControlHandler(ILogger logger, ILibraryManager libraryManager, DeviceProfile profile, string serverAddress, IImageProcessor imageProcessor, IUserDataManager userDataManager, User user, int systemUpdateId, IServerConfigurationManager config, ILocalizationManager localization, IChannelManager channelManager)
|
public ControlHandler(ILogger logger, ILibraryManager libraryManager, DeviceProfile profile, string serverAddress, string accessToken, IImageProcessor imageProcessor, IUserDataManager userDataManager, User user, int systemUpdateId, IServerConfigurationManager config, ILocalizationManager localization, IChannelManager channelManager)
|
||||||
: base(config, logger)
|
: base(config, logger)
|
||||||
{
|
{
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
|
@ -55,7 +55,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
_channelManager = channelManager;
|
_channelManager = channelManager;
|
||||||
_profile = profile;
|
_profile = profile;
|
||||||
|
|
||||||
_didlBuilder = new DidlBuilder(profile, user, imageProcessor, serverAddress, userDataManager, localization);
|
_didlBuilder = new DidlBuilder(profile, user, imageProcessor, serverAddress, accessToken, userDataManager, localization);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IEnumerable<KeyValuePair<string, string>> GetResult(string methodName, Headers methodParams)
|
protected override IEnumerable<KeyValuePair<string, string>> GetResult(string methodName, Headers methodParams)
|
||||||
|
|
|
@ -33,17 +33,19 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
private readonly DeviceProfile _profile;
|
private readonly DeviceProfile _profile;
|
||||||
private readonly IImageProcessor _imageProcessor;
|
private readonly IImageProcessor _imageProcessor;
|
||||||
private readonly string _serverAddress;
|
private readonly string _serverAddress;
|
||||||
|
private readonly string _accessToken;
|
||||||
private readonly User _user;
|
private readonly User _user;
|
||||||
private readonly IUserDataManager _userDataManager;
|
private readonly IUserDataManager _userDataManager;
|
||||||
private readonly ILocalizationManager _localization;
|
private readonly ILocalizationManager _localization;
|
||||||
|
|
||||||
public DidlBuilder(DeviceProfile profile, User user, IImageProcessor imageProcessor, string serverAddress, IUserDataManager userDataManager, ILocalizationManager localization)
|
public DidlBuilder(DeviceProfile profile, User user, IImageProcessor imageProcessor, string serverAddress, string accessToken, IUserDataManager userDataManager, ILocalizationManager localization)
|
||||||
{
|
{
|
||||||
_profile = profile;
|
_profile = profile;
|
||||||
_imageProcessor = imageProcessor;
|
_imageProcessor = imageProcessor;
|
||||||
_serverAddress = serverAddress;
|
_serverAddress = serverAddress;
|
||||||
_userDataManager = userDataManager;
|
_userDataManager = userDataManager;
|
||||||
_localization = localization;
|
_localization = localization;
|
||||||
|
_accessToken = accessToken;
|
||||||
_user = user;
|
_user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +163,7 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
AddVideoResource(container, video, deviceId, filter, contentFeature, streamInfo);
|
AddVideoResource(container, video, deviceId, filter, contentFeature, streamInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var subtitle in streamInfo.GetExternalSubtitles(_serverAddress, false))
|
foreach (var subtitle in streamInfo.GetExternalSubtitles(_serverAddress, _accessToken, false))
|
||||||
{
|
{
|
||||||
AddSubtitleElement(container, subtitle);
|
AddSubtitleElement(container, subtitle);
|
||||||
}
|
}
|
||||||
|
@ -206,7 +208,7 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
{
|
{
|
||||||
var res = container.OwnerDocument.CreateElement(string.Empty, "res", NS_DIDL);
|
var res = container.OwnerDocument.CreateElement(string.Empty, "res", NS_DIDL);
|
||||||
|
|
||||||
var url = streamInfo.ToDlnaUrl(_serverAddress);
|
var url = streamInfo.ToDlnaUrl(_serverAddress, _accessToken);
|
||||||
|
|
||||||
res.InnerText = url;
|
res.InnerText = url;
|
||||||
|
|
||||||
|
@ -351,7 +353,7 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = streamInfo.ToDlnaUrl(_serverAddress);
|
var url = streamInfo.ToDlnaUrl(_serverAddress, _accessToken);
|
||||||
|
|
||||||
res.InnerText = url;
|
res.InnerText = url;
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
|
|
||||||
private readonly DeviceDiscovery _deviceDiscovery;
|
private readonly DeviceDiscovery _deviceDiscovery;
|
||||||
private readonly string _serverAddress;
|
private readonly string _serverAddress;
|
||||||
|
private readonly string _accessToken;
|
||||||
|
|
||||||
public bool IsSessionActive
|
public bool IsSessionActive
|
||||||
{
|
{
|
||||||
|
@ -54,7 +55,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
|
|
||||||
private Timer _updateTimer;
|
private Timer _updateTimer;
|
||||||
|
|
||||||
public PlayToController(SessionInfo session, ISessionManager sessionManager, IItemRepository itemRepository, ILibraryManager libraryManager, ILogger logger, IDlnaManager dlnaManager, IUserManager userManager, IImageProcessor imageProcessor, string serverAddress, DeviceDiscovery deviceDiscovery, IUserDataManager userDataManager, ILocalizationManager localization)
|
public PlayToController(SessionInfo session, ISessionManager sessionManager, IItemRepository itemRepository, ILibraryManager libraryManager, ILogger logger, IDlnaManager dlnaManager, IUserManager userManager, IImageProcessor imageProcessor, string serverAddress, string accessToken, DeviceDiscovery deviceDiscovery, IUserDataManager userDataManager, ILocalizationManager localization)
|
||||||
{
|
{
|
||||||
_session = session;
|
_session = session;
|
||||||
_itemRepository = itemRepository;
|
_itemRepository = itemRepository;
|
||||||
|
@ -67,6 +68,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
_deviceDiscovery = deviceDiscovery;
|
_deviceDiscovery = deviceDiscovery;
|
||||||
_userDataManager = userDataManager;
|
_userDataManager = userDataManager;
|
||||||
_localization = localization;
|
_localization = localization;
|
||||||
|
_accessToken = accessToken;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,18 +308,16 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
var playlist = new List<PlaylistItem>();
|
var playlist = new List<PlaylistItem>();
|
||||||
var isFirst = true;
|
var isFirst = true;
|
||||||
|
|
||||||
var serverAddress = GetServerAddress();
|
|
||||||
|
|
||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
if (isFirst && command.StartPositionTicks.HasValue)
|
if (isFirst && command.StartPositionTicks.HasValue)
|
||||||
{
|
{
|
||||||
playlist.Add(CreatePlaylistItem(item, user, command.StartPositionTicks.Value, serverAddress));
|
playlist.Add(CreatePlaylistItem(item, user, command.StartPositionTicks.Value));
|
||||||
isFirst = false;
|
isFirst = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
playlist.Add(CreatePlaylistItem(item, user, 0, serverAddress));
|
playlist.Add(CreatePlaylistItem(item, user, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
if (info.Item != null && !info.IsDirectStream)
|
if (info.Item != null && !info.IsDirectStream)
|
||||||
{
|
{
|
||||||
var user = _session.UserId.HasValue ? _userManager.GetUserById(_session.UserId.Value) : null;
|
var user = _session.UserId.HasValue ? _userManager.GetUserById(_session.UserId.Value) : null;
|
||||||
var newItem = CreatePlaylistItem(info.Item, user, newPosition, GetServerAddress(), info.MediaSourceId, info.AudioStreamIndex, info.SubtitleStreamIndex);
|
var newItem = CreatePlaylistItem(info.Item, user, newPosition, info.MediaSourceId, info.AudioStreamIndex, info.SubtitleStreamIndex);
|
||||||
|
|
||||||
await _device.SetAvTransport(newItem.StreamUrl, GetDlnaHeaders(newItem), newItem.Didl).ConfigureAwait(false);
|
await _device.SetAvTransport(newItem.StreamUrl, GetDlnaHeaders(newItem), newItem.Didl).ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -458,12 +458,12 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlaylistItem CreatePlaylistItem(BaseItem item, User user, long startPostionTicks, string serverAddress)
|
private PlaylistItem CreatePlaylistItem(BaseItem item, User user, long startPostionTicks)
|
||||||
{
|
{
|
||||||
return CreatePlaylistItem(item, user, startPostionTicks, serverAddress, null, null, null);
|
return CreatePlaylistItem(item, user, startPostionTicks, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlaylistItem CreatePlaylistItem(BaseItem item, User user, long startPostionTicks, string serverAddress, string mediaSourceId, int? audioStreamIndex, int? subtitleStreamIndex)
|
private PlaylistItem CreatePlaylistItem(BaseItem item, User user, long startPostionTicks, string mediaSourceId, int? audioStreamIndex, int? subtitleStreamIndex)
|
||||||
{
|
{
|
||||||
var deviceInfo = _device.Properties;
|
var deviceInfo = _device.Properties;
|
||||||
|
|
||||||
|
@ -478,9 +478,9 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
var playlistItem = GetPlaylistItem(item, mediaSources, profile, _session.DeviceId, mediaSourceId, audioStreamIndex, subtitleStreamIndex);
|
var playlistItem = GetPlaylistItem(item, mediaSources, profile, _session.DeviceId, mediaSourceId, audioStreamIndex, subtitleStreamIndex);
|
||||||
playlistItem.StreamInfo.StartPositionTicks = startPostionTicks;
|
playlistItem.StreamInfo.StartPositionTicks = startPostionTicks;
|
||||||
|
|
||||||
playlistItem.StreamUrl = playlistItem.StreamInfo.ToUrl(serverAddress);
|
playlistItem.StreamUrl = playlistItem.StreamInfo.ToUrl(_serverAddress, _accessToken);
|
||||||
|
|
||||||
var itemXml = new DidlBuilder(profile, user, _imageProcessor, serverAddress, _userDataManager, _localization)
|
var itemXml = new DidlBuilder(profile, user, _imageProcessor, _serverAddress, _accessToken, _userDataManager, _localization)
|
||||||
.GetItemDidl(item, null, _session.DeviceId, new Filter(), playlistItem.StreamInfo);
|
.GetItemDidl(item, null, _session.DeviceId, new Filter(), playlistItem.StreamInfo);
|
||||||
|
|
||||||
playlistItem.Didl = itemXml;
|
playlistItem.Didl = itemXml;
|
||||||
|
@ -745,7 +745,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
var newPosition = progress.PositionTicks ?? 0;
|
var newPosition = progress.PositionTicks ?? 0;
|
||||||
|
|
||||||
var user = _session.UserId.HasValue ? _userManager.GetUserById(_session.UserId.Value) : null;
|
var user = _session.UserId.HasValue ? _userManager.GetUserById(_session.UserId.Value) : null;
|
||||||
var newItem = CreatePlaylistItem(info.Item, user, newPosition, GetServerAddress(), info.MediaSourceId, newIndex, info.SubtitleStreamIndex);
|
var newItem = CreatePlaylistItem(info.Item, user, newPosition, info.MediaSourceId, newIndex, info.SubtitleStreamIndex);
|
||||||
|
|
||||||
await _device.SetAvTransport(newItem.StreamUrl, GetDlnaHeaders(newItem), newItem.Didl).ConfigureAwait(false);
|
await _device.SetAvTransport(newItem.StreamUrl, GetDlnaHeaders(newItem), newItem.Didl).ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -771,7 +771,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
var newPosition = progress.PositionTicks ?? 0;
|
var newPosition = progress.PositionTicks ?? 0;
|
||||||
|
|
||||||
var user = _session.UserId.HasValue ? _userManager.GetUserById(_session.UserId.Value) : null;
|
var user = _session.UserId.HasValue ? _userManager.GetUserById(_session.UserId.Value) : null;
|
||||||
var newItem = CreatePlaylistItem(info.Item, user, newPosition, GetServerAddress(), info.MediaSourceId, info.AudioStreamIndex, newIndex);
|
var newItem = CreatePlaylistItem(info.Item, user, newPosition, info.MediaSourceId, info.AudioStreamIndex, newIndex);
|
||||||
|
|
||||||
await _device.SetAvTransport(newItem.StreamUrl, GetDlnaHeaders(newItem), newItem.Didl).ConfigureAwait(false);
|
await _device.SetAvTransport(newItem.StreamUrl, GetDlnaHeaders(newItem), newItem.Didl).ConfigureAwait(false);
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
if (controller == null)
|
if (controller == null)
|
||||||
{
|
{
|
||||||
var serverAddress = GetServerAddress(localIp);
|
var serverAddress = GetServerAddress(localIp);
|
||||||
|
string accessToken = null;
|
||||||
|
|
||||||
sessionInfo.SessionController = controller = new PlayToController(sessionInfo,
|
sessionInfo.SessionController = controller = new PlayToController(sessionInfo,
|
||||||
_sessionManager,
|
_sessionManager,
|
||||||
|
@ -108,6 +109,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
_userManager,
|
_userManager,
|
||||||
_imageProcessor,
|
_imageProcessor,
|
||||||
serverAddress,
|
serverAddress,
|
||||||
|
accessToken,
|
||||||
_deviceDiscovery,
|
_deviceDiscovery,
|
||||||
_userDataManager,
|
_userDataManager,
|
||||||
_localization);
|
_localization);
|
||||||
|
|
|
@ -110,6 +110,9 @@
|
||||||
<Compile Include="..\MediaBrowser.Model\ApiClient\IServerEvents.cs">
|
<Compile Include="..\MediaBrowser.Model\ApiClient\IServerEvents.cs">
|
||||||
<Link>ApiClient\IServerEvents.cs</Link>
|
<Link>ApiClient\IServerEvents.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="..\MediaBrowser.Model\ApiClient\NetworkStatus.cs">
|
||||||
|
<Link>ApiClient\NetworkStatus.cs</Link>
|
||||||
|
</Compile>
|
||||||
<Compile Include="..\MediaBrowser.Model\ApiClient\RemoteLogoutReason.cs">
|
<Compile Include="..\MediaBrowser.Model\ApiClient\RemoteLogoutReason.cs">
|
||||||
<Link>ApiClient\RemoteLogoutReason.cs</Link>
|
<Link>ApiClient\RemoteLogoutReason.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
@ -75,6 +75,9 @@
|
||||||
<Compile Include="..\MediaBrowser.Model\ApiClient\IServerEvents.cs">
|
<Compile Include="..\MediaBrowser.Model\ApiClient\IServerEvents.cs">
|
||||||
<Link>ApiClient\IServerEvents.cs</Link>
|
<Link>ApiClient\IServerEvents.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="..\MediaBrowser.Model\ApiClient\NetworkStatus.cs">
|
||||||
|
<Link>ApiClient\NetworkStatus.cs</Link>
|
||||||
|
</Compile>
|
||||||
<Compile Include="..\MediaBrowser.Model\ApiClient\RemoteLogoutReason.cs">
|
<Compile Include="..\MediaBrowser.Model\ApiClient\RemoteLogoutReason.cs">
|
||||||
<Link>ApiClient\RemoteLogoutReason.cs</Link>
|
<Link>ApiClient\RemoteLogoutReason.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
30
MediaBrowser.Model/ApiClient/NetworkStatus.cs
Normal file
30
MediaBrowser.Model/ApiClient/NetworkStatus.cs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
namespace MediaBrowser.Model.ApiClient
|
||||||
|
{
|
||||||
|
public class NetworkStatus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether this instance is network available.
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if this instance is network available; otherwise, <c>false</c>.</value>
|
||||||
|
public bool IsNetworkAvailable { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether this instance is local network available.
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>null</c> if [is local network available] contains no value, <c>true</c> if [is local network available]; otherwise, <c>false</c>.</value>
|
||||||
|
public bool? IsLocalNetworkAvailable { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the is any local network available.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||||
|
public bool GetIsAnyLocalNetworkAvailable()
|
||||||
|
{
|
||||||
|
if (!IsLocalNetworkAvailable.HasValue)
|
||||||
|
{
|
||||||
|
return IsNetworkAvailable;
|
||||||
|
}
|
||||||
|
|
||||||
|
return IsLocalNetworkAvailable.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -85,12 +85,12 @@ namespace MediaBrowser.Model.Dlna
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ToUrl(string baseUrl)
|
public string ToUrl(string baseUrl, string accessToken)
|
||||||
{
|
{
|
||||||
return ToDlnaUrl(baseUrl);
|
return ToDlnaUrl(baseUrl, accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ToDlnaUrl(string baseUrl)
|
public string ToDlnaUrl(string baseUrl, string accessToken)
|
||||||
{
|
{
|
||||||
if (PlayMethod == PlayMethod.DirectPlay)
|
if (PlayMethod == PlayMethod.DirectPlay)
|
||||||
{
|
{
|
||||||
|
@ -152,7 +152,47 @@ namespace MediaBrowser.Model.Dlna
|
||||||
return string.Format("Params={0}", string.Join(";", list.ToArray()));
|
return string.Format("Params={0}", string.Join(";", list.ToArray()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SubtitleStreamInfo> GetExternalSubtitles(string baseUrl, bool includeSelectedTrackOnly)
|
public List<SubtitleStreamInfo> GetExternalSubtitles(bool includeSelectedTrackOnly)
|
||||||
|
{
|
||||||
|
List<SubtitleStreamInfo> list = new List<SubtitleStreamInfo>();
|
||||||
|
|
||||||
|
// First add the selected track
|
||||||
|
if (SubtitleStreamIndex.HasValue)
|
||||||
|
{
|
||||||
|
foreach (MediaStream stream in MediaSource.MediaStreams)
|
||||||
|
{
|
||||||
|
if (stream.Type == MediaStreamType.Subtitle && stream.Index == SubtitleStreamIndex.Value)
|
||||||
|
{
|
||||||
|
SubtitleStreamInfo info = GetSubtitleStreamInfo(stream);
|
||||||
|
|
||||||
|
if (info != null)
|
||||||
|
{
|
||||||
|
list.Add(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!includeSelectedTrackOnly)
|
||||||
|
{
|
||||||
|
foreach (MediaStream stream in MediaSource.MediaStreams)
|
||||||
|
{
|
||||||
|
if (stream.Type == MediaStreamType.Subtitle && (!SubtitleStreamIndex.HasValue || stream.Index != SubtitleStreamIndex.Value))
|
||||||
|
{
|
||||||
|
SubtitleStreamInfo info = GetSubtitleStreamInfo(stream);
|
||||||
|
|
||||||
|
if (info != null)
|
||||||
|
{
|
||||||
|
list.Add(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SubtitleStreamInfo> GetExternalSubtitles(string baseUrl, string accessToken, bool includeSelectedTrackOnly)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(baseUrl))
|
if (string.IsNullOrEmpty(baseUrl))
|
||||||
{
|
{
|
||||||
|
@ -173,7 +213,12 @@ namespace MediaBrowser.Model.Dlna
|
||||||
{
|
{
|
||||||
if (stream.Type == MediaStreamType.Subtitle && stream.Index == SubtitleStreamIndex.Value)
|
if (stream.Type == MediaStreamType.Subtitle && stream.Index == SubtitleStreamIndex.Value)
|
||||||
{
|
{
|
||||||
AddSubtitle(list, stream, baseUrl, startPositionTicks);
|
SubtitleStreamInfo info = GetSubtitleStreamInfo(stream, baseUrl, accessToken, startPositionTicks);
|
||||||
|
|
||||||
|
if (info != null)
|
||||||
|
{
|
||||||
|
list.Add(info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,7 +229,12 @@ namespace MediaBrowser.Model.Dlna
|
||||||
{
|
{
|
||||||
if (stream.Type == MediaStreamType.Subtitle && (!SubtitleStreamIndex.HasValue || stream.Index != SubtitleStreamIndex.Value))
|
if (stream.Type == MediaStreamType.Subtitle && (!SubtitleStreamIndex.HasValue || stream.Index != SubtitleStreamIndex.Value))
|
||||||
{
|
{
|
||||||
AddSubtitle(list, stream, baseUrl, startPositionTicks);
|
SubtitleStreamInfo info = GetSubtitleStreamInfo(stream, baseUrl, accessToken, startPositionTicks);
|
||||||
|
|
||||||
|
if (info != null)
|
||||||
|
{
|
||||||
|
list.Add(info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,32 +242,41 @@ namespace MediaBrowser.Model.Dlna
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddSubtitle(List<SubtitleStreamInfo> list, MediaStream stream, string baseUrl, long startPositionTicks)
|
private SubtitleStreamInfo GetSubtitleStreamInfo(MediaStream stream, string baseUrl, string accessToken, long startPositionTicks)
|
||||||
{
|
{
|
||||||
var subtitleProfile = StreamBuilder.GetSubtitleProfile(stream, DeviceProfile);
|
SubtitleStreamInfo info = GetSubtitleStreamInfo(stream);
|
||||||
|
|
||||||
|
if (info != null)
|
||||||
|
{
|
||||||
|
info.Url = string.Format("{0}/Videos/{1}/{2}/Subtitles/{3}/{4}/Stream.{5}",
|
||||||
|
baseUrl,
|
||||||
|
ItemId,
|
||||||
|
MediaSourceId,
|
||||||
|
StringHelper.ToStringCultureInvariant(stream.Index),
|
||||||
|
StringHelper.ToStringCultureInvariant(startPositionTicks),
|
||||||
|
SubtitleFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
private SubtitleStreamInfo GetSubtitleStreamInfo(MediaStream stream)
|
||||||
|
{
|
||||||
|
SubtitleProfile subtitleProfile = StreamBuilder.GetSubtitleProfile(stream, DeviceProfile);
|
||||||
|
|
||||||
if (subtitleProfile.Method != SubtitleDeliveryMethod.External)
|
if (subtitleProfile.Method != SubtitleDeliveryMethod.External)
|
||||||
{
|
{
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
string url = string.Format("{0}/Videos/{1}/{2}/Subtitles/{3}/{4}/Stream.{5}",
|
return new SubtitleStreamInfo
|
||||||
baseUrl,
|
|
||||||
ItemId,
|
|
||||||
MediaSourceId,
|
|
||||||
StringHelper.ToStringCultureInvariant(stream.Index),
|
|
||||||
StringHelper.ToStringCultureInvariant(startPositionTicks),
|
|
||||||
SubtitleFormat);
|
|
||||||
|
|
||||||
list.Add(new SubtitleStreamInfo
|
|
||||||
{
|
{
|
||||||
Url = url,
|
|
||||||
IsForced = stream.IsForced,
|
IsForced = stream.IsForced,
|
||||||
Language = stream.Language,
|
Language = stream.Language,
|
||||||
Name = stream.Language ?? "Unknown",
|
Name = stream.Language ?? "Unknown",
|
||||||
Format = SubtitleFormat,
|
Format = SubtitleFormat,
|
||||||
Index = stream.Index
|
Index = stream.Index
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
<Compile Include="ApiClient\IDevice.cs" />
|
<Compile Include="ApiClient\IDevice.cs" />
|
||||||
<Compile Include="ApiClient\IServerEvents.cs" />
|
<Compile Include="ApiClient\IServerEvents.cs" />
|
||||||
<Compile Include="ApiClient\GeneralCommandEventArgs.cs" />
|
<Compile Include="ApiClient\GeneralCommandEventArgs.cs" />
|
||||||
|
<Compile Include="ApiClient\NetworkStatus.cs" />
|
||||||
<Compile Include="ApiClient\RemoteLogoutReason.cs" />
|
<Compile Include="ApiClient\RemoteLogoutReason.cs" />
|
||||||
<Compile Include="ApiClient\ServerCredentials.cs" />
|
<Compile Include="ApiClient\ServerCredentials.cs" />
|
||||||
<Compile Include="ApiClient\ServerDiscoveryInfo.cs" />
|
<Compile Include="ApiClient\ServerDiscoveryInfo.cs" />
|
||||||
|
|
|
@ -3,19 +3,56 @@ namespace MediaBrowser.Model.Querying
|
||||||
{
|
{
|
||||||
public class EpisodeQuery
|
public class EpisodeQuery
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the user identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The user identifier.</value>
|
||||||
public string UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the season identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The season identifier.</value>
|
||||||
public string SeasonId { get; set; }
|
public string SeasonId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the series identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The series identifier.</value>
|
||||||
public string SeriesId { get; set; }
|
public string SeriesId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether this instance is missing.
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>null</c> if [is missing] contains no value, <c>true</c> if [is missing]; otherwise, <c>false</c>.</value>
|
||||||
public bool? IsMissing { get; set; }
|
public bool? IsMissing { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether this instance is virtual unaired.
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>null</c> if [is virtual unaired] contains no value, <c>true</c> if [is virtual unaired]; otherwise, <c>false</c>.</value>
|
||||||
public bool? IsVirtualUnaired { get; set; }
|
public bool? IsVirtualUnaired { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the season number.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The season number.</value>
|
||||||
public int? SeasonNumber { get; set; }
|
public int? SeasonNumber { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the fields.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The fields.</value>
|
||||||
public ItemFields[] Fields { get; set; }
|
public ItemFields[] Fields { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the start index.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The start index.</value>
|
||||||
|
public int? StartIndex { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the limit.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The limit.</value>
|
||||||
|
public int? Limit { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the start item identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The start item identifier.</value>
|
||||||
|
public string StartItemId { get; set; }
|
||||||
|
|
||||||
public EpisodeQuery()
|
public EpisodeQuery()
|
||||||
{
|
{
|
||||||
|
|
|
@ -210,7 +210,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_fileSystem.DeleteFile(path);
|
DeleteLibraryFile(path);
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
|
@ -224,6 +224,15 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DeleteLibraryFile(string path)
|
||||||
|
{
|
||||||
|
var filename = Path.GetFileNameWithoutExtension(path);
|
||||||
|
|
||||||
|
_fileSystem.DeleteFile(path);
|
||||||
|
|
||||||
|
// Now find other files
|
||||||
|
}
|
||||||
|
|
||||||
private List<string> GetOtherDuplicatePaths(string targetPath, Series series, int seasonNumber, int episodeNumber, int? endingEpisodeNumber)
|
private List<string> GetOtherDuplicatePaths(string targetPath, Series series, int seasonNumber, int episodeNumber, int? endingEpisodeNumber)
|
||||||
{
|
{
|
||||||
var episodePaths = series.GetRecursiveChildren()
|
var episodePaths = series.GetRecursiveChildren()
|
||||||
|
@ -281,11 +290,11 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||||
|
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(result.TargetPath));
|
Directory.CreateDirectory(Path.GetDirectoryName(result.TargetPath));
|
||||||
|
|
||||||
var copy = File.Exists(result.TargetPath);
|
var targetAlreadyExists = File.Exists(result.TargetPath);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (copy || options.CopyOriginalFile)
|
if (targetAlreadyExists || options.CopyOriginalFile)
|
||||||
{
|
{
|
||||||
File.Copy(result.OriginalPath, result.TargetPath, true);
|
File.Copy(result.OriginalPath, result.TargetPath, true);
|
||||||
}
|
}
|
||||||
|
@ -312,7 +321,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||||
_libraryMonitor.ReportFileSystemChangeComplete(result.TargetPath, true);
|
_libraryMonitor.ReportFileSystemChangeComplete(result.TargetPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (copy && !options.CopyOriginalFile)
|
if (targetAlreadyExists && !options.CopyOriginalFile)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -483,7 +483,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
// No sense creating external subs if we're already burning one into the video
|
// No sense creating external subs if we're already burning one into the video
|
||||||
var externalSubs = streamInfo.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode ?
|
var externalSubs = streamInfo.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode ?
|
||||||
new List<SubtitleStreamInfo>() :
|
new List<SubtitleStreamInfo>() :
|
||||||
streamInfo.GetExternalSubtitles("dummy", false);
|
streamInfo.GetExternalSubtitles(false);
|
||||||
|
|
||||||
// Mark as requiring conversion if transcoding the video, or if any subtitles need to be extracted
|
// Mark as requiring conversion if transcoding the video, or if any subtitles need to be extracted
|
||||||
var requiresVideoTranscoding = streamInfo.PlayMethod == PlayMethod.Transcode && job.Quality != SyncQuality.Original;
|
var requiresVideoTranscoding = streamInfo.PlayMethod == PlayMethod.Transcode && job.Quality != SyncQuality.Original;
|
||||||
|
|
|
@ -285,6 +285,9 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
"thirdparty/apiclient/network.js",
|
"thirdparty/apiclient/network.js",
|
||||||
"thirdparty/apiclient/device.js",
|
"thirdparty/apiclient/device.js",
|
||||||
"thirdparty/apiclient/credentials.js",
|
"thirdparty/apiclient/credentials.js",
|
||||||
|
"thirdparty/apiclient/ajax.js",
|
||||||
|
"thirdparty/apiclient/events.js",
|
||||||
|
"thirdparty/apiclient/deferred.js",
|
||||||
"thirdparty/apiclient/mediabrowser.apiclient.js",
|
"thirdparty/apiclient/mediabrowser.apiclient.js",
|
||||||
"thirdparty/apiclient/connectservice.js",
|
"thirdparty/apiclient/connectservice.js",
|
||||||
"thirdparty/apiclient/connectionmanager.js"
|
"thirdparty/apiclient/connectionmanager.js"
|
||||||
|
|
|
@ -156,12 +156,24 @@
|
||||||
<Content Include="dashboard-ui\syncsettings.html">
|
<Content Include="dashboard-ui\syncsettings.html">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\thirdparty\apiclient\ajax.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\thirdparty\apiclient\connectservice.js">
|
<Content Include="dashboard-ui\thirdparty\apiclient\connectservice.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\thirdparty\apiclient\deferred.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\thirdparty\apiclient\deferredAlt.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\thirdparty\apiclient\device.js">
|
<Content Include="dashboard-ui\thirdparty\apiclient\device.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\thirdparty\apiclient\events.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\thirdparty\apiclient\logger.js">
|
<Content Include="dashboard-ui\thirdparty\apiclient\logger.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common.Internal</id>
|
<id>MediaBrowser.Common.Internal</id>
|
||||||
<version>3.0.568</version>
|
<version>3.0.571</version>
|
||||||
<title>MediaBrowser.Common.Internal</title>
|
<title>MediaBrowser.Common.Internal</title>
|
||||||
<authors>Luke</authors>
|
<authors>Luke</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<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>
|
<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>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.568" />
|
<dependency id="MediaBrowser.Common" version="3.0.571" />
|
||||||
<dependency id="NLog" version="3.1.0.0" />
|
<dependency id="NLog" version="3.1.0.0" />
|
||||||
<dependency id="SimpleInjector" version="2.6.1" />
|
<dependency id="SimpleInjector" version="2.6.1" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common</id>
|
<id>MediaBrowser.Common</id>
|
||||||
<version>3.0.568</version>
|
<version>3.0.571</version>
|
||||||
<title>MediaBrowser.Common</title>
|
<title>MediaBrowser.Common</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Model.Signed</id>
|
<id>MediaBrowser.Model.Signed</id>
|
||||||
<version>3.0.568</version>
|
<version>3.0.571</version>
|
||||||
<title>MediaBrowser.Model - Signed Edition</title>
|
<title>MediaBrowser.Model - Signed Edition</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Server.Core</id>
|
<id>MediaBrowser.Server.Core</id>
|
||||||
<version>3.0.568</version>
|
<version>3.0.571</version>
|
||||||
<title>Media Browser.Server.Core</title>
|
<title>Media Browser.Server.Core</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.568" />
|
<dependency id="MediaBrowser.Common" version="3.0.571" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user