mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Adds an indexer select box in search and general search improvements
This commit is contained in:
commit
18e8b7a5aa
@ -30,6 +30,7 @@
|
||||
#end if
|
||||
<td>
|
||||
<select name="indexer">
|
||||
<option value="0" #if $indexer == 0 then "selected=\"selected\"" else ""#>All Indexers</option>
|
||||
#for $curIndexer in $sickbeard.indexerApi().indexers.items():
|
||||
<option value="$curIndexer[0]" #if $curIndexer[0] == $indexer then "selected=\"selected\"" else ""#>$curIndexer[1]</option>
|
||||
#end for
|
||||
|
@ -37,12 +37,17 @@
|
||||
<input type="hidden" id="providedName" value="$provided_indexer_name" />
|
||||
<input type="hidden" id="providedIndexer" value="$provided_indexer" />
|
||||
#else:
|
||||
<input type="hidden" id="providedIndexer" value="$provided_indexer" />
|
||||
<input type="text" id="nameToSearch" value="$default_show_name" style="margin-top: 1px;" />
|
||||
<select name="indexerLang" id="indexerLangSelect" style="height: 26px;margin-top: 1px;">
|
||||
<option value="en" selected="selected">en</option>
|
||||
</select><b>*</b>
|
||||
<input class="btn" type="button" id="searchName" value="Search" style="margin-top: -3px;" /><br /><br />
|
||||
<select name="providedIndexer" id="providedIndexer" style="height: 26px;margin-top: 1px;">
|
||||
<option value="0" #if $provided_indexer == 0 then "selected=\"selected\"" else ""#>All Indexers</option>
|
||||
#for $indexer in $indexers
|
||||
<option value="$indexer" #if $provided_indexer == $indexer then "selected=\"selected\"" else ""#>$indexers[$indexer]</option>
|
||||
#end for
|
||||
</select>
|
||||
<input class="btn" type="button" id="searchName" value="Search" style="height: 26px;position:relative;top:-1px;" /><br /><br />
|
||||
|
||||
<b>*</b> This will only affect the language of the retrieved metadata file contents and episode filenames.<br />
|
||||
This <b>DOES NOT</b> allow Sick Beard to download non-english TV episodes!<br />
|
||||
|
@ -29,61 +29,75 @@ $(document).ready(function () {
|
||||
}
|
||||
}
|
||||
|
||||
var searchRequestXhr = null;
|
||||
|
||||
function searchIndexers() {
|
||||
if (!$('#nameToSearch').val().length) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('#searchResults').html('<img id="searchingAnim" src="' + sbRoot + '/images/loading32.gif" height="32" width="32" /> searching...');
|
||||
if (searchRequestXhr) searchRequestXhr.abort();
|
||||
|
||||
$.getJSON(sbRoot + '/home/addShows/searchIndexersForShowName', {'name': $('#nameToSearch').val(), 'lang': $('#indexerLangSelect').val(), 'indexer': $('#providedIndexer').val()}, function (data) {
|
||||
var firstResult = true;
|
||||
var resultStr = '<fieldset>\n<legend>Search Results:</legend>\n';
|
||||
var checked = '';
|
||||
var searchingFor = $('#nameToSearch').val() + ' on ' + $('#providedIndexer option:selected').text() + ' in ' + $('#indexerLangSelect').val();
|
||||
$('#searchResults').empty().html('<img id="searchingAnim" src="' + sbRoot + '/images/loading32.gif" height="32" width="32" /> searching ' + searchingFor + '...');
|
||||
|
||||
if (data.results.length === 0) {
|
||||
resultStr += '<b>No results found, try a different search.</b>';
|
||||
} else {
|
||||
$.each(data.results, function (index, obj) {
|
||||
if (firstResult) {
|
||||
checked = ' checked';
|
||||
firstResult = false;
|
||||
} else {
|
||||
checked = '';
|
||||
}
|
||||
searchRequestXhr = $.ajax({
|
||||
url: sbRoot + '/home/addShows/searchIndexersForShowName',
|
||||
data: {'name': $('#nameToSearch').val(), 'lang': $('#indexerLangSelect').val(), 'indexer': $('#providedIndexer').val()},
|
||||
timeout: 10000,
|
||||
dataType: 'json',
|
||||
error: function () {
|
||||
$('#searchResults').empty().html('search timed out, try again or try another indexer');
|
||||
},
|
||||
success: function (data) {
|
||||
var firstResult = true;
|
||||
var resultStr = '<fieldset>\n<legend>Search Results:</legend>\n';
|
||||
var checked = '';
|
||||
|
||||
var whichSeries = obj.join('|');
|
||||
|
||||
|
||||
resultStr += '<input type="radio" id="whichSeries" name="whichSeries" value="' + whichSeries + '"' + checked + ' /> ';
|
||||
if (data.langid && data.langid != "") {
|
||||
resultStr += '<a href="'+ obj[2] + obj[3] + '&lid=' + data.langid + '" onclick=\"window.open(this.href, \'_blank\'); return false;\" ><b>' + obj[4] + '</b></a>';
|
||||
} else {
|
||||
resultStr += '<a href="'+ obj[2] + obj[3] + '" onclick=\"window.open(this.href, \'_blank\'); return false;\" ><b>' + obj[4] + '</b></a>';
|
||||
}
|
||||
|
||||
if (obj[5] !== null) {
|
||||
var startDate = new Date(obj[5]);
|
||||
var today = new Date();
|
||||
if (startDate > today) {
|
||||
resultStr += ' (will debut on ' + obj[5] + ')';
|
||||
if (data.results.length === 0) {
|
||||
resultStr += '<b>No results found, try a different search.</b>';
|
||||
} else {
|
||||
$.each(data.results, function (index, obj) {
|
||||
if (firstResult) {
|
||||
checked = ' checked';
|
||||
firstResult = false;
|
||||
} else {
|
||||
resultStr += ' (started on ' + obj[5] + ')';
|
||||
checked = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (obj[0] !== null) {
|
||||
resultStr += ' [' + obj[0] + ']';
|
||||
}
|
||||
var whichSeries = obj.join('|');
|
||||
|
||||
resultStr += '<br />';
|
||||
});
|
||||
resultStr += '</ul>';
|
||||
|
||||
resultStr += '<input type="radio" id="whichSeries" name="whichSeries" value="' + whichSeries + '"' + checked + ' /> ';
|
||||
if (data.langid && data.langid != "") {
|
||||
resultStr += '<a href="'+ obj[2] + obj[3] + '&lid=' + data.langid + '" onclick=\"window.open(this.href, \'_blank\'); return false;\" ><b>' + obj[4] + '</b></a>';
|
||||
} else {
|
||||
resultStr += '<a href="'+ obj[2] + obj[3] + '" onclick=\"window.open(this.href, \'_blank\'); return false;\" ><b>' + obj[4] + '</b></a>';
|
||||
}
|
||||
|
||||
if (obj[5] !== null) {
|
||||
var startDate = new Date(obj[5]);
|
||||
var today = new Date();
|
||||
if (startDate > today) {
|
||||
resultStr += ' (will debut on ' + obj[5] + ')';
|
||||
} else {
|
||||
resultStr += ' (started on ' + obj[5] + ')';
|
||||
}
|
||||
}
|
||||
|
||||
if (obj[0] !== null) {
|
||||
resultStr += ' [' + obj[0] + ']';
|
||||
}
|
||||
|
||||
resultStr += '<br />';
|
||||
});
|
||||
resultStr += '</ul>';
|
||||
}
|
||||
resultStr += '</fieldset>';
|
||||
$('#searchResults').html(resultStr);
|
||||
updateSampleText();
|
||||
myform.loadsection(0);
|
||||
}
|
||||
resultStr += '</fieldset>';
|
||||
$('#searchResults').html(resultStr);
|
||||
updateSampleText();
|
||||
myform.loadsection(0);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2132,6 +2132,7 @@ class NewHomeAddShows:
|
||||
t.provided_show_dir = show_dir
|
||||
t.other_shows = other_shows
|
||||
t.provided_indexer = int(indexer or 0)
|
||||
t.indexers = sickbeard.indexerApi().indexers
|
||||
|
||||
return _munge(t)
|
||||
|
||||
@ -2148,7 +2149,7 @@ class NewHomeAddShows:
|
||||
@cherrypy.expose
|
||||
def addNewShow(self, whichSeries=None, indexerLang="en", rootDir=None, defaultStatus=None,
|
||||
anyQualities=None, bestQualities=None, flatten_folders=None, subtitles=None,
|
||||
fullShowPath=None, other_shows=None, skipShow=None):
|
||||
fullShowPath=None, other_shows=None, skipShow=None, providedIndexer=None):
|
||||
"""
|
||||
Receive tvdb id, dir, and other options and create a show from them. If extra show dirs are
|
||||
provided then it forwards back to newShow, if not it goes to /home.
|
||||
|
Loading…
Reference in New Issue
Block a user