aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Model')
-rw-r--r--MediaBrowser.Model/ApiClient/IApiClient.cs7
-rw-r--r--MediaBrowser.Model/Channels/ChannelQuery.cs6
-rw-r--r--MediaBrowser.Model/Configuration/MetadataOptions.cs5
-rw-r--r--MediaBrowser.Model/Configuration/ServerConfiguration.cs4
-rw-r--r--MediaBrowser.Model/Dlna/ConditionProcessor.cs2
-rw-r--r--MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs2
-rw-r--r--MediaBrowser.Model/Dlna/DeviceProfile.cs16
-rw-r--r--MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs48
-rw-r--r--MediaBrowser.Model/Dlna/StreamBuilder.cs10
-rw-r--r--MediaBrowser.Model/Dlna/StreamInfo.cs4
-rw-r--r--MediaBrowser.Model/Extensions/DoubleHelper.cs14
-rw-r--r--MediaBrowser.Model/Extensions/ListHelper.cs2
-rw-r--r--MediaBrowser.Model/Querying/ItemsByNameQuery.cs1
13 files changed, 77 insertions, 44 deletions
diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs
index eac2e0d9b8..4f008571ce 100644
--- a/MediaBrowser.Model/ApiClient/IApiClient.cs
+++ b/MediaBrowser.Model/ApiClient/IApiClient.cs
@@ -350,6 +350,13 @@ namespace MediaBrowser.Model.ApiClient
Task<ItemsResult> GetArtistsAsync(ArtistsQuery query);
/// <summary>
+ /// Gets the album artists asynchronous.
+ /// </summary>
+ /// <param name="query">The query.</param>
+ /// <returns>Task{ItemsResult}.</returns>
+ Task<ItemsResult> GetAlbumArtistsAsync(ArtistsQuery query);
+
+ /// <summary>
/// Gets a studio
/// </summary>
/// <param name="name">The name.</param>
diff --git a/MediaBrowser.Model/Channels/ChannelQuery.cs b/MediaBrowser.Model/Channels/ChannelQuery.cs
index 62bb543f67..f7ed368530 100644
--- a/MediaBrowser.Model/Channels/ChannelQuery.cs
+++ b/MediaBrowser.Model/Channels/ChannelQuery.cs
@@ -28,6 +28,12 @@ namespace MediaBrowser.Model.Channels
/// </summary>
/// <value><c>true</c> if [supports latest items]; otherwise, <c>false</c>.</value>
public bool? SupportsLatestItems { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is favorite.
+ /// </summary>
+ /// <value><c>null</c> if [is favorite] contains no value, <c>true</c> if [is favorite]; otherwise, <c>false</c>.</value>
+ public bool? IsFavorite { get; set; }
}
public class AllChannelMediaQuery
diff --git a/MediaBrowser.Model/Configuration/MetadataOptions.cs b/MediaBrowser.Model/Configuration/MetadataOptions.cs
index fdfbbf4f42..ddde688b25 100644
--- a/MediaBrowser.Model/Configuration/MetadataOptions.cs
+++ b/MediaBrowser.Model/Configuration/MetadataOptions.cs
@@ -1,7 +1,6 @@
using MediaBrowser.Model.Entities;
-using System;
+using MediaBrowser.Model.Extensions;
using System.Collections.Generic;
-using System.Linq;
namespace MediaBrowser.Model.Configuration
{
@@ -87,7 +86,7 @@ namespace MediaBrowser.Model.Configuration
public bool IsMetadataSaverEnabled(string name)
{
- return !DisabledMetadataSavers.Contains(name, StringComparer.OrdinalIgnoreCase);
+ return !ListHelper.ContainsIgnoreCase(DisabledMetadataSavers, name);
}
}
}
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index bbe862238d..0d728ec75e 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -246,7 +246,9 @@ namespace MediaBrowser.Model.Configuration
MinResumePct = 5;
MaxResumePct = 90;
- MinResumeDurationSeconds = Convert.ToInt32(TimeSpan.FromMinutes(5).TotalSeconds);
+
+ // 5 minutes
+ MinResumeDurationSeconds = 300;
RealtimeMonitorDelay = 30;
diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs
index 61428e39b1..66c3e0b195 100644
--- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs
+++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs
@@ -15,7 +15,7 @@ namespace MediaBrowser.Model.Dlna
int? videoBitrate,
string videoProfile,
double? videoLevel,
- double? videoFramerate,
+ float? videoFramerate,
int? packetLength,
TransportStreamTimestamp? timestamp,
bool? isAnamorphic)
diff --git a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs
index 55418e13b1..b6d9d9f77d 100644
--- a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs
+++ b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs
@@ -106,7 +106,7 @@ namespace MediaBrowser.Model.Dlna
long? runtimeTicks,
string videoProfile,
double? videoLevel,
- double? videoFramerate,
+ float? videoFramerate,
int? packetLength,
TranscodeSeekInfo transcodeSeekInfo,
bool? isAnamorphic)
diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs
index fb670a5de1..807e04427a 100644
--- a/MediaBrowser.Model/Dlna/DeviceProfile.cs
+++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs
@@ -1,8 +1,6 @@
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.MediaInfo;
-using System;
using System.Collections.Generic;
-using System.Linq;
using System.Xml.Serialization;
namespace MediaBrowser.Model.Dlna
@@ -157,12 +155,12 @@ namespace MediaBrowser.Model.Dlna
continue;
}
- if (!i.GetAudioCodecs().Contains(audioCodec ?? string.Empty))
+ if (!ListHelper.ContainsIgnoreCase(i.GetAudioCodecs(), audioCodec ?? string.Empty))
{
continue;
}
- if (!StringHelper.EqualsIgnoreCase(videoCodec, i.VideoCodec))
+ if (!StringHelper.EqualsIgnoreCase(videoCodec, i.VideoCodec ?? string.Empty))
{
continue;
}
@@ -190,7 +188,7 @@ namespace MediaBrowser.Model.Dlna
}
List<string> audioCodecs = i.GetAudioCodecs();
- if (audioCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec))
+ if (audioCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty))
{
continue;
}
@@ -267,7 +265,7 @@ namespace MediaBrowser.Model.Dlna
int? videoBitrate,
string videoProfile,
double? videoLevel,
- double? videoFramerate,
+ float? videoFramerate,
int? packetLength,
TransportStreamTimestamp timestamp,
bool? isAnamorphic)
@@ -282,19 +280,19 @@ namespace MediaBrowser.Model.Dlna
}
List<string> containers = i.GetContainers();
- if (containers.Count > 0 && !ListHelper.ContainsIgnoreCase(containers, container))
+ if (containers.Count > 0 && !ListHelper.ContainsIgnoreCase(containers, container ?? string.Empty))
{
continue;
}
List<string> audioCodecs = i.GetAudioCodecs();
- if (audioCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec))
+ if (audioCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty))
{
continue;
}
List<string> videoCodecs = i.GetVideoCodecs();
- if (videoCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec))
+ if (videoCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec ?? string.Empty))
{
continue;
}
diff --git a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs
index 022c0efda0..9bbe52dbf5 100644
--- a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs
+++ b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs
@@ -7,7 +7,7 @@ namespace MediaBrowser.Model.Dlna
{
public class MediaFormatProfileResolver
{
- public IEnumerable<MediaFormatProfile> ResolveVideoFormat(string container, string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)
+ public List<MediaFormatProfile> ResolveVideoFormat(string container, string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)
{
if (StringHelper.EqualsIgnoreCase(container, "asf"))
{
@@ -22,18 +22,18 @@ namespace MediaBrowser.Model.Dlna
}
if (StringHelper.EqualsIgnoreCase(container, "avi"))
- return new[] { MediaFormatProfile.AVI };
+ return new List<MediaFormatProfile> { MediaFormatProfile.AVI };
if (StringHelper.EqualsIgnoreCase(container, "mkv"))
- return new[] { MediaFormatProfile.MATROSKA };
+ return new List<MediaFormatProfile> { MediaFormatProfile.MATROSKA };
if (StringHelper.EqualsIgnoreCase(container, "mpeg2ps") ||
StringHelper.EqualsIgnoreCase(container, "ts"))
- return new[] { MediaFormatProfile.MPEG_PS_NTSC, MediaFormatProfile.MPEG_PS_PAL };
+ return new List<MediaFormatProfile> { MediaFormatProfile.MPEG_PS_NTSC, MediaFormatProfile.MPEG_PS_PAL };
if (StringHelper.EqualsIgnoreCase(container, "mpeg1video"))
- return new[] { MediaFormatProfile.MPEG1 };
+ return new List<MediaFormatProfile> { MediaFormatProfile.MPEG1 };
if (StringHelper.EqualsIgnoreCase(container, "mpeg2ts") ||
StringHelper.EqualsIgnoreCase(container, "mpegts") ||
@@ -44,10 +44,10 @@ namespace MediaBrowser.Model.Dlna
}
if (StringHelper.EqualsIgnoreCase(container, "flv"))
- return new[] { MediaFormatProfile.FLV };
+ return new List<MediaFormatProfile> { MediaFormatProfile.FLV };
if (StringHelper.EqualsIgnoreCase(container, "wtv"))
- return new[] { MediaFormatProfile.WTV };
+ return new List<MediaFormatProfile> { MediaFormatProfile.WTV };
if (StringHelper.EqualsIgnoreCase(container, "3gp"))
{
@@ -56,12 +56,12 @@ namespace MediaBrowser.Model.Dlna
}
if (StringHelper.EqualsIgnoreCase(container, "ogv") || StringHelper.EqualsIgnoreCase(container, "ogg"))
- return new[] { MediaFormatProfile.OGV };
+ return new List<MediaFormatProfile> { MediaFormatProfile.OGV };
return new List<MediaFormatProfile>();
}
- private IEnumerable<MediaFormatProfile> ResolveVideoMPEG2TSFormat(string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)
+ private List<MediaFormatProfile> ResolveVideoMPEG2TSFormat(string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)
{
string suffix = "";
@@ -98,36 +98,36 @@ namespace MediaBrowser.Model.Dlna
if (StringHelper.EqualsIgnoreCase(videoCodec, "h264"))
{
if (StringHelper.EqualsIgnoreCase(audioCodec, "lpcm"))
- return new[] { MediaFormatProfile.AVC_TS_HD_50_LPCM_T };
+ return new List<MediaFormatProfile> { MediaFormatProfile.AVC_TS_HD_50_LPCM_T };
if (StringHelper.EqualsIgnoreCase(audioCodec, "dts"))
{
if (timestampType == TransportStreamTimestamp.None)
{
- return new[] { MediaFormatProfile.AVC_TS_HD_DTS_ISO };
+ return new List<MediaFormatProfile> { MediaFormatProfile.AVC_TS_HD_DTS_ISO };
}
- return new[] { MediaFormatProfile.AVC_TS_HD_DTS_T };
+ return new List<MediaFormatProfile> { MediaFormatProfile.AVC_TS_HD_DTS_T };
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))
{
if (timestampType == TransportStreamTimestamp.None)
{
- return new[] { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_ISO", resolution)) };
+ return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_ISO", resolution)) };
}
- return new[] { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_T", resolution)) };
+ return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_T", resolution)) };
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
- return new[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AAC_MULT5{1}", resolution, suffix)) };
+ return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_MP_{0}D_AAC_MULT5{1}", resolution, suffix)) };
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))
- return new[] { ValueOf(string.Format("AVC_TS_MP_{0}D_MPEG1_L3{1}", resolution, suffix)) };
+ return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_MP_{0}D_MPEG1_L3{1}", resolution, suffix)) };
if (string.IsNullOrEmpty(audioCodec) ||
StringHelper.EqualsIgnoreCase(audioCodec, "ac3"))
- return new[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AC3{1}", resolution, suffix)) };
+ return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_MP_{0}D_AC3{1}", resolution, suffix)) };
}
else if (StringHelper.EqualsIgnoreCase(videoCodec, "vc1"))
{
@@ -135,28 +135,28 @@ namespace MediaBrowser.Model.Dlna
{
if ((width.HasValue && width.Value > 720) || (height.HasValue && height.Value > 576))
{
- return new[] { MediaFormatProfile.VC1_TS_AP_L2_AC3_ISO };
+ return new List<MediaFormatProfile> { MediaFormatProfile.VC1_TS_AP_L2_AC3_ISO };
}
- return new[] { MediaFormatProfile.VC1_TS_AP_L1_AC3_ISO };
+ return new List<MediaFormatProfile> { MediaFormatProfile.VC1_TS_AP_L1_AC3_ISO };
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "dts"))
{
suffix = StringHelper.EqualsIgnoreCase(suffix, "_ISO") ? suffix : "_T";
- return new[] { ValueOf(string.Format("VC1_TS_HD_DTS{0}", suffix)) };
+ return new List<MediaFormatProfile> { ValueOf(string.Format("VC1_TS_HD_DTS{0}", suffix)) };
}
}
else if (StringHelper.EqualsIgnoreCase(videoCodec, "mpeg4") || StringHelper.EqualsIgnoreCase(videoCodec, "msmpeg4"))
{
if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
- return new[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AAC{0}", suffix)) };
+ return new List<MediaFormatProfile> { ValueOf(string.Format("MPEG4_P2_TS_ASP_AAC{0}", suffix)) };
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))
- return new[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG1_L3{0}", suffix)) };
+ return new List<MediaFormatProfile> { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG1_L3{0}", suffix)) };
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp2"))
- return new[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG2_L2{0}", suffix)) };
+ return new List<MediaFormatProfile> { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG2_L2{0}", suffix)) };
if (StringHelper.EqualsIgnoreCase(audioCodec, "ac3"))
- return new[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AC3{0}", suffix)) };
+ return new List<MediaFormatProfile> { ValueOf(string.Format("MPEG4_P2_TS_ASP_AC3{0}", suffix)) };
}
return new List<MediaFormatProfile>();
diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs
index 5e8ba3ff12..877570844b 100644
--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs
+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs
@@ -323,6 +323,12 @@ namespace MediaBrowser.Model.Dlna
playlistItem.VideoBitrate = Math.Min(videoBitrate, currentValue);
}
+
+ // Hate to hard-code this, but it's still probably better than being subjected to encoder defaults
+ if (!playlistItem.VideoBitrate.HasValue)
+ {
+ playlistItem.VideoBitrate = 5000000;
+ }
}
return playlistItem;
@@ -555,8 +561,8 @@ namespace MediaBrowser.Model.Dlna
}
case ProfileConditionValue.VideoFramerate:
{
- double num;
- if (DoubleHelper.TryParseCultureInvariant(value, out num))
+ float num;
+ if (FloatHelper.TryParseCultureInvariant(value, out num))
{
item.MaxFramerate = num;
}
diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs
index 9d23597fae..8d507ae377 100644
--- a/MediaBrowser.Model/Dlna/StreamInfo.cs
+++ b/MediaBrowser.Model/Dlna/StreamInfo.cs
@@ -45,7 +45,7 @@ namespace MediaBrowser.Model.Dlna
public int? MaxWidth { get; set; }
public int? MaxHeight { get; set; }
- public double? MaxFramerate { get; set; }
+ public float? MaxFramerate { get; set; }
public string DeviceProfileId { get; set; }
public string DeviceId { get; set; }
@@ -191,7 +191,7 @@ namespace MediaBrowser.Model.Dlna
/// <summary>
/// Predicts the audio sample rate that will be in the output stream
/// </summary>
- public double? TargetFramerate
+ public float? TargetFramerate
{
get
{
diff --git a/MediaBrowser.Model/Extensions/DoubleHelper.cs b/MediaBrowser.Model/Extensions/DoubleHelper.cs
index 00e3bc6245..e6a4e05812 100644
--- a/MediaBrowser.Model/Extensions/DoubleHelper.cs
+++ b/MediaBrowser.Model/Extensions/DoubleHelper.cs
@@ -19,6 +19,20 @@ namespace MediaBrowser.Model.Extensions
}
}
+ public static class FloatHelper
+ {
+ /// <summary>
+ /// Tries the parse culture invariant.
+ /// </summary>
+ /// <param name="s">The s.</param>
+ /// <param name="result">The result.</param>
+ /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
+ public static bool TryParseCultureInvariant(string s, out float result)
+ {
+ return float.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out result);
+ }
+ }
+
public static class BoolHelper
{
/// <summary>
diff --git a/MediaBrowser.Model/Extensions/ListHelper.cs b/MediaBrowser.Model/Extensions/ListHelper.cs
index bfab14b20c..6c5d471c08 100644
--- a/MediaBrowser.Model/Extensions/ListHelper.cs
+++ b/MediaBrowser.Model/Extensions/ListHelper.cs
@@ -6,7 +6,7 @@ namespace MediaBrowser.Model.Extensions
{
public static class ListHelper
{
- public static bool ContainsIgnoreCase(List<string> list, string value)
+ public static bool ContainsIgnoreCase(IEnumerable<string> list, string value)
{
if (value == null)
{
diff --git a/MediaBrowser.Model/Querying/ItemsByNameQuery.cs b/MediaBrowser.Model/Querying/ItemsByNameQuery.cs
index 4227dc0c59..bef2f7aed3 100644
--- a/MediaBrowser.Model/Querying/ItemsByNameQuery.cs
+++ b/MediaBrowser.Model/Querying/ItemsByNameQuery.cs
@@ -90,6 +90,7 @@ namespace MediaBrowser.Model.Querying
/// </summary>
/// <value>The name starts with or greater.</value>
public string NameStartsWith { get; set; }
+ /// <summary>
/// Gets or sets the name less than.
/// </summary>
/// <value>The name less than.</value>