From 546b0a37b96a8131adb08e75694a9aa674cb6969 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Wed, 18 Aug 2021 04:25:52 +0100 Subject: [PATCH] Fix search results sorting. Add language flag to TVmaze search result items. Change Add shows/Search results first aired dates to UI date format setting. Change reinstate "expand results" and display more prominently. Change improve the search progress text. --- CHANGES.md | 5 + gui/slick/interfaces/default/home_newShow.tmpl | 6 +- gui/slick/js/newShow.js | 149 +++++++++++++++---------- lib/api_tvmaze/tvmaze_api.py | 13 ++- sickbeard/webserve.py | 105 ++++++++--------- 5 files changed, 162 insertions(+), 116 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 6353c36..0a3a841 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -86,6 +86,8 @@ * Fix handling of card filters and sort states * Add view paused "Only" to Daily Schedule * Add return paused "Only" to API +* Change Add shows/Search results first aired dates to UI date format setting +* Change improve the search progress text [develop changelog] @@ -107,6 +109,9 @@ * Change add language field to TVMaze search results * Change set TVMaze network to webchannel if no network is found * Change add TVMaze runtime, type, schedule, status, official site +* Fix search results sorting +* Add language flag to TVmaze search result items +* Change reinstate "expand results" and display more prominently ### 0.24.16 (2021-08-28 16:05:00 UTC) diff --git a/gui/slick/interfaces/default/home_newShow.tmpl b/gui/slick/interfaces/default/home_newShow.tmpl index e5ac183..63ca425 100644 --- a/gui/slick/interfaces/default/home_newShow.tmpl +++ b/gui/slick/interfaces/default/home_newShow.tmpl @@ -42,7 +42,7 @@

$title

#end if - +#for $cur_icon in $infosrc_icons##end for#
@@ -117,9 +117,7 @@ *SickGear is en, language is used for show/episode lists

-
- - + #end if
diff --git a/gui/slick/js/newShow.js b/gui/slick/js/newShow.js index 3f4fd1d..c17523c 100644 --- a/gui/slick/js/newShow.js +++ b/gui/slick/js/newShow.js @@ -67,11 +67,15 @@ $(document).ready(function () { var elTvDatabase = $('#provided-tvid'), elInfosrcLang = $('#infosrc-lang-select'), tvsrcName = elTvDatabase.find('option:selected').text(), - tvSearchSrc = 0 < tvsrcName.length ? ' on ' + elTvDatabase.find('option:selected').attr('data-name') + '' : ''; - - $('#search-results').empty().html('' - + ' searching ' + cleanseText(elNameToSearch.val(), !0) + '' - + tvSearchSrc + ' in ' + elInfosrcLang.val() + tvSearchSrc = 0 < tvsrcName.length + ? ' ' + elTvDatabase.find('option:selected').attr('data-name') + '' + : ''; + + $('#search-results').empty().html('' + + ' searching ' + + tvSearchSrc + + ' in lang:' + elInfosrcLang.val() + ' ' + + ' for ' + cleanseText(elNameToSearch.val(), !0) + '' + '...'); searchRequestXhr = $.ajax({ @@ -88,14 +92,15 @@ $(document).ready(function () { }, success: function (data) { var resultStr = '', attrs = '', checked = !1, rowType, row = 0, srcState = '', - resultItem, resultStrBuffer = '', nBufferSize = 9999, nBuffer = 0, nAll = 0; + resultItem, nBuffer = 0, nBufferSize = 20, nAll = 0; if (null === data.results || 0 === data.results.length) { resultStr += 'Sorry, no results found. Try a different search.'; } else { var n = 0, result = { SrcName: n, isInDB: ++n, SrcId: ++n, SrcDBId: ++n, SrcSlug: ++n, SrcUrl: ++n, ShowID: ++n, - Title: ++n, TitleHtml: ++n, Aired: ++n, Network: ++n, Genre: ++n, Overview: ++n, ImgUrl: ++n, + Title: ++n, TitleHtml: ++n, Aired: ++n, AiredStr: ++n, Network: ++n, Genre: ++n, + Language: ++n, LanguageCC: ++n, Overview: ++n, ImgUrl: ++n, RelSort: ++n, RelCombined : ++n, NewestAired: ++n, NewestCombined: ++n, OldestAired: ++n, OldestCombined: ++n, AzSort: ++n, AzCombined : ++n, ZaSort: ++n, ZaCombined: ++n, DirectIdMatch: ++n, RenameSuggest: ++n @@ -114,7 +119,7 @@ $(document).ready(function () { var today = new Date(); showstartdate = ' (' + (startDate > today ? 'will debut' : 'started') - + ': ' + item[result.Aired] + ')'; + + ': ' + item[result.AiredStr] + ')'; } srcState = [ @@ -140,9 +145,12 @@ $(document).ready(function () { + '' + + item[result.Language] + '' : '') + (0 < item[result.Genre].length ? '
(' + item[result.Genre] + ')
' : '') + (0 < item[result.Network].length ? '
' + item[result.Network] + '
' : '') - + '' + + (item[result.ImgUrl] && '' || '') + (0 < item[result.Overview].length ? '

' + item[result.Overview] + '

' : '') + 'Click for more' + '"' @@ -153,26 +161,23 @@ $(document).ready(function () { + ('' === srcState ? '' : ' ' + '[' + srcState + ']' + '') + '' + "\n"; - if (nBuffer < nBufferSize || item[result.isInDB]) { - resultStr += resultItem; - if (!1 === item[result.isInDB]) - nBuffer++; - } else { - resultStrBuffer += resultItem; - } + resultStr += resultItem; + if(item[result.isInDB]) + nBufferSize++; + if ((nBuffer < nBufferSize) || item[result.isInDB]) + nBuffer++; nAll++; }); } var selAttr = 'selected="selected" ', selClass = 'selected-text', classAttrSel = 'class="' + selClass + '" ', - useBuffer = nBufferSize < nAll, defSortby = /^az/.test(config.resultsSortby) || /^za/.test(config.resultsSortby) || /^newest/.test(config.resultsSortby) || /^oldest/.test(config.resultsSortby) ? '': classAttrSel + selAttr; - $('#search-results').html( + $('#search-results').addClass('collapsed').html( '
' + "\n" + '' + '' - + '' + + '' + '