diff options
Diffstat (limited to 'MediaBrowser.Controller')
| -rw-r--r-- | MediaBrowser.Controller/Entities/Audio/Audio.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs | 1 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Audio/MusicArtist.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Audio/MusicGenre.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Photo.cs | 17 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/TV/Season.cs | 1 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/TV/Series.cs | 1 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Video.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/MediaBrowser.Controller.csproj | 1 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Net/IHttpResultFactory.cs | 42 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Net/StaticResultOptions.cs | 42 |
12 files changed, 86 insertions, 31 deletions
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index b13403bbf8..25d41565ae 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -38,6 +38,7 @@ namespace MediaBrowser.Controller.Entities.Audio Tags = new List<string>(); } + [IgnoreDataMember] public override bool SupportsAddingToPlaylist { get { return LocationType == LocationType.FileSystem && RunTimeTicks.HasValue; } @@ -118,6 +119,7 @@ namespace MediaBrowser.Controller.Entities.Audio /// Gets the type of the media. /// </summary> /// <value>The type of the media.</value> + [IgnoreDataMember] public override string MediaType { get diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index 2eeec9715a..dc9f83b3c9 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -22,6 +22,7 @@ namespace MediaBrowser.Controller.Entities.Audio AlbumArtists = new List<string>(); } + [IgnoreDataMember] public override bool SupportsAddingToPlaylist { get { return true; } diff --git a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs index de527b68b3..070572b9b2 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common.Progress; +using System.Runtime.Serialization; +using MediaBrowser.Common.Progress; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; @@ -26,6 +27,7 @@ namespace MediaBrowser.Controller.Entities.Audio } } + [IgnoreDataMember] public override bool SupportsAddingToPlaylist { get { return true; } diff --git a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs index f1dc56ac68..928eb64630 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; namespace MediaBrowser.Controller.Entities.Audio { @@ -18,6 +19,7 @@ namespace MediaBrowser.Controller.Entities.Audio return "MusicGenre-" + Name; } + [IgnoreDataMember] public override bool SupportsAddingToPlaylist { get { return true; } diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index fd7a33ddf4..26b28ec72b 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -53,6 +53,7 @@ namespace MediaBrowser.Controller.Entities public List<ItemImageInfo> ImageInfos { get; set; } + [IgnoreDataMember] public virtual bool SupportsAddingToPlaylist { get @@ -192,6 +193,7 @@ namespace MediaBrowser.Controller.Entities } } + [IgnoreDataMember] public virtual bool SupportsLocalMetadata { get diff --git a/MediaBrowser.Controller/Entities/Photo.cs b/MediaBrowser.Controller/Entities/Photo.cs index 1f38de9a31..367db5dcb5 100644 --- a/MediaBrowser.Controller/Entities/Photo.cs +++ b/MediaBrowser.Controller/Entities/Photo.cs @@ -17,6 +17,7 @@ namespace MediaBrowser.Controller.Entities Taglines = new List<string>(); } + [IgnoreDataMember] public override bool SupportsLocalMetadata { get @@ -25,6 +26,7 @@ namespace MediaBrowser.Controller.Entities } } + [IgnoreDataMember] public override string MediaType { get @@ -38,6 +40,16 @@ namespace MediaBrowser.Controller.Entities { get { + return Album; + } + } + + + [IgnoreDataMember] + public PhotoAlbum Album + { + get + { return Parents.OfType<PhotoAlbum>().FirstOrDefault(); } } @@ -53,6 +65,11 @@ namespace MediaBrowser.Controller.Entities public double? Aperture { get; set; } public double? ShutterSpeed { get; set; } + public double? Latitude { get; set; } + public double? Longitude { get; set; } + public double? Altitude { get; set; } + public int? IsoSpeedRating { get; set; } + protected override bool GetBlockUnratedValue(UserConfiguration config) { return config.BlockUnratedItems.Contains(UnratedItem.Other); diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index b82a400fe8..6804b29b73 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -29,6 +29,7 @@ namespace MediaBrowser.Controller.Entities.TV } } + [IgnoreDataMember] public override bool SupportsAddingToPlaylist { get { return true; } diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index 856ed4fdf2..d3b95eb0c6 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -39,6 +39,7 @@ namespace MediaBrowser.Controller.Entities.TV DisplaySpecialsWithSeasons = true; } + [IgnoreDataMember] public override bool SupportsAddingToPlaylist { get { return true; } diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index ea530272dd..492a4a02f9 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -58,6 +58,7 @@ namespace MediaBrowser.Controller.Entities LinkedAlternateVersions = new List<LinkedChild>(); } + [IgnoreDataMember] public override bool SupportsAddingToPlaylist { get { return LocationType == LocationType.FileSystem && RunTimeTicks.HasValue; } @@ -238,6 +239,7 @@ namespace MediaBrowser.Controller.Entities /// Gets the type of the media. /// </summary> /// <value>The type of the media.</value> + [IgnoreDataMember] public override string MediaType { get diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index aeeaae073b..6a78fa5d9f 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -214,6 +214,7 @@ <Compile Include="Net\IRestfulService.cs" /> <Compile Include="Net\ISessionContext.cs" /> <Compile Include="Net\LoggedAttribute.cs" /> + <Compile Include="Net\StaticResultOptions.cs" /> <Compile Include="News\INewsService.cs" /> <Compile Include="Notifications\INotificationManager.cs" /> <Compile Include="Notifications\INotificationService.cs" /> diff --git a/MediaBrowser.Controller/Net/IHttpResultFactory.cs b/MediaBrowser.Controller/Net/IHttpResultFactory.cs index f0cfbbcfae..526bf4be2e 100644 --- a/MediaBrowser.Controller/Net/IHttpResultFactory.cs +++ b/MediaBrowser.Controller/Net/IHttpResultFactory.cs @@ -1,8 +1,8 @@ -using System; +using ServiceStack.Web; +using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; -using ServiceStack.Web; namespace MediaBrowser.Controller.Net { @@ -89,47 +89,29 @@ namespace MediaBrowser.Controller.Net bool isHeadRequest = false); /// <summary> - /// Gets the static file result. + /// Gets the static result. /// </summary> /// <param name="requestContext">The request context.</param> - /// <param name="path">The path.</param> - /// <param name="fileShare">The file share.</param> - /// <param name="responseHeaders">The response headers.</param> - /// <param name="isHeadRequest">if set to <c>true</c> [is head request].</param> + /// <param name="options">The options.</param> /// <returns>System.Object.</returns> - object GetStaticFileResult(IRequest requestContext, string path, FileShare fileShare = FileShare.Read, IDictionary<string, string> responseHeaders = null, bool isHeadRequest = false); + object GetStaticResult(IRequest requestContext, StaticResultOptions options); /// <summary> /// Gets the static file result. /// </summary> /// <param name="requestContext">The request context.</param> /// <param name="path">The path.</param> - /// <param name="contentType">Type of the content.</param> - /// <param name="cacheCuration">The cache curation.</param> /// <param name="fileShare">The file share.</param> - /// <param name="responseHeaders">The response headers.</param> - /// <param name="isHeadRequest">if set to <c>true</c> [is head request].</param> - /// <param name="throttle">if set to <c>true</c> [throttle].</param> - /// <param name="throttleLimit">The throttle limit.</param> /// <returns>System.Object.</returns> - object GetStaticFileResult(IRequest requestContext, - string path, - string contentType, - TimeSpan? cacheCuration = null, - FileShare fileShare = FileShare.Read, - IDictionary<string, string> responseHeaders = null, - bool isHeadRequest = false, - bool throttle = false, - long throttleLimit = 0); - + object GetStaticFileResult(IRequest requestContext, string path, FileShare fileShare = FileShare.Read); + /// <summary> - /// Gets the optimized serialized result using cache. + /// Gets the static file result. /// </summary> - /// <typeparam name="T"></typeparam> - /// <param name="request">The request.</param> - /// <param name="result">The result.</param> + /// <param name="requestContext">The request context.</param> + /// <param name="options">The options.</param> /// <returns>System.Object.</returns> - object GetOptimizedSerializedResultUsingCache<T>(IRequest request, T result) - where T : class; + object GetStaticFileResult(IRequest requestContext, + StaticFileResultOptions options); } } diff --git a/MediaBrowser.Controller/Net/StaticResultOptions.cs b/MediaBrowser.Controller/Net/StaticResultOptions.cs new file mode 100644 index 0000000000..fde08c269d --- /dev/null +++ b/MediaBrowser.Controller/Net/StaticResultOptions.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; + +namespace MediaBrowser.Controller.Net +{ + public class StaticResultOptions + { + public string ContentType { get; set; } + public TimeSpan? CacheDuration { get; set; } + public DateTime? DateLastModified { get; set; } + public Guid CacheKey { get; set; } + + public Func<Task<Stream>> ContentFactory { get; set; } + + public bool IsHeadRequest { get; set; } + + public IDictionary<string, string> ResponseHeaders { get; set; } + + public bool Throttle { get; set; } + public long ThrottleLimit { get; set; } + public long MinThrottlePosition { get; set; } + + public StaticResultOptions() + { + ResponseHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); + } + } + + public class StaticFileResultOptions : StaticResultOptions + { + public string Path { get; set; } + + public FileShare FileShare { get; set; } + + public StaticFileResultOptions() + { + FileShare = FileShare.Read; + } + } +} |
