Add GPL modules

This commit is contained in:
Andrew Rabert
2018-12-27 18:27:57 -05:00
parent 9bac3ac616
commit a86b71899e
648 changed files with 50005 additions and 123 deletions

View File

@@ -0,0 +1,68 @@
using MediaBrowser.Model.Logging;
using System;
namespace MediaBrowser.Model.Activity
{
public class ActivityLogEntry
{
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public long Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the overview.
/// </summary>
/// <value>The overview.</value>
public string Overview { get; set; }
/// <summary>
/// Gets or sets the short overview.
/// </summary>
/// <value>The short overview.</value>
public string ShortOverview { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public string Type { get; set; }
/// <summary>
/// Gets or sets the item identifier.
/// </summary>
/// <value>The item identifier.</value>
public string ItemId { get; set; }
/// <summary>
/// Gets or sets the date.
/// </summary>
/// <value>The date.</value>
public DateTime Date { get; set; }
/// <summary>
/// Gets or sets the user identifier.
/// </summary>
/// <value>The user identifier.</value>
public Guid UserId { get; set; }
/// <summary>
/// Gets or sets the user primary image tag.
/// </summary>
/// <value>The user primary image tag.</value>
public string UserPrimaryImageTag { get; set; }
/// <summary>
/// Gets or sets the log severity.
/// </summary>
/// <value>The log severity.</value>
public LogSeverity Severity { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Model.Activity
{
public interface IActivityManager
{
event EventHandler<GenericEventArgs<ActivityLogEntry>> EntryCreated;
void Create(ActivityLogEntry entry);
QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, int? startIndex, int? limit);
QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, bool? hasUserId, int? x, int? y);
}
}

View File

@@ -0,0 +1,12 @@
using System;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Model.Activity
{
public interface IActivityRepository
{
void Create(ActivityLogEntry entry);
QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, bool? z, int? startIndex, int? limit);
}
}

View File

@@ -0,0 +1,27 @@

namespace MediaBrowser.Model.ApiClient
{
public class ServerDiscoveryInfo
{
/// <summary>
/// Gets or sets the address.
/// </summary>
/// <value>The address.</value>
public string Address { get; set; }
/// <summary>
/// Gets or sets the server identifier.
/// </summary>
/// <value>The server identifier.</value>
public string Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the endpoint address.
/// </summary>
/// <value>The endpoint address.</value>
public string EndpointAddress { get; set; }
}
}

View File

@@ -0,0 +1,17 @@

namespace MediaBrowser.Model.Branding
{
public class BrandingOptions
{
/// <summary>
/// Gets or sets the login disclaimer.
/// </summary>
/// <value>The login disclaimer.</value>
public string LoginDisclaimer { get; set; }
/// <summary>
/// Gets or sets the custom CSS.
/// </summary>
/// <value>The custom CSS.</value>
public string CustomCss { get; set; }
}
}

View File

@@ -0,0 +1,85 @@
using System.Collections.Generic;
namespace MediaBrowser.Model.Channels
{
public class ChannelFeatures
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public string Id { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance can search.
/// </summary>
/// <value><c>true</c> if this instance can search; otherwise, <c>false</c>.</value>
public bool CanSearch { get; set; }
/// <summary>
/// Gets or sets the media types.
/// </summary>
/// <value>The media types.</value>
public ChannelMediaType[] MediaTypes { get; set; }
/// <summary>
/// Gets or sets the content types.
/// </summary>
/// <value>The content types.</value>
public ChannelMediaContentType[] ContentTypes { get; set; }
/// <summary>
/// Represents the maximum number of records the channel allows retrieving at a time
/// </summary>
public int? MaxPageSize { get; set; }
/// <summary>
/// Gets or sets the automatic refresh levels.
/// </summary>
/// <value>The automatic refresh levels.</value>
public int? AutoRefreshLevels { get; set; }
/// <summary>
/// Gets or sets the default sort orders.
/// </summary>
/// <value>The default sort orders.</value>
public ChannelItemSortField[] DefaultSortFields { get; set; }
/// <summary>
/// Indicates if a sort ascending/descending toggle is supported or not.
/// </summary>
public bool SupportsSortOrderToggle { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [supports latest media].
/// </summary>
/// <value><c>true</c> if [supports latest media]; otherwise, <c>false</c>.</value>
public bool SupportsLatestMedia { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance can filter.
/// </summary>
/// <value><c>true</c> if this instance can filter; otherwise, <c>false</c>.</value>
public bool CanFilter { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [supports content downloading].
/// </summary>
/// <value><c>true</c> if [supports content downloading]; otherwise, <c>false</c>.</value>
public bool SupportsContentDownloading { get; set; }
public ChannelFeatures()
{
MediaTypes = new ChannelMediaType[] { };
ContentTypes = new ChannelMediaContentType[] { };
DefaultSortFields = new ChannelItemSortField[] { };
}
}
}

View File

@@ -0,0 +1,17 @@
namespace MediaBrowser.Model.Channels
{
public enum ChannelFolderType
{
Container = 0,
MusicAlbum = 1,
PhotoAlbum = 2,
MusicArtist = 3,
Series = 4,
Season = 5
}
}

View File

@@ -0,0 +1,30 @@

namespace MediaBrowser.Model.Channels
{
public class ChannelInfo
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public string Id { get; set; }
/// <summary>
/// Gets or sets the home page URL.
/// </summary>
/// <value>The home page URL.</value>
public string HomePageUrl { get; set; }
/// <summary>
/// Gets or sets the features.
/// </summary>
/// <value>The features.</value>
public ChannelFeatures Features { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
namespace MediaBrowser.Model.Channels
{
public enum ChannelItemSortField
{
Name = 0,
CommunityRating = 1,
PremiereDate = 2,
DateCreated = 3,
Runtime = 4,
PlayCount = 5,
CommunityPlayCount = 6
}
}

View File

@@ -0,0 +1,23 @@
namespace MediaBrowser.Model.Channels
{
public enum ChannelMediaContentType
{
Clip = 0,
Podcast = 1,
Trailer = 2,
Movie = 3,
Episode = 4,
Song = 5,
MovieExtra = 6,
TvExtra = 7,
GameExtra = 8
}
}

View File

@@ -0,0 +1,11 @@
namespace MediaBrowser.Model.Channels
{
public enum ChannelMediaType
{
Audio = 0,
Video = 1,
Photo = 2
}
}

View File

@@ -0,0 +1,52 @@
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Model.Channels
{
public class ChannelQuery
{
/// <summary>
/// Fields to return within the items, in addition to basic information
/// </summary>
/// <value>The fields.</value>
public ItemFields[] Fields { get; set; }
public bool? EnableImages { get; set; }
public int? ImageTypeLimit { get; set; }
public ImageType[] EnableImageTypes { get; set; }
/// <summary>
/// Gets or sets the user identifier.
/// </summary>
/// <value>The user identifier.</value>
public Guid UserId { get; set; }
/// <summary>
/// Skips over a given number of items within the results. Use for paging.
/// </summary>
/// <value>The start index.</value>
public int? StartIndex { get; set; }
/// <summary>
/// The maximum number of items to return
/// </summary>
/// <value>The limit.</value>
public int? Limit { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [supports latest items].
/// </summary>
/// <value><c>true</c> if [supports latest items]; otherwise, <c>false</c>.</value>
public bool? SupportsLatestItems { get; set; }
public bool? SupportsMediaDeletion { 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 bool? IsRecordingsFolder { get; set; }
public bool RefreshLatestChannelItems { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
using System;
namespace MediaBrowser.Model.Collections
{
public class CollectionCreationResult
{
public Guid Id { get; set; }
}
}

View File

@@ -0,0 +1,22 @@

namespace MediaBrowser.Model.Configuration
{
public class AccessSchedule
{
/// <summary>
/// Gets or sets the day of week.
/// </summary>
/// <value>The day of week.</value>
public DynamicDayOfWeek DayOfWeek { get; set; }
/// <summary>
/// Gets or sets the start hour.
/// </summary>
/// <value>The start hour.</value>
public double StartHour { get; set; }
/// <summary>
/// Gets or sets the end hour.
/// </summary>
/// <value>The end hour.</value>
public double EndHour { get; set; }
}
}

View File

@@ -0,0 +1,57 @@
using MediaBrowser.Model.Updates;
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// Serves as a common base class for the Server and UI application Configurations
/// ProtoInclude tells Protobuf about subclasses,
/// The number 50 can be any number, so long as it doesn't clash with any of the ProtoMember numbers either here or in subclasses.
/// </summary>
public class BaseApplicationConfiguration
{
/// <summary>
/// Gets or sets a value indicating whether [enable debug level logging].
/// </summary>
/// <value><c>true</c> if [enable debug level logging]; otherwise, <c>false</c>.</value>
public bool EnableDebugLevelLogging { get; set; }
/// <summary>
/// Enable automatically and silently updating of the application
/// </summary>
/// <value><c>true</c> if [enable auto update]; otherwise, <c>false</c>.</value>
public bool EnableAutoUpdate { get; set; }
/// <summary>
/// The number of days we should retain log files
/// </summary>
/// <value>The log file retention days.</value>
public int LogFileRetentionDays { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [run at startup].
/// </summary>
/// <value><c>true</c> if [run at startup]; otherwise, <c>false</c>.</value>
public bool RunAtStartup { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is first run.
/// </summary>
/// <value><c>true</c> if this instance is first run; otherwise, <c>false</c>.</value>
public bool IsStartupWizardCompleted { get; set; }
/// <summary>
/// Gets or sets the cache path.
/// </summary>
/// <value>The cache path.</value>
public string CachePath { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="BaseApplicationConfiguration" /> class.
/// </summary>
public BaseApplicationConfiguration()
{
EnableAutoUpdate = true;
LogFileRetentionDays = 3;
}
}
}

View File

@@ -0,0 +1,17 @@

namespace MediaBrowser.Model.Configuration
{
public enum DynamicDayOfWeek
{
Sunday = 0,
Monday = 1,
Tuesday = 2,
Wednesday = 3,
Thursday = 4,
Friday = 5,
Saturday = 6,
Everyday = 7,
Weekday = 8,
Weekend = 9
}
}

View File

@@ -0,0 +1,36 @@

namespace MediaBrowser.Model.Configuration
{
public class EncodingOptions
{
public int EncodingThreadCount { get; set; }
public string TranscodingTempPath { get; set; }
public double DownMixAudioBoost { get; set; }
public bool EnableThrottling { get; set; }
public int ThrottleDelaySeconds { get; set; }
public string HardwareAccelerationType { get; set; }
public string EncoderAppPath { get; set; }
public string VaapiDevice { get; set; }
public int H264Crf { get; set; }
public string H264Preset { get; set; }
public string DeinterlaceMethod { get; set; }
public bool EnableHardwareEncoding { get; set; }
public bool EnableSubtitleExtraction { get; set; }
public string[] HardwareDecodingCodecs { get; set; }
public EncodingOptions()
{
DownMixAudioBoost = 2;
EnableThrottling = true;
ThrottleDelaySeconds = 180;
EncodingThreadCount = -1;
// This is a DRM device that is almost guaranteed to be there on every intel platform, plus it's the default one in ffmpeg if you don't specify anything
VaapiDevice = "/dev/dri/renderD128";
H264Crf = 23;
EnableHardwareEncoding = true;
EnableSubtitleExtraction = true;
HardwareDecodingCodecs = new string[] { "h264", "vc1" };
}
}
}

View File

@@ -0,0 +1,12 @@

namespace MediaBrowser.Model.Configuration
{
public class FanartOptions
{
/// <summary>
/// Gets or sets the user API key.
/// </summary>
/// <value>The user API key.</value>
public string UserApiKey { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Configuration
{
public class ImageOption
{
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public ImageType Type { get; set; }
/// <summary>
/// Gets or sets the limit.
/// </summary>
/// <value>The limit.</value>
public int Limit { get; set; }
/// <summary>
/// Gets or sets the minimum width.
/// </summary>
/// <value>The minimum width.</value>
public int MinWidth { get; set; }
public ImageOption()
{
Limit = 1;
}
}
}

View File

@@ -0,0 +1,8 @@
namespace MediaBrowser.Model.Configuration
{
public enum ImageSavingConvention
{
Legacy,
Compatible
}
}

View File

@@ -0,0 +1,444 @@
using System;
using MediaBrowser.Model.Entities;
using System.Collections.Generic;
namespace MediaBrowser.Model.Configuration
{
public class LibraryOptions
{
public bool EnableArchiveMediaFiles { get; set; }
public bool EnablePhotos { get; set; }
public bool EnableRealtimeMonitor { get; set; }
public bool EnableChapterImageExtraction { get; set; }
public bool ExtractChapterImagesDuringLibraryScan { get; set; }
public bool DownloadImagesInAdvance { get; set; }
public MediaPathInfo[] PathInfos { get; set; }
public bool SaveLocalMetadata { get; set; }
public bool EnableInternetProviders { get; set; }
public bool ImportMissingEpisodes { get; set; }
public bool EnableAutomaticSeriesGrouping { get; set; }
public bool EnableEmbeddedTitles { get; set; }
public int AutomaticRefreshIntervalDays { get; set; }
/// <summary>
/// Gets or sets the preferred metadata language.
/// </summary>
/// <value>The preferred metadata language.</value>
public string PreferredMetadataLanguage { get; set; }
/// <summary>
/// Gets or sets the metadata country code.
/// </summary>
/// <value>The metadata country code.</value>
public string MetadataCountryCode { get; set; }
public string SeasonZeroDisplayName { get; set; }
public string[] MetadataSavers { get; set; }
public string[] DisabledLocalMetadataReaders { get; set; }
public string[] LocalMetadataReaderOrder { get; set; }
public string[] DisabledSubtitleFetchers { get; set; }
public string[] SubtitleFetcherOrder { get; set; }
public bool SkipSubtitlesIfEmbeddedSubtitlesPresent { get; set; }
public bool SkipSubtitlesIfAudioTrackMatches { get; set; }
public string[] SubtitleDownloadLanguages { get; set; }
public bool RequirePerfectSubtitleMatch { get; set; }
public bool SaveSubtitlesWithMedia { get; set; }
public TypeOptions[] TypeOptions { get; set; }
public TypeOptions GetTypeOptions(string type)
{
foreach (var options in TypeOptions)
{
if (string.Equals(options.Type, type, StringComparison.OrdinalIgnoreCase))
{
return options;
}
}
return null;
}
public LibraryOptions()
{
TypeOptions = new TypeOptions[] { };
DisabledSubtitleFetchers = new string[] { };
SubtitleFetcherOrder = new string[] { };
DisabledLocalMetadataReaders = new string[] { };
SkipSubtitlesIfAudioTrackMatches = true;
RequirePerfectSubtitleMatch = true;
EnablePhotos = true;
SaveSubtitlesWithMedia = true;
EnableRealtimeMonitor = true;
PathInfos = new MediaPathInfo[] { };
EnableInternetProviders = true;
EnableAutomaticSeriesGrouping = true;
SeasonZeroDisplayName = "Specials";
}
}
public class MediaPathInfo
{
public string Path { get; set; }
public string NetworkPath { get; set; }
}
public class TypeOptions
{
public string Type { get; set; }
public string[] MetadataFetchers { get; set; }
public string[] MetadataFetcherOrder { get; set; }
public string[] ImageFetchers { get; set; }
public string[] ImageFetcherOrder { get; set; }
public ImageOption[] ImageOptions { get; set; }
public ImageOption GetImageOptions(ImageType type)
{
foreach (ImageOption i in ImageOptions)
{
if (i.Type == type)
{
return i;
}
}
ImageOption[] options;
if (DefaultImageOptions.TryGetValue(Type, out options))
{
foreach (ImageOption i in options)
{
if (i.Type == type)
{
return i;
}
}
}
return DefaultInstance;
}
public int GetLimit(ImageType type)
{
return GetImageOptions(type).Limit;
}
public int GetMinWidth(ImageType type)
{
return GetImageOptions(type).MinWidth;
}
public bool IsEnabled(ImageType type)
{
return GetLimit(type) > 0;
}
public TypeOptions()
{
MetadataFetchers = new string[] { };
MetadataFetcherOrder = new string[] { };
ImageFetchers = new string[] { };
ImageFetcherOrder = new string[] { };
ImageOptions = new ImageOption[] { };
}
public static Dictionary<string, ImageOption[]> DefaultImageOptions = new Dictionary<string, ImageOption[]>
{
{
"Movie", new []
{
new ImageOption
{
Limit = 1,
MinWidth = 1280,
Type = ImageType.Backdrop
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Art
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Disc
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary
},
new ImageOption
{
Limit = 0,
Type = ImageType.Banner
},
new ImageOption
{
Limit = 1,
Type = ImageType.Thumb
},
new ImageOption
{
Limit = 1,
Type = ImageType.Logo
}
}
},
{
"MusicVideo", new []
{
new ImageOption
{
Limit = 1,
MinWidth = 1280,
Type = ImageType.Backdrop
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Art
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Disc
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary
},
new ImageOption
{
Limit = 0,
Type = ImageType.Banner
},
new ImageOption
{
Limit = 1,
Type = ImageType.Thumb
},
new ImageOption
{
Limit = 1,
Type = ImageType.Logo
}
}
},
{
"Series", new []
{
new ImageOption
{
Limit = 1,
MinWidth = 1280,
Type = ImageType.Backdrop
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Art
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary
},
new ImageOption
{
Limit = 1,
Type = ImageType.Banner
},
new ImageOption
{
Limit = 1,
Type = ImageType.Thumb
},
new ImageOption
{
Limit = 1,
Type = ImageType.Logo
}
}
},
{
"MusicAlbum", new []
{
new ImageOption
{
Limit = 0,
MinWidth = 1280,
Type = ImageType.Backdrop
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Disc
}
}
},
{
"MusicArtist", new []
{
new ImageOption
{
Limit = 1,
MinWidth = 1280,
Type = ImageType.Backdrop
},
// Don't download this by default
// They do look great, but most artists won't have them, which means a banner view isn't really possible
new ImageOption
{
Limit = 0,
Type = ImageType.Banner
},
// Don't download this by default
// Generally not used
new ImageOption
{
Limit = 0,
Type = ImageType.Art
},
new ImageOption
{
Limit = 1,
Type = ImageType.Logo
}
}
},
{
"BoxSet", new []
{
new ImageOption
{
Limit = 1,
MinWidth = 1280,
Type = ImageType.Backdrop
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary
},
new ImageOption
{
Limit = 1,
Type = ImageType.Thumb
},
new ImageOption
{
Limit = 1,
Type = ImageType.Logo
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Art
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Disc
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Banner
}
}
},
{
"Season", new []
{
new ImageOption
{
Limit = 0,
MinWidth = 1280,
Type = ImageType.Backdrop
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary
},
new ImageOption
{
Limit = 0,
Type = ImageType.Banner
},
new ImageOption
{
Limit = 0,
Type = ImageType.Thumb
}
}
},
{
"Episode", new []
{
new ImageOption
{
Limit = 0,
MinWidth = 1280,
Type = ImageType.Backdrop
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary
}
}
}
};
public static ImageOption DefaultInstance = new ImageOption();
}
}

View File

@@ -0,0 +1,13 @@

namespace MediaBrowser.Model.Configuration
{
public class MetadataConfiguration
{
public bool UseFileCreationTimeForDateAdded { get; set; }
public MetadataConfiguration()
{
UseFileCreationTimeForDateAdded = true;
}
}
}

View File

@@ -0,0 +1,38 @@
using MediaBrowser.Model.Extensions;
using System;
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// Class MetadataOptions.
/// </summary>
public class MetadataOptions
{
public string ItemType { get; set; }
public string[] DisabledMetadataSavers { get; set; }
public string[] LocalMetadataReaderOrder { get; set; }
public string[] DisabledMetadataFetchers { get; set; }
public string[] MetadataFetcherOrder { get; set; }
public string[] DisabledImageFetchers { get; set; }
public string[] ImageFetcherOrder { get; set; }
public MetadataOptions()
{
DisabledMetadataSavers = new string[] { };
LocalMetadataReaderOrder = new string[] { };
DisabledMetadataFetchers = new string[] { };
MetadataFetcherOrder = new string[] { };
DisabledImageFetchers = new string[] { };
ImageFetcherOrder = new string[] { };
}
public bool IsMetadataSaverEnabled(string name)
{
return !ListHelper.ContainsIgnoreCase(DisabledMetadataSavers, name);
}
}
}

View File

@@ -0,0 +1,17 @@
namespace MediaBrowser.Model.Configuration
{
public class MetadataPlugin
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public MetadataPluginType Type { get; set; }
}
}

View File

@@ -0,0 +1,32 @@
using System.Collections.Generic;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Configuration
{
public class MetadataPluginSummary
{
/// <summary>
/// Gets or sets the type of the item.
/// </summary>
/// <value>The type of the item.</value>
public string ItemType { get; set; }
/// <summary>
/// Gets or sets the plugins.
/// </summary>
/// <value>The plugins.</value>
public MetadataPlugin[] Plugins { get; set; }
/// <summary>
/// Gets or sets the supported image types.
/// </summary>
/// <value>The supported image types.</value>
public ImageType[] SupportedImageTypes { get; set; }
public MetadataPluginSummary()
{
SupportedImageTypes = new ImageType[] { };
Plugins = new MetadataPlugin[] { };
}
}
}

View File

@@ -0,0 +1,16 @@
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// Enum MetadataPluginType
/// </summary>
public enum MetadataPluginType
{
LocalImageProvider,
ImageFetcher,
ImageSaver,
LocalMetadataProvider,
MetadataFetcher,
MetadataSaver,
SubtitleFetcher
}
}

View File

@@ -0,0 +1,313 @@
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using System;
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// Represents the server configuration.
/// </summary>
public class ServerConfiguration : BaseApplicationConfiguration
{
public const int DefaultHttpPort = 8096;
public const int DefaultHttpsPort = 8920;
/// <summary>
/// Gets or sets a value indicating whether [enable u pn p].
/// </summary>
/// <value><c>true</c> if [enable u pn p]; otherwise, <c>false</c>.</value>
public bool EnableUPnP { get; set; }
/// <summary>
/// Gets or sets the public mapped port.
/// </summary>
/// <value>The public mapped port.</value>
public int PublicPort { get; set; }
/// <summary>
/// Gets or sets the public HTTPS port.
/// </summary>
/// <value>The public HTTPS port.</value>
public int PublicHttpsPort { get; set; }
/// <summary>
/// Gets or sets the HTTP server port number.
/// </summary>
/// <value>The HTTP server port number.</value>
public int HttpServerPortNumber { get; set; }
/// <summary>
/// Gets or sets the HTTPS server port number.
/// </summary>
/// <value>The HTTPS server port number.</value>
public int HttpsPortNumber { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [use HTTPS].
/// </summary>
/// <value><c>true</c> if [use HTTPS]; otherwise, <c>false</c>.</value>
public bool EnableHttps { get; set; }
public bool EnableNormalizedItemByNameIds { get; set; }
/// <summary>
/// Gets or sets the value pointing to the file system where the ssl certiifcate is located..
/// </summary>
/// <value>The value pointing to the file system where the ssl certiifcate is located..</value>
public string CertificatePath { get; set; }
public string CertificatePassword { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is port authorized.
/// </summary>
/// <value><c>true</c> if this instance is port authorized; otherwise, <c>false</c>.</value>
public bool IsPortAuthorized { get; set; }
public bool AutoRunWebApp { get; set; }
public bool EnableRemoteAccess { get; set; }
public bool CameraUploadUpgraded { get; set; }
public bool CollectionsUpgraded { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [enable case sensitive item ids].
/// </summary>
/// <value><c>true</c> if [enable case sensitive item ids]; otherwise, <c>false</c>.</value>
public bool EnableCaseSensitiveItemIds { get; set; }
public bool DisableLiveTvChannelUserDataName { get; set; }
/// <summary>
/// Gets or sets the metadata path.
/// </summary>
/// <value>The metadata path.</value>
public string MetadataPath { get; set; }
public string MetadataNetworkPath { get; set; }
/// <summary>
/// Gets or sets the preferred metadata language.
/// </summary>
/// <value>The preferred metadata language.</value>
public string PreferredMetadataLanguage { get; set; }
/// <summary>
/// Gets or sets the metadata country code.
/// </summary>
/// <value>The metadata country code.</value>
public string MetadataCountryCode { get; set; }
/// <summary>
/// Characters to be replaced with a ' ' in strings to create a sort name
/// </summary>
/// <value>The sort replace characters.</value>
public string[] SortReplaceCharacters { get; set; }
/// <summary>
/// Characters to be removed from strings to create a sort name
/// </summary>
/// <value>The sort remove characters.</value>
public string[] SortRemoveCharacters { get; set; }
/// <summary>
/// Words to be removed from strings to create a sort name
/// </summary>
/// <value>The sort remove words.</value>
public string[] SortRemoveWords { get; set; }
/// <summary>
/// Gets or sets the minimum percentage of an item that must be played in order for playstate to be updated.
/// </summary>
/// <value>The min resume PCT.</value>
public int MinResumePct { get; set; }
/// <summary>
/// Gets or sets the maximum percentage of an item that can be played while still saving playstate. If this percentage is crossed playstate will be reset to the beginning and the item will be marked watched.
/// </summary>
/// <value>The max resume PCT.</value>
public int MaxResumePct { get; set; }
/// <summary>
/// Gets or sets the minimum duration that an item must have in order to be eligible for playstate updates..
/// </summary>
/// <value>The min resume duration seconds.</value>
public int MinResumeDurationSeconds { get; set; }
/// <summary>
/// The delay in seconds that we will wait after a file system change to try and discover what has been added/removed
/// Some delay is necessary with some items because their creation is not atomic. It involves the creation of several
/// different directories and files.
/// </summary>
/// <value>The file watcher delay.</value>
public int LibraryMonitorDelay { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [enable dashboard response caching].
/// Allows potential contributors without visual studio to modify production dashboard code and test changes.
/// </summary>
/// <value><c>true</c> if [enable dashboard response caching]; otherwise, <c>false</c>.</value>
public bool EnableDashboardResponseCaching { get; set; }
/// <summary>
/// Allows the dashboard to be served from a custom path.
/// </summary>
/// <value>The dashboard source path.</value>
public string DashboardSourcePath { get; set; }
/// <summary>
/// Gets or sets the image saving convention.
/// </summary>
/// <value>The image saving convention.</value>
public ImageSavingConvention ImageSavingConvention { get; set; }
public MetadataOptions[] MetadataOptions { get; set; }
public bool EnableAutomaticRestart { get; set; }
public bool SkipDeserializationForBasicTypes { get; set; }
public string ServerName { get; set; }
public string WanDdns { get; set; }
public string UICulture { get; set; }
public bool SaveMetadataHidden { get; set; }
public NameValuePair[] ContentTypes { get; set; }
public int RemoteClientBitrateLimit { get; set; }
public int SchemaVersion { get; set; }
public bool EnableAnonymousUsageReporting { get; set; }
public bool EnableFolderView { get; set; }
public bool EnableGroupingIntoCollections { get; set; }
public bool DisplaySpecialsWithinSeasons { get; set; }
public string[] LocalNetworkSubnets { get; set; }
public string[] LocalNetworkAddresses { get; set; }
public string[] CodecsUsed { get; set; }
public bool EnableExternalContentInSuggestions { get; set; }
public bool RequireHttps { get; set; }
public bool IsBehindProxy { get; set; }
public bool EnableNewOmdbSupport { get; set; }
public string[] RemoteIPFilter { get; set; }
public bool IsRemoteIPFilterBlacklist { get; set; }
public int ImageExtractionTimeoutMs { get; set; }
public PathSubstitution[] PathSubstitutions { get; set; }
public bool EnableSimpleArtistDetection { get; set; }
public string[] UninstalledPlugins { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
/// </summary>
public ServerConfiguration()
{
UninstalledPlugins = new string[] { };
RemoteIPFilter = new string[] { };
LocalNetworkSubnets = new string[] { };
LocalNetworkAddresses = new string[] { };
CodecsUsed = new string[] { };
ImageExtractionTimeoutMs = 0;
PathSubstitutions = new PathSubstitution[] { };
EnableSimpleArtistDetection = true;
DisplaySpecialsWithinSeasons = true;
EnableExternalContentInSuggestions = true;
ImageSavingConvention = ImageSavingConvention.Compatible;
PublicPort = DefaultHttpPort;
PublicHttpsPort = DefaultHttpsPort;
HttpServerPortNumber = DefaultHttpPort;
HttpsPortNumber = DefaultHttpsPort;
EnableHttps = true;
EnableDashboardResponseCaching = true;
EnableAnonymousUsageReporting = true;
EnableCaseSensitiveItemIds = true;
EnableAutomaticRestart = true;
AutoRunWebApp = true;
EnableRemoteAccess = true;
EnableUPnP = true;
MinResumePct = 5;
MaxResumePct = 90;
// 5 minutes
MinResumeDurationSeconds = 300;
LibraryMonitorDelay = 60;
ContentTypes = new NameValuePair[] { };
PreferredMetadataLanguage = "en";
MetadataCountryCode = "US";
SortReplaceCharacters = new[] { ".", "+", "%" };
SortRemoveCharacters = new[] { ",", "&", "-", "{", "}", "'" };
SortRemoveWords = new[] { "the", "a", "an" };
UICulture = "en-us";
MetadataOptions = new[]
{
new MetadataOptions {ItemType = "Book"},
new MetadataOptions
{
ItemType = "Movie"
},
new MetadataOptions
{
ItemType = "MusicVideo",
DisabledMetadataFetchers = new []{ "The Open Movie Database" },
DisabledImageFetchers = new []{ "The Open Movie Database", "FanArt" }
},
new MetadataOptions
{
ItemType = "Series",
DisabledMetadataFetchers = new []{ "TheMovieDb" },
DisabledImageFetchers = new []{ "TheMovieDb" }
},
new MetadataOptions
{
ItemType = "MusicAlbum",
DisabledMetadataFetchers = new []{ "TheAudioDB" }
},
new MetadataOptions
{
ItemType = "MusicArtist",
DisabledMetadataFetchers = new []{ "TheAudioDB" }
},
new MetadataOptions
{
ItemType = "BoxSet"
},
new MetadataOptions
{
ItemType = "Season",
DisabledMetadataFetchers = new []{ "TheMovieDb" },
DisabledImageFetchers = new [] { "FanArt" }
},
new MetadataOptions
{
ItemType = "Episode",
DisabledMetadataFetchers = new []{ "The Open Movie Database", "TheMovieDb" },
DisabledImageFetchers = new []{ "The Open Movie Database", "TheMovieDb" }
}
};
}
}
public class PathSubstitution
{
public string From { get; set; }
public string To { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace MediaBrowser.Model.Configuration
{
public enum SubtitlePlaybackMode
{
Default = 0,
Always = 1,
OnlyForced = 2,
None = 3,
Smart = 4
}
}

View File

@@ -0,0 +1,16 @@
namespace MediaBrowser.Model.Configuration
{
public enum UnratedItem
{
Movie,
Trailer,
Series,
Music,
Game,
Book,
LiveTvChannel,
LiveTvProgram,
ChannelContent,
Other
}
}

View File

@@ -0,0 +1,66 @@
using System;
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// Class UserConfiguration
/// </summary>
public class UserConfiguration
{
/// <summary>
/// Gets or sets the audio language preference.
/// </summary>
/// <value>The audio language preference.</value>
public string AudioLanguagePreference { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [play default audio track].
/// </summary>
/// <value><c>true</c> if [play default audio track]; otherwise, <c>false</c>.</value>
public bool PlayDefaultAudioTrack { get; set; }
/// <summary>
/// Gets or sets the subtitle language preference.
/// </summary>
/// <value>The subtitle language preference.</value>
public string SubtitleLanguagePreference { get; set; }
public bool DisplayMissingEpisodes { get; set; }
public string[] GroupedFolders { get; set; }
public SubtitlePlaybackMode SubtitleMode { get; set; }
public bool DisplayCollectionsView { get; set; }
public bool EnableLocalPassword { get; set; }
public string[] OrderedViews { get; set; }
public string[] LatestItemsExcludes { get; set; }
public string[] MyMediaExcludes { get; set; }
public bool HidePlayedInLatest { get; set; }
public bool RememberAudioSelections { get; set; }
public bool RememberSubtitleSelections { get; set; }
public bool EnableNextEpisodeAutoPlay { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="UserConfiguration" /> class.
/// </summary>
public UserConfiguration()
{
EnableNextEpisodeAutoPlay = true;
RememberAudioSelections = true;
RememberSubtitleSelections = true;
HidePlayedInLatest = true;
PlayDefaultAudioTrack = true;
LatestItemsExcludes = new string[] {};
OrderedViews = new string[] {};
MyMediaExcludes = new string[] {};
GroupedFolders = new string[] {};
}
}
}

View File

@@ -0,0 +1,23 @@

namespace MediaBrowser.Model.Configuration
{
public class XbmcMetadataOptions
{
public string UserId { get; set; }
public string ReleaseDateFormat { get; set; }
public bool SaveImagePathsInNfo { get; set; }
public bool EnablePathSubstitution { get; set; }
public bool EnableExtraThumbsDuplication { get; set; }
public XbmcMetadataOptions()
{
ReleaseDateFormat = "yyyy-MM-dd";
SaveImagePathsInNfo = true;
EnablePathSubstitution = true;
}
}
}

View File

@@ -0,0 +1,17 @@

namespace MediaBrowser.Model.Connect
{
public class ConnectAuthenticationExchangeResult
{
/// <summary>
/// Gets or sets the local user identifier.
/// </summary>
/// <value>The local user identifier.</value>
public string LocalUserId { get; set; }
/// <summary>
/// Gets or sets the access token.
/// </summary>
/// <value>The access token.</value>
public string AccessToken { get; set; }
}
}

View File

@@ -0,0 +1,17 @@

namespace MediaBrowser.Model.Connect
{
public class ConnectAuthenticationResult
{
/// <summary>
/// Gets or sets the user.
/// </summary>
/// <value>The user.</value>
public ConnectUser User { get; set; }
/// <summary>
/// Gets or sets the access token.
/// </summary>
/// <value>The access token.</value>
public string AccessToken { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using System;
namespace MediaBrowser.Model.Connect
{
public class ConnectAuthorization
{
public string ConnectUserId { get; set; }
public string UserName { get; set; }
public string ImageUrl { get; set; }
public string Id { get; set; }
public string[] EnabledLibraries { get; set; }
public bool EnableLiveTv { get; set; }
public string[] EnabledChannels { get; set; }
public ConnectAuthorization()
{
EnabledLibraries = new string[] {};
EnabledChannels = new string[] {};
}
}
}

View File

@@ -0,0 +1,19 @@
using System;
namespace MediaBrowser.Model.Connect
{
public class ConnectAuthorizationRequest
{
public string SendingUserId { get; set; }
public string ConnectUserName { get; set; }
public string[] EnabledLibraries { get; set; }
public bool EnableLiveTv { get; set; }
public string[] EnabledChannels { get; set; }
public ConnectAuthorizationRequest()
{
EnabledLibraries = new string[] {};
EnabledChannels = new string[] {};
}
}
}

View File

@@ -0,0 +1,12 @@

namespace MediaBrowser.Model.Connect
{
public class ConnectUser
{
public string Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public bool IsActive { get; set; }
public string ImageUrl { get; set; }
}
}

View File

@@ -0,0 +1,11 @@

namespace MediaBrowser.Model.Connect
{
public class ConnectUserQuery
{
public string Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string NameOrEmail { get; set; }
}
}

View File

@@ -0,0 +1,15 @@

namespace MediaBrowser.Model.Connect
{
public enum UserLinkType
{
/// <summary>
/// The linked user
/// </summary>
LinkedUser = 0,
/// <summary>
/// The guest
/// </summary>
Guest = 1
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.IO;
namespace MediaBrowser.Model.Cryptography
{
public interface ICryptoProvider
{
Guid GetMD5(string str);
byte[] ComputeMD5(Stream str);
byte[] ComputeMD5(byte[] bytes);
byte[] ComputeSHA1(byte[] bytes);
}
}

View File

@@ -0,0 +1,15 @@
using System.Collections.Generic;
namespace MediaBrowser.Model.Devices
{
public class ContentUploadHistory
{
public string DeviceId { get; set; }
public LocalFileInfo[] FilesUploaded { get; set; }
public ContentUploadHistory()
{
FilesUploaded = new LocalFileInfo[] { };
}
}
}

View File

@@ -0,0 +1,69 @@
using MediaBrowser.Model.Session;
using System;
namespace MediaBrowser.Model.Devices
{
public class DeviceInfo
{
/// <summary>
/// Gets or sets the name of the reported.
/// </summary>
/// <value>The name of the reported.</value>
public string ReportedName { get; set; }
/// <summary>
/// Gets or sets the name of the custom.
/// </summary>
/// <value>The name of the custom.</value>
public string CustomName { get; set; }
/// <summary>
/// Gets or sets the camera upload path.
/// </summary>
/// <value>The camera upload path.</value>
public string CameraUploadPath { get; set; }
public string Name { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public string Id { get; set; }
/// <summary>
/// Gets or sets the last name of the user.
/// </summary>
/// <value>The last name of the user.</value>
public string LastUserName { get; set; }
/// <summary>
/// Gets or sets the name of the application.
/// </summary>
/// <value>The name of the application.</value>
public string AppName { get; set; }
/// <summary>
/// Gets or sets the application version.
/// </summary>
/// <value>The application version.</value>
public string AppVersion { get; set; }
/// <summary>
/// Gets or sets the last user identifier.
/// </summary>
/// <value>The last user identifier.</value>
public Guid LastUserId { get; set; }
/// <summary>
/// Gets or sets the date last modified.
/// </summary>
/// <value>The date last modified.</value>
public DateTime DateLastActivity { get; set; }
/// <summary>
/// Gets or sets the capabilities.
/// </summary>
/// <value>The capabilities.</value>
public ClientCapabilities Capabilities { get; set; }
public DeviceInfo()
{
Capabilities = new ClientCapabilities();
}
public string IconUrl { get; set; }
}
}

View File

@@ -0,0 +1,22 @@

namespace MediaBrowser.Model.Devices
{
public class DeviceQuery
{
/// <summary>
/// Gets or sets a value indicating whether [supports unique identifier].
/// </summary>
/// <value><c>null</c> if [supports unique identifier] contains no value, <c>true</c> if [supports unique identifier]; otherwise, <c>false</c>.</value>
public bool? SupportsPersistentIdentifier { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [supports synchronize].
/// </summary>
/// <value><c>null</c> if [supports synchronize] contains no value, <c>true</c> if [supports synchronize]; otherwise, <c>false</c>.</value>
public bool? SupportsSync { get; set; }
/// <summary>
/// Gets or sets the user identifier.
/// </summary>
/// <value>The user identifier.</value>
public string UserId { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
using System;
namespace MediaBrowser.Model.Devices
{
public class DevicesOptions
{
public string[] EnabledCameraUploadDevices { get; set; }
public string CameraUploadPath { get; set; }
public bool EnableCameraUploadSubfolders { get; set; }
public DevicesOptions()
{
EnabledCameraUploadDevices = new string[] {};
}
}
public class DeviceOptions
{
public string[] EnabledCameraUploadDevices { get; set; }
public string CameraUploadPath { get; set; }
public bool EnableCameraUploadSubfolders { get; set; }
public string CustomName { get; set; }
}
}

View File

@@ -0,0 +1,11 @@

namespace MediaBrowser.Model.Devices
{
public class LocalFileInfo
{
public string Name { get; set; }
public string Id { get; set; }
public string Album { get; set; }
public string MimeType { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.IO;
using System.Threading.Tasks;
namespace MediaBrowser.Model.Diagnostics
{
public interface IProcess : IDisposable
{
event EventHandler Exited;
void Kill();
bool WaitForExit(int timeMs);
Task<bool> WaitForExitAsync(int timeMs);
int ExitCode { get; }
void Start();
StreamWriter StandardInput { get; }
StreamReader StandardError { get; }
StreamReader StandardOutput { get; }
ProcessOptions StartInfo { get; }
}
}

View File

@@ -0,0 +1,24 @@
using System;
namespace MediaBrowser.Model.Diagnostics
{
public interface IProcessFactory
{
IProcess Create(ProcessOptions options);
}
public class ProcessOptions
{
public String FileName { get; set; }
public String Arguments { get; set; }
public String WorkingDirectory { get; set; }
public bool CreateNoWindow { get; set; }
public bool UseShellExecute { get; set; }
public bool EnableRaisingEvents { get; set; }
public bool ErrorDialog { get; set; }
public bool RedirectStandardError { get; set; }
public bool RedirectStandardInput { get; set; }
public bool RedirectStandardOutput { get; set; }
public bool IsHidden { get; set; }
}
}

View File

@@ -0,0 +1,87 @@
using MediaBrowser.Model.Dto;
using System.Collections.Generic;
using System;
namespace MediaBrowser.Model.Dlna
{
/// <summary>
/// Class AudioOptions.
/// </summary>
public class AudioOptions
{
public AudioOptions()
{
Context = EncodingContext.Streaming;
EnableDirectPlay = true;
EnableDirectStream = true;
}
public bool EnableDirectPlay { get; set; }
public bool EnableDirectStream { get; set; }
public bool ForceDirectPlay { get; set; }
public bool ForceDirectStream { get; set; }
public Guid ItemId { get; set; }
public MediaSourceInfo[] MediaSources { get; set; }
public DeviceProfile Profile { get; set; }
/// <summary>
/// Optional. Only needed if a specific AudioStreamIndex or SubtitleStreamIndex are requested.
/// </summary>
public string MediaSourceId { get; set; }
public string DeviceId { get; set; }
/// <summary>
/// Allows an override of supported number of audio channels
/// Example: DeviceProfile supports five channel, but user only has stereo speakers
/// </summary>
public int? MaxAudioChannels { get; set; }
/// <summary>
/// The application's configured quality setting
/// </summary>
public long? MaxBitrate { get; set; }
/// <summary>
/// Gets or sets the context.
/// </summary>
/// <value>The context.</value>
public EncodingContext Context { get; set; }
/// <summary>
/// Gets or sets the audio transcoding bitrate.
/// </summary>
/// <value>The audio transcoding bitrate.</value>
public int? AudioTranscodingBitrate { get; set; }
/// <summary>
/// Gets the maximum bitrate.
/// </summary>
/// <returns>System.Nullable&lt;System.Int32&gt;.</returns>
public long? GetMaxBitrate(bool isAudio)
{
if (MaxBitrate.HasValue)
{
return MaxBitrate;
}
if (Profile != null)
{
if (Context == EncodingContext.Static)
{
if (isAudio && Profile.MaxStaticMusicBitrate.HasValue)
{
return Profile.MaxStaticMusicBitrate;
}
return Profile.MaxStaticBitrate;
}
return Profile.MaxStreamingBitrate;
}
return null;
}
}
}

View File

@@ -0,0 +1,68 @@
using MediaBrowser.Model.Extensions;
using System.Collections.Generic;
using System.Xml.Serialization;
using MediaBrowser.Model.Dlna;
namespace MediaBrowser.Model.Dlna
{
public class CodecProfile
{
[XmlAttribute("type")]
public CodecType Type { get; set; }
public ProfileCondition[] Conditions { get; set; }
public ProfileCondition[] ApplyConditions { get; set; }
[XmlAttribute("codec")]
public string Codec { get; set; }
[XmlAttribute("container")]
public string Container { get; set; }
public CodecProfile()
{
Conditions = new ProfileCondition[] {};
ApplyConditions = new ProfileCondition[] { };
}
public string[] GetCodecs()
{
return ContainerProfile.SplitValue(Codec);
}
private bool ContainsContainer(string container)
{
return ContainerProfile.ContainsContainer(Container, container);
}
public bool ContainsAnyCodec(string codec, string container)
{
return ContainsAnyCodec(ContainerProfile.SplitValue(codec), container);
}
public bool ContainsAnyCodec(string[] codec, string container)
{
if (!ContainsContainer(container))
{
return false;
}
var codecs = GetCodecs();
if (codecs.Length == 0)
{
return true;
}
foreach (var val in codec)
{
if (ListHelper.ContainsIgnoreCase(codecs, val))
{
return true;
}
}
return false;
}
}
}

View File

@@ -0,0 +1,9 @@
namespace MediaBrowser.Model.Dlna
{
public enum CodecType
{
Video = 0,
VideoAudio = 1,
Audio = 2
}
}

View File

@@ -0,0 +1,284 @@
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.MediaInfo;
using System;
using System.Collections.Generic;
using System.Globalization;
namespace MediaBrowser.Model.Dlna
{
public class ConditionProcessor
{
public bool IsVideoConditionSatisfied(ProfileCondition condition,
int? width,
int? height,
int? videoBitDepth,
int? videoBitrate,
string videoProfile,
double? videoLevel,
float? videoFramerate,
int? packetLength,
TransportStreamTimestamp? timestamp,
bool? isAnamorphic,
bool? isInterlaced,
int? refFrames,
int? numVideoStreams,
int? numAudioStreams,
string videoCodecTag,
bool? isAvc )
{
switch (condition.Property)
{
case ProfileConditionValue.IsInterlaced:
return IsConditionSatisfied(condition, isInterlaced);
case ProfileConditionValue.IsAnamorphic:
return IsConditionSatisfied(condition, isAnamorphic);
case ProfileConditionValue.IsAvc:
return IsConditionSatisfied(condition, isAvc);
case ProfileConditionValue.VideoFramerate:
return IsConditionSatisfied(condition, videoFramerate);
case ProfileConditionValue.VideoLevel:
return IsConditionSatisfied(condition, videoLevel);
case ProfileConditionValue.VideoProfile:
return IsConditionSatisfied(condition, videoProfile);
case ProfileConditionValue.VideoCodecTag:
return IsConditionSatisfied(condition, videoCodecTag);
case ProfileConditionValue.PacketLength:
return IsConditionSatisfied(condition, packetLength);
case ProfileConditionValue.VideoBitDepth:
return IsConditionSatisfied(condition, videoBitDepth);
case ProfileConditionValue.VideoBitrate:
return IsConditionSatisfied(condition, videoBitrate);
case ProfileConditionValue.Height:
return IsConditionSatisfied(condition, height);
case ProfileConditionValue.Width:
return IsConditionSatisfied(condition, width);
case ProfileConditionValue.RefFrames:
return IsConditionSatisfied(condition, refFrames);
case ProfileConditionValue.NumAudioStreams:
return IsConditionSatisfied(condition, numAudioStreams);
case ProfileConditionValue.NumVideoStreams:
return IsConditionSatisfied(condition, numVideoStreams);
case ProfileConditionValue.VideoTimestamp:
return IsConditionSatisfied(condition, timestamp);
default:
return true;
}
}
public bool IsImageConditionSatisfied(ProfileCondition condition, int? width, int? height)
{
switch (condition.Property)
{
case ProfileConditionValue.Height:
return IsConditionSatisfied(condition, height);
case ProfileConditionValue.Width:
return IsConditionSatisfied(condition, width);
default:
throw new ArgumentException("Unexpected condition on image file: " + condition.Property);
}
}
public bool IsAudioConditionSatisfied(ProfileCondition condition, int? audioChannels, int? audioBitrate, int? audioSampleRate, int? audioBitDepth)
{
switch (condition.Property)
{
case ProfileConditionValue.AudioBitrate:
return IsConditionSatisfied(condition, audioBitrate);
case ProfileConditionValue.AudioChannels:
return IsConditionSatisfied(condition, audioChannels);
case ProfileConditionValue.AudioSampleRate:
return IsConditionSatisfied(condition, audioSampleRate);
case ProfileConditionValue.AudioBitDepth:
return IsConditionSatisfied(condition, audioBitDepth);
default:
throw new ArgumentException("Unexpected condition on audio file: " + condition.Property);
}
}
public bool IsVideoAudioConditionSatisfied(ProfileCondition condition,
int? audioChannels,
int? audioBitrate,
int? audioSampleRate,
int? audioBitDepth,
string audioProfile,
bool? isSecondaryTrack)
{
switch (condition.Property)
{
case ProfileConditionValue.AudioProfile:
return IsConditionSatisfied(condition, audioProfile);
case ProfileConditionValue.AudioBitrate:
return IsConditionSatisfied(condition, audioBitrate);
case ProfileConditionValue.AudioChannels:
return IsConditionSatisfied(condition, audioChannels);
case ProfileConditionValue.IsSecondaryAudio:
return IsConditionSatisfied(condition, isSecondaryTrack);
case ProfileConditionValue.AudioSampleRate:
return IsConditionSatisfied(condition, audioSampleRate);
case ProfileConditionValue.AudioBitDepth:
return IsConditionSatisfied(condition, audioBitDepth);
default:
throw new ArgumentException("Unexpected condition on audio file: " + condition.Property);
}
}
private bool IsConditionSatisfied(ProfileCondition condition, int? currentValue)
{
if (!currentValue.HasValue)
{
// If the value is unknown, it satisfies if not marked as required
return !condition.IsRequired;
}
int expected;
if (int.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out expected))
{
switch (condition.Condition)
{
case ProfileConditionType.Equals:
case ProfileConditionType.EqualsAny:
return currentValue.Value.Equals(expected);
case ProfileConditionType.GreaterThanEqual:
return currentValue.Value >= expected;
case ProfileConditionType.LessThanEqual:
return currentValue.Value <= expected;
case ProfileConditionType.NotEquals:
return !currentValue.Value.Equals(expected);
default:
throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
}
}
return false;
}
private bool IsConditionSatisfied(ProfileCondition condition, string currentValue)
{
if (string.IsNullOrEmpty(currentValue))
{
// If the value is unknown, it satisfies if not marked as required
return !condition.IsRequired;
}
string expected = condition.Value;
switch (condition.Condition)
{
case ProfileConditionType.EqualsAny:
{
return ListHelper.ContainsIgnoreCase(expected.Split('|'), currentValue);
}
case ProfileConditionType.Equals:
return StringHelper.EqualsIgnoreCase(currentValue, expected);
case ProfileConditionType.NotEquals:
return !StringHelper.EqualsIgnoreCase(currentValue, expected);
default:
throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
}
}
private bool IsConditionSatisfied(ProfileCondition condition, bool? currentValue)
{
if (!currentValue.HasValue)
{
// If the value is unknown, it satisfies if not marked as required
return !condition.IsRequired;
}
bool expected;
if (bool.TryParse(condition.Value, out expected))
{
switch (condition.Condition)
{
case ProfileConditionType.Equals:
return currentValue.Value == expected;
case ProfileConditionType.NotEquals:
return currentValue.Value != expected;
default:
throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
}
}
return false;
}
private bool IsConditionSatisfied(ProfileCondition condition, float currentValue)
{
if (currentValue <= 0)
{
// If the value is unknown, it satisfies if not marked as required
return !condition.IsRequired;
}
float expected;
if (float.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out expected))
{
switch (condition.Condition)
{
case ProfileConditionType.Equals:
return currentValue.Equals(expected);
case ProfileConditionType.GreaterThanEqual:
return currentValue >= expected;
case ProfileConditionType.LessThanEqual:
return currentValue <= expected;
case ProfileConditionType.NotEquals:
return !currentValue.Equals(expected);
default:
throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
}
}
return false;
}
private bool IsConditionSatisfied(ProfileCondition condition, double? currentValue)
{
if (!currentValue.HasValue)
{
// If the value is unknown, it satisfies if not marked as required
return !condition.IsRequired;
}
double expected;
if (double.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out expected))
{
switch (condition.Condition)
{
case ProfileConditionType.Equals:
return currentValue.Value.Equals(expected);
case ProfileConditionType.GreaterThanEqual:
return currentValue.Value >= expected;
case ProfileConditionType.LessThanEqual:
return currentValue.Value <= expected;
case ProfileConditionType.NotEquals:
return !currentValue.Value.Equals(expected);
default:
throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
}
}
return false;
}
private bool IsConditionSatisfied(ProfileCondition condition, TransportStreamTimestamp? timestamp)
{
if (!timestamp.HasValue)
{
// If the value is unknown, it satisfies if not marked as required
return !condition.IsRequired;
}
TransportStreamTimestamp expected = (TransportStreamTimestamp)Enum.Parse(typeof(TransportStreamTimestamp), condition.Value, true);
switch (condition.Condition)
{
case ProfileConditionType.Equals:
return timestamp == expected;
case ProfileConditionType.NotEquals:
return timestamp != expected;
default:
throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
}
}
}
}

View File

@@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Model.Dlna
{
public class ContainerProfile
{
[XmlAttribute("type")]
public DlnaProfileType Type { get; set; }
public ProfileCondition[] Conditions { get; set; }
[XmlAttribute("container")]
public string Container { get; set; }
public ContainerProfile()
{
Conditions = new ProfileCondition[] { };
}
public string[] GetContainers()
{
return SplitValue(Container);
}
private static readonly string[] EmptyStringArray = Array.Empty<string>();
public static string[] SplitValue(string value)
{
if (string.IsNullOrEmpty(value))
{
return EmptyStringArray;
}
return value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
}
public bool ContainsContainer(string container)
{
var containers = GetContainers();
return ContainsContainer(containers, container);
}
public static bool ContainsContainer(string profileContainers, string inputContainer)
{
var isNegativeList = false;
if (profileContainers != null && profileContainers.StartsWith("-"))
{
isNegativeList = true;
profileContainers = profileContainers.Substring(1);
}
return ContainsContainer(SplitValue(profileContainers), isNegativeList, inputContainer);
}
public static bool ContainsContainer(string[] profileContainers, string inputContainer)
{
return ContainsContainer(profileContainers, false, inputContainer);
}
public static bool ContainsContainer(string[] profileContainers, bool isNegativeList, string inputContainer)
{
if (profileContainers.Length == 0)
{
return true;
}
if (isNegativeList)
{
var allInputContainers = SplitValue(inputContainer);
foreach (var container in allInputContainers)
{
if (ListHelper.ContainsIgnoreCase(profileContainers, container))
{
return false;
}
}
return true;
}
else
{
var allInputContainers = SplitValue(inputContainer);
foreach (var container in allInputContainers)
{
if (ListHelper.ContainsIgnoreCase(profileContainers, container))
{
return true;
}
}
return false;
}
}
}
}

View File

@@ -0,0 +1,236 @@
using MediaBrowser.Model.MediaInfo;
using System;
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Model.Dlna
{
public class ContentFeatureBuilder
{
private readonly DeviceProfile _profile;
public ContentFeatureBuilder(DeviceProfile profile)
{
_profile = profile;
}
public string BuildImageHeader(string container,
int? width,
int? height,
bool isDirectStream,
string orgPn = null)
{
string orgOp = ";DLNA.ORG_OP=" + DlnaMaps.GetImageOrgOpValue();
// 0 = native, 1 = transcoded
var orgCi = isDirectStream ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1";
DlnaFlags flagValue = DlnaFlags.BackgroundTransferMode |
DlnaFlags.InteractiveTransferMode |
DlnaFlags.DlnaV15;
string dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}",
DlnaMaps.FlagsToString(flagValue));
ResponseProfile mediaProfile = _profile.GetImageMediaProfile(container,
width,
height);
if (string.IsNullOrEmpty(orgPn))
{
orgPn = mediaProfile == null ? null : mediaProfile.OrgPn;
}
if (string.IsNullOrEmpty(orgPn))
{
orgPn = GetImageOrgPnValue(container, width, height);
}
string contentFeatures = string.IsNullOrEmpty(orgPn) ? string.Empty : "DLNA.ORG_PN=" + orgPn;
return (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';');
}
public string BuildAudioHeader(string container,
string audioCodec,
int? audioBitrate,
int? audioSampleRate,
int? audioChannels,
int? audioBitDepth,
bool isDirectStream,
long? runtimeTicks,
TranscodeSeekInfo transcodeSeekInfo)
{
// first bit means Time based seek supported, second byte range seek supported (not sure about the order now), so 01 = only byte seek, 10 = time based, 11 = both, 00 = none
string orgOp = ";DLNA.ORG_OP=" + DlnaMaps.GetOrgOpValue(runtimeTicks > 0, isDirectStream, transcodeSeekInfo);
// 0 = native, 1 = transcoded
string orgCi = isDirectStream ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1";
DlnaFlags flagValue = DlnaFlags.StreamingTransferMode |
DlnaFlags.BackgroundTransferMode |
DlnaFlags.InteractiveTransferMode |
DlnaFlags.DlnaV15;
//if (isDirectStream)
//{
// flagValue = flagValue | DlnaFlags.ByteBasedSeek;
//}
//else if (runtimeTicks.HasValue)
//{
// flagValue = flagValue | DlnaFlags.TimeBasedSeek;
//}
string dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}",
DlnaMaps.FlagsToString(flagValue));
ResponseProfile mediaProfile = _profile.GetAudioMediaProfile(container,
audioCodec,
audioChannels,
audioBitrate,
audioSampleRate,
audioBitDepth);
string orgPn = mediaProfile == null ? null : mediaProfile.OrgPn;
if (string.IsNullOrEmpty(orgPn))
{
orgPn = GetAudioOrgPnValue(container, audioBitrate, audioSampleRate, audioChannels);
}
string contentFeatures = string.IsNullOrEmpty(orgPn) ? string.Empty : "DLNA.ORG_PN=" + orgPn;
return (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';');
}
public List<string> BuildVideoHeader(string container,
string videoCodec,
string audioCodec,
int? width,
int? height,
int? bitDepth,
int? videoBitrate,
TransportStreamTimestamp timestamp,
bool isDirectStream,
long? runtimeTicks,
string videoProfile,
double? videoLevel,
float? videoFramerate,
int? packetLength,
TranscodeSeekInfo transcodeSeekInfo,
bool? isAnamorphic,
bool? isInterlaced,
int? refFrames,
int? numVideoStreams,
int? numAudioStreams,
string videoCodecTag,
bool? isAvc)
{
// first bit means Time based seek supported, second byte range seek supported (not sure about the order now), so 01 = only byte seek, 10 = time based, 11 = both, 00 = none
string orgOp = ";DLNA.ORG_OP=" + DlnaMaps.GetOrgOpValue(runtimeTicks > 0, isDirectStream, transcodeSeekInfo);
// 0 = native, 1 = transcoded
string orgCi = isDirectStream ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1";
DlnaFlags flagValue = DlnaFlags.StreamingTransferMode |
DlnaFlags.BackgroundTransferMode |
DlnaFlags.InteractiveTransferMode |
DlnaFlags.DlnaV15;
//if (isDirectStream)
//{
// flagValue = flagValue | DlnaFlags.ByteBasedSeek;
//}
//else if (runtimeTicks.HasValue)
//{
// flagValue = flagValue | DlnaFlags.TimeBasedSeek;
//}
string dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}",
DlnaMaps.FlagsToString(flagValue));
ResponseProfile mediaProfile = _profile.GetVideoMediaProfile(container,
audioCodec,
videoCodec,
width,
height,
bitDepth,
videoBitrate,
videoProfile,
videoLevel,
videoFramerate,
packetLength,
timestamp,
isAnamorphic,
isInterlaced,
refFrames,
numVideoStreams,
numAudioStreams,
videoCodecTag,
isAvc);
List<string> orgPnValues = new List<string>();
if (mediaProfile != null && !string.IsNullOrEmpty(mediaProfile.OrgPn))
{
orgPnValues.AddRange(mediaProfile.OrgPn.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
}
else
{
foreach (string s in GetVideoOrgPnValue(container, videoCodec, audioCodec, width, height, timestamp))
{
orgPnValues.Add(s);
break;
}
}
List<string> contentFeatureList = new List<string>();
foreach (string orgPn in orgPnValues)
{
string contentFeatures = string.IsNullOrEmpty(orgPn) ? string.Empty : "DLNA.ORG_PN=" + orgPn;
var value = (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';');
contentFeatureList.Add(value);
}
if (orgPnValues.Count == 0)
{
string contentFeatures = string.Empty;
var value = (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';');
contentFeatureList.Add(value);
}
return contentFeatureList;
}
private string GetImageOrgPnValue(string container, int? width, int? height)
{
MediaFormatProfile? format = new MediaFormatProfileResolver()
.ResolveImageFormat(container,
width,
height);
return format.HasValue ? format.Value.ToString() : null;
}
private string GetAudioOrgPnValue(string container, int? audioBitrate, int? audioSampleRate, int? audioChannels)
{
MediaFormatProfile? format = new MediaFormatProfileResolver()
.ResolveAudioFormat(container,
audioBitrate,
audioSampleRate,
audioChannels);
return format.HasValue ? format.Value.ToString() : null;
}
private string[] GetVideoOrgPnValue(string container, string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestamp)
{
return new MediaFormatProfileResolver().ResolveVideoFormat(container, videoCodec, audioCodec, width, height, timestamp);
}
}
}

View File

@@ -0,0 +1,61 @@
namespace MediaBrowser.Model.Dlna
{
public class DeviceIdentification
{
/// <summary>
/// Gets or sets the name of the friendly.
/// </summary>
/// <value>The name of the friendly.</value>
public string FriendlyName { get; set; }
/// <summary>
/// Gets or sets the model number.
/// </summary>
/// <value>The model number.</value>
public string ModelNumber { get; set; }
/// <summary>
/// Gets or sets the serial number.
/// </summary>
/// <value>The serial number.</value>
public string SerialNumber { get; set; }
/// <summary>
/// Gets or sets the name of the model.
/// </summary>
/// <value>The name of the model.</value>
public string ModelName { get; set; }
/// <summary>
/// Gets or sets the model description.
/// </summary>
/// <value>The model description.</value>
public string ModelDescription { get; set; }
/// <summary>
/// Gets or sets the device description.
/// </summary>
/// <value>The device description.</value>
public string DeviceDescription { get; set; }
/// <summary>
/// Gets or sets the model URL.
/// </summary>
/// <value>The model URL.</value>
public string ModelUrl { get; set; }
/// <summary>
/// Gets or sets the manufacturer.
/// </summary>
/// <value>The manufacturer.</value>
public string Manufacturer { get; set; }
/// <summary>
/// Gets or sets the manufacturer URL.
/// </summary>
/// <value>The manufacturer URL.</value>
public string ManufacturerUrl { get; set; }
/// <summary>
/// Gets or sets the headers.
/// </summary>
/// <value>The headers.</value>
public HttpHeaderInfo[] Headers { get; set; }
public DeviceIdentification()
{
Headers = new HttpHeaderInfo[] {};
}
}
}

View File

@@ -0,0 +1,327 @@
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.MediaInfo;
using System.Collections.Generic;
using System.Xml.Serialization;
using System;
namespace MediaBrowser.Model.Dlna
{
[XmlRoot("Profile")]
public class DeviceProfile
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
[XmlIgnore]
public string Id { get; set; }
/// <summary>
/// Gets or sets the identification.
/// </summary>
/// <value>The identification.</value>
public MediaBrowser.Model.Dlna.DeviceIdentification Identification { get; set; }
public string FriendlyName { get; set; }
public string Manufacturer { get; set; }
public string ManufacturerUrl { get; set; }
public string ModelName { get; set; }
public string ModelDescription { get; set; }
public string ModelNumber { get; set; }
public string ModelUrl { get; set; }
public string SerialNumber { get; set; }
public bool EnableAlbumArtInDidl { get; set; }
public bool EnableSingleAlbumArtLimit { get; set; }
public bool EnableSingleSubtitleLimit { get; set; }
public string SupportedMediaTypes { get; set; }
public string UserId { get; set; }
public string AlbumArtPn { get; set; }
public int MaxAlbumArtWidth { get; set; }
public int MaxAlbumArtHeight { get; set; }
public int? MaxIconWidth { get; set; }
public int? MaxIconHeight { get; set; }
public long? MaxStreamingBitrate { get; set; }
public long? MaxStaticBitrate { get; set; }
public int? MusicStreamingTranscodingBitrate { get; set; }
public int? MaxStaticMusicBitrate { get; set; }
/// <summary>
/// Controls the content of the aggregationFlags element in the urn:schemas-sonycom:av namespace.
/// </summary>
public string SonyAggregationFlags { get; set; }
public string ProtocolInfo { get; set; }
public int TimelineOffsetSeconds { get; set; }
public bool RequiresPlainVideoItems { get; set; }
public bool RequiresPlainFolders { get; set; }
public bool EnableMSMediaReceiverRegistrar { get; set; }
public bool IgnoreTranscodeByteRangeRequests { get; set; }
public XmlAttribute[] XmlRootAttributes { get; set; }
/// <summary>
/// Gets or sets the direct play profiles.
/// </summary>
/// <value>The direct play profiles.</value>
public DirectPlayProfile[] DirectPlayProfiles { get; set; }
/// <summary>
/// Gets or sets the transcoding profiles.
/// </summary>
/// <value>The transcoding profiles.</value>
public TranscodingProfile[] TranscodingProfiles { get; set; }
public ContainerProfile[] ContainerProfiles { get; set; }
public CodecProfile[] CodecProfiles { get; set; }
public ResponseProfile[] ResponseProfiles { get; set; }
public SubtitleProfile[] SubtitleProfiles { get; set; }
public DeviceProfile()
{
DirectPlayProfiles = new DirectPlayProfile[] { };
TranscodingProfiles = new TranscodingProfile[] { };
ResponseProfiles = new ResponseProfile[] { };
CodecProfiles = new CodecProfile[] { };
ContainerProfiles = new ContainerProfile[] { };
SubtitleProfiles = Array.Empty<SubtitleProfile>();
XmlRootAttributes = new XmlAttribute[] { };
SupportedMediaTypes = "Audio,Photo,Video";
MaxStreamingBitrate = 8000000;
MaxStaticBitrate = 8000000;
MusicStreamingTranscodingBitrate = 128000;
}
public string[] GetSupportedMediaTypes()
{
return ContainerProfile.SplitValue(SupportedMediaTypes);
}
public TranscodingProfile GetAudioTranscodingProfile(string container, string audioCodec)
{
container = (container ?? string.Empty).TrimStart('.');
foreach (var i in TranscodingProfiles)
{
if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Audio)
{
continue;
}
if (!StringHelper.EqualsIgnoreCase(container, i.Container))
{
continue;
}
if (!ListHelper.ContainsIgnoreCase(i.GetAudioCodecs(), audioCodec ?? string.Empty))
{
continue;
}
return i;
}
return null;
}
public TranscodingProfile GetVideoTranscodingProfile(string container, string audioCodec, string videoCodec)
{
container = (container ?? string.Empty).TrimStart('.');
foreach (var i in TranscodingProfiles)
{
if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Video)
{
continue;
}
if (!StringHelper.EqualsIgnoreCase(container, i.Container))
{
continue;
}
if (!ListHelper.ContainsIgnoreCase(i.GetAudioCodecs(), audioCodec ?? string.Empty))
{
continue;
}
if (!StringHelper.EqualsIgnoreCase(videoCodec, i.VideoCodec ?? string.Empty))
{
continue;
}
return i;
}
return null;
}
public ResponseProfile GetAudioMediaProfile(string container, string audioCodec, int? audioChannels, int? audioBitrate, int? audioSampleRate, int? audioBitDepth)
{
foreach (var i in ResponseProfiles)
{
if (i.Type != DlnaProfileType.Audio)
{
continue;
}
if (!ContainerProfile.ContainsContainer(i.GetContainers(), container))
{
continue;
}
var audioCodecs = i.GetAudioCodecs();
if (audioCodecs.Length > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty))
{
continue;
}
var conditionProcessor = new ConditionProcessor();
var anyOff = false;
foreach (ProfileCondition c in i.Conditions)
{
if (!conditionProcessor.IsAudioConditionSatisfied(GetModelProfileCondition(c), audioChannels, audioBitrate, audioSampleRate, audioBitDepth))
{
anyOff = true;
break;
}
}
if (anyOff)
{
continue;
}
return i;
}
return null;
}
private ProfileCondition GetModelProfileCondition(ProfileCondition c)
{
return new ProfileCondition
{
Condition = c.Condition,
IsRequired = c.IsRequired,
Property = c.Property,
Value = c.Value
};
}
public ResponseProfile GetImageMediaProfile(string container, int? width, int? height)
{
foreach (var i in ResponseProfiles)
{
if (i.Type != DlnaProfileType.Photo)
{
continue;
}
if (!ContainerProfile.ContainsContainer(i.GetContainers(), container))
{
continue;
}
var conditionProcessor = new ConditionProcessor();
var anyOff = false;
foreach (ProfileCondition c in i.Conditions)
{
if (!conditionProcessor.IsImageConditionSatisfied(GetModelProfileCondition(c), width, height))
{
anyOff = true;
break;
}
}
if (anyOff)
{
continue;
}
return i;
}
return null;
}
public ResponseProfile GetVideoMediaProfile(string container,
string audioCodec,
string videoCodec,
int? width,
int? height,
int? bitDepth,
int? videoBitrate,
string videoProfile,
double? videoLevel,
float? videoFramerate,
int? packetLength,
TransportStreamTimestamp timestamp,
bool? isAnamorphic,
bool? isInterlaced,
int? refFrames,
int? numVideoStreams,
int? numAudioStreams,
string videoCodecTag,
bool? isAvc)
{
foreach (var i in ResponseProfiles)
{
if (i.Type != DlnaProfileType.Video)
{
continue;
}
if (!ContainerProfile.ContainsContainer(i.GetContainers(), container))
{
continue;
}
var audioCodecs = i.GetAudioCodecs();
if (audioCodecs.Length > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty))
{
continue;
}
var videoCodecs = i.GetVideoCodecs();
if (videoCodecs.Length > 0 && !ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec ?? string.Empty))
{
continue;
}
var conditionProcessor = new ConditionProcessor();
var anyOff = false;
foreach (ProfileCondition c in i.Conditions)
{
if (!conditionProcessor.IsVideoConditionSatisfied(GetModelProfileCondition(c), width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc))
{
anyOff = true;
break;
}
}
if (anyOff)
{
continue;
}
return i;
}
return null;
}
}
}

View File

@@ -0,0 +1,24 @@

namespace MediaBrowser.Model.Dlna
{
public class DeviceProfileInfo
{
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public string Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public DeviceProfileType Type { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace MediaBrowser.Model.Dlna
{
public enum DeviceProfileType
{
System = 0,
User = 1
}
}

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
namespace MediaBrowser.Model.Dlna
{
public class DirectPlayProfile
{
[XmlAttribute("container")]
public string Container { get; set; }
[XmlAttribute("audioCodec")]
public string AudioCodec { get; set; }
[XmlAttribute("videoCodec")]
public string VideoCodec { get; set; }
[XmlAttribute("type")]
public DlnaProfileType Type { get; set; }
public bool SupportsContainer(string container)
{
return ContainerProfile.ContainsContainer(Container, container);
}
public bool SupportsVideoCodec(string codec)
{
return ContainerProfile.ContainsContainer(VideoCodec, codec);
}
public bool SupportsAudioCodec(string codec)
{
return ContainerProfile.ContainsContainer(AudioCodec, codec);
}
}
}

View File

@@ -0,0 +1,48 @@
using System;
namespace MediaBrowser.Model.Dlna
{
[Flags]
public enum DlnaFlags : ulong
{
/*! <i>Background</i> transfer mode.
For use with upload and download transfers to and from the server.
The primary difference between \ref DH_TransferMode_Interactive and
\ref DH_TransferMode_Bulk is that the latter assumes that the user
is not relying on the transfer for immediately rendering the content
and there are no issues with causing a buffer overflow if the
receiver uses TCP flow control to reduce total throughput.
*/
BackgroundTransferMode = 1 << 22,
ByteBasedSeek = 1 << 29,
ConnectionStall = 1 << 21,
DlnaV15 = 1 << 20,
/*! <i>Interactive</i> transfer mode.
For best effort transfer of images and non-real-time transfers.
URIs with image content usually support \ref DH_TransferMode_Bulk too.
The primary difference between \ref DH_TransferMode_Interactive and
\ref DH_TransferMode_Bulk is that the former assumes that the
transfer is intended for immediate rendering.
*/
InteractiveTransferMode = 1 << 23,
PlayContainer = 1 << 28,
RtspPause = 1 << 25,
S0Increase = 1 << 27,
SenderPaced = 1L << 31,
SnIncrease = 1 << 26,
/*! <i>Streaming</i> transfer mode.
The server transmits at a throughput sufficient for real-time playback of
audio or video. URIs with audio or video often support the
\ref DH_TransferMode_Interactive and \ref DH_TransferMode_Bulk transfer modes.
The most well-known exception to this general claim is for live streams.
*/
StreamingTransferMode = 1 << 24,
TimeBasedSeek = 1 << 30
}
}

View File

@@ -0,0 +1,56 @@
namespace MediaBrowser.Model.Dlna
{
public class DlnaMaps
{
private static readonly string DefaultStreaming =
FlagsToString(DlnaFlags.StreamingTransferMode |
DlnaFlags.BackgroundTransferMode |
DlnaFlags.ConnectionStall |
DlnaFlags.ByteBasedSeek |
DlnaFlags.DlnaV15);
private static readonly string DefaultInteractive =
FlagsToString(DlnaFlags.InteractiveTransferMode |
DlnaFlags.BackgroundTransferMode |
DlnaFlags.ConnectionStall |
DlnaFlags.ByteBasedSeek |
DlnaFlags.DlnaV15);
public static string FlagsToString(DlnaFlags flags)
{
return string.Format("{0:X8}{1:D24}", (ulong)flags, 0);
}
public static string GetOrgOpValue(bool hasKnownRuntime, bool isDirectStream, TranscodeSeekInfo profileTranscodeSeekInfo)
{
if (hasKnownRuntime)
{
string orgOp = string.Empty;
// Time-based seeking currently only possible when transcoding
orgOp += isDirectStream ? "0" : "1";
// Byte-based seeking only possible when not transcoding
orgOp += isDirectStream || profileTranscodeSeekInfo == TranscodeSeekInfo.Bytes ? "1" : "0";
return orgOp;
}
// No seeking is available if we don't know the content runtime
return "00";
}
public static string GetImageOrgOpValue()
{
string orgOp = string.Empty;
// Time-based seeking currently only possible when transcoding
orgOp += "0";
// Byte-based seeking only possible when not transcoding
orgOp += "0";
return orgOp;
}
}
}

View File

@@ -0,0 +1,9 @@
namespace MediaBrowser.Model.Dlna
{
public enum DlnaProfileType
{
Audio = 0,
Video = 1,
Photo = 2
}
}

View File

@@ -0,0 +1,8 @@
namespace MediaBrowser.Model.Dlna
{
public enum EncodingContext
{
Streaming = 0,
Static = 1
}
}

View File

@@ -0,0 +1,9 @@
namespace MediaBrowser.Model.Dlna
{
public enum HeaderMatchType
{
Equals = 0,
Regex = 1,
Substring = 2
}
}

View File

@@ -0,0 +1,17 @@
using System.Xml.Serialization;
using MediaBrowser.Model.Dlna;
namespace MediaBrowser.Model.Dlna
{
public class HttpHeaderInfo
{
[XmlAttribute("name")]
public string Name { get; set; }
[XmlAttribute("value")]
public string Value { get; set; }
[XmlAttribute("match")]
public HeaderMatchType Match { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using System;
using MediaBrowser.Model.Events;
namespace MediaBrowser.Model.Dlna
{
public interface IDeviceDiscovery
{
event EventHandler<GenericEventArgs<UpnpDeviceInfo>> DeviceDiscovered;
event EventHandler<GenericEventArgs<UpnpDeviceInfo>> DeviceLeft;
}
}

View File

@@ -0,0 +1,25 @@
namespace MediaBrowser.Model.Dlna
{
public interface ITranscoderSupport
{
bool CanEncodeToAudioCodec(string codec);
bool CanEncodeToSubtitleCodec(string codec);
bool CanExtractSubtitles(string codec);
}
public class FullTranscoderSupport : ITranscoderSupport
{
public bool CanEncodeToAudioCodec(string codec)
{
return true;
}
public bool CanEncodeToSubtitleCodec(string codec)
{
return true;
}
public bool CanExtractSubtitles(string codec)
{
return true;
}
}
}

View File

@@ -0,0 +1,113 @@

namespace MediaBrowser.Model.Dlna
{
public enum MediaFormatProfile
{
MP3,
WMA_BASE,
WMA_FULL,
LPCM16_44_MONO,
LPCM16_44_STEREO,
LPCM16_48_MONO,
LPCM16_48_STEREO,
AAC_ISO,
AAC_ISO_320,
AAC_ADTS,
AAC_ADTS_320,
FLAC,
OGG,
JPEG_SM,
JPEG_MED,
JPEG_LRG,
JPEG_TN,
PNG_LRG,
PNG_TN,
GIF_LRG,
RAW,
MPEG1,
MPEG_PS_PAL,
MPEG_PS_NTSC,
MPEG_TS_SD_EU,
MPEG_TS_SD_EU_ISO,
MPEG_TS_SD_EU_T,
MPEG_TS_SD_NA,
MPEG_TS_SD_NA_ISO,
MPEG_TS_SD_NA_T,
MPEG_TS_SD_KO,
MPEG_TS_SD_KO_ISO,
MPEG_TS_SD_KO_T,
MPEG_TS_JP_T,
AVI,
MATROSKA,
FLV,
DVR_MS,
WTV,
OGV,
AVC_MP4_MP_SD_AAC_MULT5,
AVC_MP4_MP_SD_MPEG1_L3,
AVC_MP4_MP_SD_AC3,
AVC_MP4_MP_HD_720p_AAC,
AVC_MP4_MP_HD_1080i_AAC,
AVC_MP4_HP_HD_AAC,
AVC_TS_MP_HD_AAC_MULT5,
AVC_TS_MP_HD_AAC_MULT5_T,
AVC_TS_MP_HD_AAC_MULT5_ISO,
AVC_TS_MP_HD_MPEG1_L3,
AVC_TS_MP_HD_MPEG1_L3_T,
AVC_TS_MP_HD_MPEG1_L3_ISO,
AVC_TS_MP_HD_AC3,
AVC_TS_MP_HD_AC3_T,
AVC_TS_MP_HD_AC3_ISO,
AVC_TS_HP_HD_MPEG1_L2_T,
AVC_TS_HP_HD_MPEG1_L2_ISO,
AVC_TS_MP_SD_AAC_MULT5,
AVC_TS_MP_SD_AAC_MULT5_T,
AVC_TS_MP_SD_AAC_MULT5_ISO,
AVC_TS_MP_SD_MPEG1_L3,
AVC_TS_MP_SD_MPEG1_L3_T,
AVC_TS_MP_SD_MPEG1_L3_ISO,
AVC_TS_HP_SD_MPEG1_L2_T,
AVC_TS_HP_SD_MPEG1_L2_ISO,
AVC_TS_MP_SD_AC3,
AVC_TS_MP_SD_AC3_T,
AVC_TS_MP_SD_AC3_ISO,
AVC_TS_HD_DTS_T,
AVC_TS_HD_DTS_ISO,
WMVMED_BASE,
WMVMED_FULL,
WMVMED_PRO,
WMVHIGH_FULL,
WMVHIGH_PRO,
VC1_ASF_AP_L1_WMA,
VC1_ASF_AP_L2_WMA,
VC1_ASF_AP_L3_WMA,
VC1_TS_AP_L1_AC3_ISO,
VC1_TS_AP_L2_AC3_ISO,
VC1_TS_HD_DTS_ISO,
VC1_TS_HD_DTS_T,
MPEG4_P2_MP4_ASP_AAC,
MPEG4_P2_MP4_SP_L6_AAC,
MPEG4_P2_MP4_NDSD,
MPEG4_P2_TS_ASP_AAC,
MPEG4_P2_TS_ASP_AAC_T,
MPEG4_P2_TS_ASP_AAC_ISO,
MPEG4_P2_TS_ASP_MPEG1_L3,
MPEG4_P2_TS_ASP_MPEG1_L3_T,
MPEG4_P2_TS_ASP_MPEG1_L3_ISO,
MPEG4_P2_TS_ASP_MPEG2_L2,
MPEG4_P2_TS_ASP_MPEG2_L2_T,
MPEG4_P2_TS_ASP_MPEG2_L2_ISO,
MPEG4_P2_TS_ASP_AC3,
MPEG4_P2_TS_ASP_AC3_T,
MPEG4_P2_TS_ASP_AC3_ISO,
AVC_TS_HD_50_LPCM_T,
AVC_MP4_LPCM,
MPEG4_P2_3GPP_SP_L0B_AAC,
MPEG4_P2_3GPP_SP_L0B_AMR,
AVC_3GPP_BL_QCIF15_AAC,
MPEG4_H263_3GPP_P0_L10_AMR,
MPEG4_H263_MP4_P0_L10_AAC
}
}

View File

@@ -0,0 +1,439 @@
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.MediaInfo;
using System;
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Model.Dlna
{
public class MediaFormatProfileResolver
{
public string[] ResolveVideoFormat(string container, string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)
{
return ResolveVideoFormatInternal(container, videoCodec, audioCodec, width, height, timestampType)
.Select(i => i.ToString())
.ToArray();
}
private MediaFormatProfile[] ResolveVideoFormatInternal(string container, string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)
{
if (StringHelper.EqualsIgnoreCase(container, "asf"))
{
MediaFormatProfile? val = ResolveVideoASFFormat(videoCodec, audioCodec, width, height);
return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { };
}
if (StringHelper.EqualsIgnoreCase(container, "mp4"))
{
MediaFormatProfile? val = ResolveVideoMP4Format(videoCodec, audioCodec, width, height);
return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { };
}
if (StringHelper.EqualsIgnoreCase(container, "avi"))
return new MediaFormatProfile[] { MediaFormatProfile.AVI };
if (StringHelper.EqualsIgnoreCase(container, "mkv"))
return new MediaFormatProfile[] { MediaFormatProfile.MATROSKA };
if (StringHelper.EqualsIgnoreCase(container, "mpeg2ps") ||
StringHelper.EqualsIgnoreCase(container, "ts"))
return new MediaFormatProfile[] { MediaFormatProfile.MPEG_PS_NTSC, MediaFormatProfile.MPEG_PS_PAL };
if (StringHelper.EqualsIgnoreCase(container, "mpeg1video"))
return new MediaFormatProfile[] { MediaFormatProfile.MPEG1 };
if (StringHelper.EqualsIgnoreCase(container, "mpeg2ts") ||
StringHelper.EqualsIgnoreCase(container, "mpegts") ||
StringHelper.EqualsIgnoreCase(container, "m2ts"))
{
return ResolveVideoMPEG2TSFormat(videoCodec, audioCodec, width, height, timestampType);
}
if (StringHelper.EqualsIgnoreCase(container, "flv"))
return new MediaFormatProfile[] { MediaFormatProfile.FLV };
if (StringHelper.EqualsIgnoreCase(container, "wtv"))
return new MediaFormatProfile[] { MediaFormatProfile.WTV };
if (StringHelper.EqualsIgnoreCase(container, "3gp"))
{
MediaFormatProfile? val = ResolveVideo3GPFormat(videoCodec, audioCodec);
return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { };
}
if (StringHelper.EqualsIgnoreCase(container, "ogv") || StringHelper.EqualsIgnoreCase(container, "ogg"))
return new MediaFormatProfile[] { MediaFormatProfile.OGV };
return new MediaFormatProfile[] { };
}
private MediaFormatProfile[] ResolveVideoMPEG2TSFormat(string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)
{
string suffix = "";
switch (timestampType)
{
case TransportStreamTimestamp.None:
suffix = "_ISO";
break;
case TransportStreamTimestamp.Valid:
suffix = "_T";
break;
}
string resolution = "S";
if ((width.HasValue && width.Value > 720) || (height.HasValue && height.Value > 576))
{
resolution = "H";
}
if (StringHelper.EqualsIgnoreCase(videoCodec, "mpeg2video"))
{
List<MediaFormatProfile> list = new List<MediaFormatProfile>();
list.Add(ValueOf("MPEG_TS_SD_NA" + suffix));
list.Add(ValueOf("MPEG_TS_SD_EU" + suffix));
list.Add(ValueOf("MPEG_TS_SD_KO" + suffix));
if ((timestampType == TransportStreamTimestamp.Valid) && StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
{
list.Add(MediaFormatProfile.MPEG_TS_JP_T);
}
return list.ToArray(list.Count);
}
if (StringHelper.EqualsIgnoreCase(videoCodec, "h264"))
{
if (StringHelper.EqualsIgnoreCase(audioCodec, "lpcm"))
return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_50_LPCM_T };
if (StringHelper.EqualsIgnoreCase(audioCodec, "dts"))
{
if (timestampType == TransportStreamTimestamp.None)
{
return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_ISO };
}
return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_T };
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp2"))
{
if (timestampType == TransportStreamTimestamp.None)
{
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_ISO", resolution)) };
}
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_T", resolution)) };
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AAC_MULT5{1}", resolution, suffix)) };
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_MPEG1_L3{1}", resolution, suffix)) };
if (string.IsNullOrEmpty(audioCodec) ||
StringHelper.EqualsIgnoreCase(audioCodec, "ac3"))
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AC3{1}", resolution, suffix)) };
}
else if (StringHelper.EqualsIgnoreCase(videoCodec, "vc1"))
{
if (string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "ac3"))
{
if ((width.HasValue && width.Value > 720) || (height.HasValue && height.Value > 576))
{
return new MediaFormatProfile[] { MediaFormatProfile.VC1_TS_AP_L2_AC3_ISO };
}
return new MediaFormatProfile[] { MediaFormatProfile.VC1_TS_AP_L1_AC3_ISO };
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "dts"))
{
suffix = StringHelper.EqualsIgnoreCase(suffix, "_ISO") ? suffix : "_T";
return new 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 MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AAC{0}", suffix)) };
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG1_L3{0}", suffix)) };
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp2"))
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG2_L2{0}", suffix)) };
if (StringHelper.EqualsIgnoreCase(audioCodec, "ac3"))
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AC3{0}", suffix)) };
}
return new MediaFormatProfile[]{};
}
private MediaFormatProfile ValueOf(string value)
{
return (MediaFormatProfile)Enum.Parse(typeof(MediaFormatProfile), value, true);
}
private MediaFormatProfile? ResolveVideoMP4Format(string videoCodec, string audioCodec, int? width, int? height)
{
if (StringHelper.EqualsIgnoreCase(videoCodec, "h264"))
{
if (StringHelper.EqualsIgnoreCase(audioCodec, "lpcm"))
return MediaFormatProfile.AVC_MP4_LPCM;
if (string.IsNullOrEmpty(audioCodec) ||
StringHelper.EqualsIgnoreCase(audioCodec, "ac3"))
{
return MediaFormatProfile.AVC_MP4_MP_SD_AC3;
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))
{
return MediaFormatProfile.AVC_MP4_MP_SD_MPEG1_L3;
}
if (width.HasValue && height.HasValue)
{
if ((width.Value <= 720) && (height.Value <= 576))
{
if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
return MediaFormatProfile.AVC_MP4_MP_SD_AAC_MULT5;
}
else if ((width.Value <= 1280) && (height.Value <= 720))
{
if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
return MediaFormatProfile.AVC_MP4_MP_HD_720p_AAC;
}
else if ((width.Value <= 1920) && (height.Value <= 1080))
{
if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
{
return MediaFormatProfile.AVC_MP4_MP_HD_1080i_AAC;
}
}
}
}
else if (StringHelper.EqualsIgnoreCase(videoCodec, "mpeg4") ||
StringHelper.EqualsIgnoreCase(videoCodec, "msmpeg4"))
{
if (width.HasValue && height.HasValue && width.Value <= 720 && height.Value <= 576)
{
if (string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
return MediaFormatProfile.MPEG4_P2_MP4_ASP_AAC;
if (StringHelper.EqualsIgnoreCase(audioCodec, "ac3") || StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))
{
return MediaFormatProfile.MPEG4_P2_MP4_NDSD;
}
}
else if (string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
{
return MediaFormatProfile.MPEG4_P2_MP4_SP_L6_AAC;
}
}
else if (StringHelper.EqualsIgnoreCase(videoCodec, "h263") && StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
{
return MediaFormatProfile.MPEG4_H263_MP4_P0_L10_AAC;
}
return null;
}
private MediaFormatProfile? ResolveVideo3GPFormat(string videoCodec, string audioCodec)
{
if (StringHelper.EqualsIgnoreCase(videoCodec, "h264"))
{
if (string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
return MediaFormatProfile.AVC_3GPP_BL_QCIF15_AAC;
}
else if (StringHelper.EqualsIgnoreCase(videoCodec, "mpeg4") ||
StringHelper.EqualsIgnoreCase(videoCodec, "msmpeg4"))
{
if (string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "wma"))
return MediaFormatProfile.MPEG4_P2_3GPP_SP_L0B_AAC;
if (StringHelper.EqualsIgnoreCase(audioCodec, "amrnb"))
return MediaFormatProfile.MPEG4_P2_3GPP_SP_L0B_AMR;
}
else if (StringHelper.EqualsIgnoreCase(videoCodec, "h263") && StringHelper.EqualsIgnoreCase(audioCodec, "amrnb"))
{
return MediaFormatProfile.MPEG4_H263_3GPP_P0_L10_AMR;
}
return null;
}
private MediaFormatProfile? ResolveVideoASFFormat(string videoCodec, string audioCodec, int? width, int? height)
{
if (StringHelper.EqualsIgnoreCase(videoCodec, "wmv") &&
(string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "wma") || StringHelper.EqualsIgnoreCase(videoCodec, "wmapro")))
{
if (width.HasValue && height.HasValue)
{
if ((width.Value <= 720) && (height.Value <= 576))
{
if (string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "wma"))
{
return MediaFormatProfile.WMVMED_FULL;
}
return MediaFormatProfile.WMVMED_PRO;
}
}
if (string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "wma"))
{
return MediaFormatProfile.WMVHIGH_FULL;
}
return MediaFormatProfile.WMVHIGH_PRO;
}
if (StringHelper.EqualsIgnoreCase(videoCodec, "vc1"))
{
if (width.HasValue && height.HasValue)
{
if ((width.Value <= 720) && (height.Value <= 576))
return MediaFormatProfile.VC1_ASF_AP_L1_WMA;
if ((width.Value <= 1280) && (height.Value <= 720))
return MediaFormatProfile.VC1_ASF_AP_L2_WMA;
if ((width.Value <= 1920) && (height.Value <= 1080))
return MediaFormatProfile.VC1_ASF_AP_L3_WMA;
}
}
else if (StringHelper.EqualsIgnoreCase(videoCodec, "mpeg2video"))
{
return MediaFormatProfile.DVR_MS;
}
return null;
}
public MediaFormatProfile? ResolveAudioFormat(string container, int? bitrate, int? frequency, int? channels)
{
if (StringHelper.EqualsIgnoreCase(container, "asf"))
return ResolveAudioASFFormat(bitrate);
if (StringHelper.EqualsIgnoreCase(container, "mp3"))
return MediaFormatProfile.MP3;
if (StringHelper.EqualsIgnoreCase(container, "lpcm"))
return ResolveAudioLPCMFormat(frequency, channels);
if (StringHelper.EqualsIgnoreCase(container, "mp4") ||
StringHelper.EqualsIgnoreCase(container, "aac"))
return ResolveAudioMP4Format(bitrate);
if (StringHelper.EqualsIgnoreCase(container, "adts"))
return ResolveAudioADTSFormat(bitrate);
if (StringHelper.EqualsIgnoreCase(container, "flac"))
return MediaFormatProfile.FLAC;
if (StringHelper.EqualsIgnoreCase(container, "oga") ||
StringHelper.EqualsIgnoreCase(container, "ogg"))
return MediaFormatProfile.OGG;
return null;
}
private MediaFormatProfile ResolveAudioASFFormat(int? bitrate)
{
if (bitrate.HasValue && bitrate.Value <= 193)
{
return MediaFormatProfile.WMA_BASE;
}
return MediaFormatProfile.WMA_FULL;
}
private MediaFormatProfile? ResolveAudioLPCMFormat(int? frequency, int? channels)
{
if (frequency.HasValue && channels.HasValue)
{
if (frequency.Value == 44100 && channels.Value == 1)
{
return MediaFormatProfile.LPCM16_44_MONO;
}
if (frequency.Value == 44100 && channels.Value == 2)
{
return MediaFormatProfile.LPCM16_44_STEREO;
}
if (frequency.Value == 48000 && channels.Value == 1)
{
return MediaFormatProfile.LPCM16_48_MONO;
}
if (frequency.Value == 48000 && channels.Value == 2)
{
return MediaFormatProfile.LPCM16_48_STEREO;
}
return null;
}
return MediaFormatProfile.LPCM16_48_STEREO;
}
private MediaFormatProfile ResolveAudioMP4Format(int? bitrate)
{
if (bitrate.HasValue && bitrate.Value <= 320)
{
return MediaFormatProfile.AAC_ISO_320;
}
return MediaFormatProfile.AAC_ISO;
}
private MediaFormatProfile ResolveAudioADTSFormat(int? bitrate)
{
if (bitrate.HasValue && bitrate.Value <= 320)
{
return MediaFormatProfile.AAC_ADTS_320;
}
return MediaFormatProfile.AAC_ADTS;
}
public MediaFormatProfile? ResolveImageFormat(string container, int? width, int? height)
{
if (StringHelper.EqualsIgnoreCase(container, "jpeg") ||
StringHelper.EqualsIgnoreCase(container, "jpg"))
return ResolveImageJPGFormat(width, height);
if (StringHelper.EqualsIgnoreCase(container, "png"))
return ResolveImagePNGFormat(width, height);
if (StringHelper.EqualsIgnoreCase(container, "gif"))
return MediaFormatProfile.GIF_LRG;
if (StringHelper.EqualsIgnoreCase(container, "raw"))
return MediaFormatProfile.RAW;
return null;
}
private MediaFormatProfile ResolveImageJPGFormat(int? width, int? height)
{
if (width.HasValue && height.HasValue)
{
if ((width.Value <= 160) && (height.Value <= 160))
return MediaFormatProfile.JPEG_TN;
if ((width.Value <= 640) && (height.Value <= 480))
return MediaFormatProfile.JPEG_SM;
if ((width.Value <= 1024) && (height.Value <= 768))
{
return MediaFormatProfile.JPEG_MED;
}
return MediaFormatProfile.JPEG_LRG;
}
return MediaFormatProfile.JPEG_SM;
}
private MediaFormatProfile ResolveImagePNGFormat(int? width, int? height)
{
if (width.HasValue && height.HasValue)
{
if ((width.Value <= 160) && (height.Value <= 160))
return MediaFormatProfile.PNG_TN;
}
return MediaFormatProfile.PNG_LRG;
}
}
}

View File

@@ -0,0 +1,10 @@

namespace MediaBrowser.Model.Dlna
{
public enum PlaybackErrorCode
{
NotAllowed = 0,
NoCompatibleStream = 1,
RateLimitExceeded = 2
}
}

View File

@@ -0,0 +1,38 @@
using System.Xml.Serialization;
namespace MediaBrowser.Model.Dlna
{
public class ProfileCondition
{
[XmlAttribute("condition")]
public ProfileConditionType Condition { get; set; }
[XmlAttribute("property")]
public ProfileConditionValue Property { get; set; }
[XmlAttribute("value")]
public string Value { get; set; }
[XmlAttribute("isRequired")]
public bool IsRequired { get; set; }
public ProfileCondition()
{
IsRequired = true;
}
public ProfileCondition(ProfileConditionType condition, ProfileConditionValue property, string value)
: this(condition, property, value, false)
{
}
public ProfileCondition(ProfileConditionType condition, ProfileConditionValue property, string value, bool isRequired)
{
Condition = condition;
Property = property;
Value = value;
IsRequired = isRequired;
}
}
}

View File

@@ -0,0 +1,11 @@
namespace MediaBrowser.Model.Dlna
{
public enum ProfileConditionType
{
Equals = 0,
NotEquals = 1,
LessThanEqual = 2,
GreaterThanEqual = 3,
EqualsAny = 4
}
}

View File

@@ -0,0 +1,29 @@
namespace MediaBrowser.Model.Dlna
{
public enum ProfileConditionValue
{
AudioChannels = 0,
AudioBitrate = 1,
AudioProfile = 2,
Width = 3,
Height = 4,
Has64BitOffsets = 5,
PacketLength = 6,
VideoBitDepth = 7,
VideoBitrate = 8,
VideoFramerate = 9,
VideoLevel = 10,
VideoProfile = 11,
VideoTimestamp = 12,
IsAnamorphic = 13,
RefFrames = 14,
NumAudioStreams = 16,
NumVideoStreams = 17,
IsSecondaryAudio = 18,
VideoCodecTag = 19,
IsAvc = 20,
IsInterlaced = 21,
AudioSampleRate = 22,
AudioBitDepth = 23
}
}

View File

@@ -0,0 +1,14 @@
namespace MediaBrowser.Model.Dlna
{
public class ResolutionConfiguration
{
public int MaxWidth { get; set; }
public int MaxBitrate { get; set; }
public ResolutionConfiguration(int maxWidth, int maxBitrate)
{
MaxWidth = maxWidth;
MaxBitrate = maxBitrate;
}
}
}

View File

@@ -0,0 +1,99 @@
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Model.Dlna
{
public class ResolutionNormalizer
{
private static readonly ResolutionConfiguration[] Configurations =
new []
{
new ResolutionConfiguration(426, 320000),
new ResolutionConfiguration(640, 400000),
new ResolutionConfiguration(720, 950000),
new ResolutionConfiguration(1280, 2500000),
new ResolutionConfiguration(1920, 4000000),
new ResolutionConfiguration(3840, 35000000)
};
public static ResolutionOptions Normalize(int? inputBitrate,
int? unused1,
int? unused2,
int outputBitrate,
string inputCodec,
string outputCodec,
int? maxWidth,
int? maxHeight)
{
// If the bitrate isn't changing, then don't downlscale the resolution
if (inputBitrate.HasValue && outputBitrate >= inputBitrate.Value)
{
if (maxWidth.HasValue || maxHeight.HasValue)
{
return new ResolutionOptions
{
MaxWidth = maxWidth,
MaxHeight = maxHeight
};
}
}
var resolutionConfig = GetResolutionConfiguration(outputBitrate);
if (resolutionConfig != null)
{
var originvalValue = maxWidth;
maxWidth = Math.Min(resolutionConfig.MaxWidth, maxWidth ?? resolutionConfig.MaxWidth);
if (!originvalValue.HasValue || originvalValue.Value != maxWidth.Value)
{
maxHeight = null;
}
}
return new ResolutionOptions
{
MaxWidth = maxWidth,
MaxHeight = maxHeight
};
}
private static ResolutionConfiguration GetResolutionConfiguration(int outputBitrate)
{
ResolutionConfiguration previousOption = null;
foreach (var config in Configurations)
{
if (outputBitrate <= config.MaxBitrate)
{
return previousOption ?? config;
}
previousOption = config;
}
return null;
}
private static double GetVideoBitrateScaleFactor(string codec)
{
if (StringHelper.EqualsIgnoreCase(codec, "h265") ||
StringHelper.EqualsIgnoreCase(codec, "hevc") ||
StringHelper.EqualsIgnoreCase(codec, "vp9"))
{
return .5;
}
return 1;
}
public static int ScaleBitrate(int bitrate, string inputVideoCodec, string outputVideoCodec)
{
var inputScaleFactor = GetVideoBitrateScaleFactor(inputVideoCodec);
var outputScaleFactor = GetVideoBitrateScaleFactor(outputVideoCodec);
var scaleFactor = outputScaleFactor/inputScaleFactor;
var newBitrate = scaleFactor*bitrate;
return Convert.ToInt32(newBitrate);
}
}
}

View File

@@ -0,0 +1,8 @@
namespace MediaBrowser.Model.Dlna
{
public class ResolutionOptions
{
public int? MaxWidth { get; set; }
public int? MaxHeight { get; set; }
}
}

View File

@@ -0,0 +1,49 @@
using System.Collections.Generic;
using System.Xml.Serialization;
using MediaBrowser.Model.Dlna;
namespace MediaBrowser.Model.Dlna
{
public class ResponseProfile
{
[XmlAttribute("container")]
public string Container { get; set; }
[XmlAttribute("audioCodec")]
public string AudioCodec { get; set; }
[XmlAttribute("videoCodec")]
public string VideoCodec { get; set; }
[XmlAttribute("type")]
public DlnaProfileType Type { get; set; }
[XmlAttribute("orgPn")]
public string OrgPn { get; set; }
[XmlAttribute("mimeType")]
public string MimeType { get; set; }
public ProfileCondition[] Conditions { get; set; }
public ResponseProfile()
{
Conditions = new ProfileCondition[] {};
}
public string[] GetContainers()
{
return ContainerProfile.SplitValue(Container);
}
public string[] GetAudioCodecs()
{
return ContainerProfile.SplitValue(AudioCodec);
}
public string[] GetVideoCodecs()
{
return ContainerProfile.SplitValue(VideoCodec);
}
}
}

View File

@@ -0,0 +1,75 @@
using MediaBrowser.Model.Extensions;
using System;
using System.Text.RegularExpressions;
namespace MediaBrowser.Model.Dlna
{
public class SearchCriteria
{
public SearchType SearchType { get; set; }
/// <summary>
/// Splits the specified string.
/// </summary>
/// <param name="str">The string.</param>
/// <param name="term">The term.</param>
/// <param name="limit">The limit.</param>
/// <returns>System.String[].</returns>
private string[] RegexSplit(string str, string term, int limit)
{
return new Regex(term).Split(str, limit);
}
/// <summary>
/// Splits the specified string.
/// </summary>
/// <param name="str">The string.</param>
/// <param name="term">The term.</param>
/// <returns>System.String[].</returns>
private string[] RegexSplit(string str, string term)
{
return Regex.Split(str, term, RegexOptions.IgnoreCase);
}
public SearchCriteria(string search)
{
if (string.IsNullOrEmpty(search))
{
throw new ArgumentNullException("search");
}
SearchType = SearchType.Unknown;
String[] factors = RegexSplit(search, "(and|or)");
foreach (String factor in factors)
{
String[] subFactors = RegexSplit(factor.Trim().Trim('(').Trim(')').Trim(), "\\s", 3);
if (subFactors.Length == 3)
{
if (StringHelper.EqualsIgnoreCase("upnp:class", subFactors[0]) &&
(StringHelper.EqualsIgnoreCase("=", subFactors[1]) || StringHelper.EqualsIgnoreCase("derivedfrom", subFactors[1])))
{
if (StringHelper.EqualsIgnoreCase("\"object.item.imageItem\"", subFactors[2]) || StringHelper.EqualsIgnoreCase("\"object.item.imageItem.photo\"", subFactors[2]))
{
SearchType = SearchType.Image;
}
else if (StringHelper.EqualsIgnoreCase("\"object.item.videoItem\"", subFactors[2]))
{
SearchType = SearchType.Video;
}
else if (StringHelper.EqualsIgnoreCase("\"object.container.playlistContainer\"", subFactors[2]))
{
SearchType = SearchType.Playlist;
}
else if (StringHelper.EqualsIgnoreCase("\"object.container.album.musicAlbum\"", subFactors[2]))
{
SearchType = SearchType.MusicAlbum;
}
}
}
}
}
}
}

View File

@@ -0,0 +1,12 @@
namespace MediaBrowser.Model.Dlna
{
public enum SearchType
{
Unknown = 0,
Audio = 1,
Image = 2,
Video = 3,
Playlist = 4,
MusicAlbum = 5
}
}

View File

@@ -0,0 +1,17 @@
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Dlna
{
public class SortCriteria
{
public SortOrder SortOrder
{
get { return SortOrder.Ascending; }
}
public SortCriteria(string value)
{
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
namespace MediaBrowser.Model.Dlna
{
public enum SubtitleDeliveryMethod
{
/// <summary>
/// The encode
/// </summary>
Encode = 0,
/// <summary>
/// The embed
/// </summary>
Embed = 1,
/// <summary>
/// The external
/// </summary>
External = 2,
/// <summary>
/// The HLS
/// </summary>
Hls = 3
}
}

View File

@@ -0,0 +1,46 @@
using MediaBrowser.Model.Extensions;
using System.Collections.Generic;
using System.Xml.Serialization;
using MediaBrowser.Model.Dlna;
namespace MediaBrowser.Model.Dlna
{
public class SubtitleProfile
{
[XmlAttribute("format")]
public string Format { get; set; }
[XmlAttribute("method")]
public SubtitleDeliveryMethod Method { get; set; }
[XmlAttribute("didlMode")]
public string DidlMode { get; set; }
[XmlAttribute("language")]
public string Language { get; set; }
[XmlAttribute("container")]
public string Container { get; set; }
public string[] GetLanguages()
{
return ContainerProfile.SplitValue(Language);
}
public bool SupportsLanguage(string subLanguage)
{
if (string.IsNullOrEmpty(Language))
{
return true;
}
if (string.IsNullOrEmpty(subLanguage))
{
subLanguage = "und";
}
var languages = GetLanguages();
return languages.Length == 0 || ListHelper.ContainsIgnoreCase(languages, subLanguage);
}
}
}

View File

@@ -0,0 +1,15 @@
namespace MediaBrowser.Model.Dlna
{
public class SubtitleStreamInfo
{
public string Url { get; set; }
public string Language { get; set; }
public string Name { get; set; }
public bool IsForced { get; set; }
public string Format { get; set; }
public string DisplayTitle { get; set; }
public int Index { get; set; }
public SubtitleDeliveryMethod DeliveryMethod { get; set; }
public bool IsExternalUrl { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace MediaBrowser.Model.Dlna
{
public enum TranscodeSeekInfo
{
Auto = 0,
Bytes = 1
}
}

View File

@@ -0,0 +1,59 @@
using System.Collections.Generic;
using System.Xml.Serialization;
using MediaBrowser.Model.Dlna;
namespace MediaBrowser.Model.Dlna
{
public class TranscodingProfile
{
[XmlAttribute("container")]
public string Container { get; set; }
[XmlAttribute("type")]
public DlnaProfileType Type { get; set; }
[XmlAttribute("videoCodec")]
public string VideoCodec { get; set; }
[XmlAttribute("audioCodec")]
public string AudioCodec { get; set; }
[XmlAttribute("protocol")]
public string Protocol { get; set; }
[XmlAttribute("estimateContentLength")]
public bool EstimateContentLength { get; set; }
[XmlAttribute("enableMpegtsM2TsMode")]
public bool EnableMpegtsM2TsMode { get; set; }
[XmlAttribute("transcodeSeekInfo")]
public TranscodeSeekInfo TranscodeSeekInfo { get; set; }
[XmlAttribute("copyTimestamps")]
public bool CopyTimestamps { get; set; }
[XmlAttribute("context")]
public EncodingContext Context { get; set; }
[XmlAttribute("enableSubtitlesInManifest")]
public bool EnableSubtitlesInManifest { get; set; }
[XmlAttribute("maxAudioChannels")]
public string MaxAudioChannels { get; set; }
[XmlAttribute("minSegments")]
public int MinSegments { get; set; }
[XmlAttribute("segmentLength")]
public int SegmentLength { get; set; }
[XmlAttribute("breakOnNonKeyFrames")]
public bool BreakOnNonKeyFrames { get; set; }
public string[] GetAudioCodecs()
{
return ContainerProfile.SplitValue(AudioCodec);
}
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Net;
namespace MediaBrowser.Model.Dlna
{
public class UpnpDeviceInfo
{
public Uri Location { get; set; }
public Dictionary<string, string> Headers { get; set; }
public IpAddressInfo LocalIpAddress { get; set; }
public int LocalPort { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace MediaBrowser.Model.Dlna
{
/// <summary>
/// Class VideoOptions.
/// </summary>
public class VideoOptions : AudioOptions
{
public int? AudioStreamIndex { get; set; }
public int? SubtitleStreamIndex { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using System.Xml.Serialization;
namespace MediaBrowser.Model.Dlna
{
public class XmlAttribute
{
[XmlAttribute("name")]
public string Name { get; set; }
[XmlAttribute("value")]
public string Value { get; set; }
}
}

View File

@@ -0,0 +1,91 @@
namespace MediaBrowser.Model.Drawing
{
/// <summary>
/// Class DrawingUtils
/// </summary>
public static class DrawingUtils
{
/// <summary>
/// Resizes a set of dimensions
/// </summary>
/// <param name="size">The original size object</param>
/// <param name="width">A new fixed width, if desired</param>
/// <param name="height">A new fixed height, if desired</param>
/// <param name="maxWidth">A max fixed width, if desired</param>
/// <param name="maxHeight">A max fixed height, if desired</param>
/// <returns>A new size object</returns>
public static ImageSize Resize(ImageSize size,
double width,
double height,
double maxWidth,
double maxHeight)
{
double newWidth = size.Width;
double newHeight = size.Height;
if (width > 0 && height > 0)
{
newWidth = width;
newHeight = height;
}
else if (height > 0)
{
newWidth = GetNewWidth(newHeight, newWidth, height);
newHeight = height;
}
else if (width > 0)
{
newHeight = GetNewHeight(newHeight, newWidth, width);
newWidth = width;
}
if (maxHeight > 0 && maxHeight < newHeight)
{
newWidth = GetNewWidth(newHeight, newWidth, maxHeight);
newHeight = maxHeight;
}
if (maxWidth > 0 && maxWidth < newWidth)
{
newHeight = GetNewHeight(newHeight, newWidth, maxWidth);
newWidth = maxWidth;
}
return new ImageSize { Width = newWidth, Height = newHeight };
}
/// <summary>
/// Gets the new width.
/// </summary>
/// <param name="currentHeight">Height of the current.</param>
/// <param name="currentWidth">Width of the current.</param>
/// <param name="newHeight">The new height.</param>
/// <returns>System.Double.</returns>
private static double GetNewWidth(double currentHeight, double currentWidth, double newHeight)
{
double scaleFactor = newHeight;
scaleFactor /= currentHeight;
scaleFactor *= currentWidth;
return scaleFactor;
}
/// <summary>
/// Gets the new height.
/// </summary>
/// <param name="currentHeight">Height of the current.</param>
/// <param name="currentWidth">Width of the current.</param>
/// <param name="newWidth">The new width.</param>
/// <returns>System.Double.</returns>
private static double GetNewHeight(double currentHeight, double currentWidth, double newWidth)
{
double scaleFactor = newWidth;
scaleFactor /= currentWidth;
scaleFactor *= currentHeight;
return scaleFactor;
}
}
}

View File

@@ -0,0 +1,30 @@

namespace MediaBrowser.Model.Drawing
{
/// <summary>
/// Enum ImageOutputFormat
/// </summary>
public enum ImageFormat
{
/// <summary>
/// The BMP
/// </summary>
Bmp,
/// <summary>
/// The GIF
/// </summary>
Gif,
/// <summary>
/// The JPG
/// </summary>
Jpg,
/// <summary>
/// The PNG
/// </summary>
Png,
/// <summary>
/// The webp
/// </summary>
Webp
}
}

View File

@@ -0,0 +1,15 @@

namespace MediaBrowser.Model.Drawing
{
public enum ImageOrientation
{
TopLeft = 1,
TopRight = 2,
BottomRight = 3,
BottomLeft = 4,
LeftTop = 5,
RightTop = 6,
RightBottom = 7,
LeftBottom = 8,
}
}

View File

@@ -0,0 +1,93 @@
using System.Globalization;
namespace MediaBrowser.Model.Drawing
{
/// <summary>
/// Struct ImageSize
/// </summary>
public struct ImageSize
{
private double _height;
private double _width;
/// <summary>
/// Gets or sets the height.
/// </summary>
/// <value>The height.</value>
public double Height
{
get
{
return _height;
}
set
{
_height = value;
}
}
/// <summary>
/// Gets or sets the width.
/// </summary>
/// <value>The width.</value>
public double Width
{
get { return _width; }
set { _width = value; }
}
public bool Equals(ImageSize size)
{
return Width.Equals(size.Width) && Height.Equals(size.Height);
}
public override string ToString()
{
return string.Format("{0}-{1}", Width, Height);
}
public ImageSize(string value)
{
_width = 0;
_height = 0;
ParseValue(value);
}
public ImageSize(int width, int height)
{
_width = width;
_height = height;
}
public ImageSize(double width, double height)
{
_width = width;
_height = height;
}
private void ParseValue(string value)
{
if (!string.IsNullOrEmpty(value))
{
string[] parts = value.Split('-');
if (parts.Length == 2)
{
double val;
if (double.TryParse(parts[0], NumberStyles.Any, CultureInfo.InvariantCulture, out val))
{
_width = val;
}
if (double.TryParse(parts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out val))
{
_height = val;
}
}
}
}
}
}

View File

@@ -0,0 +1,791 @@
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Library;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Sync;
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Serialization;
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// This is strictly used as a data transfer object from the api layer.
/// This holds information about a BaseItem in a format that is convenient for the client.
/// </summary>
public class BaseItemDto : IHasProviderIds, IItemDto, IHasServerId
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
public string OriginalTitle { get; set; }
/// <summary>
/// Gets or sets the server identifier.
/// </summary>
/// <value>The server identifier.</value>
public string ServerId { get; set; }
/// <summary>
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the etag.
/// </summary>
/// <value>The etag.</value>
public string Etag { get; set; }
/// <summary>
/// Gets or sets the type of the source.
/// </summary>
/// <value>The type of the source.</value>
public string SourceType { get; set; }
/// <summary>
/// Gets or sets the playlist item identifier.
/// </summary>
/// <value>The playlist item identifier.</value>
public string PlaylistItemId { get; set; }
/// <summary>
/// Gets or sets the date created.
/// </summary>
/// <value>The date created.</value>
public DateTime? DateCreated { get; set; }
public DateTime? DateLastMediaAdded { get; set; }
public string ExtraType { get; set; }
public int? AirsBeforeSeasonNumber { get; set; }
public int? AirsAfterSeasonNumber { get; set; }
public int? AirsBeforeEpisodeNumber { get; set; }
public bool? DisplaySpecialsWithSeasons { get; set; }
public bool? CanDelete { get; set; }
public bool? CanDownload { get; set; }
public bool? HasSubtitles { get; set; }
public string PreferredMetadataLanguage { get; set; }
public string PreferredMetadataCountryCode { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [supports synchronize].
/// </summary>
public bool? SupportsSync { get; set; }
public string Container { get; set; }
/// <summary>
/// Gets or sets the name of the sort.
/// </summary>
/// <value>The name of the sort.</value>
public string SortName { get; set; }
public string ForcedSortName { get; set; }
/// <summary>
/// Gets or sets the video3 D format.
/// </summary>
/// <value>The video3 D format.</value>
public Video3DFormat? Video3DFormat { get; set; }
/// <summary>
/// Gets or sets the premiere date.
/// </summary>
/// <value>The premiere date.</value>
public DateTime? PremiereDate { get; set; }
/// <summary>
/// Gets or sets the external urls.
/// </summary>
/// <value>The external urls.</value>
public ExternalUrl[] ExternalUrls { get; set; }
/// <summary>
/// Gets or sets the media versions.
/// </summary>
/// <value>The media versions.</value>
public MediaSourceInfo[] MediaSources { get; set; }
/// <summary>
/// Gets or sets the critic rating.
/// </summary>
/// <value>The critic rating.</value>
public float? CriticRating { get; set; }
/// <summary>
/// Gets or sets the game system.
/// </summary>
/// <value>The game system.</value>
public string GameSystem { get; set; }
public string[] ProductionLocations { get; set; }
public string[] MultiPartGameFiles { get; set; }
/// <summary>
/// Gets or sets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; set; }
public bool? EnableMediaSourceDisplay { get; set; }
/// <summary>
/// Gets or sets the official rating.
/// </summary>
/// <value>The official rating.</value>
public string OfficialRating { get; set; }
/// <summary>
/// Gets or sets the custom rating.
/// </summary>
/// <value>The custom rating.</value>
public string CustomRating { get; set; }
/// <summary>
/// Gets or sets the channel identifier.
/// </summary>
/// <value>The channel identifier.</value>
public Guid ChannelId { get; set; }
public string ChannelName { get; set; }
public string ServiceName { get; set; }
/// <summary>
/// Gets or sets the overview.
/// </summary>
/// <value>The overview.</value>
public string Overview { get; set; }
/// <summary>
/// Gets or sets the taglines.
/// </summary>
/// <value>The taglines.</value>
public string[] Taglines { get; set; }
/// <summary>
/// Gets or sets the genres.
/// </summary>
/// <value>The genres.</value>
public string[] Genres { get; set; }
/// <summary>
/// Gets or sets the community rating.
/// </summary>
/// <value>The community rating.</value>
public float? CommunityRating { get; set; }
/// <summary>
/// Gets or sets the cumulative run time ticks.
/// </summary>
/// <value>The cumulative run time ticks.</value>
public long? CumulativeRunTimeTicks { get; set; }
/// <summary>
/// Gets or sets the run time ticks.
/// </summary>
/// <value>The run time ticks.</value>
public long? RunTimeTicks { get; set; }
/// <summary>
/// Gets or sets the play access.
/// </summary>
/// <value>The play access.</value>
public PlayAccess? PlayAccess { get; set; }
/// <summary>
/// Gets or sets the aspect ratio.
/// </summary>
/// <value>The aspect ratio.</value>
public string AspectRatio { get; set; }
/// <summary>
/// Gets or sets the production year.
/// </summary>
/// <value>The production year.</value>
public int? ProductionYear { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is place holder.
/// </summary>
/// <value><c>null</c> if [is place holder] contains no value, <c>true</c> if [is place holder]; otherwise, <c>false</c>.</value>
public bool? IsPlaceHolder { get; set; }
/// <summary>
/// Gets or sets the number.
/// </summary>
/// <value>The number.</value>
public string Number { get; set; }
public string ChannelNumber { get; set; }
/// <summary>
/// Gets or sets the index number.
/// </summary>
/// <value>The index number.</value>
public int? IndexNumber { get; set; }
/// <summary>
/// Gets or sets the index number end.
/// </summary>
/// <value>The index number end.</value>
public int? IndexNumberEnd { get; set; }
/// <summary>
/// Gets or sets the parent index number.
/// </summary>
/// <value>The parent index number.</value>
public int? ParentIndexNumber { get; set; }
/// <summary>
/// Gets or sets the trailer urls.
/// </summary>
/// <value>The trailer urls.</value>
public MediaUrl[] RemoteTrailers { get; set; }
/// <summary>
/// Gets or sets the provider ids.
/// </summary>
/// <value>The provider ids.</value>
public Dictionary<string, string> ProviderIds { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is HD.
/// </summary>
/// <value><c>null</c> if [is HD] contains no value, <c>true</c> if [is HD]; otherwise, <c>false</c>.</value>
public bool? IsHD { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is folder.
/// </summary>
/// <value><c>true</c> if this instance is folder; otherwise, <c>false</c>.</value>
public bool? IsFolder { get; set; }
/// <summary>
/// Gets or sets the parent id.
/// </summary>
/// <value>The parent id.</value>
public Guid ParentId { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public string Type { get; set; }
/// <summary>
/// Gets or sets the people.
/// </summary>
/// <value>The people.</value>
public BaseItemPerson[] People { get; set; }
/// <summary>
/// Gets or sets the studios.
/// </summary>
/// <value>The studios.</value>
public NameGuidPair[] Studios { get; set; }
public NameGuidPair[] GenreItems { get; set; }
/// <summary>
/// If the item does not have a logo, this will hold the Id of the Parent that has one.
/// </summary>
/// <value>The parent logo item id.</value>
public string ParentLogoItemId { get; set; }
/// <summary>
/// If the item does not have any backdrops, this will hold the Id of the Parent that has one.
/// </summary>
/// <value>The parent backdrop item id.</value>
public string ParentBackdropItemId { get; set; }
/// <summary>
/// Gets or sets the parent backdrop image tags.
/// </summary>
/// <value>The parent backdrop image tags.</value>
public string[] ParentBackdropImageTags { get; set; }
/// <summary>
/// Gets or sets the local trailer count.
/// </summary>
/// <value>The local trailer count.</value>
public int? LocalTrailerCount { get; set; }
/// <summary>
/// User data for this item based on the user it's being requested for
/// </summary>
/// <value>The user data.</value>
public UserItemDataDto UserData { get; set; }
/// <summary>
/// Gets or sets the recursive item count.
/// </summary>
/// <value>The recursive item count.</value>
public int? RecursiveItemCount { get; set; }
/// <summary>
/// Gets or sets the child count.
/// </summary>
/// <value>The child count.</value>
public int? ChildCount { get; set; }
/// <summary>
/// Gets or sets the name of the series.
/// </summary>
/// <value>The name of the series.</value>
public string SeriesName { get; set; }
/// <summary>
/// Gets or sets the series id.
/// </summary>
/// <value>The series id.</value>
public Guid SeriesId { get; set; }
/// <summary>
/// Gets or sets the season identifier.
/// </summary>
/// <value>The season identifier.</value>
public Guid SeasonId { get; set; }
/// <summary>
/// Gets or sets the special feature count.
/// </summary>
/// <value>The special feature count.</value>
public int? SpecialFeatureCount { get; set; }
/// <summary>
/// Gets or sets the display preferences id.
/// </summary>
/// <value>The display preferences id.</value>
public string DisplayPreferencesId { get; set; }
/// <summary>
/// Gets or sets the status.
/// </summary>
/// <value>The status.</value>
public string Status { get; set; }
/// <summary>
/// Gets or sets the air time.
/// </summary>
/// <value>The air time.</value>
public string AirTime { get; set; }
/// <summary>
/// Gets or sets the air days.
/// </summary>
/// <value>The air days.</value>
public DayOfWeek[] AirDays { get; set; }
/// <summary>
/// Gets or sets the tags.
/// </summary>
/// <value>The tags.</value>
public string[] Tags { get; set; }
/// <summary>
/// Gets or sets the primary image aspect ratio, after image enhancements.
/// </summary>
/// <value>The primary image aspect ratio.</value>
public double? PrimaryImageAspectRatio { get; set; }
/// <summary>
/// Gets or sets the artists.
/// </summary>
/// <value>The artists.</value>
public string[] Artists { get; set; }
/// <summary>
/// Gets or sets the artist items.
/// </summary>
/// <value>The artist items.</value>
public NameGuidPair[] ArtistItems { get; set; }
/// <summary>
/// Gets or sets the album.
/// </summary>
/// <value>The album.</value>
public string Album { get; set; }
/// <summary>
/// Gets or sets the type of the collection.
/// </summary>
/// <value>The type of the collection.</value>
public string CollectionType { get; set; }
/// <summary>
/// Gets or sets the display order.
/// </summary>
/// <value>The display order.</value>
public string DisplayOrder { get; set; }
/// <summary>
/// Gets or sets the album id.
/// </summary>
/// <value>The album id.</value>
public Guid AlbumId { get; set; }
/// <summary>
/// Gets or sets the album image tag.
/// </summary>
/// <value>The album image tag.</value>
public string AlbumPrimaryImageTag { get; set; }
/// <summary>
/// Gets or sets the series primary image tag.
/// </summary>
/// <value>The series primary image tag.</value>
public string SeriesPrimaryImageTag { get; set; }
/// <summary>
/// Gets or sets the album artist.
/// </summary>
/// <value>The album artist.</value>
public string AlbumArtist { get; set; }
/// <summary>
/// Gets or sets the album artists.
/// </summary>
/// <value>The album artists.</value>
public NameGuidPair[] AlbumArtists { get; set; }
/// <summary>
/// Gets or sets the name of the season.
/// </summary>
/// <value>The name of the season.</value>
public string SeasonName { get; set; }
/// <summary>
/// Gets or sets the media streams.
/// </summary>
/// <value>The media streams.</value>
public MediaStream[] MediaStreams { get; set; }
/// <summary>
/// Gets or sets the type of the video.
/// </summary>
/// <value>The type of the video.</value>
public VideoType? VideoType { get; set; }
/// <summary>
/// Gets or sets the part count.
/// </summary>
/// <value>The part count.</value>
public int? PartCount { get; set; }
public int? MediaSourceCount { get; set; }
/// <summary>
/// Determines whether the specified type is type.
/// </summary>
/// <param name="type">The type.</param>
/// <returns><c>true</c> if the specified type is type; otherwise, <c>false</c>.</returns>
public bool IsType(Type type)
{
return IsType(type.Name);
}
/// <summary>
/// Determines whether the specified type is type.
/// </summary>
/// <param name="type">The type.</param>
/// <returns><c>true</c> if the specified type is type; otherwise, <c>false</c>.</returns>
public bool IsType(string type)
{
return StringHelper.EqualsIgnoreCase(Type, type);
}
/// <summary>
/// Gets or sets the image tags.
/// </summary>
/// <value>The image tags.</value>
public Dictionary<ImageType, string> ImageTags { get; set; }
/// <summary>
/// Gets or sets the backdrop image tags.
/// </summary>
/// <value>The backdrop image tags.</value>
public string[] BackdropImageTags { get; set; }
/// <summary>
/// Gets or sets the screenshot image tags.
/// </summary>
/// <value>The screenshot image tags.</value>
public string[] ScreenshotImageTags { get; set; }
/// <summary>
/// Gets or sets the parent logo image tag.
/// </summary>
/// <value>The parent logo image tag.</value>
public string ParentLogoImageTag { get; set; }
/// <summary>
/// If the item does not have a art, this will hold the Id of the Parent that has one.
/// </summary>
/// <value>The parent art item id.</value>
public string ParentArtItemId { get; set; }
/// <summary>
/// Gets or sets the parent art image tag.
/// </summary>
/// <value>The parent art image tag.</value>
public string ParentArtImageTag { get; set; }
/// <summary>
/// Gets or sets the series thumb image tag.
/// </summary>
/// <value>The series thumb image tag.</value>
public string SeriesThumbImageTag { get; set; }
/// <summary>
/// Gets or sets the series studio.
/// </summary>
/// <value>The series studio.</value>
public string SeriesStudio { get; set; }
/// <summary>
/// Gets or sets the parent thumb item id.
/// </summary>
/// <value>The parent thumb item id.</value>
public string ParentThumbItemId { get; set; }
/// <summary>
/// Gets or sets the parent thumb image tag.
/// </summary>
/// <value>The parent thumb image tag.</value>
public string ParentThumbImageTag { get; set; }
/// <summary>
/// Gets or sets the parent primary image item identifier.
/// </summary>
/// <value>The parent primary image item identifier.</value>
public string ParentPrimaryImageItemId { get; set; }
/// <summary>
/// Gets or sets the parent primary image tag.
/// </summary>
/// <value>The parent primary image tag.</value>
public string ParentPrimaryImageTag { get; set; }
/// <summary>
/// Gets or sets the chapters.
/// </summary>
/// <value>The chapters.</value>
public List<ChapterInfo> Chapters { get; set; }
/// <summary>
/// Gets or sets the type of the location.
/// </summary>
/// <value>The type of the location.</value>
public LocationType? LocationType { get; set; }
/// <summary>
/// Gets or sets the type of the iso.
/// </summary>
/// <value>The type of the iso.</value>
public IsoType? IsoType { get; set; }
/// <summary>
/// Gets or sets the type of the media.
/// </summary>
/// <value>The type of the media.</value>
public string MediaType { get; set; }
/// <summary>
/// Gets or sets the end date.
/// </summary>
/// <value>The end date.</value>
public DateTime? EndDate { get; set; }
/// <summary>
/// Gets or sets the home page URL.
/// </summary>
/// <value>The home page URL.</value>
public string HomePageUrl { get; set; }
/// <summary>
/// Gets or sets the locked fields.
/// </summary>
/// <value>The locked fields.</value>
public MetadataFields[] LockedFields { get; set; }
/// <summary>
/// Gets or sets the trailer count.
/// </summary>
/// <value>The trailer count.</value>
public int? TrailerCount { get; set; }
/// <summary>
/// Gets or sets the movie count.
/// </summary>
/// <value>The movie count.</value>
public int? MovieCount { get; set; }
/// <summary>
/// Gets or sets the series count.
/// </summary>
/// <value>The series count.</value>
public int? SeriesCount { get; set; }
public int? ProgramCount { get; set; }
/// <summary>
/// Gets or sets the episode count.
/// </summary>
/// <value>The episode count.</value>
public int? EpisodeCount { get; set; }
/// <summary>
/// Gets or sets the game count.
/// </summary>
/// <value>The game count.</value>
public int? GameCount { get; set; }
/// <summary>
/// Gets or sets the song count.
/// </summary>
/// <value>The song count.</value>
public int? SongCount { get; set; }
/// <summary>
/// Gets or sets the album count.
/// </summary>
/// <value>The album count.</value>
public int? AlbumCount { get; set; }
public int? ArtistCount { get; set; }
/// <summary>
/// Gets or sets the music video count.
/// </summary>
/// <value>The music video count.</value>
public int? MusicVideoCount { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [enable internet providers].
/// </summary>
/// <value><c>true</c> if [enable internet providers]; otherwise, <c>false</c>.</value>
public bool? LockData { get; set; }
public int? Width { get; set; }
public int? Height { get; set; }
public string CameraMake { get; set; }
public string CameraModel { get; set; }
public string Software { get; set; }
public double? ExposureTime { get; set; }
public double? FocalLength { get; set; }
public ImageOrientation? ImageOrientation { get; set; }
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; }
/// <summary>
/// Used by RecordingGroup
/// </summary>
public int? RecordingCount { get; set; }
/// <summary>
/// Gets or sets the series timer identifier.
/// </summary>
/// <value>The series timer identifier.</value>
public string SeriesTimerId { get; set; }
/// <summary>
/// Gets or sets the program identifier.
/// </summary>
/// <value>The program identifier.</value>
public string ProgramId { get; set; }
/// <summary>
/// Gets or sets the channel primary image tag.
/// </summary>
/// <value>The channel primary image tag.</value>
public string ChannelPrimaryImageTag { get; set; }
/// <summary>
/// The start date of the recording, in UTC.
/// </summary>
public DateTime? StartDate { get; set; }
/// <summary>
/// Gets or sets the completion percentage.
/// </summary>
/// <value>The completion percentage.</value>
public double? CompletionPercentage { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is repeat.
/// </summary>
/// <value><c>true</c> if this instance is repeat; otherwise, <c>false</c>.</value>
public bool? IsRepeat { get; set; }
/// <summary>
/// Gets or sets the episode title.
/// </summary>
/// <value>The episode title.</value>
public string EpisodeTitle { get; set; }
/// <summary>
/// Gets or sets the type of the channel.
/// </summary>
/// <value>The type of the channel.</value>
public ChannelType? ChannelType { get; set; }
/// <summary>
/// Gets or sets the audio.
/// </summary>
/// <value>The audio.</value>
public ProgramAudio? Audio { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is movie.
/// </summary>
/// <value><c>true</c> if this instance is movie; otherwise, <c>false</c>.</value>
public bool? IsMovie { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is sports.
/// </summary>
/// <value><c>true</c> if this instance is sports; otherwise, <c>false</c>.</value>
public bool? IsSports { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is series.
/// </summary>
/// <value><c>true</c> if this instance is series; otherwise, <c>false</c>.</value>
public bool? IsSeries { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is live.
/// </summary>
/// <value><c>true</c> if this instance is live; otherwise, <c>false</c>.</value>
public bool? IsLive { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is news.
/// </summary>
/// <value><c>true</c> if this instance is news; otherwise, <c>false</c>.</value>
public bool? IsNews { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is kids.
/// </summary>
/// <value><c>true</c> if this instance is kids; otherwise, <c>false</c>.</value>
public bool? IsKids { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is premiere.
/// </summary>
/// <value><c>true</c> if this instance is premiere; otherwise, <c>false</c>.</value>
public bool? IsPremiere { get; set; }
/// <summary>
/// Gets or sets the timer identifier.
/// </summary>
/// <value>The timer identifier.</value>
public string TimerId { get; set; }
/// <summary>
/// Gets or sets the current program.
/// </summary>
/// <value>The current program.</value>
public BaseItemDto CurrentProgram { get; set; }
}
}

View File

@@ -0,0 +1,53 @@
using MediaBrowser.Model.Serialization;
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// This is used by the api to get information about a Person within a BaseItem
/// </summary>
public class BaseItemPerson
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public string Id { get; set; }
/// <summary>
/// Gets or sets the role.
/// </summary>
/// <value>The role.</value>
public string Role { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public string Type { get; set; }
/// <summary>
/// Gets or sets the primary image tag.
/// </summary>
/// <value>The primary image tag.</value>
public string PrimaryImageTag { get; set; }
/// <summary>
/// Gets a value indicating whether this instance has primary image.
/// </summary>
/// <value><c>true</c> if this instance has primary image; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool HasPrimaryImage
{
get
{
return PrimaryImageTag != null;
}
}
}
}

View File

@@ -0,0 +1,38 @@
using MediaBrowser.Model.Serialization;
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Class ChapterInfo
/// </summary>
public class ChapterInfoDto
{
/// <summary>
/// Gets or sets the start position ticks.
/// </summary>
/// <value>The start position ticks.</value>
public long StartPositionTicks { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the image tag.
/// </summary>
/// <value>The image tag.</value>
public string ImageTag { get; set; }
/// <summary>
/// Gets a value indicating whether this instance has image.
/// </summary>
/// <value><c>true</c> if this instance has image; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool HasImage
{
get { return ImageTag != null; }
}
}
}

View File

@@ -0,0 +1,49 @@
using System.Collections.Generic;
using System;
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Class GameSystemSummary
/// </summary>
public class GameSystemSummary
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string DisplayName { get; set; }
/// <summary>
/// Gets or sets the game count.
/// </summary>
/// <value>The game count.</value>
public int GameCount { get; set; }
/// <summary>
/// Gets or sets the game extensions.
/// </summary>
/// <value>The game extensions.</value>
public string[] GameFileExtensions { get; set; }
/// <summary>
/// Gets or sets the client installed game count.
/// </summary>
/// <value>The client installed game count.</value>
public int ClientInstalledGameCount { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="GameSystemSummary"/> class.
/// </summary>
public GameSystemSummary()
{
GameFileExtensions = new string[] {};
}
}
}

View File

@@ -0,0 +1,8 @@

namespace MediaBrowser.Model.Dto
{
public interface IHasServerId
{
string ServerId { get; }
}
}

View File

@@ -0,0 +1,15 @@

namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Interface IItemDto
/// </summary>
public interface IItemDto
{
/// <summary>
/// Gets or sets the primary image aspect ratio.
/// </summary>
/// <value>The primary image aspect ratio.</value>
double? PrimaryImageAspectRatio { get; set; }
}
}

View File

@@ -0,0 +1,32 @@

namespace MediaBrowser.Model.Dto
{
public class ImageByNameInfo
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the theme.
/// </summary>
/// <value>The theme.</value>
public string Theme { get; set; }
/// <summary>
/// Gets or sets the context.
/// </summary>
/// <value>The context.</value>
public string Context { get; set; }
/// <summary>
/// Gets or sets the length of the file.
/// </summary>
/// <value>The length of the file.</value>
public long FileLength { get; set; }
/// <summary>
/// Gets or sets the format.
/// </summary>
/// <value>The format.</value>
public string Format { get; set; }
}
}

View File

@@ -0,0 +1,51 @@
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Class ImageInfo
/// </summary>
public class ImageInfo
{
/// <summary>
/// Gets or sets the type of the image.
/// </summary>
/// <value>The type of the image.</value>
public ImageType ImageType { get; set; }
/// <summary>
/// Gets or sets the index of the image.
/// </summary>
/// <value>The index of the image.</value>
public int? ImageIndex { get; set; }
/// <summary>
/// The image tag
/// </summary>
public string ImageTag;
/// <summary>
/// Gets or sets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; set; }
/// <summary>
/// Gets or sets the height.
/// </summary>
/// <value>The height.</value>
public int? Height { get; set; }
/// <summary>
/// Gets or sets the width.
/// </summary>
/// <value>The width.</value>
public int? Width { get; set; }
/// <summary>
/// Gets or sets the size.
/// </summary>
/// <value>The size.</value>
public long Size { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More