From 5f72582686bfe5ba9ea23b58709eca8c0a9bd3af Mon Sep 17 00:00:00 2001 From: JackDandy Date: Thu, 13 Sep 2018 03:31:20 +0100 Subject: [PATCH] Add display first 20 results with link to display more. Add search results sort by Z to A. Add search results sort by newest aired. Add search results sort by oldest aired. --- CHANGES.md | 4 ++ gui/slick/css/dark.css | 4 +- gui/slick/css/light.css | 4 +- gui/slick/css/style.css | 12 ++-- .../interfaces/default/home_newShow.tmpl | 4 +- gui/slick/js/newShow.js | 59 ++++++++++++++----- sickbeard/webserve.py | 42 +++++++++---- 7 files changed, 91 insertions(+), 38 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 7f689ff5..5f86ecb1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -16,6 +16,10 @@ * Change site services tester to fallback to http if error with SSL * Change try to use folder name when filename does not contain show name * Change force redirects in TVMaze API to be https +* Add display first 20 results with link to display more +* Add search results sort by Z to A +* Add search results sort by newest aired +* Add search results sort by oldest aired [develop changelog] diff --git a/gui/slick/css/dark.css b/gui/slick/css/dark.css index 3730947d..be30683a 100644 --- a/gui/slick/css/dark.css +++ b/gui/slick/css/dark.css @@ -330,7 +330,7 @@ home_newShow.tmpl border:0 } -.step-one #searchResults .alt{ +.step-one #search-results .alt{ background-color:rgb(40, 40, 40) } @@ -1418,7 +1418,7 @@ div.stepsguide .step p{ color:#ccc } -.stepDiv #searchResults div .exists-db{ +.stepDiv #search-results div .exists-db{ color:#1178B3 } diff --git a/gui/slick/css/light.css b/gui/slick/css/light.css index 3baeb8bf..3f3840dd 100644 --- a/gui/slick/css/light.css +++ b/gui/slick/css/light.css @@ -346,7 +346,7 @@ home_newShow.tmpl border-color:#dfdede } -.step-one #searchResults .alt{ +.step-one #search-results .alt{ background-color:rgb(245, 245, 245) } @@ -1384,7 +1384,7 @@ div.stepsguide .disabledstep p{ color:#8a775e } -.stepDiv #searchResults div .exists-db{ +.stepDiv #search-results div .exists-db{ color:#1178B3 } diff --git a/gui/slick/css/style.css b/gui/slick/css/style.css index 52be93d0..c15fa3f9 100644 --- a/gui/slick/css/style.css +++ b/gui/slick/css/style.css @@ -1138,7 +1138,7 @@ div.formpaginate{ border:1px solid } -#searchResults input[type="radio"]{ +#search-results input[type="radio"]{ vertical-align:-2px } @@ -1174,21 +1174,21 @@ div.formpaginate{ margin-left:10px } -.stepDiv #searchResults .results-item{ +.stepDiv #search-results .results-item{ width:100%; line-height:1.7 } -.stepDiv #searchResults .results-item input[disabled=disabled]{ +.stepDiv #search-results .results-item input[disabled=disabled]{ visibility:hidden } -.stepDiv #searchResults .results-item .exists-db{ +.stepDiv #search-results .results-item .exists-db{ font-weight:800; font-style:italic } -.stepDiv #searchResults #searchingAnim{ +.stepDiv #search-results #searchingAnim{ margin-right:6px } @@ -4377,7 +4377,7 @@ fieldset.sectionwrap{ border-width:0 } -.step-one #searchResults legend.legendStep{ +.step-one #search-results legend.legendStep{ margin-top:10px } diff --git a/gui/slick/interfaces/default/home_newShow.tmpl b/gui/slick/interfaces/default/home_newShow.tmpl index 7b177989..efb95456 100644 --- a/gui/slick/interfaces/default/home_newShow.tmpl +++ b/gui/slick/interfaces/default/home_newShow.tmpl @@ -95,7 +95,9 @@

Enter show name, TVDB ID, IMDb Url, or IMDb ID.  *SickGear supports english, language is used for show/episode data

-
+
+ + #end if diff --git a/gui/slick/js/newShow.js b/gui/slick/js/newShow.js index b4512481..928f5dad 100644 --- a/gui/slick/js/newShow.js +++ b/gui/slick/js/newShow.js @@ -57,7 +57,7 @@ $(document).ready(function () { tvsrcName = elTvDatabase.find('option:selected').text(), tvSearchSrc = 0 < tvsrcName.length ? ' on ' + tvsrcName : ''; - $('#searchResults').empty().html('' + $('#search-results').empty().html('' + ' searching ' + cleanseText(elNameToSearch.val(), !0) + '' + tvSearchSrc + ' in ' + elIndexerLang.val() + '...'); @@ -72,17 +72,18 @@ $(document).ready(function () { timeout: parseInt($('#indexer_timeout').val(), 10) * parseInt($('#indexer_count').val(), 2) * 1000 + 15000, dataType: 'json', error: function () { - $('#searchResults').empty().html('search timed out, try again or try another database'); + $('#search-results').empty().html('search timed out, try again in a few mins.'); }, success: function (data) { - var resultStr = '', attrs = '', checked = !1, rowType, row = 0, srcState = ''; + var resultStr = '', attrs = '', checked = !1, rowType, row = 0, srcState = '', + resultItem, resultStrBuffer = '', nBufferSize = 20, nBuffer = 0, nAll = 0; - if (0 === data.results.length) { + if (null === data.results || 0 === data.results.length) { resultStr += 'Sorry, no results found. Try a different search.'; } else { var result = { SrcName: 0, isInDB: 1, SrcId: 2, SrcDBId: 3, SrcUrl: 4, ShowID: 5, Title: 6, TitleHtml: 7, - Aired: 8, Network: 9, Genre: 10, Overview: 11, RelSort: 12, DateSort: 13, AzSort: 14, ImgUrl: 15 + Aired: 8, Network: 9, Genre: 10, Overview: 11, RelSort: 12, NewestAired: 13, OldestAired: 14, AzSort: 15 , ZaSort: 16, ImgUrl: 17 }; $.each(data.results, function (index, item) { attrs = (!1 !== item[result.isInDB] ? ' disabled="disabled"' : (!0 === checked ? '' : ' checked')); @@ -104,7 +105,7 @@ $(document).ready(function () { null === item[result.SrcName] ? '' : item[result.SrcName], !1 === item[result.isInDB] ? '' : 'exists in db'] .join(' - ').replace(/(^[\s-]+|[\s-]+$)/, ''); - resultStr += '
' + resultItem = '
' + '' + '[' + srcState + ']' + '') + '
' + "\n"; - + if (nBuffer < nBufferSize || item[result.isInDB]) { + resultStr += resultItem; + if (!1 === item[result.isInDB]) + nBuffer++; + } else { + resultStrBuffer += resultItem; + } + nAll++; }); } var selAttr = 'selected="selected" ', selClass = 'selected-text', classAttrSel = 'class="' + selClass + '" ', - defSortby = /^az/.test(config.resultsSortby) || /^date/.test(config.resultsSortby) ? '': classAttrSel + selAttr; + useBuffer = nBufferSize < nAll, + defSortby = /^az/.test(config.resultsSortby) || /^za/.test(config.resultsSortby) || /^newest/.test(config.resultsSortby) || /^oldest/.test(config.resultsSortby) ? '': classAttrSel + selAttr; - $('#searchResults').html( + $('#search-results').html( '
' + "\n" + '' - + (0 < row ? row : 'No') - + ' search result' + (1 == row ? '' : 's') + '...' + + '' + '' + '