aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Sync/SyncHelper.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-03-15 13:50:47 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-03-15 13:50:47 -0400
commit72a5383c703b86286cf61decb92b987b48b50d3c (patch)
treeea5093857e4a84311ce4683e44cd4cc6b36faf68 /MediaBrowser.Server.Implementations/Sync/SyncHelper.cs
parentc8dc67d980afcd071609a3697478ade9ae439399 (diff)
rework handling of original quality
Diffstat (limited to 'MediaBrowser.Server.Implementations/Sync/SyncHelper.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Sync/SyncHelper.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/Sync/SyncHelper.cs b/MediaBrowser.Server.Implementations/Sync/SyncHelper.cs
new file mode 100644
index 000000000..6bcb27328
--- /dev/null
+++ b/MediaBrowser.Server.Implementations/Sync/SyncHelper.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Globalization;
+
+namespace MediaBrowser.Server.Implementations.Sync
+{
+ public class SyncHelper
+ {
+ public static int? AdjustBitrate(int? profileBitrate, string quality)
+ {
+ if (profileBitrate.HasValue)
+ {
+ if (string.Equals(quality, "medium", StringComparison.OrdinalIgnoreCase))
+ {
+ profileBitrate = Convert.ToInt32(profileBitrate.Value * .75);
+ }
+ else if (string.Equals(quality, "low", StringComparison.OrdinalIgnoreCase))
+ {
+ profileBitrate = Convert.ToInt32(profileBitrate.Value*.5);
+ }
+ else
+ {
+ int value;
+ if (int.TryParse(quality, NumberStyles.Any, CultureInfo.InvariantCulture, out value))
+ {
+ profileBitrate = value;
+ }
+ }
+ }
+
+ return profileBitrate;
+ }
+ }
+}