diff options
Diffstat (limited to 'MediaBrowser.Model')
| -rw-r--r-- | MediaBrowser.Model/ApiClient/NetworkStatus.cs | 30 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/StreamInfo.cs | 99 | ||||
| -rw-r--r-- | MediaBrowser.Model/MediaBrowser.Model.csproj | 1 | ||||
| -rw-r--r-- | MediaBrowser.Model/Querying/EpisodeQuery.cs | 51 |
4 files changed, 154 insertions, 27 deletions
diff --git a/MediaBrowser.Model/ApiClient/NetworkStatus.cs b/MediaBrowser.Model/ApiClient/NetworkStatus.cs new file mode 100644 index 000000000..715087607 --- /dev/null +++ b/MediaBrowser.Model/ApiClient/NetworkStatus.cs @@ -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; + } + } +} diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index 3c2f39b74..57a3899d4 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -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) { @@ -152,7 +152,47 @@ namespace MediaBrowser.Model.Dlna 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)) { @@ -173,7 +213,12 @@ namespace MediaBrowser.Model.Dlna { 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)) { - 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; } - 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 (subtitleProfile.Method != SubtitleDeliveryMethod.External) + if (info != null) { - return; + info.Url = string.Format("{0}/Videos/{1}/{2}/Subtitles/{3}/{4}/Stream.{5}", + baseUrl, + ItemId, + MediaSourceId, + StringHelper.ToStringCultureInvariant(stream.Index), + StringHelper.ToStringCultureInvariant(startPositionTicks), + SubtitleFormat); } - string 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) + { + return null; + } - list.Add(new SubtitleStreamInfo + return new SubtitleStreamInfo { - Url = url, IsForced = stream.IsForced, Language = stream.Language, Name = stream.Language ?? "Unknown", Format = SubtitleFormat, Index = stream.Index - }); + }; } /// <summary> diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index c8e09dd82..9fd632cbd 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -72,6 +72,7 @@ <Compile Include="ApiClient\IDevice.cs" /> <Compile Include="ApiClient\IServerEvents.cs" /> <Compile Include="ApiClient\GeneralCommandEventArgs.cs" /> + <Compile Include="ApiClient\NetworkStatus.cs" /> <Compile Include="ApiClient\RemoteLogoutReason.cs" /> <Compile Include="ApiClient\ServerCredentials.cs" /> <Compile Include="ApiClient\ServerDiscoveryInfo.cs" /> diff --git a/MediaBrowser.Model/Querying/EpisodeQuery.cs b/MediaBrowser.Model/Querying/EpisodeQuery.cs index e2fc3220a..78fe943e3 100644 --- a/MediaBrowser.Model/Querying/EpisodeQuery.cs +++ b/MediaBrowser.Model/Querying/EpisodeQuery.cs @@ -3,20 +3,57 @@ namespace MediaBrowser.Model.Querying { public class EpisodeQuery { + /// <summary> + /// Gets or sets the user identifier. + /// </summary> + /// <value>The user identifier.</value> public string UserId { get; set; } - + /// <summary> + /// Gets or sets the season identifier. + /// </summary> + /// <value>The season identifier.</value> public string SeasonId { get; set; } - + /// <summary> + /// Gets or sets the series identifier. + /// </summary> + /// <value>The series identifier.</value> 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; } - + /// <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; } - + /// <summary> + /// Gets or sets the season number. + /// </summary> + /// <value>The season number.</value> public int? SeasonNumber { get; set; } - + /// <summary> + /// Gets or sets the fields. + /// </summary> + /// <value>The fields.</value> 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() { Fields = new ItemFields[] { }; |
