mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-10 01:38:49 +01:00
16
MediaBrowser.Model/Activity/IActivityManager.cs
Normal file
16
MediaBrowser.Model/Activity/IActivityManager.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Querying;
|
||||
|
||||
namespace MediaBrowser.Model.Activity
|
||||
{
|
||||
public interface IActivityManager
|
||||
{
|
||||
event EventHandler<GenericEventArgs<ActivityLogEntry>> EntryCreated;
|
||||
|
||||
Task Create(ActivityLogEntry entry);
|
||||
|
||||
QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, int? startIndex, int? limit);
|
||||
}
|
||||
}
|
||||
13
MediaBrowser.Model/Activity/IActivityRepository.cs
Normal file
13
MediaBrowser.Model/Activity/IActivityRepository.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Querying;
|
||||
|
||||
namespace MediaBrowser.Model.Activity
|
||||
{
|
||||
public interface IActivityRepository
|
||||
{
|
||||
Task Create(ActivityLogEntry entry);
|
||||
|
||||
QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, int? startIndex, int? limit);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
public bool SaveLocalMetadata { get; set; }
|
||||
public bool EnableInternetProviders { get; set; }
|
||||
public bool ImportMissingEpisodes { get; set; }
|
||||
public bool EnableAutomaticSeriesGrouping { get; set; }
|
||||
|
||||
public LibraryOptions()
|
||||
{
|
||||
@@ -20,6 +22,7 @@
|
||||
EnableRealtimeMonitor = true;
|
||||
PathInfos = new MediaPathInfo[] { };
|
||||
EnableInternetProviders = true;
|
||||
EnableAutomaticSeriesGrouping = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace MediaBrowser.Model.Configuration
|
||||
{
|
||||
public class PeopleMetadataOptions
|
||||
{
|
||||
public bool DownloadActorMetadata { get; set; }
|
||||
public bool DownloadDirectorMetadata { get; set; }
|
||||
public bool DownloadProducerMetadata { get; set; }
|
||||
public bool DownloadWriterMetadata { get; set; }
|
||||
public bool DownloadComposerMetadata { get; set; }
|
||||
public bool DownloadOtherPeopleMetadata { get; set; }
|
||||
public bool DownloadGuestStarMetadata { get; set; }
|
||||
|
||||
public PeopleMetadataOptions()
|
||||
{
|
||||
DownloadActorMetadata = true;
|
||||
DownloadDirectorMetadata = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,9 @@ namespace MediaBrowser.Model.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>
|
||||
@@ -43,6 +46,7 @@ namespace MediaBrowser.Model.Configuration
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [use HTTPS]; otherwise, <c>false</c>.</value>
|
||||
public bool EnableHttps { get; set; }
|
||||
public bool EnableSeriesPresentationUniqueKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value pointing to the file system where the ssl certiifcate is located..
|
||||
@@ -151,7 +155,6 @@ namespace MediaBrowser.Model.Configuration
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [enable dashboard response caching]; otherwise, <c>false</c>.</value>
|
||||
public bool EnableDashboardResponseCaching { get; set; }
|
||||
public bool EnableDashboardResourceMinification { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Allows the dashboard to be served from a custom path.
|
||||
@@ -170,6 +173,7 @@ namespace MediaBrowser.Model.Configuration
|
||||
public bool EnableAutomaticRestart { get; set; }
|
||||
public bool SkipDeserializationForBasicTypes { get; set; }
|
||||
public bool SkipDeserializationForPrograms { get; set; }
|
||||
public bool SkipDeserializationForAudio { get; set; }
|
||||
|
||||
public PathSubstitution[] PathSubstitutions { get; set; }
|
||||
|
||||
@@ -178,8 +182,6 @@ namespace MediaBrowser.Model.Configuration
|
||||
|
||||
public string UICulture { get; set; }
|
||||
|
||||
public PeopleMetadataOptions PeopleMetadataOptions { get; set; }
|
||||
|
||||
public bool SaveMetadataHidden { get; set; }
|
||||
|
||||
public NameValuePair[] ContentTypes { get; set; }
|
||||
@@ -188,11 +190,7 @@ namespace MediaBrowser.Model.Configuration
|
||||
|
||||
public int SharingExpirationDays { get; set; }
|
||||
|
||||
public string[] Migrations { get; set; }
|
||||
|
||||
public int MigrationVersion { get; set; }
|
||||
public int SchemaVersion { get; set; }
|
||||
public int SqliteCacheSize { get; set; }
|
||||
|
||||
public bool EnableAnonymousUsageReporting { get; set; }
|
||||
public bool EnableStandaloneMusicKeys { get; set; }
|
||||
@@ -203,6 +201,7 @@ namespace MediaBrowser.Model.Configuration
|
||||
public bool DisplayCollectionsView { get; set; }
|
||||
public string[] LocalNetworkAddresses { get; set; }
|
||||
public string[] CodecsUsed { get; set; }
|
||||
public string[] Migrations { get; set; }
|
||||
public bool EnableChannelView { get; set; }
|
||||
public bool EnableExternalContentInSuggestions { get; set; }
|
||||
public bool EnableSimpleArtistDetection { get; set; }
|
||||
@@ -214,9 +213,8 @@ namespace MediaBrowser.Model.Configuration
|
||||
public ServerConfiguration()
|
||||
{
|
||||
LocalNetworkAddresses = new string[] { };
|
||||
Migrations = new string[] { };
|
||||
CodecsUsed = new string[] { };
|
||||
SqliteCacheSize = 0;
|
||||
Migrations = new string[] { };
|
||||
ImageExtractionTimeoutMs = 0;
|
||||
|
||||
EnableLocalizedGuids = true;
|
||||
@@ -224,13 +222,12 @@ namespace MediaBrowser.Model.Configuration
|
||||
EnableExternalContentInSuggestions = true;
|
||||
|
||||
ImageSavingConvention = ImageSavingConvention.Compatible;
|
||||
PublicPort = 8096;
|
||||
PublicHttpsPort = 8920;
|
||||
HttpServerPortNumber = 8096;
|
||||
HttpsPortNumber = 8920;
|
||||
PublicPort = DefaultHttpPort;
|
||||
PublicHttpsPort = DefaultHttpsPort;
|
||||
HttpServerPortNumber = DefaultHttpPort;
|
||||
HttpsPortNumber = DefaultHttpsPort;
|
||||
EnableHttps = false;
|
||||
EnableDashboardResponseCaching = true;
|
||||
EnableDashboardResourceMinification = true;
|
||||
EnableAnonymousUsageReporting = true;
|
||||
|
||||
EnableAutomaticRestart = true;
|
||||
@@ -262,8 +259,6 @@ namespace MediaBrowser.Model.Configuration
|
||||
|
||||
UICulture = "en-us";
|
||||
|
||||
PeopleMetadataOptions = new PeopleMetadataOptions();
|
||||
|
||||
MetadataOptions = new[]
|
||||
{
|
||||
new MetadataOptions(1, 1280) {ItemType = "Book"},
|
||||
|
||||
@@ -57,6 +57,7 @@ namespace MediaBrowser.Model.Configuration
|
||||
|
||||
HidePlayedInLatest = true;
|
||||
PlayDefaultAudioTrack = true;
|
||||
DisplayMissingEpisodes = true;
|
||||
|
||||
LatestItemsExcludes = new string[] { };
|
||||
OrderedViews = new string[] { };
|
||||
|
||||
13
MediaBrowser.Model/Cryptography/ICryptoProvider.cs
Normal file
13
MediaBrowser.Model/Cryptography/ICryptoProvider.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,6 @@ namespace MediaBrowser.Model.Devices
|
||||
{
|
||||
public class DeviceQuery
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [supports content uploading].
|
||||
/// </summary>
|
||||
/// <value><c>null</c> if [supports content uploading] contains no value, <c>true</c> if [supports content uploading]; otherwise, <c>false</c>.</value>
|
||||
public bool? SupportsContentUploading { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [supports unique identifier].
|
||||
/// </summary>
|
||||
|
||||
19
MediaBrowser.Model/Diagnostics/IProcess.cs
Normal file
19
MediaBrowser.Model/Diagnostics/IProcess.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Model.Diagnostics
|
||||
{
|
||||
public interface IProcess : IDisposable
|
||||
{
|
||||
event EventHandler Exited;
|
||||
|
||||
void Kill();
|
||||
bool WaitForExit(int timeMs);
|
||||
int ExitCode { get; }
|
||||
void Start();
|
||||
StreamWriter StandardInput { get; }
|
||||
StreamReader StandardError { get; }
|
||||
StreamReader StandardOutput { get; }
|
||||
ProcessOptions StartInfo { get; }
|
||||
}
|
||||
}
|
||||
24
MediaBrowser.Model/Diagnostics/IProcessFactory.cs
Normal file
24
MediaBrowser.Model/Diagnostics/IProcessFactory.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
@@ -21,7 +24,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
int? numVideoStreams,
|
||||
int? numAudioStreams,
|
||||
string videoCodecTag,
|
||||
bool? isAvc)
|
||||
bool? isAvc )
|
||||
{
|
||||
switch (condition.Property)
|
||||
{
|
||||
@@ -86,8 +89,8 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsVideoAudioConditionSatisfied(ProfileCondition condition,
|
||||
int? audioChannels,
|
||||
public bool IsVideoAudioConditionSatisfied(ProfileCondition condition,
|
||||
int? audioChannels,
|
||||
int? audioBitrate,
|
||||
string audioProfile,
|
||||
bool? isSecondaryTrack)
|
||||
@@ -116,7 +119,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
|
||||
int expected;
|
||||
if (IntHelper.TryParseCultureInvariant(condition.Value, out expected))
|
||||
if (int.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out expected))
|
||||
{
|
||||
switch (condition.Condition)
|
||||
{
|
||||
@@ -149,9 +152,9 @@ namespace MediaBrowser.Model.Dlna
|
||||
switch (condition.Condition)
|
||||
{
|
||||
case ProfileConditionType.EqualsAny:
|
||||
{
|
||||
return ListHelper.ContainsIgnoreCase(expected.Split('|'), currentValue);
|
||||
}
|
||||
{
|
||||
return ListHelper.ContainsIgnoreCase(expected.Split('|'), currentValue);
|
||||
}
|
||||
case ProfileConditionType.Equals:
|
||||
return StringHelper.EqualsIgnoreCase(currentValue, expected);
|
||||
case ProfileConditionType.NotEquals:
|
||||
@@ -170,7 +173,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
|
||||
bool expected;
|
||||
if (BoolHelper.TryParseCultureInvariant(condition.Value, out expected))
|
||||
if (bool.TryParse(condition.Value, out expected))
|
||||
{
|
||||
switch (condition.Condition)
|
||||
{
|
||||
@@ -195,7 +198,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
|
||||
float expected;
|
||||
if (FloatHelper.TryParseCultureInvariant(condition.Value, out expected))
|
||||
if (float.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out expected))
|
||||
{
|
||||
switch (condition.Condition)
|
||||
{
|
||||
@@ -214,7 +217,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool IsConditionSatisfied(ProfileCondition condition, double? currentValue)
|
||||
{
|
||||
if (!currentValue.HasValue)
|
||||
@@ -224,7 +227,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
|
||||
double expected;
|
||||
if (DoubleHelper.TryParseCultureInvariant(condition.Value, out expected))
|
||||
if (double.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out expected))
|
||||
{
|
||||
switch (condition.Condition)
|
||||
{
|
||||
@@ -243,7 +246,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool IsConditionSatisfied(ProfileCondition condition, TransportStreamTimestamp? timestamp)
|
||||
{
|
||||
if (!timestamp.HasValue)
|
||||
@@ -251,9 +254,9 @@ namespace MediaBrowser.Model.Dlna
|
||||
// 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:
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
@@ -26,5 +28,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool ContainsContainer(string container)
|
||||
{
|
||||
List<string> containers = GetContainers();
|
||||
|
||||
return containers.Count == 0 || ListHelper.ContainsIgnoreCase(containers, container ?? string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@ namespace MediaBrowser.Model.Dlna
|
||||
public string Id { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public DeviceProfileType ProfileType { get; set; }
|
||||
public MediaBrowser.Model.Dlna.DeviceProfileType ProfileType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the identification.
|
||||
/// </summary>
|
||||
/// <value>The identification.</value>
|
||||
public DeviceIdentification Identification { get; set; }
|
||||
public MediaBrowser.Model.Dlna.DeviceIdentification Identification { get; set; }
|
||||
|
||||
public string FriendlyName { get; set; }
|
||||
public string Manufacturer { get; set; }
|
||||
@@ -36,8 +36,8 @@ namespace MediaBrowser.Model.Dlna
|
||||
public string SerialNumber { get; set; }
|
||||
|
||||
public bool EnableAlbumArtInDidl { get; set; }
|
||||
public bool EnableSingleAlbumArtLimit { get; set; }
|
||||
public bool EnableSingleSubtitleLimit { get; set; }
|
||||
public bool EnableSingleAlbumArtLimit { get; set; }
|
||||
public bool EnableSingleSubtitleLimit { get; set; }
|
||||
|
||||
public string SupportedMediaTypes { get; set; }
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
public ResponseProfile[] ResponseProfiles { get; set; }
|
||||
|
||||
public SubtitleProfile[] SubtitleProfiles { get; set; }
|
||||
|
||||
|
||||
public DeviceProfile()
|
||||
{
|
||||
DirectPlayProfiles = new DirectPlayProfile[] { };
|
||||
@@ -108,9 +108,9 @@ namespace MediaBrowser.Model.Dlna
|
||||
CodecProfiles = new CodecProfile[] { };
|
||||
ContainerProfiles = new ContainerProfile[] { };
|
||||
SubtitleProfiles = new SubtitleProfile[] { };
|
||||
|
||||
|
||||
XmlRootAttributes = new XmlAttribute[] { };
|
||||
|
||||
|
||||
SupportedMediaTypes = "Audio,Photo,Video";
|
||||
MaxStreamingBitrate = 8000000;
|
||||
MaxStaticBitrate = 8000000;
|
||||
@@ -122,7 +122,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
List<string> list = new List<string>();
|
||||
foreach (string i in (SupportedMediaTypes ?? string.Empty).Split(','))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(i))
|
||||
if (!string.IsNullOrEmpty(i))
|
||||
list.Add(i);
|
||||
}
|
||||
return list;
|
||||
@@ -134,7 +134,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
foreach (var i in TranscodingProfiles)
|
||||
{
|
||||
if (i.Type != DlnaProfileType.Audio)
|
||||
if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Audio)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
foreach (var i in TranscodingProfiles)
|
||||
{
|
||||
if (i.Type != DlnaProfileType.Video)
|
||||
if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Video)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -191,7 +191,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
foreach (var i in ResponseProfiles)
|
||||
{
|
||||
if (i.Type != DlnaProfileType.Audio)
|
||||
if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Audio)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -208,12 +208,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
continue;
|
||||
}
|
||||
|
||||
ConditionProcessor conditionProcessor = new ConditionProcessor();
|
||||
var conditionProcessor = new MediaBrowser.Model.Dlna.ConditionProcessor();
|
||||
|
||||
var anyOff = false;
|
||||
foreach (ProfileCondition c in i.Conditions)
|
||||
{
|
||||
if (!conditionProcessor.IsAudioConditionSatisfied(c, audioChannels, audioBitrate))
|
||||
if (!conditionProcessor.IsAudioConditionSatisfied(GetModelProfileCondition(c), audioChannels, audioBitrate))
|
||||
{
|
||||
anyOff = true;
|
||||
break;
|
||||
@@ -230,13 +230,24 @@ namespace MediaBrowser.Model.Dlna
|
||||
return null;
|
||||
}
|
||||
|
||||
private MediaBrowser.Model.Dlna.ProfileCondition GetModelProfileCondition(ProfileCondition c)
|
||||
{
|
||||
return new MediaBrowser.Model.Dlna.ProfileCondition
|
||||
{
|
||||
Condition = c.Condition,
|
||||
IsRequired = c.IsRequired,
|
||||
Property = c.Property,
|
||||
Value = c.Value
|
||||
};
|
||||
}
|
||||
|
||||
public ResponseProfile GetImageMediaProfile(string container, int? width, int? height)
|
||||
{
|
||||
container = StringHelper.TrimStart(container ?? string.Empty, '.');
|
||||
|
||||
foreach (var i in ResponseProfiles)
|
||||
{
|
||||
if (i.Type != DlnaProfileType.Photo)
|
||||
if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Photo)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -247,12 +258,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
continue;
|
||||
}
|
||||
|
||||
ConditionProcessor conditionProcessor = new ConditionProcessor();
|
||||
var conditionProcessor = new MediaBrowser.Model.Dlna.ConditionProcessor();
|
||||
|
||||
var anyOff = false;
|
||||
foreach (ProfileCondition c in i.Conditions)
|
||||
{
|
||||
if (!conditionProcessor.IsImageConditionSatisfied(c, width, height))
|
||||
if (!conditionProcessor.IsImageConditionSatisfied(GetModelProfileCondition(c), width, height))
|
||||
{
|
||||
anyOff = true;
|
||||
break;
|
||||
@@ -269,7 +280,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
return null;
|
||||
}
|
||||
|
||||
public ResponseProfile GetVideoMediaProfile(string container,
|
||||
public ResponseProfile GetVideoMediaProfile(string container,
|
||||
string audioCodec,
|
||||
string videoCodec,
|
||||
int? width,
|
||||
@@ -292,7 +303,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
foreach (var i in ResponseProfiles)
|
||||
{
|
||||
if (i.Type != DlnaProfileType.Video)
|
||||
if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Video)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -315,12 +326,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
continue;
|
||||
}
|
||||
|
||||
ConditionProcessor conditionProcessor = new ConditionProcessor();
|
||||
var conditionProcessor = new MediaBrowser.Model.Dlna.ConditionProcessor();
|
||||
|
||||
var anyOff = false;
|
||||
foreach (ProfileCondition c in i.Conditions)
|
||||
{
|
||||
if (!conditionProcessor.IsVideoConditionSatisfied(c, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc))
|
||||
if (!conditionProcessor.IsVideoConditionSatisfied(GetModelProfileCondition(c), width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc))
|
||||
{
|
||||
anyOff = true;
|
||||
break;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Xml.Serialization;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
|
||||
11
MediaBrowser.Model/Dlna/IDeviceDiscovery.cs
Normal file
11
MediaBrowser.Model/Dlna/IDeviceDiscovery.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Xml.Serialization;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
|
||||
@@ -61,7 +61,8 @@ namespace MediaBrowser.Model.Dlna
|
||||
private static double GetVideoBitrateScaleFactor(string codec)
|
||||
{
|
||||
if (StringHelper.EqualsIgnoreCase(codec, "h265") ||
|
||||
StringHelper.EqualsIgnoreCase(codec, "hevc"))
|
||||
StringHelper.EqualsIgnoreCase(codec, "hevc") ||
|
||||
StringHelper.EqualsIgnoreCase(codec, "vp9"))
|
||||
{
|
||||
return .5;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
|
||||
@@ -6,6 +6,8 @@ using MediaBrowser.Model.MediaInfo;
|
||||
using MediaBrowser.Model.Session;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
@@ -408,6 +410,8 @@ namespace MediaBrowser.Model.Dlna
|
||||
audioStreamIndex = audioStream.Index;
|
||||
}
|
||||
|
||||
var allMediaStreams = item.MediaStreams;
|
||||
|
||||
MediaStream videoStream = item.VideoStream;
|
||||
|
||||
// TODO: This doesn't accout for situation of device being able to handle media bitrate, but wifi connection not fast enough
|
||||
@@ -423,7 +427,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
if (isEligibleForDirectPlay || isEligibleForDirectStream)
|
||||
{
|
||||
// See if it can be direct played
|
||||
PlayMethod? directPlay = GetVideoDirectPlayProfile(options, item, videoStream, audioStream, isEligibleForDirectPlay, isEligibleForDirectStream);
|
||||
PlayMethod? directPlay = GetVideoDirectPlayProfile(options, item, videoStream, audioStream, isEligibleForDirectPlay, isEligibleForDirectStream, allMediaStreams);
|
||||
|
||||
if (directPlay != null)
|
||||
{
|
||||
@@ -483,7 +487,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
if (!string.IsNullOrEmpty(transcodingProfile.MaxAudioChannels))
|
||||
{
|
||||
int transcodingMaxAudioChannels;
|
||||
if (IntHelper.TryParseCultureInvariant(transcodingProfile.MaxAudioChannels, out transcodingMaxAudioChannels))
|
||||
if (int.TryParse(transcodingProfile.MaxAudioChannels, NumberStyles.Any, CultureInfo.InvariantCulture, out transcodingMaxAudioChannels))
|
||||
{
|
||||
playlistItem.TranscodingMaxAudioChannels = transcodingMaxAudioChannels;
|
||||
}
|
||||
@@ -652,7 +656,8 @@ namespace MediaBrowser.Model.Dlna
|
||||
MediaStream videoStream,
|
||||
MediaStream audioStream,
|
||||
bool isEligibleForDirectPlay,
|
||||
bool isEligibleForDirectStream)
|
||||
bool isEligibleForDirectStream,
|
||||
List<MediaStream> allMediaStreams)
|
||||
{
|
||||
DeviceProfile profile = options.Profile;
|
||||
|
||||
@@ -700,7 +705,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
foreach (ContainerProfile i in profile.ContainerProfiles)
|
||||
{
|
||||
if (i.Type == DlnaProfileType.Video &&
|
||||
ListHelper.ContainsIgnoreCase(i.GetContainers(), container))
|
||||
i.ContainsContainer(container))
|
||||
{
|
||||
foreach (ProfileCondition c in i.Conditions)
|
||||
{
|
||||
@@ -975,7 +980,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
if (item.Bitrate.Value > maxBitrate.Value)
|
||||
{
|
||||
_logger.Info("Bitrate exceeds DirectPlay limit");
|
||||
_logger.Info("Bitrate exceeds DirectPlay limit: media bitrate: {0}, max bitrate: {1}", item.Bitrate.Value.ToString(CultureInfo.InvariantCulture), maxBitrate.Value.ToString(CultureInfo.InvariantCulture));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1039,7 +1044,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.AudioBitrate:
|
||||
{
|
||||
int num;
|
||||
if (IntHelper.TryParseCultureInvariant(value, out num))
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.AudioBitrate = num;
|
||||
}
|
||||
@@ -1048,12 +1053,28 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.AudioChannels:
|
||||
{
|
||||
int num;
|
||||
if (IntHelper.TryParseCultureInvariant(value, out num))
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.MaxAudioChannels = num;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ProfileConditionValue.IsAvc:
|
||||
{
|
||||
bool isAvc;
|
||||
if (bool.TryParse(value, out isAvc))
|
||||
{
|
||||
if (isAvc && condition.Condition == ProfileConditionType.Equals)
|
||||
{
|
||||
item.RequireAvc = true;
|
||||
}
|
||||
else if (!isAvc && condition.Condition == ProfileConditionType.NotEquals)
|
||||
{
|
||||
item.RequireAvc = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ProfileConditionValue.IsAnamorphic:
|
||||
case ProfileConditionValue.AudioProfile:
|
||||
case ProfileConditionValue.Has64BitOffsets:
|
||||
@@ -1069,7 +1090,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.RefFrames:
|
||||
{
|
||||
int num;
|
||||
if (IntHelper.TryParseCultureInvariant(value, out num))
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.MaxRefFrames = num;
|
||||
}
|
||||
@@ -1078,7 +1099,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.VideoBitDepth:
|
||||
{
|
||||
int num;
|
||||
if (IntHelper.TryParseCultureInvariant(value, out num))
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.MaxVideoBitDepth = num;
|
||||
}
|
||||
@@ -1092,7 +1113,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.Height:
|
||||
{
|
||||
int num;
|
||||
if (IntHelper.TryParseCultureInvariant(value, out num))
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.MaxHeight = num;
|
||||
}
|
||||
@@ -1101,7 +1122,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.VideoBitrate:
|
||||
{
|
||||
int num;
|
||||
if (IntHelper.TryParseCultureInvariant(value, out num))
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.VideoBitrate = num;
|
||||
}
|
||||
@@ -1110,7 +1131,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.VideoFramerate:
|
||||
{
|
||||
float num;
|
||||
if (FloatHelper.TryParseCultureInvariant(value, out num))
|
||||
if (float.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.MaxFramerate = num;
|
||||
}
|
||||
@@ -1119,7 +1140,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.VideoLevel:
|
||||
{
|
||||
int num;
|
||||
if (IntHelper.TryParseCultureInvariant(value, out num))
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.VideoLevel = num;
|
||||
}
|
||||
@@ -1128,12 +1149,14 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.Width:
|
||||
{
|
||||
int num;
|
||||
if (IntHelper.TryParseCultureInvariant(value, out num))
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.MaxWidth = num;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using MediaBrowser.Model.MediaInfo;
|
||||
using MediaBrowser.Model.Session;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
@@ -35,6 +36,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
public string VideoCodec { get; set; }
|
||||
public string VideoProfile { get; set; }
|
||||
|
||||
public bool RequireAvc { get; set; }
|
||||
public bool CopyTimestamps { get; set; }
|
||||
public bool EnableSubtitlesInManifest { get; set; }
|
||||
public bool EnableSplittingOnNonKeyFrames { get; set; }
|
||||
@@ -266,6 +268,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
list.Add(new NameValuePair("Tag", item.MediaSource.ETag ?? string.Empty));
|
||||
list.Add(new NameValuePair("EnableSplittingOnNonKeyFrames", item.EnableSplittingOnNonKeyFrames.ToString().ToLower()));
|
||||
list.Add(new NameValuePair("RequireAvc", item.RequireAvc.ToString().ToLower()));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
|
||||
14
MediaBrowser.Model/Dlna/UpnpDeviceInfo.cs
Normal file
14
MediaBrowser.Model/Dlna/UpnpDeviceInfo.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using System.Globalization;
|
||||
|
||||
namespace MediaBrowser.Model.Drawing
|
||||
{
|
||||
@@ -71,12 +71,12 @@ namespace MediaBrowser.Model.Drawing
|
||||
{
|
||||
double val;
|
||||
|
||||
if (DoubleHelper.TryParseCultureInvariant(parts[0], out val))
|
||||
if (double.TryParse(parts[0], NumberStyles.Any, CultureInfo.InvariantCulture, out val))
|
||||
{
|
||||
_width = val;
|
||||
}
|
||||
|
||||
if (DoubleHelper.TryParseCultureInvariant(parts[1], out val))
|
||||
if (double.TryParse(parts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out val))
|
||||
{
|
||||
_height = val;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ using MediaBrowser.Model.Sync;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Model.Dto
|
||||
{
|
||||
@@ -729,6 +729,8 @@ namespace MediaBrowser.Model.Dto
|
||||
/// <value>The series studio.</value>
|
||||
public string SeriesStudio { get; set; }
|
||||
|
||||
public StudioDto SeriesStudioInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the parent thumb item id.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Model.Dto
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Model.Dto
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Model.Dto
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Model.Dto
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using MediaBrowser.Model.Connect;
|
||||
using MediaBrowser.Model.Users;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Model.Dto
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Model.Entities
|
||||
{
|
||||
@@ -132,6 +132,8 @@ namespace MediaBrowser.Model.Entities
|
||||
/// <value>The album.</value>
|
||||
public string Album { get; set; }
|
||||
|
||||
public bool IsThemeMedia { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the artists.
|
||||
/// </summary>
|
||||
|
||||
@@ -118,7 +118,9 @@ namespace MediaBrowser.Model.Entities
|
||||
|
||||
private string AddLanguageIfNeeded(string title)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Language) && title.IndexOf(Language, StringComparison.OrdinalIgnoreCase) == -1)
|
||||
if (!string.IsNullOrEmpty(Language) &&
|
||||
!string.Equals(Language, "und", StringComparison.OrdinalIgnoreCase) &&
|
||||
!IsLanguageInTitle(title, Language))
|
||||
{
|
||||
title = StringHelper.FirstToUpper(Language) + " " + title;
|
||||
}
|
||||
@@ -126,6 +128,16 @@ namespace MediaBrowser.Model.Entities
|
||||
return title;
|
||||
}
|
||||
|
||||
private bool IsLanguageInTitle(string title, string language)
|
||||
{
|
||||
if (title.IndexOf(Language, StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public string NalLengthSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace MediaBrowser.Model.Extensions
|
||||
{
|
||||
public static class BoolHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Tries the parse culture invariant.
|
||||
/// </summary>
|
||||
/// <param name="s">The s.</param>
|
||||
/// <param name="result">The result.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
public static bool TryParseCultureInvariant(string s, out bool result)
|
||||
{
|
||||
return bool.TryParse(s, out result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace MediaBrowser.Model.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Isolating these helpers allow this entire project to be easily converted to Java
|
||||
/// </summary>
|
||||
public static class DoubleHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Tries the parse culture invariant.
|
||||
/// </summary>
|
||||
/// <param name="s">The s.</param>
|
||||
/// <param name="result">The result.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
public static bool TryParseCultureInvariant(string s, out double result)
|
||||
{
|
||||
return double.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace MediaBrowser.Model.Extensions
|
||||
{
|
||||
public static class FloatHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Tries the parse culture invariant.
|
||||
/// </summary>
|
||||
/// <param name="s">The s.</param>
|
||||
/// <param name="result">The result.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
public static bool TryParseCultureInvariant(string s, out float result)
|
||||
{
|
||||
return float.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace MediaBrowser.Model.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Isolating these helpers allow this entire project to be easily converted to Java
|
||||
/// </summary>
|
||||
public static class IntHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Tries the parse culture invariant.
|
||||
/// </summary>
|
||||
/// <param name="s">The s.</param>
|
||||
/// <param name="result">The result.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
public static bool TryParseCultureInvariant(string s, out int result)
|
||||
{
|
||||
return int.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out result);
|
||||
}
|
||||
}
|
||||
}
|
||||
84
MediaBrowser.Model/Extensions/LinqExtensions.cs
Normal file
84
MediaBrowser.Model/Extensions/LinqExtensions.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Model.Extensions
|
||||
{
|
||||
// MoreLINQ - Extensions to LINQ to Objects
|
||||
// Copyright (c) 2008 Jonathan Skeet. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
public static class LinqExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns all distinct elements of the given source, where "distinctness"
|
||||
/// is determined via a projection and the default equality comparer for the projected type.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This operator uses deferred execution and streams the results, although
|
||||
/// a set of already-seen keys is retained. If a key is seen multiple times,
|
||||
/// only the first element with that key is returned.
|
||||
/// </remarks>
|
||||
/// <typeparam name="TSource">Type of the source sequence</typeparam>
|
||||
/// <typeparam name="TKey">Type of the projected element</typeparam>
|
||||
/// <param name="source">Source sequence</param>
|
||||
/// <param name="keySelector">Projection for determining "distinctness"</param>
|
||||
/// <returns>A sequence consisting of distinct elements from the source sequence,
|
||||
/// comparing them by the specified key projection.</returns>
|
||||
|
||||
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source,
|
||||
Func<TSource, TKey> keySelector)
|
||||
{
|
||||
return source.DistinctBy(keySelector, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all distinct elements of the given source, where "distinctness"
|
||||
/// is determined via a projection and the specified comparer for the projected type.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This operator uses deferred execution and streams the results, although
|
||||
/// a set of already-seen keys is retained. If a key is seen multiple times,
|
||||
/// only the first element with that key is returned.
|
||||
/// </remarks>
|
||||
/// <typeparam name="TSource">Type of the source sequence</typeparam>
|
||||
/// <typeparam name="TKey">Type of the projected element</typeparam>
|
||||
/// <param name="source">Source sequence</param>
|
||||
/// <param name="keySelector">Projection for determining "distinctness"</param>
|
||||
/// <param name="comparer">The equality comparer to use to determine whether or not keys are equal.
|
||||
/// If null, the default equality comparer for <c>TSource</c> is used.</param>
|
||||
/// <returns>A sequence consisting of distinct elements from the source sequence,
|
||||
/// comparing them by the specified key projection.</returns>
|
||||
|
||||
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source,
|
||||
Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
if (source == null) throw new ArgumentNullException("source");
|
||||
if (keySelector == null) throw new ArgumentNullException("keySelector");
|
||||
return DistinctByImpl(source, keySelector, comparer);
|
||||
}
|
||||
|
||||
private static IEnumerable<TSource> DistinctByImpl<TSource, TKey>(IEnumerable<TSource> source,
|
||||
Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
var knownKeys = new HashSet<TKey>(comparer);
|
||||
foreach (var element in source)
|
||||
{
|
||||
if (knownKeys.Add(keySelector(element)))
|
||||
{
|
||||
yield return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
58
MediaBrowser.Model/Globalization/ILocalizationManager.cs
Normal file
58
MediaBrowser.Model/Globalization/ILocalizationManager.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Model.Globalization
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface ILocalizationManager
|
||||
/// </summary>
|
||||
public interface ILocalizationManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the cultures.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{CultureDto}.</returns>
|
||||
IEnumerable<CultureDto> GetCultures();
|
||||
/// <summary>
|
||||
/// Gets the countries.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{CountryInfo}.</returns>
|
||||
IEnumerable<CountryInfo> GetCountries();
|
||||
/// <summary>
|
||||
/// Gets the parental ratings.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{ParentalRating}.</returns>
|
||||
IEnumerable<ParentalRating> GetParentalRatings();
|
||||
/// <summary>
|
||||
/// Gets the rating level.
|
||||
/// </summary>
|
||||
/// <param name="rating">The rating.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
int? GetRatingLevel(string rating);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the localized string.
|
||||
/// </summary>
|
||||
/// <param name="phrase">The phrase.</param>
|
||||
/// <param name="culture">The culture.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string GetLocalizedString(string phrase, string culture);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the localized string.
|
||||
/// </summary>
|
||||
/// <param name="phrase">The phrase.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string GetLocalizedString(string phrase);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the localization options.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{LocalizatonOption}.</returns>
|
||||
IEnumerable<LocalizatonOption> GetLocalizationOptions();
|
||||
|
||||
string RemoveDiacritics(string text);
|
||||
|
||||
string NormalizeFormKD(string text);
|
||||
}
|
||||
}
|
||||
12
MediaBrowser.Model/Health/IHealthMonitor.cs
Normal file
12
MediaBrowser.Model/Health/IHealthMonitor.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Notifications;
|
||||
|
||||
namespace MediaBrowser.Model.Health
|
||||
{
|
||||
public interface IHealthMonitor
|
||||
{
|
||||
Task<List<Notification>> GetNotifications(CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
56
MediaBrowser.Model/IO/FileSystemMetadata.cs
Normal file
56
MediaBrowser.Model/IO/FileSystemMetadata.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.IO
|
||||
{
|
||||
public class FileSystemMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="FileSystemMetadata"/> is exists.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if exists; otherwise, <c>false</c>.</value>
|
||||
public bool Exists { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the full name.
|
||||
/// </summary>
|
||||
/// <value>The full name.</value>
|
||||
public string FullName { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the extension.
|
||||
/// </summary>
|
||||
/// <value>The extension.</value>
|
||||
public string Extension { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the length.
|
||||
/// </summary>
|
||||
/// <value>The length.</value>
|
||||
public long Length { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the directory.
|
||||
/// </summary>
|
||||
/// <value>The name of the directory.</value>
|
||||
public string DirectoryName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the last write time UTC.
|
||||
/// </summary>
|
||||
/// <value>The last write time UTC.</value>
|
||||
public DateTime LastWriteTimeUtc { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the creation time UTC.
|
||||
/// </summary>
|
||||
/// <value>The creation time UTC.</value>
|
||||
public DateTime CreationTimeUtc { get; set; }
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is directory.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is directory; otherwise, <c>false</c>.</value>
|
||||
public bool IsDirectory { get; set; }
|
||||
public bool IsHidden { get; set; }
|
||||
public bool IsReadOnly { get; set; }
|
||||
}
|
||||
}
|
||||
421
MediaBrowser.Model/IO/IFileSystem.cs
Normal file
421
MediaBrowser.Model/IO/IFileSystem.cs
Normal file
@@ -0,0 +1,421 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace MediaBrowser.Model.IO
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface IFileSystem
|
||||
/// </summary>
|
||||
public interface IFileSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Determines whether the specified filename is shortcut.
|
||||
/// </summary>
|
||||
/// <param name="filename">The filename.</param>
|
||||
/// <returns><c>true</c> if the specified filename is shortcut; otherwise, <c>false</c>.</returns>
|
||||
bool IsShortcut(string filename);
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the shortcut.
|
||||
/// </summary>
|
||||
/// <param name="filename">The filename.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string ResolveShortcut(string filename);
|
||||
|
||||
/// <summary>
|
||||
/// Creates the shortcut.
|
||||
/// </summary>
|
||||
/// <param name="shortcutPath">The shortcut path.</param>
|
||||
/// <param name="target">The target.</param>
|
||||
void CreateShortcut(string shortcutPath, string target);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="FileSystemMetadata"/> object for the specified file or directory path.
|
||||
/// </summary>
|
||||
/// <param name="path">A path to a file or directory.</param>
|
||||
/// <returns>A <see cref="FileSystemMetadata"/> object.</returns>
|
||||
/// <remarks>If the specified path points to a directory, the returned <see cref="FileSystemMetadata"/> object's
|
||||
/// <see cref="FileSystemMetadata.IsDirectory"/> property will be set to true and all other properties will reflect the properties of the directory.</remarks>
|
||||
FileSystemMetadata GetFileSystemInfo(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="FileSystemMetadata"/> object for the specified file path.
|
||||
/// </summary>
|
||||
/// <param name="path">A path to a file.</param>
|
||||
/// <returns>A <see cref="FileSystemMetadata"/> object.</returns>
|
||||
/// <remarks><para>If the specified path points to a directory, the returned <see cref="FileSystemMetadata"/> object's
|
||||
/// <see cref="FileSystemMetadata.IsDirectory"/> property and the <see cref="FileSystemMetadata.Exists"/> property will both be set to false.</para>
|
||||
/// <para>For automatic handling of files <b>and</b> directories, use <see cref="GetFileSystemInfo"/>.</para></remarks>
|
||||
FileSystemMetadata GetFileInfo(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="FileSystemMetadata"/> object for the specified directory path.
|
||||
/// </summary>
|
||||
/// <param name="path">A path to a directory.</param>
|
||||
/// <returns>A <see cref="FileSystemMetadata"/> object.</returns>
|
||||
/// <remarks><para>If the specified path points to a file, the returned <see cref="FileSystemMetadata"/> object's
|
||||
/// <see cref="FileSystemMetadata.IsDirectory"/> property will be set to true and the <see cref="FileSystemMetadata.Exists"/> property will be set to false.</para>
|
||||
/// <para>For automatic handling of files <b>and</b> directories, use <see cref="GetFileSystemInfo"/>.</para></remarks>
|
||||
FileSystemMetadata GetDirectoryInfo(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the valid filename.
|
||||
/// </summary>
|
||||
/// <param name="filename">The filename.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string GetValidFilename(string filename);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the creation time UTC.
|
||||
/// </summary>
|
||||
/// <param name="info">The information.</param>
|
||||
/// <returns>DateTime.</returns>
|
||||
DateTime GetCreationTimeUtc(FileSystemMetadata info);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the creation time UTC.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns>DateTime.</returns>
|
||||
DateTime GetCreationTimeUtc(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the last write time UTC.
|
||||
/// </summary>
|
||||
/// <param name="info">The information.</param>
|
||||
/// <returns>DateTime.</returns>
|
||||
DateTime GetLastWriteTimeUtc(FileSystemMetadata info);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the last write time UTC.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns>DateTime.</returns>
|
||||
DateTime GetLastWriteTimeUtc(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the file stream.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="mode">The mode.</param>
|
||||
/// <param name="access">The access.</param>
|
||||
/// <param name="share">The share.</param>
|
||||
/// <param name="isAsync">if set to <c>true</c> [is asynchronous].</param>
|
||||
/// <returns>FileStream.</returns>
|
||||
Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileShareMode share, bool isAsync = false);
|
||||
|
||||
/// <summary>
|
||||
/// Opens the read.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns>Stream.</returns>
|
||||
Stream OpenRead(String path);
|
||||
|
||||
/// <summary>
|
||||
/// Swaps the files.
|
||||
/// </summary>
|
||||
/// <param name="file1">The file1.</param>
|
||||
/// <param name="file2">The file2.</param>
|
||||
void SwapFiles(string file1, string file2);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether [contains sub path] [the specified parent path].
|
||||
/// </summary>
|
||||
/// <param name="parentPath">The parent path.</param>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns><c>true</c> if [contains sub path] [the specified parent path]; otherwise, <c>false</c>.</returns>
|
||||
bool ContainsSubPath(string parentPath, string path);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether [is root path] [the specified path].
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns><c>true</c> if [is root path] [the specified path]; otherwise, <c>false</c>.</returns>
|
||||
bool IsRootPath(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Normalizes the path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string NormalizePath(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the file name without extension.
|
||||
/// </summary>
|
||||
/// <param name="info">The information.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string GetFileNameWithoutExtension(FileSystemMetadata info);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the file name without extension.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string GetFileNameWithoutExtension(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether [is path file] [the specified path].
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns><c>true</c> if [is path file] [the specified path]; otherwise, <c>false</c>.</returns>
|
||||
bool IsPathFile(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the file.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
void DeleteFile(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the directory.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
|
||||
void DeleteDirectory(string path, bool recursive);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the directories.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
|
||||
/// <returns>IEnumerable<DirectoryInfo>.</returns>
|
||||
IEnumerable<FileSystemMetadata> GetDirectories(string path, bool recursive = false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the files.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
|
||||
/// <returns>IEnumerable<FileInfo>.</returns>
|
||||
IEnumerable<FileSystemMetadata> GetFiles(string path, bool recursive = false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the file system entries.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
|
||||
/// <returns>IEnumerable<FileSystemMetadata>.</returns>
|
||||
IEnumerable<FileSystemMetadata> GetFileSystemEntries(string path, bool recursive = false);
|
||||
|
||||
/// <summary>
|
||||
/// Creates the directory.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
void CreateDirectory(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Copies the file.
|
||||
/// </summary>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="target">The target.</param>
|
||||
/// <param name="overwrite">if set to <c>true</c> [overwrite].</param>
|
||||
void CopyFile(string source, string target, bool overwrite);
|
||||
|
||||
/// <summary>
|
||||
/// Moves the file.
|
||||
/// </summary>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="target">The target.</param>
|
||||
void MoveFile(string source, string target);
|
||||
|
||||
/// <summary>
|
||||
/// Moves the directory.
|
||||
/// </summary>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="target">The target.</param>
|
||||
void MoveDirectory(string source, string target);
|
||||
|
||||
/// <summary>
|
||||
/// Directories the exists.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
bool DirectoryExists(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Files the exists.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
bool FileExists(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Reads all text.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string ReadAllText(string path);
|
||||
|
||||
byte[] ReadAllBytes(string path);
|
||||
|
||||
void WriteAllBytes(string path, byte[] bytes);
|
||||
|
||||
/// <summary>
|
||||
/// Writes all text.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="text">The text.</param>
|
||||
void WriteAllText(string path, string text);
|
||||
|
||||
/// <summary>
|
||||
/// Writes all text.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="text">The text.</param>
|
||||
/// <param name="encoding">The encoding.</param>
|
||||
void WriteAllText(string path, string text, Encoding encoding);
|
||||
|
||||
/// <summary>
|
||||
/// Reads all text.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="encoding">The encoding.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string ReadAllText(string path, Encoding encoding);
|
||||
|
||||
string[] ReadAllLines(string path);
|
||||
|
||||
void WriteAllLines(string path, IEnumerable<string> lines);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the directory paths.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
|
||||
/// <returns>IEnumerable<System.String>.</returns>
|
||||
IEnumerable<string> GetDirectoryPaths(string path, bool recursive = false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the file paths.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
|
||||
/// <returns>IEnumerable<System.String>.</returns>
|
||||
IEnumerable<string> GetFilePaths(string path, bool recursive = false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the file system entry paths.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
|
||||
/// <returns>IEnumerable<System.String>.</returns>
|
||||
IEnumerable<string> GetFileSystemEntryPaths(string path, bool recursive = false);
|
||||
|
||||
void SetHidden(string path, bool isHidden);
|
||||
void SetReadOnly(string path, bool isHidden);
|
||||
|
||||
char DirectorySeparatorChar { get; }
|
||||
char PathSeparator { get; }
|
||||
|
||||
string GetFullPath(string path);
|
||||
|
||||
List<FileSystemMetadata> GetDrives();
|
||||
|
||||
void SetExecutable(string path);
|
||||
}
|
||||
|
||||
public enum FileOpenMode
|
||||
{
|
||||
//
|
||||
// Summary:
|
||||
// Specifies that the operating system should create a new file. This requires System.Security.Permissions.FileIOPermissionAccess.Write
|
||||
// permission. If the file already exists, an System.IO.IOException exception is
|
||||
// thrown.
|
||||
CreateNew = 1,
|
||||
//
|
||||
// Summary:
|
||||
// Specifies that the operating system should create a new file. If the file already
|
||||
// exists, it will be overwritten. This requires System.Security.Permissions.FileIOPermissionAccess.Write
|
||||
// permission. FileMode.Create is equivalent to requesting that if the file does
|
||||
// not exist, use System.IO.FileMode.CreateNew; otherwise, use System.IO.FileMode.Truncate.
|
||||
// If the file already exists but is a hidden file, an System.UnauthorizedAccessException
|
||||
// exception is thrown.
|
||||
Create = 2,
|
||||
//
|
||||
// Summary:
|
||||
// Specifies that the operating system should open an existing file. The ability
|
||||
// to open the file is dependent on the value specified by the System.IO.FileAccess
|
||||
// enumeration. A System.IO.FileNotFoundException exception is thrown if the file
|
||||
// does not exist.
|
||||
Open = 3,
|
||||
//
|
||||
// Summary:
|
||||
// Specifies that the operating system should open a file if it exists; otherwise,
|
||||
// a new file should be created. If the file is opened with FileAccess.Read, System.Security.Permissions.FileIOPermissionAccess.Read
|
||||
// permission is required. If the file access is FileAccess.Write, System.Security.Permissions.FileIOPermissionAccess.Write
|
||||
// permission is required. If the file is opened with FileAccess.ReadWrite, both
|
||||
// System.Security.Permissions.FileIOPermissionAccess.Read and System.Security.Permissions.FileIOPermissionAccess.Write
|
||||
// permissions are required.
|
||||
OpenOrCreate = 4,
|
||||
//
|
||||
// Summary:
|
||||
// Specifies that the operating system should open an existing file. When the file
|
||||
// is opened, it should be truncated so that its size is zero bytes. This requires
|
||||
// System.Security.Permissions.FileIOPermissionAccess.Write permission. Attempts
|
||||
// to read from a file opened with FileMode.Truncate cause an System.ArgumentException
|
||||
// exception.
|
||||
Truncate = 5,
|
||||
//
|
||||
// Summary:
|
||||
// Opens the file if it exists and seeks to the end of the file, or creates a new
|
||||
// file. This requires System.Security.Permissions.FileIOPermissionAccess.Append
|
||||
// permission. FileMode.Append can be used only in conjunction with FileAccess.Write.
|
||||
// Trying to seek to a position before the end of the file throws an System.IO.IOException
|
||||
// exception, and any attempt to read fails and throws a System.NotSupportedException
|
||||
// exception.
|
||||
Append = 6
|
||||
}
|
||||
|
||||
public enum FileAccessMode
|
||||
{
|
||||
//
|
||||
// Summary:
|
||||
// Read access to the file. Data can be read from the file. Combine with Write for
|
||||
// read/write access.
|
||||
Read = 1,
|
||||
//
|
||||
// Summary:
|
||||
// Write access to the file. Data can be written to the file. Combine with Read
|
||||
// for read/write access.
|
||||
Write = 2,
|
||||
//
|
||||
// Summary:
|
||||
// Read and write access to the file. Data can be written to and read from the file.
|
||||
ReadWrite = 3
|
||||
}
|
||||
|
||||
public enum FileShareMode
|
||||
{
|
||||
//
|
||||
// Summary:
|
||||
// Declines sharing of the current file. Any request to open the file (by this process
|
||||
// or another process) will fail until the file is closed.
|
||||
None = 0,
|
||||
//
|
||||
// Summary:
|
||||
// Allows subsequent opening of the file for reading. If this flag is not specified,
|
||||
// any request to open the file for reading (by this process or another process)
|
||||
// will fail until the file is closed. However, even if this flag is specified,
|
||||
// additional permissions might still be needed to access the file.
|
||||
Read = 1,
|
||||
//
|
||||
// Summary:
|
||||
// Allows subsequent opening of the file for writing. If this flag is not specified,
|
||||
// any request to open the file for writing (by this process or another process)
|
||||
// will fail until the file is closed. However, even if this flag is specified,
|
||||
// additional permissions might still be needed to access the file.
|
||||
Write = 2,
|
||||
//
|
||||
// Summary:
|
||||
// Allows subsequent opening of the file for reading or writing. If this flag is
|
||||
// not specified, any request to open the file for reading or writing (by this process
|
||||
// or another process) will fail until the file is closed. However, even if this
|
||||
// flag is specified, additional permissions might still be needed to access the
|
||||
// file.
|
||||
ReadWrite = 3
|
||||
}
|
||||
|
||||
}
|
||||
12
MediaBrowser.Model/IO/IMemoryStreamFactory.cs
Normal file
12
MediaBrowser.Model/IO/IMemoryStreamFactory.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Model.IO
|
||||
{
|
||||
public interface IMemoryStreamFactory
|
||||
{
|
||||
MemoryStream CreateNew();
|
||||
MemoryStream CreateNew(int capacity);
|
||||
MemoryStream CreateNew(byte[] buffer);
|
||||
bool TryGetBuffer(MemoryStream stream, out byte[] buffer);
|
||||
}
|
||||
}
|
||||
25
MediaBrowser.Model/IO/IShortcutHandler.cs
Normal file
25
MediaBrowser.Model/IO/IShortcutHandler.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
namespace MediaBrowser.Model.IO
|
||||
{
|
||||
public interface IShortcutHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the extension.
|
||||
/// </summary>
|
||||
/// <value>The extension.</value>
|
||||
string Extension { get; }
|
||||
/// <summary>
|
||||
/// Resolves the specified shortcut path.
|
||||
/// </summary>
|
||||
/// <param name="shortcutPath">The shortcut path.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string Resolve(string shortcutPath);
|
||||
/// <summary>
|
||||
/// Creates the specified shortcut path.
|
||||
/// </summary>
|
||||
/// <param name="shortcutPath">The shortcut path.</param>
|
||||
/// <param name="targetPath">The target path.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
void Create(string shortcutPath, string targetPath);
|
||||
}
|
||||
}
|
||||
19
MediaBrowser.Model/IO/StreamDefaults.cs
Normal file
19
MediaBrowser.Model/IO/StreamDefaults.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
namespace MediaBrowser.Model.IO
|
||||
{
|
||||
/// <summary>
|
||||
/// Class StreamDefaults
|
||||
/// </summary>
|
||||
public static class StreamDefaults
|
||||
{
|
||||
/// <summary>
|
||||
/// The default copy to buffer size
|
||||
/// </summary>
|
||||
public const int DefaultCopyToBufferSize = 81920;
|
||||
|
||||
/// <summary>
|
||||
/// The default file stream buffer size
|
||||
/// </summary>
|
||||
public const int DefaultFileStreamBufferSize = 81920;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using MediaBrowser.Model.Dto;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Model.LiveTv
|
||||
{
|
||||
@@ -102,6 +103,18 @@ namespace MediaBrowser.Model.LiveTv
|
||||
/// <value><c>true</c> if this instance is pre padding required; otherwise, <c>false</c>.</value>
|
||||
public bool IsPrePaddingRequired { 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 List<string> ParentBackdropImageTags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is post padding required.
|
||||
/// </summary>
|
||||
|
||||
@@ -3,7 +3,7 @@ using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Library;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Model.LiveTv
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace MediaBrowser.Model.LiveTv
|
||||
public string RecordingEncodingFormat { get; set; }
|
||||
public bool EnableRecordingSubfolders { get; set; }
|
||||
public bool EnableOriginalAudioWithEncodedRecordings { get; set; }
|
||||
public bool EnableOriginalVideoWithEncodedRecordings { get; set; }
|
||||
public string RecordedVideoCodec { get; set; }
|
||||
|
||||
public List<TunerHostInfo> TunerHosts { get; set; }
|
||||
public List<ListingsProviderInfo> ListingProviders { get; set; }
|
||||
@@ -26,14 +26,17 @@ namespace MediaBrowser.Model.LiveTv
|
||||
|
||||
public string[] MediaLocationsCreated { get; set; }
|
||||
|
||||
public string RecordingPostProcessor { get; set; }
|
||||
public string RecordingPostProcessorArguments { get; set; }
|
||||
|
||||
public LiveTvOptions()
|
||||
{
|
||||
EnableMovieProviders = true;
|
||||
EnableRecordingSubfolders = true;
|
||||
TunerHosts = new List<TunerHostInfo>();
|
||||
ListingProviders = new List<ListingsProviderInfo>();
|
||||
MediaLocationsCreated = new string[] { };
|
||||
RecordingEncodingFormat = "mp4";
|
||||
RecordingPostProcessorArguments = "\"{path}\"";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +86,7 @@ namespace MediaBrowser.Model.LiveTv
|
||||
public string[] KidsCategories { get; set; }
|
||||
public string[] MovieCategories { get; set; }
|
||||
public NameValuePair[] ChannelMappings { get; set; }
|
||||
public string MoviePrefix { get; set; }
|
||||
|
||||
public ListingsProviderInfo()
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Model.LiveTv
|
||||
{
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
/// <value>The channel identifier.</value>
|
||||
public string ChannelId { get; set; }
|
||||
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the series timer identifier.
|
||||
/// </summary>
|
||||
|
||||
97
MediaBrowser.Model/Logging/LogHelper.cs
Normal file
97
MediaBrowser.Model/Logging/LogHelper.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace MediaBrowser.Model.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// Class LogHelper
|
||||
/// </summary>
|
||||
public static class LogHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the log message.
|
||||
/// </summary>
|
||||
/// <param name="exception">The exception.</param>
|
||||
/// <returns>StringBuilder.</returns>
|
||||
public static StringBuilder GetLogMessage(Exception exception)
|
||||
{
|
||||
if (exception == null)
|
||||
{
|
||||
throw new ArgumentNullException("exception");
|
||||
}
|
||||
|
||||
var messageText = new StringBuilder();
|
||||
|
||||
messageText.AppendLine(exception.ToString());
|
||||
|
||||
messageText.AppendLine(exception.GetType().FullName);
|
||||
|
||||
LogExceptionData(messageText, exception);
|
||||
|
||||
messageText.AppendLine(exception.StackTrace ?? "No Stack Trace Available");
|
||||
|
||||
// Log the InnerExceptions, if any
|
||||
AppendInnerExceptions(messageText, exception);
|
||||
|
||||
messageText.AppendLine(string.Empty);
|
||||
|
||||
return messageText;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Appends the inner exceptions.
|
||||
/// </summary>
|
||||
/// <param name="messageText">The message text.</param>
|
||||
/// <param name="e">The e.</param>
|
||||
private static void AppendInnerExceptions(StringBuilder messageText, Exception e)
|
||||
{
|
||||
var aggregate = e as AggregateException;
|
||||
|
||||
if (aggregate != null && aggregate.InnerExceptions != null)
|
||||
{
|
||||
foreach (var ex in aggregate.InnerExceptions)
|
||||
{
|
||||
AppendInnerException(messageText, ex);
|
||||
AppendInnerExceptions(messageText, ex);
|
||||
}
|
||||
}
|
||||
|
||||
else if (e.InnerException != null)
|
||||
{
|
||||
AppendInnerException(messageText, e.InnerException);
|
||||
AppendInnerExceptions(messageText, e.InnerException);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Appends the inner exception.
|
||||
/// </summary>
|
||||
/// <param name="messageText">The message text.</param>
|
||||
/// <param name="e">The e.</param>
|
||||
private static void AppendInnerException(StringBuilder messageText, Exception e)
|
||||
{
|
||||
messageText.AppendLine("InnerException: " + e.GetType().FullName);
|
||||
messageText.AppendLine(e.ToString());
|
||||
|
||||
LogExceptionData(messageText, e);
|
||||
|
||||
if (e.StackTrace != null)
|
||||
{
|
||||
messageText.AppendLine(e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs the exception data.
|
||||
/// </summary>
|
||||
/// <param name="messageText">The message text.</param>
|
||||
/// <param name="e">The e.</param>
|
||||
private static void LogExceptionData(StringBuilder messageText, Exception e)
|
||||
{
|
||||
foreach (var key in e.Data.Keys)
|
||||
{
|
||||
messageText.AppendLine(key + ": " + e.Data[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}</ProjectGuid>
|
||||
@@ -9,12 +10,11 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MediaBrowser.Model</RootNamespace>
|
||||
<AssemblyName>MediaBrowser.Model</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<ReleaseVersion>
|
||||
</ReleaseVersion>
|
||||
<NuGetPackageImportStamp>60e95275</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -24,7 +24,6 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -34,25 +33,17 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release Mono|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release Mono\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<RunPostBuildEvent>Always</RunPostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>MediaBrowser.Model.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="project.json" />
|
||||
<!-- A reference to the entire .NET Framework is automatically included -->
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\SharedVersion.cs">
|
||||
<Link>Properties\SharedVersion.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Activity\ActivityLogEntry.cs" />
|
||||
<Compile Include="Activity\IActivityManager.cs" />
|
||||
<Compile Include="Activity\IActivityRepository.cs" />
|
||||
<Compile Include="ApiClient\ApiHelpers.cs" />
|
||||
<Compile Include="ApiClient\ConnectionMode.cs" />
|
||||
<Compile Include="ApiClient\ConnectionResult.cs" />
|
||||
@@ -93,7 +84,6 @@
|
||||
<Compile Include="Configuration\FanartOptions.cs" />
|
||||
<Compile Include="Configuration\LibraryOptions.cs" />
|
||||
<Compile Include="Configuration\MetadataConfiguration.cs" />
|
||||
<Compile Include="Configuration\PeopleMetadataOptions.cs" />
|
||||
<Compile Include="Configuration\XbmcMetadataOptions.cs" />
|
||||
<Compile Include="Configuration\SubtitlePlaybackMode.cs" />
|
||||
<Compile Include="Connect\ConnectAuthenticationExchangeResult.cs" />
|
||||
@@ -109,13 +99,24 @@
|
||||
<Compile Include="Connect\PinExchangeResult.cs" />
|
||||
<Compile Include="Connect\PinStatusResult.cs" />
|
||||
<Compile Include="Connect\UserLinkType.cs" />
|
||||
<Compile Include="Cryptography\ICryptoProvider.cs" />
|
||||
<Compile Include="Devices\DeviceOptions.cs" />
|
||||
<Compile Include="Devices\DeviceQuery.cs" />
|
||||
<Compile Include="Devices\LocalFileInfo.cs" />
|
||||
<Compile Include="Devices\DeviceInfo.cs" />
|
||||
<Compile Include="Devices\DevicesOptions.cs" />
|
||||
<Compile Include="Diagnostics\IProcess.cs" />
|
||||
<Compile Include="Diagnostics\IProcessFactory.cs" />
|
||||
<Compile Include="Dlna\CodecProfile.cs" />
|
||||
<Compile Include="Dlna\ContainerProfile.cs" />
|
||||
<Compile Include="Dlna\DeviceProfile.cs" />
|
||||
<Compile Include="Dlna\DirectPlayProfile.cs" />
|
||||
<Compile Include="Dlna\EncodingContext.cs" />
|
||||
<Compile Include="Dlna\HttpHeaderInfo.cs" />
|
||||
<Compile Include="Dlna\IDeviceDiscovery.cs" />
|
||||
<Compile Include="Dlna\ITranscoderSupport.cs" />
|
||||
<Compile Include="Dlna\ProfileCondition.cs" />
|
||||
<Compile Include="Dlna\ResponseProfile.cs" />
|
||||
<Compile Include="Dlna\StreamInfoSorter.cs" />
|
||||
<Compile Include="Dlna\PlaybackErrorCode.cs" />
|
||||
<Compile Include="Dlna\PlaybackException.cs" />
|
||||
@@ -123,7 +124,11 @@
|
||||
<Compile Include="Dlna\ResolutionNormalizer.cs" />
|
||||
<Compile Include="Dlna\ResolutionOptions.cs" />
|
||||
<Compile Include="Dlna\SubtitleDeliveryMethod.cs" />
|
||||
<Compile Include="Dlna\SubtitleProfile.cs" />
|
||||
<Compile Include="Dlna\SubtitleStreamInfo.cs" />
|
||||
<Compile Include="Dlna\TranscodingProfile.cs" />
|
||||
<Compile Include="Dlna\UpnpDeviceInfo.cs" />
|
||||
<Compile Include="Dlna\XmlAttribute.cs" />
|
||||
<Compile Include="Drawing\ImageOrientation.cs" />
|
||||
<Compile Include="Dto\IHasServerId.cs" />
|
||||
<Compile Include="Dto\IHasSyncInfo.cs" />
|
||||
@@ -131,7 +136,26 @@
|
||||
<Compile Include="Dto\MetadataEditorInfo.cs" />
|
||||
<Compile Include="Dto\NameIdPair.cs" />
|
||||
<Compile Include="Dto\NameValuePair.cs" />
|
||||
<Compile Include="Net\IpEndPointInfo.cs" />
|
||||
<Compile Include="Net\ISocket.cs" />
|
||||
<Compile Include="Net\ISocketFactory.cs" />
|
||||
<Compile Include="Net\IUdpSocket.cs" />
|
||||
<Compile Include="Net\SocketReceiveResult.cs" />
|
||||
<Compile Include="Services\IHttpResult.cs" />
|
||||
<Compile Include="Social\ISharingRepository.cs" />
|
||||
<Compile Include="System\IEnvironmentInfo.cs" />
|
||||
<Compile Include="System\IPowerManagement.cs" />
|
||||
<Compile Include="Text\ITextEncoding.cs" />
|
||||
<Compile Include="Extensions\LinqExtensions.cs" />
|
||||
<Compile Include="FileOrganization\SmartMatchInfo.cs" />
|
||||
<Compile Include="Health\IHealthMonitor.cs" />
|
||||
<Compile Include="IO\FileSystemMetadata.cs" />
|
||||
<Compile Include="IO\IFileSystem.cs" />
|
||||
<Compile Include="IO\IMemoryStreamFactory.cs" />
|
||||
<Compile Include="IO\IShortcutHandler.cs" />
|
||||
<Compile Include="IO\StreamDefaults.cs" />
|
||||
<Compile Include="Globalization\ILocalizationManager.cs" />
|
||||
<Compile Include="Logging\LogHelper.cs" />
|
||||
<Compile Include="MediaInfo\LiveStreamRequest.cs" />
|
||||
<Compile Include="MediaInfo\LiveStreamResponse.cs" />
|
||||
<Compile Include="MediaInfo\PlaybackInfoRequest.cs" />
|
||||
@@ -140,8 +164,6 @@
|
||||
<Compile Include="Configuration\DynamicDayOfWeek.cs" />
|
||||
<Compile Include="Entities\ExtraType.cs" />
|
||||
<Compile Include="Entities\TrailerType.cs" />
|
||||
<Compile Include="Extensions\BoolHelper.cs" />
|
||||
<Compile Include="Extensions\FloatHelper.cs" />
|
||||
<Compile Include="FileOrganization\AutoOrganizeOptions.cs" />
|
||||
<Compile Include="FileOrganization\TvFileOrganizationOptions.cs" />
|
||||
<Compile Include="Configuration\BaseApplicationConfiguration.cs" />
|
||||
@@ -153,13 +175,27 @@
|
||||
<Compile Include="Configuration\MetadataOptions.cs" />
|
||||
<Compile Include="Configuration\MetadataPluginSummary.cs" />
|
||||
<Compile Include="Configuration\MetadataPluginType.cs" />
|
||||
<Compile Include="Dlna\SubtitleProfile.cs" />
|
||||
<Compile Include="MediaInfo\MediaProtocol.cs" />
|
||||
<Compile Include="MediaInfo\SubtitleTrackEvent.cs" />
|
||||
<Compile Include="MediaInfo\SubtitleTrackInfo.cs" />
|
||||
<Compile Include="Net\EndPointInfo.cs" />
|
||||
<Compile Include="Net\HttpResponse.cs" />
|
||||
<Compile Include="Net\IpAddressInfo.cs" />
|
||||
<Compile Include="Plugins\IHasWebPages.cs" />
|
||||
<Compile Include="Plugins\PluginPageInfo.cs" />
|
||||
<Compile Include="Reflection\IAssemblyInfo.cs" />
|
||||
<Compile Include="Services\ApiMemberAttribute.cs" />
|
||||
<Compile Include="Services\IAsyncStreamWriter.cs" />
|
||||
<Compile Include="Services\IHasHeaders.cs" />
|
||||
<Compile Include="Services\IHasRequestFilter.cs" />
|
||||
<Compile Include="Services\IHttpRequest.cs" />
|
||||
<Compile Include="Services\IHttpResponse.cs" />
|
||||
<Compile Include="Services\IRequest.cs" />
|
||||
<Compile Include="Services\IRequestFilter.cs" />
|
||||
<Compile Include="Services\IRequiresRequestStream.cs" />
|
||||
<Compile Include="Services\IService.cs" />
|
||||
<Compile Include="Net\MimeTypes.cs" />
|
||||
<Compile Include="News\INewsService.cs" />
|
||||
<Compile Include="Notifications\NotificationOption.cs" />
|
||||
<Compile Include="Notifications\NotificationOptions.cs" />
|
||||
<Compile Include="Notifications\NotificationType.cs" />
|
||||
@@ -171,36 +207,27 @@
|
||||
<Compile Include="Providers\SubtitleOptions.cs" />
|
||||
<Compile Include="Configuration\UnratedItem.cs" />
|
||||
<Compile Include="Dlna\AudioOptions.cs" />
|
||||
<Compile Include="Dlna\CodecProfile.cs" />
|
||||
<Compile Include="Dlna\CodecType.cs" />
|
||||
<Compile Include="Dlna\ConditionProcessor.cs" />
|
||||
<Compile Include="Dlna\ContainerProfile.cs" />
|
||||
<Compile Include="Dlna\ContentFeatureBuilder.cs" />
|
||||
<Compile Include="Dlna\DeviceIdentification.cs" />
|
||||
<Compile Include="Dlna\DeviceProfile.cs" />
|
||||
<Compile Include="Dlna\DeviceProfileInfo.cs" />
|
||||
<Compile Include="Dlna\DeviceProfileType.cs" />
|
||||
<Compile Include="Dlna\DirectPlayProfile.cs" />
|
||||
<Compile Include="Dlna\DlnaFlags.cs" />
|
||||
<Compile Include="Dlna\DlnaMaps.cs" />
|
||||
<Compile Include="Dlna\DlnaProfileType.cs" />
|
||||
<Compile Include="Dlna\HeaderMatchType.cs" />
|
||||
<Compile Include="Dlna\HttpHeaderInfo.cs" />
|
||||
<Compile Include="Dlna\MediaFormatProfile.cs" />
|
||||
<Compile Include="Dlna\MediaFormatProfileResolver.cs" />
|
||||
<Compile Include="Dlna\ProfileCondition.cs" />
|
||||
<Compile Include="Dlna\ProfileConditionType.cs" />
|
||||
<Compile Include="Dlna\ProfileConditionValue.cs" />
|
||||
<Compile Include="Dlna\ResponseProfile.cs" />
|
||||
<Compile Include="Dlna\SearchCriteria.cs" />
|
||||
<Compile Include="Dlna\SearchType.cs" />
|
||||
<Compile Include="Dlna\SortCriteria.cs" />
|
||||
<Compile Include="Dlna\StreamBuilder.cs" />
|
||||
<Compile Include="Dlna\StreamInfo.cs" />
|
||||
<Compile Include="Dlna\TranscodeSeekInfo.cs" />
|
||||
<Compile Include="Dlna\TranscodingProfile.cs" />
|
||||
<Compile Include="Dlna\VideoOptions.cs" />
|
||||
<Compile Include="Dlna\XmlAttribute.cs" />
|
||||
<Compile Include="Drawing\ImageFormat.cs" />
|
||||
<Compile Include="Drawing\ImageSize.cs" />
|
||||
<Compile Include="Dto\BaseItemPerson.cs" />
|
||||
@@ -224,8 +251,6 @@
|
||||
<Compile Include="Entities\ScrollDirection.cs" />
|
||||
<Compile Include="Entities\SortOrder.cs" />
|
||||
<Compile Include="Events\GenericEventArgs.cs" />
|
||||
<Compile Include="Extensions\DoubleHelper.cs" />
|
||||
<Compile Include="Extensions\IntHelper.cs" />
|
||||
<Compile Include="Extensions\ListHelper.cs" />
|
||||
<Compile Include="Extensions\StringHelper.cs" />
|
||||
<Compile Include="FileOrganization\EpisodeFileOrganizationRequest.cs" />
|
||||
@@ -315,6 +340,10 @@
|
||||
<Compile Include="Querying\UserQuery.cs" />
|
||||
<Compile Include="Registration\RegistrationInfo.cs" />
|
||||
<Compile Include="Search\SearchQuery.cs" />
|
||||
<Compile Include="Serialization\IgnoreDataMemberAttribute.cs" />
|
||||
<Compile Include="Services\IStreamWriter.cs" />
|
||||
<Compile Include="Services\QueryParamCollection.cs" />
|
||||
<Compile Include="Services\RouteAttribute.cs" />
|
||||
<Compile Include="Session\BrowseRequest.cs" />
|
||||
<Compile Include="Session\ClientCapabilities.cs" />
|
||||
<Compile Include="Session\GeneralCommand.cs" />
|
||||
@@ -364,6 +393,7 @@
|
||||
<Compile Include="Session\TranscodingInfo.cs" />
|
||||
<Compile Include="Session\UserDataChangeInfo.cs" />
|
||||
<Compile Include="Devices\ContentUploadHistory.cs" />
|
||||
<Compile Include="Social\ISharingManager.cs" />
|
||||
<Compile Include="Social\SocialShareInfo.cs" />
|
||||
<Compile Include="Sync\CompleteSyncJobInfo.cs" />
|
||||
<Compile Include="Sync\DeviceFileInfo.cs" />
|
||||
@@ -391,8 +421,19 @@
|
||||
<Compile Include="Sync\SyncQualityOption.cs" />
|
||||
<Compile Include="Sync\SyncTarget.cs" />
|
||||
<Compile Include="System\Architecture.cs" />
|
||||
<Compile Include="System\ISystemEvents.cs" />
|
||||
<Compile Include="System\LogFile.cs" />
|
||||
<Compile Include="System\PublicSystemInfo.cs" />
|
||||
<Compile Include="Tasks\IConfigurableScheduledTask.cs" />
|
||||
<Compile Include="Tasks\IScheduledTask.cs" />
|
||||
<Compile Include="Tasks\IScheduledTaskWorker.cs" />
|
||||
<Compile Include="Tasks\ITaskManager.cs" />
|
||||
<Compile Include="Tasks\ITaskTrigger.cs" />
|
||||
<Compile Include="Tasks\ScheduledTaskHelpers.cs" />
|
||||
<Compile Include="Tasks\TaskCompletionEventArgs.cs" />
|
||||
<Compile Include="Tasks\TaskExecutionOptions.cs" />
|
||||
<Compile Include="Threading\ITimer.cs" />
|
||||
<Compile Include="Threading\ITimerFactory.cs" />
|
||||
<Compile Include="Updates\CheckForUpdateResult.cs" />
|
||||
<Compile Include="Updates\PackageTargetSystem.cs" />
|
||||
<Compile Include="Updates\InstallationInfo.cs" />
|
||||
@@ -432,22 +473,9 @@
|
||||
<Compile Include="Users\UserAction.cs" />
|
||||
<Compile Include="Users\UserActionType.cs" />
|
||||
<Compile Include="Users\UserPolicy.cs" />
|
||||
<None Include="MediaBrowser.Model.snk" />
|
||||
<Compile Include="Xml\IXmlReaderSettingsFactory.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent />
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
6
MediaBrowser.Model/MediaBrowser.Model.nuget.targets
Normal file
6
MediaBrowser.Model/MediaBrowser.Model.nuget.targets
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Target Name="EmitMSBuildWarning" BeforeTargets="Build">
|
||||
<Warning Text="Packages containing MSBuild targets and props files cannot be fully installed in projects targeting multiple frameworks. The MSBuild targets and props files have been ignored." />
|
||||
</Target>
|
||||
</Project>
|
||||
Binary file not shown.
28
MediaBrowser.Model/Net/ISocket.cs
Normal file
28
MediaBrowser.Model/Net/ISocket.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
{
|
||||
public interface ISocket : IDisposable
|
||||
{
|
||||
bool DualMode { get; }
|
||||
IpEndPointInfo LocalEndPoint { get; }
|
||||
IpEndPointInfo RemoteEndPoint { get; }
|
||||
void Close();
|
||||
void Shutdown(bool both);
|
||||
void Listen(int backlog);
|
||||
void Bind(IpEndPointInfo endpoint);
|
||||
|
||||
void StartAccept(Action<ISocket> onAccept, Func<bool> isClosed);
|
||||
}
|
||||
|
||||
public class SocketCreateException : Exception
|
||||
{
|
||||
public SocketCreateException(string errorCode, Exception originalException)
|
||||
: base(errorCode, originalException)
|
||||
{
|
||||
ErrorCode = errorCode;
|
||||
}
|
||||
|
||||
public string ErrorCode { get; private set; }
|
||||
}
|
||||
}
|
||||
43
MediaBrowser.Model/Net/ISocketFactory.cs
Normal file
43
MediaBrowser.Model/Net/ISocketFactory.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
{
|
||||
/// <summary>
|
||||
/// Implemented by components that can create a platform specific UDP socket implementation, and wrap it in the cross platform <see cref="IUdpSocket"/> interface.
|
||||
/// </summary>
|
||||
public interface ISocketFactory
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Createa a new unicast socket using the specified local port number.
|
||||
/// </summary>
|
||||
/// <param name="localPort">The local port to bind to.</param>
|
||||
/// <returns>A <see cref="IUdpSocket"/> implementation.</returns>
|
||||
IUdpSocket CreateUdpSocket(int localPort);
|
||||
|
||||
/// <summary>
|
||||
/// Createa a new unicast socket using the specified local port number.
|
||||
/// </summary>
|
||||
IUdpSocket CreateSsdpUdpSocket(IpAddressInfo localIp, int localPort);
|
||||
|
||||
/// <summary>
|
||||
/// Createa a new multicast socket using the specified multicast IP address, multicast time to live and local port.
|
||||
/// </summary>
|
||||
/// <param name="ipAddress">The multicast IP address to bind to.</param>
|
||||
/// <param name="multicastTimeToLive">The multicast time to live value. Actually a maximum number of network hops for UDP packets.</param>
|
||||
/// <param name="localPort">The local port to bind to.</param>
|
||||
/// <returns>A <see cref="IUdpSocket"/> implementation.</returns>
|
||||
IUdpSocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort);
|
||||
|
||||
ISocket CreateSocket(IpAddressFamily family, SocketType socketType, ProtocolType protocolType, bool dualMode);
|
||||
}
|
||||
|
||||
public enum SocketType
|
||||
{
|
||||
Stream
|
||||
}
|
||||
|
||||
public enum ProtocolType
|
||||
{
|
||||
Tcp
|
||||
}
|
||||
}
|
||||
27
MediaBrowser.Model/Net/IUdpSocket.cs
Normal file
27
MediaBrowser.Model/Net/IUdpSocket.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a common interface across platforms for UDP sockets used by this SSDP implementation.
|
||||
/// </summary>
|
||||
public interface IUdpSocket : IDisposable
|
||||
{
|
||||
IpAddressInfo LocalIPAddress { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Waits for and returns the next UDP message sent to this socket (uni or multicast).
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<SocketReceiveResult> ReceiveAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Sends a UDP message to a particular end point (uni or multicast).
|
||||
/// </summary>
|
||||
Task SendAsync(byte[] buffer, int bytes, IpEndPointInfo endPoint);
|
||||
}
|
||||
}
|
||||
42
MediaBrowser.Model/Net/IpAddressInfo.cs
Normal file
42
MediaBrowser.Model/Net/IpAddressInfo.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
{
|
||||
public class IpAddressInfo
|
||||
{
|
||||
public static IpAddressInfo Any = new IpAddressInfo("0.0.0.0", IpAddressFamily.InterNetwork);
|
||||
public static IpAddressInfo IPv6Any = new IpAddressInfo("00000000000000000000", IpAddressFamily.InterNetworkV6);
|
||||
public static IpAddressInfo Loopback = new IpAddressInfo("127.0.0.1", IpAddressFamily.InterNetwork);
|
||||
public static IpAddressInfo IPv6Loopback = new IpAddressInfo("::1", IpAddressFamily.InterNetworkV6);
|
||||
|
||||
public string Address { get; set; }
|
||||
public IpAddressFamily AddressFamily { get; set; }
|
||||
|
||||
public IpAddressInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IpAddressInfo(string address, IpAddressFamily addressFamily)
|
||||
{
|
||||
Address = address;
|
||||
AddressFamily = addressFamily;
|
||||
}
|
||||
|
||||
public bool Equals(IpAddressInfo address)
|
||||
{
|
||||
return string.Equals(address.Address, Address, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public override String ToString()
|
||||
{
|
||||
return Address;
|
||||
}
|
||||
}
|
||||
|
||||
public enum IpAddressFamily
|
||||
{
|
||||
InterNetwork,
|
||||
InterNetworkV6
|
||||
}
|
||||
}
|
||||
30
MediaBrowser.Model/Net/IpEndPointInfo.cs
Normal file
30
MediaBrowser.Model/Net/IpEndPointInfo.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
{
|
||||
public class IpEndPointInfo
|
||||
{
|
||||
public IpAddressInfo IpAddress { get; set; }
|
||||
|
||||
public int Port { get; set; }
|
||||
|
||||
public IpEndPointInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IpEndPointInfo(IpAddressInfo address, int port)
|
||||
{
|
||||
IpAddress = address;
|
||||
Port = port;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var ipAddresString = IpAddress == null ? string.Empty : IpAddress.ToString();
|
||||
|
||||
return ipAddresString + ":" + Port.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
25
MediaBrowser.Model/Net/SocketReceiveResult.cs
Normal file
25
MediaBrowser.Model/Net/SocketReceiveResult.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
namespace MediaBrowser.Model.Net
|
||||
{
|
||||
/// <summary>
|
||||
/// Used by the sockets wrapper to hold raw data received from a UDP socket.
|
||||
/// </summary>
|
||||
public sealed class SocketReceiveResult
|
||||
{
|
||||
/// <summary>
|
||||
/// The buffer to place received data into.
|
||||
/// </summary>
|
||||
public byte[] Buffer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of bytes received.
|
||||
/// </summary>
|
||||
public int ReceivedBytes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IpEndPointInfo"/> the data was received from.
|
||||
/// </summary>
|
||||
public IpEndPointInfo RemoteEndPoint { get; set; }
|
||||
public IpAddressInfo LocalIPAddress { get; set; }
|
||||
}
|
||||
}
|
||||
17
MediaBrowser.Model/News/INewsService.cs
Normal file
17
MediaBrowser.Model/News/INewsService.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using MediaBrowser.Model.Querying;
|
||||
|
||||
namespace MediaBrowser.Model.News
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface INewsFeed
|
||||
/// </summary>
|
||||
public interface INewsService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the product news.
|
||||
/// </summary>
|
||||
/// <param name="query">The query.</param>
|
||||
/// <returns>QueryResult{NewsItem}.</returns>
|
||||
QueryResult<NewsItem> GetProductNews(NewsQuery query);
|
||||
}
|
||||
}
|
||||
9
MediaBrowser.Model/Plugins/IHasWebPages.cs
Normal file
9
MediaBrowser.Model/Plugins/IHasWebPages.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Model.Plugins
|
||||
{
|
||||
public interface IHasWebPages
|
||||
{
|
||||
IEnumerable<PluginPageInfo> GetPages();
|
||||
}
|
||||
}
|
||||
9
MediaBrowser.Model/Plugins/PluginPageInfo.cs
Normal file
9
MediaBrowser.Model/Plugins/PluginPageInfo.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace MediaBrowser.Model.Plugins
|
||||
{
|
||||
public class PluginPageInfo
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public string EmbeddedResourcePath { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>PropertyChanged</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:PropertyChanged.AlsoNotifyForAttribute">
|
||||
<summary>
|
||||
Injects this property to be notified when a dependant property is set.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:PropertyChanged.AlsoNotifyForAttribute.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of <see cref="T:PropertyChanged.DependsOnAttribute"/>.
|
||||
</summary>
|
||||
<param name="property">A property that will be notified for.</param>
|
||||
</member>
|
||||
<member name="M:PropertyChanged.AlsoNotifyForAttribute.#ctor(System.String,System.String[])">
|
||||
<summary>
|
||||
Initializes a new instance of <see cref="T:PropertyChanged.DependsOnAttribute"/>.
|
||||
</summary>
|
||||
<param name="property">A property that will be notified for.</param>
|
||||
<param name="otherProperties">The properties that will be notified for.</param>
|
||||
</member>
|
||||
<member name="T:PropertyChanged.DependsOnAttribute">
|
||||
<summary>
|
||||
Injects this property to be notified when a dependant property is set.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:PropertyChanged.DependsOnAttribute.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of <see cref="T:PropertyChanged.DependsOnAttribute"/>.
|
||||
</summary>
|
||||
<param name="dependency">A property that the assigned property depends on.</param>
|
||||
</member>
|
||||
<member name="M:PropertyChanged.DependsOnAttribute.#ctor(System.String,System.String[])">
|
||||
<summary>
|
||||
Initializes a new instance of <see cref="T:PropertyChanged.DependsOnAttribute"/>.
|
||||
</summary>
|
||||
<param name="dependency">A property that the assigned property depends on.</param>
|
||||
<param name="otherDependencies">The properties that the assigned property depends on.</param>
|
||||
</member>
|
||||
<member name="T:PropertyChanged.DoNotNotifyAttribute">
|
||||
<summary>
|
||||
Exclude a <see cref="T:System.Type"/> or property from notification.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:PropertyChanged.DoNotSetChangedAttribute">
|
||||
<summary>
|
||||
Exclude a <see cref="T:System.Type"/> or property from IsChanged flagging.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
@@ -45,6 +45,8 @@
|
||||
/// </summary>
|
||||
Chapters,
|
||||
|
||||
ChildCount,
|
||||
|
||||
/// <summary>
|
||||
/// The critic rating summary
|
||||
/// </summary>
|
||||
@@ -169,6 +171,8 @@
|
||||
/// </summary>
|
||||
PrimaryImageAspectRatio,
|
||||
|
||||
RecursiveItemCount,
|
||||
|
||||
/// <summary>
|
||||
/// The revenue
|
||||
/// </summary>
|
||||
|
||||
14
MediaBrowser.Model/Reflection/IAssemblyInfo.cs
Normal file
14
MediaBrowser.Model/Reflection/IAssemblyInfo.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace MediaBrowser.Model.Reflection
|
||||
{
|
||||
public interface IAssemblyInfo
|
||||
{
|
||||
Stream GetManifestResourceStream(Type type, string resource);
|
||||
string[] GetManifestResourceNames(Type type);
|
||||
|
||||
Assembly[] GetCurrentAssemblies();
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ namespace MediaBrowser.Model.Serialization
|
||||
/// <param name="file">The file.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
object DeserializeFromFile(Type type, string file);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes from bytes.
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.Serialization
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
|
||||
public sealed class IgnoreDataMemberAttribute : Attribute
|
||||
{
|
||||
public IgnoreDataMemberAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
61
MediaBrowser.Model/Services/ApiMemberAttribute.cs
Normal file
61
MediaBrowser.Model/Services/ApiMemberAttribute.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.Services
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
|
||||
public class ApiMemberAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets verb to which applies attribute. By default applies to all verbs.
|
||||
/// </summary>
|
||||
public string Verb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets parameter type: It can be only one of the following: path, query, body, form, or header.
|
||||
/// </summary>
|
||||
public string ParameterType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets unique name for the parameter. Each name must be unique, even if they are associated with different paramType values.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Other notes on the name field:
|
||||
/// If paramType is body, the name is used only for UI and codegeneration.
|
||||
/// If paramType is path, the name field must correspond to the associated path segment from the path field in the api object.
|
||||
/// If paramType is query, the name field corresponds to the query param name.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the human-readable description for the parameter.
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For path, query, and header paramTypes, this field must be a primitive. For body, this can be a complex or container datatype.
|
||||
/// </summary>
|
||||
public string DataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For path, this is always true. Otherwise, this field tells the client whether or not the field must be supplied.
|
||||
/// </summary>
|
||||
public bool IsRequired { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For query params, this specifies that a comma-separated list of values can be passed to the API. For path and body types, this field cannot be true.
|
||||
/// </summary>
|
||||
public bool AllowMultiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets route to which applies attribute, matches using StartsWith. By default applies to all routes.
|
||||
/// </summary>
|
||||
public string Route { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to exclude this property from being included in the ModelSchema
|
||||
/// </summary>
|
||||
public bool ExcludeInSchema { get; set; }
|
||||
}
|
||||
}
|
||||
11
MediaBrowser.Model/Services/IAsyncStreamWriter.cs
Normal file
11
MediaBrowser.Model/Services/IAsyncStreamWriter.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Model.Services
|
||||
{
|
||||
public interface IAsyncStreamWriter
|
||||
{
|
||||
Task WriteToAsync(Stream responseStream, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
9
MediaBrowser.Model/Services/IHasHeaders.cs
Normal file
9
MediaBrowser.Model/Services/IHasHeaders.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Model.Services
|
||||
{
|
||||
public interface IHasHeaders
|
||||
{
|
||||
IDictionary<string, string> Headers { get; }
|
||||
}
|
||||
}
|
||||
21
MediaBrowser.Model/Services/IHasRequestFilter.cs
Normal file
21
MediaBrowser.Model/Services/IHasRequestFilter.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
namespace MediaBrowser.Model.Services
|
||||
{
|
||||
public interface IHasRequestFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// Order in which Request Filters are executed.
|
||||
/// <0 Executed before global request filters
|
||||
/// >0 Executed after global request filters
|
||||
/// </summary>
|
||||
int Priority { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The request filter is executed before the service.
|
||||
/// </summary>
|
||||
/// <param name="req">The http request wrapper</param>
|
||||
/// <param name="res">The http response wrapper</param>
|
||||
/// <param name="requestDto">The request DTO</param>
|
||||
void RequestFilter(IRequest req, IResponse res, object requestDto);
|
||||
}
|
||||
}
|
||||
46
MediaBrowser.Model/Services/IHttpRequest.cs
Normal file
46
MediaBrowser.Model/Services/IHttpRequest.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Model.Services
|
||||
{
|
||||
public interface IHttpRequest : IRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// The HttpResponse
|
||||
/// </summary>
|
||||
IHttpResponse HttpResponse { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The HTTP Verb
|
||||
/// </summary>
|
||||
string HttpMethod { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The IP Address of the X-Forwarded-For header, null if null or empty
|
||||
/// </summary>
|
||||
string XForwardedFor { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Port number of the X-Forwarded-Port header, null if null or empty
|
||||
/// </summary>
|
||||
int? XForwardedPort { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The http or https scheme of the X-Forwarded-Proto header, null if null or empty
|
||||
/// </summary>
|
||||
string XForwardedProtocol { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The value of the X-Real-IP header, null if null or empty
|
||||
/// </summary>
|
||||
string XRealIp { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The value of the Accept HTTP Request Header
|
||||
/// </summary>
|
||||
string Accept { get; }
|
||||
}
|
||||
}
|
||||
25
MediaBrowser.Model/Services/IHttpResponse.cs
Normal file
25
MediaBrowser.Model/Services/IHttpResponse.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Model.Services
|
||||
{
|
||||
public interface IHttpResponse : IResponse
|
||||
{
|
||||
//ICookies Cookies { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new Set-Cookie instruction to Response
|
||||
/// </summary>
|
||||
/// <param name="cookie"></param>
|
||||
void SetCookie(Cookie cookie);
|
||||
|
||||
/// <summary>
|
||||
/// Removes all pending Set-Cookie instructions
|
||||
/// </summary>
|
||||
void ClearCookies();
|
||||
}
|
||||
}
|
||||
42
MediaBrowser.Model/Services/IHttpResult.cs
Normal file
42
MediaBrowser.Model/Services/IHttpResult.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Model.Services
|
||||
{
|
||||
public interface IHttpResult : IHasHeaders
|
||||
{
|
||||
/// <summary>
|
||||
/// The HTTP Response Status
|
||||
/// </summary>
|
||||
int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The HTTP Response Status Code
|
||||
/// </summary>
|
||||
HttpStatusCode StatusCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The HTTP Response ContentType
|
||||
/// </summary>
|
||||
string ContentType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Additional HTTP Cookies
|
||||
/// </summary>
|
||||
List<Cookie> Cookies { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Response DTO
|
||||
/// </summary>
|
||||
object Response { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the request call context
|
||||
/// </summary>
|
||||
IRequest RequestContext { get; set; }
|
||||
}
|
||||
}
|
||||
156
MediaBrowser.Model/Services/IRequest.cs
Normal file
156
MediaBrowser.Model/Services/IRequest.cs
Normal file
@@ -0,0 +1,156 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
|
||||
namespace MediaBrowser.Model.Services
|
||||
{
|
||||
public interface IRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// The underlying ASP.NET or HttpListener HttpRequest
|
||||
/// </summary>
|
||||
object OriginalRequest { get; }
|
||||
|
||||
IResponse Response { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the service being called (e.g. Request DTO Name)
|
||||
/// </summary>
|
||||
string OperationName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Verb / HttpMethod or Action for this request
|
||||
/// </summary>
|
||||
string Verb { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Request DTO, after it has been deserialized.
|
||||
/// </summary>
|
||||
object Dto { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The request ContentType
|
||||
/// </summary>
|
||||
string ContentType { get; }
|
||||
|
||||
bool IsLocal { get; }
|
||||
|
||||
string UserAgent { get; }
|
||||
|
||||
IDictionary<string, Cookie> Cookies { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The expected Response ContentType for this request
|
||||
/// </summary>
|
||||
string ResponseContentType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the ResponseContentType has been explicitly overrided or whether it was just the default
|
||||
/// </summary>
|
||||
bool HasExplicitResponseContentType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Attach any data to this request that all filters and services can access.
|
||||
/// </summary>
|
||||
Dictionary<string, object> Items { get; }
|
||||
|
||||
QueryParamCollection Headers { get; }
|
||||
|
||||
QueryParamCollection QueryString { get; }
|
||||
|
||||
QueryParamCollection FormData { get; }
|
||||
|
||||
string RawUrl { get; }
|
||||
|
||||
string AbsoluteUri { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Remote Ip as reported by Request.UserHostAddress
|
||||
/// </summary>
|
||||
string UserHostAddress { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Remote Ip as reported by X-Forwarded-For, X-Real-IP or Request.UserHostAddress
|
||||
/// </summary>
|
||||
string RemoteIp { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The value of the Authorization Header used to send the Api Key, null if not available
|
||||
/// </summary>
|
||||
string Authorization { get; }
|
||||
|
||||
/// <summary>
|
||||
/// e.g. is https or not
|
||||
/// </summary>
|
||||
bool IsSecureConnection { get; }
|
||||
|
||||
string[] AcceptTypes { get; }
|
||||
|
||||
string PathInfo { get; }
|
||||
|
||||
Stream InputStream { get; }
|
||||
|
||||
long ContentLength { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Access to the multi-part/formdata files posted on this request
|
||||
/// </summary>
|
||||
IHttpFile[] Files { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The value of the Referrer, null if not available
|
||||
/// </summary>
|
||||
Uri UrlReferrer { get; }
|
||||
}
|
||||
|
||||
public interface IHttpFile
|
||||
{
|
||||
string Name { get; }
|
||||
string FileName { get; }
|
||||
long ContentLength { get; }
|
||||
string ContentType { get; }
|
||||
Stream InputStream { get; }
|
||||
}
|
||||
|
||||
public interface IRequiresRequest
|
||||
{
|
||||
IRequest Request { get; set; }
|
||||
}
|
||||
|
||||
public interface IResponse
|
||||
{
|
||||
IRequest Request { get; }
|
||||
|
||||
int StatusCode { get; set; }
|
||||
|
||||
string StatusDescription { get; set; }
|
||||
|
||||
string ContentType { get; set; }
|
||||
|
||||
void AddHeader(string name, string value);
|
||||
|
||||
string GetHeader(string name);
|
||||
|
||||
void Redirect(string url);
|
||||
|
||||
Stream OutputStream { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Signal that this response has been handled and no more processing should be done.
|
||||
/// When used in a request or response filter, no more filters or processing is done on this request.
|
||||
/// </summary>
|
||||
void Close();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is closed.
|
||||
/// </summary>
|
||||
bool IsClosed { get; }
|
||||
|
||||
void SetContentLength(long contentLength);
|
||||
|
||||
//Add Metadata to Response
|
||||
Dictionary<string, object> Items { get; }
|
||||
}
|
||||
|
||||
}
|
||||
8
MediaBrowser.Model/Services/IRequestFilter.cs
Normal file
8
MediaBrowser.Model/Services/IRequestFilter.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
namespace MediaBrowser.Model.Services
|
||||
{
|
||||
public interface IRequestFilter
|
||||
{
|
||||
void Filter(IRequest request, IResponse response, object requestDto);
|
||||
}
|
||||
}
|
||||
12
MediaBrowser.Model/Services/IRequiresRequestStream.cs
Normal file
12
MediaBrowser.Model/Services/IRequiresRequestStream.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Model.Services
|
||||
{
|
||||
public interface IRequiresRequestStream
|
||||
{
|
||||
/// <summary>
|
||||
/// The raw Http Request Input Stream
|
||||
/// </summary>
|
||||
Stream RequestStream { get; set; }
|
||||
}
|
||||
}
|
||||
12
MediaBrowser.Model/Services/IService.cs
Normal file
12
MediaBrowser.Model/Services/IService.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
namespace MediaBrowser.Model.Services
|
||||
{
|
||||
// marker interface
|
||||
public interface IService
|
||||
{
|
||||
}
|
||||
|
||||
public interface IReturn { }
|
||||
public interface IReturn<T> : IReturn { }
|
||||
public interface IReturnVoid : IReturn { }
|
||||
}
|
||||
9
MediaBrowser.Model/Services/IStreamWriter.cs
Normal file
9
MediaBrowser.Model/Services/IStreamWriter.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Model.Services
|
||||
{
|
||||
public interface IStreamWriter
|
||||
{
|
||||
void WriteTo(Stream responseStream);
|
||||
}
|
||||
}
|
||||
195
MediaBrowser.Model/Services/QueryParamCollection.cs
Normal file
195
MediaBrowser.Model/Services/QueryParamCollection.cs
Normal file
@@ -0,0 +1,195 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.Dto;
|
||||
|
||||
namespace MediaBrowser.Model.Services
|
||||
{
|
||||
public class QueryParamCollection : List<NameValuePair>
|
||||
{
|
||||
public QueryParamCollection()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public QueryParamCollection(IDictionary<string, string> headers)
|
||||
{
|
||||
foreach (var pair in headers)
|
||||
{
|
||||
Add(pair.Key, pair.Value);
|
||||
}
|
||||
}
|
||||
|
||||
private StringComparison GetStringComparison()
|
||||
{
|
||||
return StringComparison.OrdinalIgnoreCase;
|
||||
}
|
||||
|
||||
private StringComparer GetStringComparer()
|
||||
{
|
||||
return StringComparer.OrdinalIgnoreCase;
|
||||
}
|
||||
|
||||
public string GetKey(int index)
|
||||
{
|
||||
return this[index].Name;
|
||||
}
|
||||
|
||||
public string Get(int index)
|
||||
{
|
||||
return this[index].Value;
|
||||
}
|
||||
|
||||
public virtual string[] GetValues(int index)
|
||||
{
|
||||
return new[] { Get(index) };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new query parameter.
|
||||
/// </summary>
|
||||
public virtual void Add(string key, string value)
|
||||
{
|
||||
Add(new NameValuePair(key, value));
|
||||
}
|
||||
|
||||
public virtual void Set(string key, string value)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
var stringComparison = GetStringComparison();
|
||||
|
||||
var parameters = this.Where(p => string.Equals(key, p.Name, stringComparison)).ToArray();
|
||||
|
||||
foreach (var p in parameters)
|
||||
{
|
||||
Remove(p);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var pair in this)
|
||||
{
|
||||
var stringComparison = GetStringComparison();
|
||||
|
||||
if (string.Equals(key, pair.Name, stringComparison))
|
||||
{
|
||||
pair.Value = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Add(key, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if the collection contains a query parameter with the given name.
|
||||
/// </summary>
|
||||
public bool ContainsKey(string name)
|
||||
{
|
||||
return this.Any(p => p.Name == name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes all parameters of the given name.
|
||||
/// </summary>
|
||||
/// <returns>The number of parameters that were removed</returns>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="name" /> is null.</exception>
|
||||
public virtual int Remove(string name)
|
||||
{
|
||||
return RemoveAll(p => p.Name == name);
|
||||
}
|
||||
|
||||
public string Get(string name)
|
||||
{
|
||||
var stringComparison = GetStringComparison();
|
||||
|
||||
return this.Where(p => string.Equals(p.Name, name, stringComparison))
|
||||
.Select(p => p.Value)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
public virtual string[] GetValues(string name)
|
||||
{
|
||||
var stringComparison = GetStringComparison();
|
||||
|
||||
return this.Where(p => string.Equals(p.Name, name, stringComparison)).Select(p => p.Value).ToArray();
|
||||
}
|
||||
|
||||
public Dictionary<string, string> ToDictionary()
|
||||
{
|
||||
var stringComparer = GetStringComparer();
|
||||
|
||||
var headers = new Dictionary<string, string>(stringComparer);
|
||||
|
||||
foreach (var pair in this)
|
||||
{
|
||||
headers[pair.Name] = pair.Value;
|
||||
}
|
||||
|
||||
return headers;
|
||||
}
|
||||
|
||||
public IEnumerable<string> Keys
|
||||
{
|
||||
get { return this.Select(i => i.Name); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a query parameter value by name. A query may contain multiple values of the same name
|
||||
/// (i.e. "x=1&x=2"), in which case the value is an array, which works for both getting and setting.
|
||||
/// </summary>
|
||||
/// <param name="name">The query parameter name</param>
|
||||
/// <returns>The query parameter value or array of values</returns>
|
||||
public string this[string name]
|
||||
{
|
||||
get { return Get(name); }
|
||||
set
|
||||
{
|
||||
Set(name, value);
|
||||
//var parameters = this.Where(p => p.Name == name).ToArray();
|
||||
//var values = new[] { value };
|
||||
|
||||
//for (int i = 0; ; i++)
|
||||
//{
|
||||
// if (i < parameters.Length && i < values.Length)
|
||||
// {
|
||||
// if (values[i] == null)
|
||||
// Remove(parameters[i]);
|
||||
// else if (values[i] is NameValuePair)
|
||||
// this[IndexOf(parameters[i])] = (NameValuePair)values[i];
|
||||
// else
|
||||
// parameters[i].Value = values[i];
|
||||
// }
|
||||
// else if (i < parameters.Length)
|
||||
// Remove(parameters[i]);
|
||||
// else if (i < values.Length)
|
||||
// {
|
||||
// if (values[i] != null)
|
||||
// {
|
||||
// if (values[i] is NameValuePair)
|
||||
// Add((NameValuePair)values[i]);
|
||||
// else
|
||||
// Add(name, values[i]);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
private string GetQueryStringValue(NameValuePair pair)
|
||||
{
|
||||
return pair.Name + "=" + pair.Value;
|
||||
}
|
||||
|
||||
public override String ToString()
|
||||
{
|
||||
var vals = this.Select(GetQueryStringValue).ToArray();
|
||||
|
||||
return string.Join("&", vals);
|
||||
}
|
||||
}
|
||||
}
|
||||
144
MediaBrowser.Model/Services/RouteAttribute.cs
Normal file
144
MediaBrowser.Model/Services/RouteAttribute.cs
Normal file
@@ -0,0 +1,144 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.Services
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
|
||||
public class RouteAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>Initializes an instance of the <see cref="RouteAttribute"/> class.</para>
|
||||
/// </summary>
|
||||
/// <param name="path">
|
||||
/// <para>The path template to map to the request. See
|
||||
/// <see cref="Path">RouteAttribute.Path</see>
|
||||
/// for details on the correct format.</para>
|
||||
/// </param>
|
||||
public RouteAttribute(string path)
|
||||
: this(path, null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>Initializes an instance of the <see cref="RouteAttribute"/> class.</para>
|
||||
/// </summary>
|
||||
/// <param name="path">
|
||||
/// <para>The path template to map to the request. See
|
||||
/// <see cref="Path">RouteAttribute.Path</see>
|
||||
/// for details on the correct format.</para>
|
||||
/// </param>
|
||||
/// <param name="verbs">A comma-delimited list of HTTP verbs supported by the
|
||||
/// service. If unspecified, all verbs are assumed to be supported.</param>
|
||||
public RouteAttribute(string path, string verbs)
|
||||
{
|
||||
Path = path;
|
||||
Verbs = verbs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path template to be mapped to the request.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// A <see cref="String"/> value providing the path mapped to
|
||||
/// the request. Never <see langword="null"/>.
|
||||
/// </value>
|
||||
/// <remarks>
|
||||
/// <para>Some examples of valid paths are:</para>
|
||||
///
|
||||
/// <list>
|
||||
/// <item>"/Inventory"</item>
|
||||
/// <item>"/Inventory/{Category}/{ItemId}"</item>
|
||||
/// <item>"/Inventory/{ItemPath*}"</item>
|
||||
/// </list>
|
||||
///
|
||||
/// <para>Variables are specified within "{}"
|
||||
/// brackets. Each variable in the path is mapped to the same-named property
|
||||
/// on the request DTO. At runtime, ServiceStack will parse the
|
||||
/// request URL, extract the variable values, instantiate the request DTO,
|
||||
/// and assign the variable values into the corresponding request properties,
|
||||
/// prior to passing the request DTO to the service object for processing.</para>
|
||||
///
|
||||
/// <para>It is not necessary to specify all request properties as
|
||||
/// variables in the path. For unspecified properties, callers may provide
|
||||
/// values in the query string. For example: the URL
|
||||
/// "http://services/Inventory?Category=Books&ItemId=12345" causes the same
|
||||
/// request DTO to be processed as "http://services/Inventory/Books/12345",
|
||||
/// provided that the paths "/Inventory" (which supports the first URL) and
|
||||
/// "/Inventory/{Category}/{ItemId}" (which supports the second URL)
|
||||
/// are both mapped to the request DTO.</para>
|
||||
///
|
||||
/// <para>Please note that while it is possible to specify property values
|
||||
/// in the query string, it is generally considered to be less RESTful and
|
||||
/// less desirable than to specify them as variables in the path. Using the
|
||||
/// query string to specify property values may also interfere with HTTP
|
||||
/// caching.</para>
|
||||
///
|
||||
/// <para>The final variable in the path may contain a "*" suffix
|
||||
/// to grab all remaining segments in the path portion of the request URL and assign
|
||||
/// them to a single property on the request DTO.
|
||||
/// For example, if the path "/Inventory/{ItemPath*}" is mapped to the request DTO,
|
||||
/// then the request URL "http://services/Inventory/Books/12345" will result
|
||||
/// in a request DTO whose ItemPath property contains "Books/12345".
|
||||
/// You may only specify one such variable in the path, and it must be positioned at
|
||||
/// the end of the path.</para>
|
||||
/// </remarks>
|
||||
public string Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets short summary of what the route does.
|
||||
/// </summary>
|
||||
public string Summary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets longer text to explain the behaviour of the route.
|
||||
/// </summary>
|
||||
public string Notes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a comma-delimited list of HTTP verbs supported by the service, such as
|
||||
/// "GET,PUT,POST,DELETE".
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// A <see cref="String"/> providing a comma-delimited list of HTTP verbs supported
|
||||
/// by the service, <see langword="null"/> or empty if all verbs are supported.
|
||||
/// </value>
|
||||
public string Verbs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used to rank the precedences of route definitions in reverse routing.
|
||||
/// i.e. Priorities below 0 are auto-generated have less precedence.
|
||||
/// </summary>
|
||||
public int Priority { get; set; }
|
||||
|
||||
protected bool Equals(RouteAttribute other)
|
||||
{
|
||||
return base.Equals(other)
|
||||
&& string.Equals(Path, other.Path)
|
||||
&& string.Equals(Summary, other.Summary)
|
||||
&& string.Equals(Notes, other.Notes)
|
||||
&& string.Equals(Verbs, other.Verbs)
|
||||
&& Priority == other.Priority;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
if (obj.GetType() != this.GetType()) return false;
|
||||
return Equals((RouteAttribute)obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
var hashCode = base.GetHashCode();
|
||||
hashCode = (hashCode * 397) ^ (Path != null ? Path.GetHashCode() : 0);
|
||||
hashCode = (hashCode * 397) ^ (Summary != null ? Summary.GetHashCode() : 0);
|
||||
hashCode = (hashCode * 397) ^ (Notes != null ? Notes.GetHashCode() : 0);
|
||||
hashCode = (hashCode * 397) ^ (Verbs != null ? Verbs.GetHashCode() : 0);
|
||||
hashCode = (hashCode * 397) ^ Priority;
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,10 +13,8 @@ namespace MediaBrowser.Model.Session
|
||||
|
||||
public string MessageCallbackUrl { get; set; }
|
||||
|
||||
public bool SupportsContentUploading { get; set; }
|
||||
public bool SupportsPersistentIdentifier { get; set; }
|
||||
public bool SupportsSync { get; set; }
|
||||
public bool SupportsOfflineAccess { get; set; }
|
||||
|
||||
public DeviceProfile DeviceProfile { get; set; }
|
||||
public List<string> SupportedLiveMediaTypes { get; set; }
|
||||
|
||||
27
MediaBrowser.Model/Social/ISharingManager.cs
Normal file
27
MediaBrowser.Model/Social/ISharingManager.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Model.Social
|
||||
{
|
||||
public interface ISharingManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the share.
|
||||
/// </summary>
|
||||
/// <param name="itemId">The item identifier.</param>
|
||||
/// <param name="userId">The user identifier.</param>
|
||||
/// <returns>Task<SocialShareInfo>.</returns>
|
||||
Task<SocialShareInfo> CreateShare(string itemId, string userId);
|
||||
/// <summary>
|
||||
/// Gets the share information.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier.</param>
|
||||
/// <returns>SocialShareInfo.</returns>
|
||||
SocialShareInfo GetShareInfo(string id);
|
||||
/// <summary>
|
||||
/// Deletes the share.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task DeleteShare(string id);
|
||||
}
|
||||
}
|
||||
15
MediaBrowser.Model/Social/ISharingRepository.cs
Normal file
15
MediaBrowser.Model/Social/ISharingRepository.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Model.Social
|
||||
{
|
||||
public interface ISharingRepository
|
||||
{
|
||||
Task CreateShare(SocialShareInfo info);
|
||||
Task DeleteShare(string id);
|
||||
SocialShareInfo GetShareInfo(string id);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
{
|
||||
X86 = 0,
|
||||
X64 = 1,
|
||||
Arm = 2
|
||||
Arm = 2,
|
||||
Arm64 = 3
|
||||
}
|
||||
}
|
||||
|
||||
22
MediaBrowser.Model/System/IEnvironmentInfo.cs
Normal file
22
MediaBrowser.Model/System/IEnvironmentInfo.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
namespace MediaBrowser.Model.System
|
||||
{
|
||||
public interface IEnvironmentInfo
|
||||
{
|
||||
MediaBrowser.Model.System.OperatingSystem OperatingSystem { get; }
|
||||
string OperatingSystemName { get; }
|
||||
string OperatingSystemVersion { get; }
|
||||
Architecture SystemArchitecture { get; }
|
||||
string GetEnvironmentVariable(string name);
|
||||
void SetProcessEnvironmentVariable(string name, string value);
|
||||
string GetUserId();
|
||||
string StackTrace { get; }
|
||||
}
|
||||
|
||||
public enum OperatingSystem
|
||||
{
|
||||
Windows,
|
||||
Linux,
|
||||
OSX
|
||||
}
|
||||
}
|
||||
9
MediaBrowser.Model/System/IPowerManagement.cs
Normal file
9
MediaBrowser.Model/System/IPowerManagement.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
namespace MediaBrowser.Model.System
|
||||
{
|
||||
public interface IPowerManagement
|
||||
{
|
||||
void PreventSystemStandby();
|
||||
void AllowSystemStandby();
|
||||
}
|
||||
}
|
||||
12
MediaBrowser.Model/System/ISystemEvents.cs
Normal file
12
MediaBrowser.Model/System/ISystemEvents.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.System
|
||||
{
|
||||
public interface ISystemEvents
|
||||
{
|
||||
event EventHandler Resume;
|
||||
event EventHandler Suspend;
|
||||
event EventHandler SessionLogoff;
|
||||
event EventHandler SystemShutdown;
|
||||
}
|
||||
}
|
||||
@@ -48,12 +48,6 @@ namespace MediaBrowser.Model.System
|
||||
/// <value><c>true</c> if [supports library monitor]; otherwise, <c>false</c>.</value>
|
||||
public bool SupportsLibraryMonitor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is network deployed.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is network deployed; otherwise, <c>false</c>.</value>
|
||||
public bool IsNetworkDeployed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the in progress installations.
|
||||
/// </summary>
|
||||
|
||||
18
MediaBrowser.Model/Tasks/IConfigurableScheduledTask.cs
Normal file
18
MediaBrowser.Model/Tasks/IConfigurableScheduledTask.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace MediaBrowser.Model.Tasks
|
||||
{
|
||||
public interface IConfigurableScheduledTask
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is hidden.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is hidden; otherwise, <c>false</c>.</value>
|
||||
bool IsHidden { get; }
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is enabled.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is enabled; otherwise, <c>false</c>.</value>
|
||||
bool IsEnabled { get; }
|
||||
|
||||
bool IsLogged { get; }
|
||||
}
|
||||
}
|
||||
47
MediaBrowser.Model/Tasks/IScheduledTask.cs
Normal file
47
MediaBrowser.Model/Tasks/IScheduledTask.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Model.Tasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface IScheduledTaskWorker
|
||||
/// </summary>
|
||||
public interface IScheduledTask
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the name of the task
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
string Name { get; }
|
||||
|
||||
string Key { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the description.
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the category.
|
||||
/// </summary>
|
||||
/// <value>The category.</value>
|
||||
string Category { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Executes the task
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <param name="progress">The progress.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task Execute(CancellationToken cancellationToken, IProgress<double> progress);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default triggers.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
|
||||
IEnumerable<TaskTriggerInfo> GetDefaultTriggers();
|
||||
}
|
||||
}
|
||||
76
MediaBrowser.Model/Tasks/IScheduledTaskWorker.cs
Normal file
76
MediaBrowser.Model/Tasks/IScheduledTaskWorker.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using MediaBrowser.Model.Events;
|
||||
|
||||
namespace MediaBrowser.Model.Tasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface IScheduledTaskWorker
|
||||
/// </summary>
|
||||
public interface IScheduledTaskWorker : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when [task progress].
|
||||
/// </summary>
|
||||
event EventHandler<GenericEventArgs<double>> TaskProgress;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the scheduled task.
|
||||
/// </summary>
|
||||
/// <value>The scheduled task.</value>
|
||||
IScheduledTask ScheduledTask { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the last execution result.
|
||||
/// </summary>
|
||||
/// <value>The last execution result.</value>
|
||||
TaskResult LastExecutionResult { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the description.
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the category.
|
||||
/// </summary>
|
||||
/// <value>The category.</value>
|
||||
string Category { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the state.
|
||||
/// </summary>
|
||||
/// <value>The state.</value>
|
||||
TaskState State { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current progress.
|
||||
/// </summary>
|
||||
/// <value>The current progress.</value>
|
||||
double? CurrentProgress { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the triggers that define when the task will run
|
||||
/// </summary>
|
||||
/// <value>The triggers.</value>
|
||||
/// <exception cref="ArgumentNullException">value</exception>
|
||||
TaskTriggerInfo[] Triggers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique id.
|
||||
/// </summary>
|
||||
/// <value>The unique id.</value>
|
||||
string Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the trigger events.
|
||||
/// </summary>
|
||||
void ReloadTriggerEvents();
|
||||
}
|
||||
}
|
||||
78
MediaBrowser.Model/Tasks/ITaskManager.cs
Normal file
78
MediaBrowser.Model/Tasks/ITaskManager.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Events;
|
||||
|
||||
namespace MediaBrowser.Model.Tasks
|
||||
{
|
||||
public interface ITaskManager : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the list of Scheduled Tasks
|
||||
/// </summary>
|
||||
/// <value>The scheduled tasks.</value>
|
||||
IScheduledTaskWorker[] ScheduledTasks { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Cancels if running and queue.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="options">Task options.</param>
|
||||
void CancelIfRunningAndQueue<T>(TaskExecutionOptions options)
|
||||
where T : IScheduledTask;
|
||||
|
||||
/// <summary>
|
||||
/// Cancels if running and queue.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
void CancelIfRunningAndQueue<T>()
|
||||
where T : IScheduledTask;
|
||||
|
||||
/// <summary>
|
||||
/// Cancels if running.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
void CancelIfRunning<T>()
|
||||
where T : IScheduledTask;
|
||||
|
||||
/// <summary>
|
||||
/// Queues the scheduled task.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="options">Task options.</param>
|
||||
void QueueScheduledTask<T>(TaskExecutionOptions options)
|
||||
where T : IScheduledTask;
|
||||
|
||||
/// <summary>
|
||||
/// Queues the scheduled task.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
void QueueScheduledTask<T>()
|
||||
where T : IScheduledTask;
|
||||
|
||||
void QueueIfNotRunning<T>()
|
||||
where T : IScheduledTask;
|
||||
|
||||
/// <summary>
|
||||
/// Queues the scheduled task.
|
||||
/// </summary>
|
||||
/// <param name="task">The task.</param>
|
||||
/// <param name="options">The task run options.</param>
|
||||
void QueueScheduledTask(IScheduledTask task, TaskExecutionOptions options = null);
|
||||
|
||||
/// <summary>
|
||||
/// Adds the tasks.
|
||||
/// </summary>
|
||||
/// <param name="tasks">The tasks.</param>
|
||||
void AddTasks(IEnumerable<IScheduledTask> tasks);
|
||||
|
||||
void Cancel(IScheduledTaskWorker task);
|
||||
Task Execute(IScheduledTaskWorker task, TaskExecutionOptions options = null);
|
||||
|
||||
void Execute<T>()
|
||||
where T : IScheduledTask;
|
||||
|
||||
event EventHandler<GenericEventArgs<IScheduledTaskWorker>> TaskExecuting;
|
||||
event EventHandler<TaskCompletionEventArgs> TaskCompleted;
|
||||
}
|
||||
}
|
||||
35
MediaBrowser.Model/Tasks/ITaskTrigger.cs
Normal file
35
MediaBrowser.Model/Tasks/ITaskTrigger.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Model.Tasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface ITaskTrigger
|
||||
/// </summary>
|
||||
public interface ITaskTrigger
|
||||
{
|
||||
/// <summary>
|
||||
/// Fires when the trigger condition is satisfied and the task should run
|
||||
/// </summary>
|
||||
event EventHandler<GenericEventArgs<TaskExecutionOptions>> Triggered;
|
||||
|
||||
/// <summary>
|
||||
/// Stars waiting for the trigger action
|
||||
/// </summary>
|
||||
void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup);
|
||||
|
||||
/// <summary>
|
||||
/// Stops waiting for the trigger action
|
||||
/// </summary>
|
||||
void Stop();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the execution properties of this task.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The execution properties of this task.
|
||||
/// </value>
|
||||
TaskExecutionOptions TaskOptions { get; set; }
|
||||
}
|
||||
}
|
||||
52
MediaBrowser.Model/Tasks/ScheduledTaskHelpers.cs
Normal file
52
MediaBrowser.Model/Tasks/ScheduledTaskHelpers.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Model.Tasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ScheduledTaskHelpers
|
||||
/// </summary>
|
||||
public static class ScheduledTaskHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the task info.
|
||||
/// </summary>
|
||||
/// <param name="task">The task.</param>
|
||||
/// <returns>TaskInfo.</returns>
|
||||
public static TaskInfo GetTaskInfo(IScheduledTaskWorker task)
|
||||
{
|
||||
var isHidden = false;
|
||||
|
||||
var configurableTask = task.ScheduledTask as IConfigurableScheduledTask;
|
||||
|
||||
if (configurableTask != null)
|
||||
{
|
||||
isHidden = configurableTask.IsHidden;
|
||||
}
|
||||
|
||||
string key = task.ScheduledTask.Key;
|
||||
|
||||
var triggers = task.Triggers
|
||||
.OrderBy(i => i.Type)
|
||||
.ThenBy(i => i.DayOfWeek ?? DayOfWeek.Sunday)
|
||||
.ThenBy(i => i.TimeOfDayTicks ?? 0)
|
||||
.ToList();
|
||||
|
||||
return new TaskInfo
|
||||
{
|
||||
Name = task.Name,
|
||||
CurrentProgressPercentage = task.CurrentProgress,
|
||||
State = task.State,
|
||||
Id = task.Id,
|
||||
LastExecutionResult = task.LastExecutionResult,
|
||||
|
||||
Triggers = triggers,
|
||||
|
||||
Description = task.Description,
|
||||
Category = task.Category,
|
||||
IsHidden = isHidden,
|
||||
Key = key
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
11
MediaBrowser.Model/Tasks/TaskCompletionEventArgs.cs
Normal file
11
MediaBrowser.Model/Tasks/TaskCompletionEventArgs.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.Tasks
|
||||
{
|
||||
public class TaskCompletionEventArgs : EventArgs
|
||||
{
|
||||
public IScheduledTaskWorker Task { get; set; }
|
||||
|
||||
public TaskResult Result { get; set; }
|
||||
}
|
||||
}
|
||||
11
MediaBrowser.Model/Tasks/TaskExecutionOptions.cs
Normal file
11
MediaBrowser.Model/Tasks/TaskExecutionOptions.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
namespace MediaBrowser.Model.Tasks
|
||||
{
|
||||
/// <summary>
|
||||
/// A class that encomposases all common task run properties.
|
||||
/// </summary>
|
||||
public class TaskExecutionOptions
|
||||
{
|
||||
public int? MaxRuntimeMs { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -42,5 +42,11 @@ namespace MediaBrowser.Model.Tasks
|
||||
/// </summary>
|
||||
/// <value>The maximum runtime ms.</value>
|
||||
public int? MaxRuntimeMs { get; set; }
|
||||
|
||||
public const string TriggerDaily = "DailyTrigger";
|
||||
public const string TriggerWeekly = "WeeklyTrigger";
|
||||
public const string TriggerInterval = "IntervalTrigger";
|
||||
public const string TriggerSystemEvent = "SystemEventTrigger";
|
||||
public const string TriggerStartup = "StartupTrigger";
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user