Updated series grid

Added some parser tests
pull/4/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));
}
[Test]
public void newzbin_search_returns_valid_results()
[TestCase("simpsons",21,23)]
[TestCase("Hawaii Five-0", 1, 5)]
public void newzbin_search_returns_valid_results(string title, int season, int episode)
{
var mocker = new AutoMoqer();
@ -194,12 +195,12 @@ namespace NzbDrone.Core.Test
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().OnlyContain(r => r.CleanTitle == "simpsons");
result.Should().OnlyContain(r => r.SeasonNumber == 21);
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23));
result.Should().OnlyContain(r => r.CleanTitle == title);
result.Should().OnlyContain(r => r.SeasonNumber == season);
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(episode));
}
[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("Adventure.Inc.S03E19.DVDRip.\"XviD\"-OSiTV", "Adventure.Inc", 3, 19)]
[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)
{
var result = Parser.ParseEpisodeInfo(postTitle);
@ -202,6 +204,7 @@ namespace NzbDrone.Core.Test
[TestCase("CaPitAl", "capital")]
[TestCase("peri.od", "period")]
[TestCase("this.^&%^**$%@#$!That", "thisthat")]
[TestCase("test/test", "testtest")]
public void Normalize_Title(string dirty, string clean)
{
var result = Parser.NormalizeTitle(dirty);

@ -9,7 +9,7 @@
@{Html.Telerik().ComboBox()
.Name("path_" + ViewData["guid"])
.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))
.HighlightFirstMatch(true)
.HtmlAttributes(new { style = "width: 300px;" })

@ -1,70 +1,49 @@
@using NzbDrone.Core.Repository;
@using NzbDrone.Web.Models;
@model IEnumerable<NzbDrone.Core.Repository.Series>
@section TitleContent{
Series
Series
}
<style>
/* progress bar container */
.progressbar
{
border:1px solid grey;
-khtml-border-radius:8px;
border-radius:8px;
-moz-border-radius:8px;
-webkit-border-radius:8px;
width:125px;
height:20px;
position:relative;
color:black;
}
/* progress bar container */
.progressbar
{
border: 1px solid #065EFE;
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;
-moz-border-bottom-left-radius:7px;
-webkit-border-bottom-left-radius:7px;
}
/* color bar */
.progressbar div.progress
{
position:absolute;
width:0;
height:100%;
overflow:hidden;
background-color:#065EFE;
}
/* text on bar */
.progressbar div.progress .progressText{
position:absolute;
text-align:center;
color:white;
}
/* text off bar */
.progressbar div.progressText{
position:absolute;
width:100%;
height:100%;
text-align:center;
}
/* color bar */
.progressbar div.progress
{
position: absolute;
width: 0;
height: 100%;
overflow: hidden;
background-color: #065EFE;
}
/* text on bar */
.progressbar div.progress .progressText
{
position: absolute;
text-align: center;
color: white;
}
/* text off bar */
.progressbar div.progressText
{
position: absolute;
width: 100%;
height: 100%;
text-align: center;
}
</style>
@section ActionMenu{
@{Html.RenderPartial("SubMenu");}
}
@section MainContent{
<div class="grid-container">
@{Html.Telerik().Grid<SeriesModel>().Name("Grid")
@ -76,9 +55,15 @@
.Delete("_DeleteAjaxSeriesEditing", "Series"))
.Columns(columns =>
{
columns.Command(commands =>
{
commands.Edit().ButtonType(GridButtonType.Image);
commands.Delete().ButtonType(GridButtonType.Image);
}).Title("Actions").Width(80);
columns.Bound(o => o.Title)
.ClientTemplate("<a href=" +
Url.Action("Details", "Series", new {seriesId = "<#= SeriesId #>"}) +
Url.Action("Details", "Series", new { seriesId = "<#= SeriesId #>" }) +
"><#= Title #></a>");
columns.Bound(o => o.SeasonsCount).Title("Seasons");
columns.Bound(o => o.QualityProfileName).Title("Quality");
@ -91,28 +76,25 @@
"<span class=\"progressText\" style=\"width: 125px;\"></span>" +
"</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))
.Sortable(sort => sort.OrderBy(order => order.Add(o => o.Title).Ascending()).Enabled(true))
.DetailView(detailView => detailView.ClientTemplate("<div style=\"width:95%\"><#= Overview #></div>"))
.ClientEvents(clientEvents => { clientEvents.OnEdit("grid_edit");
clientEvents.OnSave("grid_save");
clientEvents.OnDataBinding("grid_bind");
clientEvents.OnDataBound("grid_bound");
clientEvents.OnRowDataBound("grid_rowBound");
})
.ClientEvents(clientEvents =>
{
clientEvents.OnEdit("grid_edit");
clientEvents.OnSave("grid_save");
clientEvents.OnDataBinding("grid_bind");
clientEvents.OnDataBound("grid_bound");
clientEvents.OnRowDataBound("grid_rowBound");
})
.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>
}
<script type="text/javascript">
var windowElement;
@ -135,7 +117,7 @@
var seasonEditor = e.form.SeasonEditor_collection;
var saveSeasonEditUrl = '@Url.Action("SaveSeason", "Series")';
jQuery.each(seasonEditor, function() {
jQuery.each(seasonEditor, function () {
var guid = $(this).val();
var prefix = '#SeasonEditor_' + guid + '__';
var seriesId = $(prefix + 'SeriesId').val();
@ -143,13 +125,13 @@
var monitored = $(prefix + 'Monitored').attr('checked');
$.ajax({
type: "POST",
url: saveSeasonEditUrl,
data: jQuery.param({ seriesId: seriesId, seasonNumber: seasonNumber, monitored: monitored }),
error: function(req, status, error) {
alert("Sorry! We could save season changes at this time. " + error);
},
success: function(data, textStatus, jqXHR) { }
type: "POST",
url: saveSeasonEditUrl,
data: jQuery.param({ seriesId: seriesId, seasonNumber: seasonNumber, monitored: monitored }),
error: function (req, status, error) {
alert("Sorry! We could save season changes at this time. " + error);
},
success: function (data, textStatus, jqXHR) { }
});
});
}
@ -163,7 +145,6 @@
$("#progressbar_" + seriesId).episodeProgress(episodeFileCount, episodeCount);
}
</script>
<script type="text/javascript" src="../../Scripts/doTimeout.js"></script>
<script>
(function ($) {
@ -177,17 +158,7 @@
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);
});

Loading…
Cancel
Save