aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Configuration
diff options
context:
space:
mode:
author7illusions <z@7illusions.com>2014-05-12 16:55:07 +0200
committer7illusions <z@7illusions.com>2014-05-12 16:55:07 +0200
commitbaf5cf2544fcaad2246923f60caaf3fed4a94aaf (patch)
treea808b700095f876e437b95c432c0220e241f9fda /MediaBrowser.Model/Configuration
parent8f3a6279e173dcbaaa05a56556afb410ee12dd4d (diff)
parentb9b568de13d81f9db1a8502d50940475c1d79c72 (diff)
Merge pull request #3 from MediaBrowser/master
Sync with Master
Diffstat (limited to 'MediaBrowser.Model/Configuration')
-rw-r--r--MediaBrowser.Model/Configuration/EncodingQuality.cs10
-rw-r--r--MediaBrowser.Model/Configuration/ImageOption.cs29
-rw-r--r--MediaBrowser.Model/Configuration/ImageSavingConvention.cs8
-rw-r--r--MediaBrowser.Model/Configuration/LiveTvOptions.cs7
-rw-r--r--MediaBrowser.Model/Configuration/MetadataOptions.cs47
-rw-r--r--MediaBrowser.Model/Configuration/MetadataPlugin.cs45
-rw-r--r--MediaBrowser.Model/Configuration/MetadataPluginSummary.cs32
-rw-r--r--MediaBrowser.Model/Configuration/MetadataPluginType.cs15
-rw-r--r--MediaBrowser.Model/Configuration/NotificationOption.cs54
-rw-r--r--MediaBrowser.Model/Configuration/NotificationOptions.cs90
-rw-r--r--MediaBrowser.Model/Configuration/NotificationType.cs20
-rw-r--r--MediaBrowser.Model/Configuration/PathSubstitution.cs8
-rw-r--r--MediaBrowser.Model/Configuration/SendToUserType.cs9
-rw-r--r--MediaBrowser.Model/Configuration/ServerConfiguration.cs31
-rw-r--r--MediaBrowser.Model/Configuration/SubtitleOptions.cs21
-rw-r--r--MediaBrowser.Model/Configuration/TvFileOrganizationOptions.cs (renamed from MediaBrowser.Model/Configuration/AutoOrganize.cs)0
-rw-r--r--MediaBrowser.Model/Configuration/UnratedItem.cs16
-rw-r--r--MediaBrowser.Model/Configuration/UserConfiguration.cs14
18 files changed, 263 insertions, 193 deletions
diff --git a/MediaBrowser.Model/Configuration/EncodingQuality.cs b/MediaBrowser.Model/Configuration/EncodingQuality.cs
new file mode 100644
index 000000000..ba5a1f279
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/EncodingQuality.cs
@@ -0,0 +1,10 @@
+namespace MediaBrowser.Model.Configuration
+{
+ public enum EncodingQuality
+ {
+ Auto,
+ HighSpeed,
+ HighQuality,
+ MaxQuality
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Model/Configuration/ImageOption.cs b/MediaBrowser.Model/Configuration/ImageOption.cs
new file mode 100644
index 000000000..ade0af83e
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/ImageOption.cs
@@ -0,0 +1,29 @@
+using MediaBrowser.Model.Entities;
+
+namespace MediaBrowser.Model.Configuration
+{
+ public class ImageOption
+ {
+ /// <summary>
+ /// Gets or sets the type.
+ /// </summary>
+ /// <value>The type.</value>
+ public ImageType Type { get; set; }
+ /// <summary>
+ /// Gets or sets the limit.
+ /// </summary>
+ /// <value>The limit.</value>
+ public int Limit { get; set; }
+
+ /// <summary>
+ /// Gets or sets the minimum width.
+ /// </summary>
+ /// <value>The minimum width.</value>
+ public int MinWidth { get; set; }
+
+ public ImageOption()
+ {
+ Limit = 1;
+ }
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Model/Configuration/ImageSavingConvention.cs b/MediaBrowser.Model/Configuration/ImageSavingConvention.cs
new file mode 100644
index 000000000..611678e67
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/ImageSavingConvention.cs
@@ -0,0 +1,8 @@
+namespace MediaBrowser.Model.Configuration
+{
+ public enum ImageSavingConvention
+ {
+ Legacy,
+ Compatible
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Model/Configuration/LiveTvOptions.cs b/MediaBrowser.Model/Configuration/LiveTvOptions.cs
new file mode 100644
index 000000000..ae8aeb200
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/LiveTvOptions.cs
@@ -0,0 +1,7 @@
+namespace MediaBrowser.Model.Configuration
+{
+ public class LiveTvOptions
+ {
+ public int? GuideDays { get; set; }
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Model/Configuration/MetadataOptions.cs b/MediaBrowser.Model/Configuration/MetadataOptions.cs
index d666f6cce..fdfbbf4f4 100644
--- a/MediaBrowser.Model/Configuration/MetadataOptions.cs
+++ b/MediaBrowser.Model/Configuration/MetadataOptions.cs
@@ -30,7 +30,7 @@ namespace MediaBrowser.Model.Configuration
public MetadataOptions(int backdropLimit, int minBackdropWidth)
{
- var imageOptions = new List<ImageOption>
+ List<ImageOption> imageOptions = new List<ImageOption>
{
new ImageOption
{
@@ -52,14 +52,30 @@ namespace MediaBrowser.Model.Configuration
public int GetLimit(ImageType type)
{
- var option = ImageOptions.FirstOrDefault(i => i.Type == type);
+ ImageOption option = null;
+ foreach (ImageOption i in ImageOptions)
+ {
+ if (i.Type == type)
+ {
+ option = i;
+ break;
+ }
+ }
return option == null ? 1 : option.Limit;
}
public int GetMinWidth(ImageType type)
{
- var option = ImageOptions.FirstOrDefault(i => i.Type == type);
+ ImageOption option = null;
+ foreach (ImageOption i in ImageOptions)
+ {
+ if (i.Type == type)
+ {
+ option = i;
+ break;
+ }
+ }
return option == null ? 0 : option.MinWidth;
}
@@ -74,29 +90,4 @@ namespace MediaBrowser.Model.Configuration
return !DisabledMetadataSavers.Contains(name, StringComparer.OrdinalIgnoreCase);
}
}
-
- public class ImageOption
- {
- /// <summary>
- /// Gets or sets the type.
- /// </summary>
- /// <value>The type.</value>
- public ImageType Type { get; set; }
- /// <summary>
- /// Gets or sets the limit.
- /// </summary>
- /// <value>The limit.</value>
- public int Limit { get; set; }
-
- /// <summary>
- /// Gets or sets the minimum width.
- /// </summary>
- /// <value>The minimum width.</value>
- public int MinWidth { get; set; }
-
- public ImageOption()
- {
- Limit = 1;
- }
- }
}
diff --git a/MediaBrowser.Model/Configuration/MetadataPlugin.cs b/MediaBrowser.Model/Configuration/MetadataPlugin.cs
index b019cf71a..f3e0ce106 100644
--- a/MediaBrowser.Model/Configuration/MetadataPlugin.cs
+++ b/MediaBrowser.Model/Configuration/MetadataPlugin.cs
@@ -1,7 +1,4 @@
-using MediaBrowser.Model.Entities;
-using System.Collections.Generic;
-
-namespace MediaBrowser.Model.Configuration
+namespace MediaBrowser.Model.Configuration
{
public class MetadataPlugin
{
@@ -17,44 +14,4 @@ namespace MediaBrowser.Model.Configuration
/// <value>The type.</value>
public MetadataPluginType Type { get; set; }
}
-
- public class MetadataPluginSummary
- {
- /// <summary>
- /// Gets or sets the type of the item.
- /// </summary>
- /// <value>The type of the item.</value>
- public string ItemType { get; set; }
-
- /// <summary>
- /// Gets or sets the plugins.
- /// </summary>
- /// <value>The plugins.</value>
- public List<MetadataPlugin> Plugins { get; set; }
-
- /// <summary>
- /// Gets or sets the supported image types.
- /// </summary>
- /// <value>The supported image types.</value>
- public List<ImageType> SupportedImageTypes { get; set; }
-
- public MetadataPluginSummary()
- {
- SupportedImageTypes = new List<ImageType>();
- Plugins = new List<MetadataPlugin>();
- }
- }
-
- /// <summary>
- /// Enum MetadataPluginType
- /// </summary>
- public enum MetadataPluginType
- {
- LocalImageProvider,
- ImageFetcher,
- ImageSaver,
- LocalMetadataProvider,
- MetadataFetcher,
- MetadataSaver
- }
}
diff --git a/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs b/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs
new file mode 100644
index 000000000..90b3933eb
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs
@@ -0,0 +1,32 @@
+using System.Collections.Generic;
+using MediaBrowser.Model.Entities;
+
+namespace MediaBrowser.Model.Configuration
+{
+ public class MetadataPluginSummary
+ {
+ /// <summary>
+ /// Gets or sets the type of the item.
+ /// </summary>
+ /// <value>The type of the item.</value>
+ public string ItemType { get; set; }
+
+ /// <summary>
+ /// Gets or sets the plugins.
+ /// </summary>
+ /// <value>The plugins.</value>
+ public List<MetadataPlugin> Plugins { get; set; }
+
+ /// <summary>
+ /// Gets or sets the supported image types.
+ /// </summary>
+ /// <value>The supported image types.</value>
+ public List<ImageType> SupportedImageTypes { get; set; }
+
+ public MetadataPluginSummary()
+ {
+ SupportedImageTypes = new List<ImageType>();
+ Plugins = new List<MetadataPlugin>();
+ }
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Model/Configuration/MetadataPluginType.cs b/MediaBrowser.Model/Configuration/MetadataPluginType.cs
new file mode 100644
index 000000000..95ca3b2e6
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/MetadataPluginType.cs
@@ -0,0 +1,15 @@
+namespace MediaBrowser.Model.Configuration
+{
+ /// <summary>
+ /// Enum MetadataPluginType
+ /// </summary>
+ public enum MetadataPluginType
+ {
+ LocalImageProvider,
+ ImageFetcher,
+ ImageSaver,
+ LocalMetadataProvider,
+ MetadataFetcher,
+ MetadataSaver
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Model/Configuration/NotificationOption.cs b/MediaBrowser.Model/Configuration/NotificationOption.cs
new file mode 100644
index 000000000..5fcf3550c
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/NotificationOption.cs
@@ -0,0 +1,54 @@
+namespace MediaBrowser.Model.Configuration
+{
+ public class NotificationOption
+ {
+ public string Type { get; set; }
+
+ /// <summary>
+ /// User Ids to not monitor (it's opt out)
+ /// </summary>
+ public string[] DisabledMonitorUsers { get; set; }
+
+ /// <summary>
+ /// User Ids to send to (if SendToUserMode == Custom)
+ /// </summary>
+ public string[] SendToUsers { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether this <see cref="NotificationOption"/> is enabled.
+ /// </summary>
+ /// <value><c>true</c> if enabled; otherwise, <c>false</c>.</value>
+ public bool Enabled { get; set; }
+
+ /// <summary>
+ /// Gets or sets the title format string.
+ /// </summary>
+ /// <value>The title format string.</value>
+ public string Title { get; set; }
+
+ /// <summary>
+ /// Gets or sets the description.
+ /// </summary>
+ /// <value>The description.</value>
+ public string Description { get; set; }
+
+ /// <summary>
+ /// Gets or sets the disabled services.
+ /// </summary>
+ /// <value>The disabled services.</value>
+ public string[] DisabledServices { get; set; }
+
+ /// <summary>
+ /// Gets or sets the send to user mode.
+ /// </summary>
+ /// <value>The send to user mode.</value>
+ public SendToUserType SendToUserMode { get; set; }
+
+ public NotificationOption()
+ {
+ DisabledServices = new string[] { };
+ DisabledMonitorUsers = new string[] { };
+ SendToUsers = new string[] { };
+ }
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Model/Configuration/NotificationOptions.cs b/MediaBrowser.Model/Configuration/NotificationOptions.cs
index fedc1c2f8..d6517e895 100644
--- a/MediaBrowser.Model/Configuration/NotificationOptions.cs
+++ b/MediaBrowser.Model/Configuration/NotificationOptions.cs
@@ -70,19 +70,23 @@ namespace MediaBrowser.Model.Configuration
public NotificationOption GetOptions(string type)
{
- return Options.FirstOrDefault(i => string.Equals(type, i.Type, StringComparison.OrdinalIgnoreCase));
+ foreach (NotificationOption i in Options)
+ {
+ if (string.Equals(type, i.Type, StringComparison.OrdinalIgnoreCase)) return i;
+ }
+ return null;
}
public bool IsEnabled(string type)
{
- var opt = GetOptions(type);
+ NotificationOption opt = GetOptions(type);
return opt != null && opt.Enabled;
}
public bool IsServiceEnabled(string service, string notificationType)
{
- var opt = GetOptions(notificationType);
+ NotificationOption opt = GetOptions(notificationType);
return opt == null ||
!opt.DisabledServices.Contains(service, StringComparer.OrdinalIgnoreCase);
@@ -90,7 +94,7 @@ namespace MediaBrowser.Model.Configuration
public bool IsEnabledToMonitorUser(string type, string userId)
{
- var opt = GetOptions(type);
+ NotificationOption opt = GetOptions(type);
return opt != null && opt.Enabled &&
!opt.DisabledMonitorUsers.Contains(userId, StringComparer.OrdinalIgnoreCase);
@@ -98,7 +102,7 @@ namespace MediaBrowser.Model.Configuration
public bool IsEnabledToSendToUser(string type, string userId, UserConfiguration userConfig)
{
- var opt = GetOptions(type);
+ NotificationOption opt = GetOptions(type);
if (opt != null && opt.Enabled)
{
@@ -118,80 +122,4 @@ namespace MediaBrowser.Model.Configuration
return false;
}
}
-
- public class NotificationOption
- {
- public string Type { get; set; }
-
- /// <summary>
- /// User Ids to not monitor (it's opt out)
- /// </summary>
- public string[] DisabledMonitorUsers { get; set; }
-
- /// <summary>
- /// User Ids to send to (if SendToUserMode == Custom)
- /// </summary>
- public string[] SendToUsers { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether this <see cref="NotificationOption"/> is enabled.
- /// </summary>
- /// <value><c>true</c> if enabled; otherwise, <c>false</c>.</value>
- public bool Enabled { get; set; }
-
- /// <summary>
- /// Gets or sets the title format string.
- /// </summary>
- /// <value>The title format string.</value>
- public string Title { get; set; }
-
- /// <summary>
- /// Gets or sets the description.
- /// </summary>
- /// <value>The description.</value>
- public string Description { get; set; }
-
- /// <summary>
- /// Gets or sets the disabled services.
- /// </summary>
- /// <value>The disabled services.</value>
- public string[] DisabledServices { get; set; }
-
- /// <summary>
- /// Gets or sets the send to user mode.
- /// </summary>
- /// <value>The send to user mode.</value>
- public SendToUserType SendToUserMode { get; set; }
-
- public NotificationOption()
- {
- DisabledServices = new string[] { };
- DisabledMonitorUsers = new string[] { };
- SendToUsers = new string[] { };
- }
- }
-
- public enum NotificationType
- {
- ApplicationUpdateAvailable,
- ApplicationUpdateInstalled,
- AudioPlayback,
- GamePlayback,
- InstallationFailed,
- PluginError,
- PluginInstalled,
- PluginUpdateInstalled,
- PluginUninstalled,
- NewLibraryContent,
- ServerRestartRequired,
- TaskFailed,
- VideoPlayback
- }
-
- public enum SendToUserType
- {
- All = 0,
- Admins = 1,
- Custom = 2
- }
}
diff --git a/MediaBrowser.Model/Configuration/NotificationType.cs b/MediaBrowser.Model/Configuration/NotificationType.cs
new file mode 100644
index 000000000..0ddcf4251
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/NotificationType.cs
@@ -0,0 +1,20 @@
+namespace MediaBrowser.Model.Configuration
+{
+ public enum NotificationType
+ {
+ ApplicationUpdateAvailable,
+ ApplicationUpdateInstalled,
+ AudioPlayback,
+ GamePlayback,
+ InstallationFailed,
+ PluginError,
+ PluginInstalled,
+ PluginUpdateInstalled,
+ PluginUninstalled,
+ NewLibraryContent,
+ NewLibraryContentMultiple,
+ ServerRestartRequired,
+ TaskFailed,
+ VideoPlayback
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Model/Configuration/PathSubstitution.cs b/MediaBrowser.Model/Configuration/PathSubstitution.cs
new file mode 100644
index 000000000..576dd2d5a
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/PathSubstitution.cs
@@ -0,0 +1,8 @@
+namespace MediaBrowser.Model.Configuration
+{
+ public class PathSubstitution
+ {
+ public string From { get; set; }
+ public string To { get; set; }
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Model/Configuration/SendToUserType.cs b/MediaBrowser.Model/Configuration/SendToUserType.cs
new file mode 100644
index 000000000..a2eac4c2d
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/SendToUserType.cs
@@ -0,0 +1,9 @@
+namespace MediaBrowser.Model.Configuration
+{
+ public enum SendToUserType
+ {
+ All = 0,
+ Admins = 1,
+ Custom = 2
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index 0fb9db6c0..c19039439 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -221,6 +221,8 @@ namespace MediaBrowser.Model.Configuration
public NotificationOptions NotificationOptions { get; set; }
+ public SubtitleOptions SubtitleOptions { get; set; }
+
/// <summary>
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
/// </summary>
@@ -269,7 +271,7 @@ namespace MediaBrowser.Model.Configuration
EnableRealtimeMonitor = true;
- var options = new List<MetadataOptions>
+ List<MetadataOptions> options = new List<MetadataOptions>
{
new MetadataOptions(1, 1280) {ItemType = "Book"},
new MetadataOptions(1, 1280) {ItemType = "MusicAlbum"},
@@ -284,31 +286,8 @@ namespace MediaBrowser.Model.Configuration
UICulture = "en-us";
NotificationOptions = new NotificationOptions();
- }
- }
-
- public enum ImageSavingConvention
- {
- Legacy,
- Compatible
- }
-
- public enum EncodingQuality
- {
- Auto,
- HighSpeed,
- HighQuality,
- MaxQuality
- }
- public class LiveTvOptions
- {
- public int? GuideDays { get; set; }
- }
-
- public class PathSubstitution
- {
- public string From { get; set; }
- public string To { get; set; }
+ SubtitleOptions = new SubtitleOptions();
+ }
}
}
diff --git a/MediaBrowser.Model/Configuration/SubtitleOptions.cs b/MediaBrowser.Model/Configuration/SubtitleOptions.cs
new file mode 100644
index 000000000..96e04e511
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/SubtitleOptions.cs
@@ -0,0 +1,21 @@
+namespace MediaBrowser.Model.Configuration
+{
+ public class SubtitleOptions
+ {
+ public bool SkipIfGraphicalSubtitlesPresent { get; set; }
+ public bool SkipIfAudioTrackMatches { get; set; }
+ public string[] DownloadLanguages { get; set; }
+ public bool DownloadMovieSubtitles { get; set; }
+ public bool DownloadEpisodeSubtitles { get; set; }
+
+ public string OpenSubtitlesUsername { get; set; }
+ public string OpenSubtitlesPasswordHash { get; set; }
+
+ public SubtitleOptions()
+ {
+ DownloadLanguages = new string[] { };
+
+ SkipIfAudioTrackMatches = true;
+ }
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Model/Configuration/AutoOrganize.cs b/MediaBrowser.Model/Configuration/TvFileOrganizationOptions.cs
index fe32d4a80..fe32d4a80 100644
--- a/MediaBrowser.Model/Configuration/AutoOrganize.cs
+++ b/MediaBrowser.Model/Configuration/TvFileOrganizationOptions.cs
diff --git a/MediaBrowser.Model/Configuration/UnratedItem.cs b/MediaBrowser.Model/Configuration/UnratedItem.cs
new file mode 100644
index 000000000..1082d684b
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/UnratedItem.cs
@@ -0,0 +1,16 @@
+namespace MediaBrowser.Model.Configuration
+{
+ public enum UnratedItem
+ {
+ Movie,
+ Trailer,
+ Series,
+ Music,
+ Game,
+ Book,
+ LiveTvChannel,
+ LiveTvProgram,
+ ChannelContent,
+ Other
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Model/Configuration/UserConfiguration.cs b/MediaBrowser.Model/Configuration/UserConfiguration.cs
index f8df19436..2658e8973 100644
--- a/MediaBrowser.Model/Configuration/UserConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/UserConfiguration.cs
@@ -79,18 +79,4 @@ namespace MediaBrowser.Model.Configuration
BlockUnratedItems = new UnratedItem[] { };
}
}
-
- public enum UnratedItem
- {
- Movie,
- Trailer,
- Series,
- Music,
- Game,
- Book,
- LiveTvChannel,
- LiveTvProgram,
- ChannelContent,
- Other
- }
}