mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-17 23:05:11 -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
|
#end if
|
||||||
<td>
|
<td>
|
||||||
<select name="indexer">
|
<select name="indexer">
|
||||||
|
<option value="0" #if $indexer == 0 then "selected=\"selected\"" else ""#>All Indexers</option>
|
||||||
#for $curIndexer in $sickbeard.indexerApi().indexers.items():
|
#for $curIndexer in $sickbeard.indexerApi().indexers.items():
|
||||||
<option value="$curIndexer[0]" #if $curIndexer[0] == $indexer then "selected=\"selected\"" else ""#>$curIndexer[1]</option>
|
<option value="$curIndexer[0]" #if $curIndexer[0] == $indexer then "selected=\"selected\"" else ""#>$curIndexer[1]</option>
|
||||||
#end for
|
#end for
|
||||||
|
@ -37,12 +37,17 @@
|
|||||||
<input type="hidden" id="providedName" value="$provided_indexer_name" />
|
<input type="hidden" id="providedName" value="$provided_indexer_name" />
|
||||||
<input type="hidden" id="providedIndexer" value="$provided_indexer" />
|
<input type="hidden" id="providedIndexer" value="$provided_indexer" />
|
||||||
#else:
|
#else:
|
||||||
<input type="hidden" id="providedIndexer" value="$provided_indexer" />
|
|
||||||
<input type="text" id="nameToSearch" value="$default_show_name" style="margin-top: 1px;" />
|
<input type="text" id="nameToSearch" value="$default_show_name" style="margin-top: 1px;" />
|
||||||
<select name="indexerLang" id="indexerLangSelect" style="height: 26px;margin-top: 1px;">
|
<select name="indexerLang" id="indexerLangSelect" style="height: 26px;margin-top: 1px;">
|
||||||
<option value="en" selected="selected">en</option>
|
<option value="en" selected="selected">en</option>
|
||||||
</select><b>*</b>
|
</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 />
|
<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 />
|
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() {
|
function searchIndexers() {
|
||||||
if (!$('#nameToSearch').val().length) {
|
if (!$('#nameToSearch').val().length) {
|
||||||
return;
|
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 searchingFor = $('#nameToSearch').val() + ' on ' + $('#providedIndexer option:selected').text() + ' in ' + $('#indexerLangSelect').val();
|
||||||
var firstResult = true;
|
$('#searchResults').empty().html('<img id="searchingAnim" src="' + sbRoot + '/images/loading32.gif" height="32" width="32" /> searching ' + searchingFor + '...');
|
||||||
var resultStr = '<fieldset>\n<legend>Search Results:</legend>\n';
|
|
||||||
var checked = '';
|
|
||||||
|
|
||||||
if (data.results.length === 0) {
|
searchRequestXhr = $.ajax({
|
||||||
resultStr += '<b>No results found, try a different search.</b>';
|
url: sbRoot + '/home/addShows/searchIndexersForShowName',
|
||||||
} else {
|
data: {'name': $('#nameToSearch').val(), 'lang': $('#indexerLangSelect').val(), 'indexer': $('#providedIndexer').val()},
|
||||||
$.each(data.results, function (index, obj) {
|
timeout: 10000,
|
||||||
if (firstResult) {
|
dataType: 'json',
|
||||||
checked = ' checked';
|
error: function () {
|
||||||
firstResult = false;
|
$('#searchResults').empty().html('search timed out, try again or try another indexer');
|
||||||
} else {
|
},
|
||||||
checked = '';
|
success: function (data) {
|
||||||
}
|
var firstResult = true;
|
||||||
|
var resultStr = '<fieldset>\n<legend>Search Results:</legend>\n';
|
||||||
|
var checked = '';
|
||||||
|
|
||||||
var whichSeries = obj.join('|');
|
if (data.results.length === 0) {
|
||||||
|
resultStr += '<b>No results found, try a different search.</b>';
|
||||||
|
} else {
|
||||||
resultStr += '<input type="radio" id="whichSeries" name="whichSeries" value="' + whichSeries + '"' + checked + ' /> ';
|
$.each(data.results, function (index, obj) {
|
||||||
if (data.langid && data.langid != "") {
|
if (firstResult) {
|
||||||
resultStr += '<a href="'+ obj[2] + obj[3] + '&lid=' + data.langid + '" onclick=\"window.open(this.href, \'_blank\'); return false;\" ><b>' + obj[4] + '</b></a>';
|
checked = ' checked';
|
||||||
} else {
|
firstResult = false;
|
||||||
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 {
|
} else {
|
||||||
resultStr += ' (started on ' + obj[5] + ')';
|
checked = '';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (obj[0] !== null) {
|
var whichSeries = obj.join('|');
|
||||||
resultStr += ' [' + obj[0] + ']';
|
|
||||||
}
|
|
||||||
|
|
||||||
resultStr += '<br />';
|
|
||||||
});
|
resultStr += '<input type="radio" id="whichSeries" name="whichSeries" value="' + whichSeries + '"' + checked + ' /> ';
|
||||||
resultStr += '</ul>';
|
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.provided_show_dir = show_dir
|
||||||
t.other_shows = other_shows
|
t.other_shows = other_shows
|
||||||
t.provided_indexer = int(indexer or 0)
|
t.provided_indexer = int(indexer or 0)
|
||||||
|
t.indexers = sickbeard.indexerApi().indexers
|
||||||
|
|
||||||
return _munge(t)
|
return _munge(t)
|
||||||
|
|
||||||
@ -2148,7 +2149,7 @@ class NewHomeAddShows:
|
|||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def addNewShow(self, whichSeries=None, indexerLang="en", rootDir=None, defaultStatus=None,
|
def addNewShow(self, whichSeries=None, indexerLang="en", rootDir=None, defaultStatus=None,
|
||||||
anyQualities=None, bestQualities=None, flatten_folders=None, subtitles=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
|
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.
|
provided then it forwards back to newShow, if not it goes to /home.
|
||||||
|
Loading…
Reference in New Issue
Block a user