Updated series grid

Added some parser tests
pull/3113/head
kay.one 14 years ago
parent f7de28b1bb
commit 9d7ed33d0d

@ -179,8 +179,9 @@ namespace NzbDrone.Core.Test
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23)); result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23));
} }
[Test] [TestCase("simpsons",21,23)]
public void newzbin_search_returns_valid_results() [TestCase("Hawaii Five-0", 1, 5)]
public void newzbin_search_returns_valid_results(string title, int season, int episode)
{ {
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
@ -194,12 +195,12 @@ namespace NzbDrone.Core.Test
mocker.Resolve<HttpProvider>(); mocker.Resolve<HttpProvider>();
var result = mocker.Resolve<Newzbin>().FetchEpisode("Simpsons", 21, 23); var result = mocker.Resolve<Newzbin>().FetchEpisode(title, season, episode);
result.Should().NotBeEmpty(); result.Should().NotBeEmpty();
result.Should().OnlyContain(r => r.CleanTitle == "simpsons"); result.Should().OnlyContain(r => r.CleanTitle == title);
result.Should().OnlyContain(r => r.SeasonNumber == 21); result.Should().OnlyContain(r => r.SeasonNumber == season);
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23)); result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(episode));
} }
[Test] [Test]

@ -41,6 +41,8 @@ namespace NzbDrone.Core.Test
[TestCase(@"24-7 Penguins-Capitals- Road to the NHL Winter Classic - S01E03 - Episode 3.mkv", "24-7 Penguins-Capitals- Road to the NHL Winter Classic", 1, 3)] [TestCase(@"24-7 Penguins-Capitals- Road to the NHL Winter Classic - S01E03 - Episode 3.mkv", "24-7 Penguins-Capitals- Road to the NHL Winter Classic", 1, 3)]
[TestCase("Adventure.Inc.S03E19.DVDRip.\"XviD\"-OSiTV", "Adventure.Inc", 3, 19)] [TestCase("Adventure.Inc.S03E19.DVDRip.\"XviD\"-OSiTV", "Adventure.Inc", 3, 19)]
[TestCase("C:/Test/TV/Chuck.4x05.HDTV.XviD-LOL", "Chuck", 4, 5)] [TestCase("C:/Test/TV/Chuck.4x05.HDTV.XviD-LOL", "Chuck", 4, 5)]
[TestCase("Hawaii Five-0 (2010) - 1x05 - Nalowale (Forgotten/Missing)", "Hawaii Five-0 (2010)", 1, 5)]
[TestCase("Hawaii Five-0 (2010) - 1x05 - Title", "Hawaii Five-0 (2010)", 1, 5)]
public void episode_parse(string postTitle, string title, int season, int episode) public void episode_parse(string postTitle, string title, int season, int episode)
{ {
var result = Parser.ParseEpisodeInfo(postTitle); var result = Parser.ParseEpisodeInfo(postTitle);
@ -202,6 +204,7 @@ namespace NzbDrone.Core.Test
[TestCase("CaPitAl", "capital")] [TestCase("CaPitAl", "capital")]
[TestCase("peri.od", "period")] [TestCase("peri.od", "period")]
[TestCase("this.^&%^**$%@#$!That", "thisthat")] [TestCase("this.^&%^**$%@#$!That", "thisthat")]
[TestCase("test/test", "testtest")]
public void Normalize_Title(string dirty, string clean) public void Normalize_Title(string dirty, string clean)
{ {
var result = Parser.NormalizeTitle(dirty); var result = Parser.NormalizeTitle(dirty);

@ -9,7 +9,7 @@
@{Html.Telerik().ComboBox() @{Html.Telerik().ComboBox()
.Name("path_" + ViewData["guid"]) .Name("path_" + ViewData["guid"])
.BindTo(Model.SelectList) .BindTo(Model.SelectList)
.DataBinding(binding => binding.Ajax().Select("_autoCompletePath", "Directory").Delay(400).Cache(false)) .DataBinding(binding => binding.Ajax().Select("_autoCompletePath", "Directory").Delay(400).Cache(true))
.Filterable(f => f.FilterMode(AutoCompleteFilterMode.StartsWith)) .Filterable(f => f.FilterMode(AutoCompleteFilterMode.StartsWith))
.HighlightFirstMatch(true) .HighlightFirstMatch(true)
.HtmlAttributes(new { style = "width: 300px;" }) .HtmlAttributes(new { style = "width: 300px;" })

@ -1,70 +1,49 @@
@using NzbDrone.Core.Repository; @using NzbDrone.Core.Repository;
@using NzbDrone.Web.Models; @using NzbDrone.Web.Models;
@model IEnumerable<NzbDrone.Core.Repository.Series> @model IEnumerable<NzbDrone.Core.Repository.Series>
@section TitleContent{ @section TitleContent{
Series Series
} }
<style> <style>
/* progress bar container */ /* progress bar container */
.progressbar .progressbar
{ {
border:1px solid grey; border: 1px solid #065EFE;
-khtml-border-radius:8px; width: 125px;
border-radius:8px; height: 20px;
-moz-border-radius:8px; position: relative;
-webkit-border-radius:8px; color: black;
width:125px; }
height:20px;
position:relative;
color:black;
}
/* apply curves to the progress bar */
.progress
{
-khtml-border-top-left-radius:7px;
border-top-left-radius:7px;
-moz-border-top-left-radius:7px;
-webkit-border-top-left-radius:7px;
-khtml-border-bottom-left-radius:7px;
border-bottom-left-radius:7px; /* color bar */
-moz-border-bottom-left-radius:7px; .progressbar div.progress
-webkit-border-bottom-left-radius:7px; {
} position: absolute;
width: 0;
/* color bar */ height: 100%;
.progressbar div.progress overflow: hidden;
{ background-color: #065EFE;
position:absolute; }
width:0; /* text on bar */
height:100%; .progressbar div.progress .progressText
overflow:hidden; {
background-color:#065EFE; position: absolute;
} text-align: center;
/* text on bar */ color: white;
.progressbar div.progress .progressText{ }
position:absolute; /* text off bar */
text-align:center; .progressbar div.progressText
color:white; {
} position: absolute;
/* text off bar */ width: 100%;
.progressbar div.progressText{ height: 100%;
position:absolute; text-align: center;
width:100%; }
height:100%;
text-align:center;
}
</style> </style>
@section ActionMenu{ @section ActionMenu{
@{Html.RenderPartial("SubMenu");} @{Html.RenderPartial("SubMenu");}
} }
@section MainContent{ @section MainContent{
<div class="grid-container"> <div class="grid-container">
@{Html.Telerik().Grid<SeriesModel>().Name("Grid") @{Html.Telerik().Grid<SeriesModel>().Name("Grid")
@ -76,9 +55,15 @@
.Delete("_DeleteAjaxSeriesEditing", "Series")) .Delete("_DeleteAjaxSeriesEditing", "Series"))
.Columns(columns => .Columns(columns =>
{ {
columns.Command(commands =>
{
commands.Edit().ButtonType(GridButtonType.Image);
commands.Delete().ButtonType(GridButtonType.Image);
}).Title("Actions").Width(80);
columns.Bound(o => o.Title) columns.Bound(o => o.Title)
.ClientTemplate("<a href=" + .ClientTemplate("<a href=" +
Url.Action("Details", "Series", new {seriesId = "<#= SeriesId #>"}) + Url.Action("Details", "Series", new { seriesId = "<#= SeriesId #>" }) +
"><#= Title #></a>"); "><#= Title #></a>");
columns.Bound(o => o.SeasonsCount).Title("Seasons"); columns.Bound(o => o.SeasonsCount).Title("Seasons");
columns.Bound(o => o.QualityProfileName).Title("Quality"); columns.Bound(o => o.QualityProfileName).Title("Quality");
@ -86,33 +71,30 @@
columns.Bound(o => o.AirsDayOfWeek); columns.Bound(o => o.AirsDayOfWeek);
columns.Bound(o => o.Episodes).Title("Episodes").Width(125) columns.Bound(o => o.Episodes).Title("Episodes").Width(125)
.ClientTemplate("<div id=\"progressbar_<#= SeriesId #>\" class=\"progressbar\">" + .ClientTemplate("<div id=\"progressbar_<#= SeriesId #>\" class=\"progressbar\">" +
"<div class=\"progressText\"></div>" + "<div class=\"progressText\"></div>" +
"<div class=\"progress\">" + "<div class=\"progress\">" +
"<span class=\"progressText\" style=\"width: 125px;\"></span>" + "<span class=\"progressText\" style=\"width: 125px;\"></span>" +
"</div>" + "</div>" +
"</div>"); "</div>");
columns.Bound(o => o.Path);
columns.Command(commands =>
{
commands.Edit().ButtonType(GridButtonType.Image);
commands.Delete().ButtonType(GridButtonType.Image);
}).Title("Actions").Width(80);
}) })
.Editable(editor => editor.Mode(GridEditMode.PopUp)) .Editable(editor => editor.Mode(GridEditMode.PopUp))
.Sortable(sort => sort.OrderBy(order => order.Add(o => o.Title).Ascending()).Enabled(true)) .Sortable(sort => sort.OrderBy(order => order.Add(o => o.Title).Ascending()).Enabled(true))
.DetailView(detailView => detailView.ClientTemplate("<div style=\"width:95%\"><#= Overview #></div>")) .DetailView(detailView => detailView.ClientTemplate("<div style=\"width:95%\"><#= Overview #></div>"))
.ClientEvents(clientEvents => { clientEvents.OnEdit("grid_edit"); .ClientEvents(clientEvents =>
clientEvents.OnSave("grid_save"); {
clientEvents.OnDataBinding("grid_bind"); clientEvents.OnEdit("grid_edit");
clientEvents.OnDataBound("grid_bound"); clientEvents.OnSave("grid_save");
clientEvents.OnRowDataBound("grid_rowBound"); clientEvents.OnDataBinding("grid_bind");
}) clientEvents.OnDataBound("grid_bound");
clientEvents.OnRowDataBound("grid_rowBound");
})
.Render();} .Render();}
<span class="grid-loader"><img src="@Url.Content( "~/Content/Images/Loading.gif" )" alt="Loading"/> Loading...</span> <span class="grid-loader">
<img src="@Url.Content("~/Content/Images/Loading.gif")" alt="Loading"/>
Loading...</span>
</div> </div>
} }
<script type="text/javascript"> <script type="text/javascript">
var windowElement; var windowElement;
@ -121,7 +103,7 @@
.closest(".t-window") .closest(".t-window")
.data("tWindow") .data("tWindow")
.center(); .center();
var seriesId = args.dataItem.SeriesId; var seriesId = args.dataItem.SeriesId;
var url = '@Url.Action("SeasonEditor", "Series")'; var url = '@Url.Action("SeasonEditor", "Series")';
$('#season-editor').load(url, { seriesId: seriesId }, function (response, status, xhr) { $('#season-editor').load(url, { seriesId: seriesId }, function (response, status, xhr) {
@ -131,25 +113,25 @@
function grid_save(e) { function grid_save(e) {
$('#ajaxSaveWheel').show(); $('#ajaxSaveWheel').show();
var seasonEditor = e.form.SeasonEditor_collection; var seasonEditor = e.form.SeasonEditor_collection;
var saveSeasonEditUrl = '@Url.Action("SaveSeason", "Series")'; var saveSeasonEditUrl = '@Url.Action("SaveSeason", "Series")';
jQuery.each(seasonEditor, function() { jQuery.each(seasonEditor, function () {
var guid = $(this).val(); var guid = $(this).val();
var prefix = '#SeasonEditor_' + guid + '__'; var prefix = '#SeasonEditor_' + guid + '__';
var seriesId = $(prefix + 'SeriesId').val(); var seriesId = $(prefix + 'SeriesId').val();
var seasonNumber = $(prefix + 'SeasonNumber').val(); var seasonNumber = $(prefix + 'SeasonNumber').val();
var monitored = $(prefix + 'Monitored').attr('checked'); var monitored = $(prefix + 'Monitored').attr('checked');
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: saveSeasonEditUrl, url: saveSeasonEditUrl,
data: jQuery.param({ seriesId: seriesId, seasonNumber: seasonNumber, monitored: monitored }), data: jQuery.param({ seriesId: seriesId, seasonNumber: seasonNumber, monitored: monitored }),
error: function(req, status, error) { error: function (req, status, error) {
alert("Sorry! We could save season changes at this time. " + error); alert("Sorry! We could save season changes at this time. " + error);
}, },
success: function(data, textStatus, jqXHR) { } success: function (data, textStatus, jqXHR) { }
}); });
}); });
} }
@ -163,7 +145,6 @@
$("#progressbar_" + seriesId).episodeProgress(episodeFileCount, episodeCount); $("#progressbar_" + seriesId).episodeProgress(episodeFileCount, episodeCount);
} }
</script> </script>
<script type="text/javascript" src="../../Scripts/doTimeout.js"></script> <script type="text/javascript" src="../../Scripts/doTimeout.js"></script>
<script> <script>
(function ($) { (function ($) {
@ -177,20 +158,10 @@
progressBar.css("width", width + "%"); progressBar.css("width", width + "%");
if (width > 97) {
progressBar.css("-khtml-border-top-right-radius", "7px");
progressBar.css("border-top-right-radius", "7px");
progressBar.css("-moz-border-top-right-radius", "7px");
progressBar.css("-webkit-border-top-right-radius", "7px");
progressBar.css("-khtml-border-bottom-right-radius", "7px");
progressBar.css("border-bottom-right-radius", "7px");
progressBar.css("-moz-border-bottom-right-radius", "7px");
progressBar.css("-webkit-border-bottom-right-radius", "7px");
}
div.find(".progressText").html(episodes + " / " + totalEpisodes); div.find(".progressText").html(episodes + " / " + totalEpisodes);
}); });
}; };
})(jQuery); })(jQuery);
</script> </script>

Loading…
Cancel
Save