SABnzbd settings will now dynamically get the categories available from SABnzbd when the category drop-box gets focus, it will use values on the page so there is no need to save your settings first.
parent
d554e9ec83
commit
1d983801e8
@ -0,0 +1 @@
|
|||||||
|
{"categories":["*","anime","apps","books","consoles","ds-games","emulation","games","misc","movies","music","pda","resources","test","tv","tv-dvd","unknown","wii-games","xbox-dlc","xbox-xbla","xxx"]}
|
@ -1,9 +1,38 @@
|
|||||||
<img src='../../Content/Images/ignoredNeutral.png' class='ignoredEpisodesMaster ignoreEpisode' id='master' value='10'/>
|
@Html.DropDownList("SabTvCategory", new SelectList(new List<string> { "TV" }))
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(".ignoreEpisode").live("click", function () {
|
var sabCategoryUrl = '../Command/GetSabnzbdCategories';
|
||||||
var toggle = $(this);
|
|
||||||
var value = $(this).attr('value');
|
$('#SabTvCategory').focus(function () {
|
||||||
var test = 0;
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: sabCategoryUrl,
|
||||||
|
data: jQuery.param({ host: '192.168.5.55', port: 2222, apiKey: '5c770e3197e4fe763423ee7c392c25d1', username: 'admin', password: 'pass' }),
|
||||||
|
error: function (req, status, error) {
|
||||||
|
$.each($('#SabTvCategory option'), function () {
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#SabTvCategory').append($('<option />').val('tv').text('Please check your SABnzbd Settings'));
|
||||||
|
},
|
||||||
|
success: function (data, textStatus, jqXHR) {
|
||||||
|
//Get the current value
|
||||||
|
var currentlySelected = $('#SabTvCategory').val();
|
||||||
|
|
||||||
|
//Remove all existing options
|
||||||
|
$.each($('#SabTvCategory option'), function () {
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
//Add the new ones
|
||||||
|
$.each(data.categories, function () {
|
||||||
|
$('#SabTvCategory').append($('<option />').val(this.toString()).text(this.toString()));
|
||||||
|
});
|
||||||
|
|
||||||
|
//Attempt to reset to the preiously selected value (change to lower-case)
|
||||||
|
$("#SabTvCategory").val(currentlySelected.toLowerCase());
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
Loading…
Reference in new issue