mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-10 11:10:40 +02:00
Quality size sliders are implemented. Limits are calculated based on MB/Minute.
This commit is contained in:
parent
4b2427ade7
commit
8c06dde28a
@ -61,7 +61,7 @@ public class InventoryProvider_IsAcceptableSizeTest : TestBase
|
|||||||
|
|
||||||
qualityType = Builder<QualityType>.CreateNew()
|
qualityType = Builder<QualityType>.CreateNew()
|
||||||
.With(q => q.MinSize = 0)
|
.With(q => q.MinSize = 0)
|
||||||
.With(q => q.MaxSize = 314572800)
|
.With(q => q.MaxSize = 10)
|
||||||
.With(q => q.QualityTypeId = 1)
|
.With(q => q.QualityTypeId = 1)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ public void IsAcceptableSize_false_single_episode_not_first_or_last_30_minute()
|
|||||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||||
|
|
||||||
parseResultSingle.Series = series30minutes;
|
parseResultSingle.Series = series30minutes;
|
||||||
parseResultSingle.Size = 1184572800;
|
parseResultSingle.Size = 10000.Megabytes();
|
||||||
|
|
||||||
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ public void IsAcceptableSize_false_single_episode_not_first_or_last_60_minute()
|
|||||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||||
|
|
||||||
parseResultSingle.Series = series60minutes;
|
parseResultSingle.Series = series60minutes;
|
||||||
parseResultSingle.Size = 1368572800;
|
parseResultSingle.Size = 10000.Megabytes();
|
||||||
|
|
||||||
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ public void IsAcceptableSize_false_multi_episode_not_first_or_last_30_minute()
|
|||||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||||
|
|
||||||
parseResultMulti.Series = series30minutes;
|
parseResultMulti.Series = series30minutes;
|
||||||
parseResultMulti.Size = 1184572800;
|
parseResultMulti.Size = 10000.Megabytes();
|
||||||
|
|
||||||
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ public void IsAcceptableSize_false_multi_episode_not_first_or_last_60_minute()
|
|||||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||||
|
|
||||||
parseResultMulti.Series = series60minutes;
|
parseResultMulti.Series = series60minutes;
|
||||||
parseResultMulti.Size = 1368572800;
|
parseResultMulti.Size = 10000.Megabytes();
|
||||||
|
|
||||||
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ public void IsAcceptableSize_false_single_episode_first_30_minute()
|
|||||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||||
|
|
||||||
parseResultSingle.Series = series30minutes;
|
parseResultSingle.Series = series30minutes;
|
||||||
parseResultSingle.Size = 1184572800;
|
parseResultSingle.Size = 10000.Megabytes();
|
||||||
|
|
||||||
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ public void IsAcceptableSize_false_single_episode_first_60_minute()
|
|||||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||||
|
|
||||||
parseResultSingle.Series = series60minutes;
|
parseResultSingle.Series = series60minutes;
|
||||||
parseResultSingle.Size = 1368572800;
|
parseResultSingle.Size = 10000.Megabytes();
|
||||||
|
|
||||||
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||||
|
|
||||||
@ -319,5 +319,49 @@ public void IsAcceptableSize_false_single_episode_first_60_minute()
|
|||||||
//Assert
|
//Assert
|
||||||
result.Should().BeFalse();
|
result.Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void IsAcceptableSize_true_unlimited_30_minute()
|
||||||
|
{
|
||||||
|
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||||
|
|
||||||
|
parseResultSingle.Series = series30minutes;
|
||||||
|
parseResultSingle.Size = 18457280000;
|
||||||
|
qualityType.MaxSize = 0;
|
||||||
|
|
||||||
|
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||||
|
|
||||||
|
mocker.GetMock<EpisodeProvider>().Setup(
|
||||||
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||||
|
.Returns(true);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
bool result = mocker.Resolve<InventoryProvider>().IsAcceptableSize(parseResultSingle);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
result.Should().BeTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void IsAcceptableSize_true_unlimited_60_minute()
|
||||||
|
{
|
||||||
|
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||||
|
|
||||||
|
parseResultSingle.Series = series60minutes;
|
||||||
|
parseResultSingle.Size = 36857280000;
|
||||||
|
qualityType.MaxSize = 0;
|
||||||
|
|
||||||
|
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
|
||||||
|
|
||||||
|
mocker.GetMock<EpisodeProvider>().Setup(
|
||||||
|
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||||
|
.Returns(true);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
bool result = mocker.Resolve<InventoryProvider>().IsAcceptableSize(parseResultSingle);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
result.Should().BeTrue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -137,7 +137,7 @@ public void IsQualityNeeded_file_already_at_cut_off_should_be_skipped()
|
|||||||
|
|
||||||
mocker.GetMock<QualityTypeProvider>()
|
mocker.GetMock<QualityTypeProvider>()
|
||||||
.Setup(s => s.Get(It.IsAny<int>()))
|
.Setup(s => s.Get(It.IsAny<int>()))
|
||||||
.Returns(new QualityType { MaxSize = 10.Gigabytes(), MinSize = 0 });
|
.Returns(new QualityType { MaxSize = 100, MinSize = 0 });
|
||||||
|
|
||||||
episode.EpisodeFile.Quality = QualityTypes.Bluray720p;
|
episode.EpisodeFile.Quality = QualityTypes.Bluray720p;
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ public void IsQualityNeeded_file_in_history_should_be_skipped()
|
|||||||
|
|
||||||
mocker.GetMock<QualityTypeProvider>()
|
mocker.GetMock<QualityTypeProvider>()
|
||||||
.Setup(s => s.Get(It.IsAny<int>()))
|
.Setup(s => s.Get(It.IsAny<int>()))
|
||||||
.Returns(new QualityType { MaxSize = 10.Gigabytes(), MinSize = 0 });
|
.Returns(new QualityType { MaxSize = 100, MinSize = 0 });
|
||||||
|
|
||||||
episode.EpisodeFile.Quality = QualityTypes.SDTV;
|
episode.EpisodeFile.Quality = QualityTypes.SDTV;
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ public void IsQualityNeeded_lesser_file_in_history_should_be_downloaded()
|
|||||||
|
|
||||||
mocker.GetMock<QualityTypeProvider>()
|
mocker.GetMock<QualityTypeProvider>()
|
||||||
.Setup(s => s.Get(It.IsAny<int>()))
|
.Setup(s => s.Get(It.IsAny<int>()))
|
||||||
.Returns(new QualityType { MaxSize = 10.Gigabytes(), MinSize = 0 });
|
.Returns(new QualityType { MaxSize = 100, MinSize = 0 });
|
||||||
|
|
||||||
episode.EpisodeFile.Quality = QualityTypes.SDTV;
|
episode.EpisodeFile.Quality = QualityTypes.SDTV;
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ public void IsQualityNeeded_file_not_in_history_should_be_downloaded()
|
|||||||
|
|
||||||
mocker.GetMock<QualityTypeProvider>()
|
mocker.GetMock<QualityTypeProvider>()
|
||||||
.Setup(s => s.Get(It.IsAny<int>()))
|
.Setup(s => s.Get(It.IsAny<int>()))
|
||||||
.Returns(new QualityType { MaxSize = 10.Gigabytes(), MinSize = 0 });
|
.Returns(new QualityType { MaxSize = 100, MinSize = 0 });
|
||||||
|
|
||||||
episode.EpisodeFile.Quality = QualityTypes.SDTV;
|
episode.EpisodeFile.Quality = QualityTypes.SDTV;
|
||||||
//Act
|
//Act
|
||||||
|
@ -17,8 +17,8 @@ public override void Up()
|
|||||||
{
|
{
|
||||||
new Column("QualityTypeId", DbType.Int32, ColumnProperty.PrimaryKey),
|
new Column("QualityTypeId", DbType.Int32, ColumnProperty.PrimaryKey),
|
||||||
new Column("Name", DbType.String, ColumnProperty.NotNull),
|
new Column("Name", DbType.String, ColumnProperty.NotNull),
|
||||||
new Column("MinSize", DbType.Int64, ColumnProperty.NotNull),
|
new Column("MinSize", DbType.Int32, ColumnProperty.NotNull),
|
||||||
new Column("MaxSize", DbType.Int64, ColumnProperty.NotNull)
|
new Column("MaxSize", DbType.Int32, ColumnProperty.NotNull)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,6 @@ public virtual bool IsQualityNeeded(EpisodeParseResult parsedReport)
|
|||||||
return true; //If we get to this point and the file has not yet been rejected then accept it
|
return true; //If we get to this point and the file has not yet been rejected then accept it
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static bool IsUpgrade(Quality currentQuality, Quality newQuality, QualityTypes cutOff)
|
public static bool IsUpgrade(Quality currentQuality, Quality newQuality, QualityTypes cutOff)
|
||||||
{
|
{
|
||||||
if (currentQuality.QualityType >= cutOff)
|
if (currentQuality.QualityType >= cutOff)
|
||||||
@ -147,12 +146,15 @@ public virtual bool IsAcceptableSize(EpisodeParseResult parseResult)
|
|||||||
//Is it a multi-episode release?
|
//Is it a multi-episode release?
|
||||||
//Is it the first or last series of a season?
|
//Is it the first or last series of a season?
|
||||||
|
|
||||||
var maxSize = qualityType.MaxSize;
|
//0 will be treated as unlimited
|
||||||
|
if (qualityType.MaxSize == 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
var maxSize = qualityType.MaxSize.Megabytes();
|
||||||
var series = parseResult.Series;
|
var series = parseResult.Series;
|
||||||
|
|
||||||
//If this is an hour long episode (between 50 and 65 minutes) then multiply by 2
|
//Multiply maxSize by Series.Runtime
|
||||||
if (series.Runtime >= 50 && series.Runtime <= 65)
|
maxSize = maxSize * series.Runtime;
|
||||||
maxSize = maxSize * 2;
|
|
||||||
|
|
||||||
//Multiply maxSize by the number of episodes parsed
|
//Multiply maxSize by the number of episodes parsed
|
||||||
maxSize = maxSize * parseResult.EpisodeNumbers.Count;
|
maxSize = maxSize * parseResult.EpisodeNumbers.Count;
|
||||||
|
@ -60,12 +60,12 @@ public virtual void SetupDefault()
|
|||||||
Logger.Info("Setting up default quality types");
|
Logger.Info("Setting up default quality types");
|
||||||
|
|
||||||
var qualityTypes = new List<QualityType>();
|
var qualityTypes = new List<QualityType>();
|
||||||
qualityTypes.Add(new QualityType { QualityTypeId = 1, Name = "SDTV", MinSize = 0, MaxSize = 10.Gigabytes() });
|
qualityTypes.Add(new QualityType { QualityTypeId = 1, Name = "SDTV", MinSize = 0, MaxSize = 100 });
|
||||||
qualityTypes.Add(new QualityType { QualityTypeId = 2, Name = "DVD", MinSize = 0, MaxSize = 10.Gigabytes() });
|
qualityTypes.Add(new QualityType { QualityTypeId = 2, Name = "DVD", MinSize = 0, MaxSize = 100 });
|
||||||
qualityTypes.Add(new QualityType { QualityTypeId = 4, Name = "HDTV", MinSize = 0, MaxSize = 10.Gigabytes() });
|
qualityTypes.Add(new QualityType { QualityTypeId = 4, Name = "HDTV", MinSize = 0, MaxSize = 100 });
|
||||||
qualityTypes.Add(new QualityType { QualityTypeId = 5, Name = "WEBDL", MinSize = 0, MaxSize = 10.Gigabytes() });
|
qualityTypes.Add(new QualityType { QualityTypeId = 5, Name = "WEBDL", MinSize = 0, MaxSize = 100 });
|
||||||
qualityTypes.Add(new QualityType { QualityTypeId = 6, Name = "Bluray720p", MinSize = 0, MaxSize = 10.Gigabytes() });
|
qualityTypes.Add(new QualityType { QualityTypeId = 6, Name = "Bluray720p", MinSize = 0, MaxSize = 100 });
|
||||||
qualityTypes.Add(new QualityType { QualityTypeId = 7, Name = "Bluray1080p", MinSize = 0, MaxSize = 10.Gigabytes() });
|
qualityTypes.Add(new QualityType { QualityTypeId = 7, Name = "Bluray1080p", MinSize = 0, MaxSize = 100 });
|
||||||
|
|
||||||
_database.InsertMany(qualityTypes);
|
_database.InsertMany(qualityTypes);
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,8 @@ public class QualityType
|
|||||||
{
|
{
|
||||||
public int QualityTypeId { get; set; }
|
public int QualityTypeId { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public long MinSize { get; set; }
|
public int MinSize { get; set; }
|
||||||
public long MaxSize { get; set; }
|
public int MaxSize { get; set; }
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
|
@ -105,4 +105,15 @@
|
|||||||
{
|
{
|
||||||
min-height: 23px;
|
min-height: 23px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sliders
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider-container
|
||||||
|
{
|
||||||
|
margin-bottom: 10px;
|
||||||
}
|
}
|
@ -27,12 +27,15 @@ public class SettingsController : Controller
|
|||||||
private readonly AutoConfigureProvider _autoConfigureProvider;
|
private readonly AutoConfigureProvider _autoConfigureProvider;
|
||||||
private readonly SeriesProvider _seriesProvider;
|
private readonly SeriesProvider _seriesProvider;
|
||||||
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
||||||
|
private readonly QualityTypeProvider _qualityTypeProvider;
|
||||||
|
|
||||||
public SettingsController(ConfigProvider configProvider, IndexerProvider indexerProvider,
|
public SettingsController(ConfigProvider configProvider, IndexerProvider indexerProvider,
|
||||||
QualityProvider qualityProvider, AutoConfigureProvider autoConfigureProvider,
|
QualityProvider qualityProvider, AutoConfigureProvider autoConfigureProvider,
|
||||||
SeriesProvider seriesProvider, ExternalNotificationProvider externalNotificationProvider)
|
SeriesProvider seriesProvider, ExternalNotificationProvider externalNotificationProvider,
|
||||||
|
QualityTypeProvider qualityTypeProvider)
|
||||||
{
|
{
|
||||||
_externalNotificationProvider = externalNotificationProvider;
|
_externalNotificationProvider = externalNotificationProvider;
|
||||||
|
_qualityTypeProvider = qualityTypeProvider;
|
||||||
_configProvider = configProvider;
|
_configProvider = configProvider;
|
||||||
_indexerProvider = indexerProvider;
|
_indexerProvider = indexerProvider;
|
||||||
_qualityProvider = qualityProvider;
|
_qualityProvider = qualityProvider;
|
||||||
@ -123,12 +126,19 @@ public ActionResult Quality()
|
|||||||
|
|
||||||
var defaultQualityQualityProfileId = Convert.ToInt32(_configProvider.DefaultQualityProfile);
|
var defaultQualityQualityProfileId = Convert.ToInt32(_configProvider.DefaultQualityProfile);
|
||||||
var qualityProfileSelectList = new SelectList(profiles, "QualityProfileId", "Name");
|
var qualityProfileSelectList = new SelectList(profiles, "QualityProfileId", "Name");
|
||||||
|
var qualityTypesFromDb = _qualityTypeProvider.All();
|
||||||
|
|
||||||
var model = new QualityModel
|
var model = new QualityModel
|
||||||
{
|
{
|
||||||
Profiles = profiles,
|
Profiles = profiles,
|
||||||
DefaultQualityProfileId = defaultQualityQualityProfileId,
|
DefaultQualityProfileId = defaultQualityQualityProfileId,
|
||||||
QualityProfileSelectList = qualityProfileSelectList
|
QualityProfileSelectList = qualityProfileSelectList,
|
||||||
|
SdtvMaxSize = qualityTypesFromDb.Single(q => q.QualityTypeId == 1).MaxSize,
|
||||||
|
DvdMaxSize = qualityTypesFromDb.Single(q => q.QualityTypeId == 2).MaxSize,
|
||||||
|
HdtvMaxSize = qualityTypesFromDb.Single(q => q.QualityTypeId == 4).MaxSize,
|
||||||
|
WebdlMaxSize = qualityTypesFromDb.Single(q => q.QualityTypeId == 5).MaxSize,
|
||||||
|
Bluray720pMaxSize = qualityTypesFromDb.Single(q => q.QualityTypeId == 6).MaxSize,
|
||||||
|
Bluray1080pMaxSize = qualityTypesFromDb.Single(q => q.QualityTypeId == 7).MaxSize
|
||||||
};
|
};
|
||||||
|
|
||||||
return View(model);
|
return View(model);
|
||||||
@ -322,8 +332,6 @@ public JsonResult SaveSabnzbd(SabnzbdSettingsModel data)
|
|||||||
Json(new NotificationResult() { Title = "Failed", Text = "Invalid request data.", NotificationType = NotificationType.Error });
|
Json(new NotificationResult() { Title = "Failed", Text = "Invalid request data.", NotificationType = NotificationType.Error });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public JsonResult SaveQuality(QualityModel data)
|
public JsonResult SaveQuality(QualityModel data)
|
||||||
{
|
{
|
||||||
@ -358,6 +366,17 @@ public JsonResult SaveQuality(QualityModel data)
|
|||||||
_qualityProvider.Update(profile);
|
_qualityProvider.Update(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var qualityTypesFromDb = _qualityTypeProvider.All();
|
||||||
|
|
||||||
|
qualityTypesFromDb.Single(q => q.QualityTypeId == 1).MaxSize = data.SdtvMaxSize;
|
||||||
|
qualityTypesFromDb.Single(q => q.QualityTypeId == 2).MaxSize = data.DvdMaxSize;
|
||||||
|
qualityTypesFromDb.Single(q => q.QualityTypeId == 4).MaxSize = data.HdtvMaxSize;
|
||||||
|
qualityTypesFromDb.Single(q => q.QualityTypeId == 5).MaxSize = data.WebdlMaxSize;
|
||||||
|
qualityTypesFromDb.Single(q => q.QualityTypeId == 6).MaxSize = data.Bluray720pMaxSize;
|
||||||
|
qualityTypesFromDb.Single(q => q.QualityTypeId == 7).MaxSize = data.Bluray1080pMaxSize;
|
||||||
|
|
||||||
|
_qualityTypeProvider.UpdateAll(qualityTypesFromDb);
|
||||||
|
|
||||||
return GetSuccessResult();
|
return GetSuccessResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,5 +14,12 @@ public class QualityModel
|
|||||||
public int DefaultQualityProfileId { get; set; }
|
public int DefaultQualityProfileId { get; set; }
|
||||||
|
|
||||||
public SelectList QualityProfileSelectList { get; set; }
|
public SelectList QualityProfileSelectList { get; set; }
|
||||||
|
|
||||||
|
public int SdtvMaxSize { get; set; }
|
||||||
|
public int DvdMaxSize { get; set; }
|
||||||
|
public int HdtvMaxSize { get; set; }
|
||||||
|
public int WebdlMaxSize { get; set; }
|
||||||
|
public int Bluray720pMaxSize { get; set; }
|
||||||
|
public int Bluray1080pMaxSize { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -23,6 +23,50 @@ Settings
|
|||||||
<span class="small">@Html.DescriptionFor(m => m.DefaultQualityProfileId)</span>
|
<span class="small">@Html.DescriptionFor(m => m.DefaultQualityProfileId)</span>
|
||||||
</label>
|
</label>
|
||||||
@Html.DropDownListFor(m => m.DefaultQualityProfileId, Model.QualityProfileSelectList, new { @class = "inputClass" })
|
@Html.DropDownListFor(m => m.DefaultQualityProfileId, Model.QualityProfileSelectList, new { @class = "inputClass" })
|
||||||
|
|
||||||
|
<div class="sliders">
|
||||||
|
<div class="slider-container">
|
||||||
|
<b>SDTV</b>
|
||||||
|
<div id="sdtv-slider" class="slider"></div>
|
||||||
|
@Html.HiddenFor(m => m.SdtvMaxSize, new { @class="slider-value" })
|
||||||
|
30 minute size: <span class="30-minute"></span> | 60 minute size: <span class="60-minute"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="slider-container">
|
||||||
|
<b>DVD</b>
|
||||||
|
<div id="dvd-slider" class="slider"></div>
|
||||||
|
@Html.HiddenFor(m => m.DvdMaxSize, new { @class = "slider-value" })
|
||||||
|
30 minute size: <span class="30-minute"></span> | 60 minute size: <span class="60-minute"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="slider-container">
|
||||||
|
<b>HDTV</b>
|
||||||
|
<div id="hdtv-slider" class="slider"></div>
|
||||||
|
@Html.HiddenFor(m => m.HdtvMaxSize, new { @class = "slider-value" })
|
||||||
|
30 minute size: <span class="30-minute"></span> | 60 minute size: <span class="60-minute"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="slider-container">
|
||||||
|
<b>WEBDL</b>
|
||||||
|
<div id="webdl-slider" class="slider"></div>
|
||||||
|
@Html.HiddenFor(m => m.WebdlMaxSize, new { @class = "slider-value" })
|
||||||
|
30 minute size: <span class="30-minute"></span> | 60 minute size: <span class="60-minute"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="slider-container">
|
||||||
|
<b>Bluray 720p</b>
|
||||||
|
<div id="bluray720p-slider" class="slider"></div>
|
||||||
|
@Html.HiddenFor(m => m.Bluray720pMaxSize, new { @class = "slider-value" })
|
||||||
|
30 minute size: <span class="30-minute"></span> | 60 minute size: <span class="60-minute"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="slider-container">
|
||||||
|
<b>Bluray 1080p</b>
|
||||||
|
<div id="bluray1080p-slider" class="slider"></div>
|
||||||
|
@Html.HiddenFor(m => m.Bluray1080pMaxSize, new { @class = "slider-value" })
|
||||||
|
30 minute size: <span class="30-minute"></span> | 60 minute size: <span class="60-minute"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="bottom" class="clearfix">
|
<div id="bottom" class="clearfix">
|
||||||
@ -48,7 +92,7 @@ Settings
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@section Scripts{
|
@section Scripts{
|
||||||
<script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script>
|
<script src="../../Scripts/Plugins/MicrosoftAjax.js" type="text/javascript"></script>
|
||||||
<script src="http://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.validate.unobtrusive.min.js"
|
<script src="http://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.validate.unobtrusive.min.js"
|
||||||
type="text/javascript"></script>
|
type="text/javascript"></script>
|
||||||
<script src="../../Scripts/settingsForm.js" type="text/javascript"></script>
|
<script src="../../Scripts/settingsForm.js" type="text/javascript"></script>
|
||||||
@ -156,5 +200,35 @@ Settings
|
|||||||
|
|
||||||
$(allowedString).empty().val(result);
|
$(allowedString).empty().val(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var sliderOptions = {
|
||||||
|
min: 0,
|
||||||
|
max: 200,
|
||||||
|
value: 0,
|
||||||
|
step: 1,
|
||||||
|
create: function( event, ui ) {
|
||||||
|
var startingValue = $(this).siblings('.slider-value').val();
|
||||||
|
$(this).siblings('.30-minute').text(startingValue * 30);
|
||||||
|
$(this).siblings('.60-minute').text(startingValue * 60);
|
||||||
|
},
|
||||||
|
slide: function( event, ui ) {
|
||||||
|
$(this).siblings('.slider-value').val(ui.value);
|
||||||
|
$(this).siblings('.30-minute').text(ui.value * 30);
|
||||||
|
$(this).siblings('.60-minute').text(ui.value * 60);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
setupSliders();
|
||||||
|
});
|
||||||
|
|
||||||
|
function setupSliders() {
|
||||||
|
$(".slider").each(function() {
|
||||||
|
var localOptions = sliderOptions;
|
||||||
|
localOptions["value"] = $(this).siblings('.slider-value').val();
|
||||||
|
|
||||||
|
$(this).empty().slider(localOptions);
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user