mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-05 17:43:37 +00:00
Change "Add New Show" results sorted newest show to oldest from top.
Change add show genre, network, and overview to "Add New Show" results. Change improve highlight of shows found in database in "Add New Show" results. Change use full first aired date where available in "Add New Show" results. Change prevent duplicate results in "Add New Show".
This commit is contained in:
parent
515a00dcef
commit
e6eac3457d
8 changed files with 66 additions and 18 deletions
|
@ -97,6 +97,11 @@
|
|||
* Change nzbs.org anime search category and fix newznab anime backlog search
|
||||
* Change improve nzbgeek search response
|
||||
* Change use query search at 6box (id search fails)
|
||||
* Change "Add New Show" results sorted newest show to oldest from top
|
||||
* Change add show genre, network, and overview to "Add New Show" results
|
||||
* Change improve highlight of shows found in database in "Add New Show" results
|
||||
* Change use full first aired date where available in "Add New Show" results
|
||||
* Change prevent duplicate results in "Add New Show"
|
||||
|
||||
|
||||
### 0.11.12 (2016-06-20 02:20:00 UTC)
|
||||
|
|
|
@ -1244,6 +1244,10 @@ div.stepsguide .step p{
|
|||
color:#ccc;
|
||||
}
|
||||
|
||||
.stepDiv #searchResults div .exists-db{
|
||||
color:#1178B3
|
||||
}
|
||||
|
||||
div.stepsguide .disabledstep p{
|
||||
border-color:#1178B3
|
||||
}
|
||||
|
|
|
@ -1203,6 +1203,10 @@ div.stepsguide .disabledstep p{
|
|||
color:#8a775e;
|
||||
}
|
||||
|
||||
.stepDiv #searchResults div .exists-db{
|
||||
color:#1178B3
|
||||
}
|
||||
|
||||
div.formpaginate .prev, div.formpaginate .next{
|
||||
color:#fff;
|
||||
background:#57442b
|
||||
|
|
|
@ -985,6 +985,11 @@ div.formpaginate{
|
|||
line-height:1.7
|
||||
}
|
||||
|
||||
.stepDiv #searchResults div .exists-db{
|
||||
font-weight:800;
|
||||
font-style:italic
|
||||
}
|
||||
|
||||
.stepDiv #searchResults #searchingAnim{
|
||||
margin-right:6px
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
<div style="clear:both"> </div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="sectionwrap step-two">
|
||||
<fieldset class="sectionwrap step-two" style="visibility:hidden">
|
||||
<legend class="legendStep"><p>Pick parent folder</p></legend>
|
||||
|
||||
<div class="stepDiv parent-folder">
|
||||
|
@ -97,7 +97,7 @@
|
|||
<div style="clear:both"> </div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="sectionwrap step-three">
|
||||
<fieldset class="sectionwrap step-three" style="visibility:hidden">
|
||||
<legend class="legendStep"><p>Set custom options</p></legend>
|
||||
<div class="stepDiv">
|
||||
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_addShowOptions.tmpl')
|
||||
|
|
|
@ -77,7 +77,8 @@ $(document).ready(function () {
|
|||
if (0 === data.results.length) {
|
||||
resultStr += '<span class="boldest">Sorry, no results found. Try a different search.</span>';
|
||||
} else {
|
||||
var idxSrcDB = 0, idxSrcDBId = 1, idxSrcUrl = 2, idxShowID = 3, idxTitle = 4, idxDate = 5;
|
||||
var idxSrcDB = 0, idxSrcDBId = 1, idxSrcUrl = 2, idxShowID = 3, idxTitle = 4, idxTitleHtml = 5,
|
||||
idxDate = 6, idxNetwork = 7, idxGenres = 8, idxOverview = 9;
|
||||
$.each(data.results, function (index, obj) {
|
||||
checked = (0 == row ? ' checked' : '');
|
||||
rowType = (0 == row % 2 ? '' : ' class="alt"');
|
||||
|
@ -102,7 +103,12 @@ $(document).ready(function () {
|
|||
+ ' />'
|
||||
+ '<a'
|
||||
+ ' class="stepone-result-title"'
|
||||
+ ' title="View detail for <span style=\'color: rgb(66, 139, 202)\'>' + display_show_name + '</span>"'
|
||||
+ ' title="<div style=\'color: rgb(66, 139, 202)\'>' + cleanseText(obj[idxTitleHtml], !0) + '</div>'
|
||||
+ (0 < obj[idxGenres].length ? '<div style=\'font-weight:bold\'>(<em>' + obj[idxGenres] + '</em>)</div>' : '')
|
||||
+ (0 < obj[idxNetwork].length ? '<div style=\'font-weight:bold;font-size:0.9em;color:#888\'><em>' + obj[idxNetwork] + '</em></div>' : '')
|
||||
+ (0 < obj[idxOverview].length ? '<p style=\'margin:0 0 2px\'>' + obj[idxOverview] + '</p>' : '')
|
||||
+ '<span style=\'float:right\'>Click for more</span>'
|
||||
+ '"'
|
||||
+ ' href="' + anonURL + obj[idxSrcUrl] + obj[idxShowID] + ((data.langid && '' != data.langid) ? '&lid=' + data.langid : '') + '"'
|
||||
+ ' onclick="window.open(this.href, \'_blank\'); return false;"'
|
||||
+ '>' + display_show_name + '</a>'
|
||||
|
|
|
@ -481,7 +481,7 @@ else:
|
|||
TRAKT_CLIENT_ID = 'f1c453c67d81f1307f9118172c408a883eb186b094d5ea33080d59ddedb7fc7c'
|
||||
TRAKT_CLIENT_SECRET = '12efb6fb6e863a08934d9904032a90008325df7e23514650cade55e7e7c118c5'
|
||||
TRAKT_PIN_URL = 'https://trakt.tv/pin/6314'
|
||||
TRAKT_BASE_URL = 'https://api-v2launch.trakt.tv/'
|
||||
TRAKT_BASE_URL = 'https://api.trakt.tv/'
|
||||
|
||||
COOKIE_SECRET = base64.b64encode(uuid.uuid4().bytes + uuid.uuid4().bytes)
|
||||
|
||||
|
|
|
@ -2204,8 +2204,8 @@ class NewHomeAddShows(Home):
|
|||
search_id = ''
|
||||
try:
|
||||
search_id = re.search(r'(?m)((?:tt\d{4,})|^\d{4,}$)', search_term).group(1)
|
||||
resp = [r for r in self.getTrakt('/search?id_type=%s&id=%s' % (('tvdb', 'imdb')['tt' in search_id],
|
||||
search_id)) if 'show' == r['type']][0]
|
||||
resp = [r for r in self.getTrakt('/search/%s/%s?type=show&extended=full' % (
|
||||
('tvdb', 'imdb')['tt' in search_id], search_id)) if 'show' == r['type']][0]
|
||||
search_term = resp['show']['title']
|
||||
indexer_id = resp['show']['ids']['tvdb']
|
||||
except:
|
||||
|
@ -2224,7 +2224,12 @@ class NewHomeAddShows(Home):
|
|||
logger.log('Fetching show using id: %s (%s) from tv datasource %s' % (
|
||||
search_id, search_term, sickbeard.indexerApi(indexer).name), logger.DEBUG)
|
||||
results.setdefault('tt' in search_id and 3 or indexer, []).extend(
|
||||
[{'id': indexer_id, 'seriesname': t[indexer_id]['seriesname'], 'firstaired': t[indexer_id]['firstaired']}])
|
||||
[{'id': indexer_id, 'seriesname': t[indexer_id]['seriesname'],
|
||||
'firstaired': t[indexer_id]['firstaired'], 'network': t[indexer_id]['network'],
|
||||
'overview': t[indexer_id]['overview'],
|
||||
'genres': '' if not t[indexer_id]['genre'] else
|
||||
t[indexer_id]['genre'].lower().strip('|').replace('|', ', '),
|
||||
}])
|
||||
break
|
||||
else:
|
||||
logger.log('Searching for shows using search term: %s from tv datasource %s' % (
|
||||
|
@ -2236,29 +2241,48 @@ class NewHomeAddShows(Home):
|
|||
# Query trakt for tvdb ids
|
||||
try:
|
||||
logger.log('Searching for show using search term: %s from tv datasource Trakt' % search_term, logger.DEBUG)
|
||||
resp = self.getTrakt('/search?query=%s&type=show' % search_term)
|
||||
resp = self.getTrakt('/search/show?query=%s&extended=full' % search_term)
|
||||
tvdb_ids = []
|
||||
for tvdb_item in results[INDEXER_TVDB]:
|
||||
tvdb_ids.append(int(tvdb_item['id']))
|
||||
results_trakt = []
|
||||
for item in resp:
|
||||
if 'tvdb' in item['show']['ids'] and item['show']['ids']['tvdb'] and \
|
||||
item['show']['ids']['tvdb'] not in tvdb_ids:
|
||||
results_trakt.append({'id': item['show']['ids']['tvdb'], 'seriesname': item['show']['title'],
|
||||
'firstaired': item['show']['year']})
|
||||
show = item['show']
|
||||
if 'tvdb' in show['ids'] and show['ids']['tvdb'] and show['ids']['tvdb'] not in tvdb_ids:
|
||||
results_trakt.append({
|
||||
'id': show['ids']['tvdb'], 'seriesname': show['title'],
|
||||
'firstaired': (show['first_aired'] and re.sub(r'T.*$', '', str(show['first_aired'])) or show['year']),
|
||||
'network': show['network'], 'overview': show['overview'],
|
||||
'genres': ', '.join(['%s' % v.lower() for v in show.get('genres', {}) or []])})
|
||||
tvdb_ids.append(show['ids']['tvdb'])
|
||||
results.update({3: results_trakt})
|
||||
if INDEXER_TVDB in results:
|
||||
tvdb_filtered = []
|
||||
for tvdb_item in results[INDEXER_TVDB]:
|
||||
if int(tvdb_item['id']) not in tvdb_ids:
|
||||
tvdb_filtered.append(tvdb_item)
|
||||
if tvdb_filtered:
|
||||
results[INDEXER_TVDB] = tvdb_filtered
|
||||
else:
|
||||
del(results[INDEXER_TVDB])
|
||||
except:
|
||||
pass
|
||||
|
||||
id_names = [None, sickbeard.indexerApi(INDEXER_TVDB).name, sickbeard.indexerApi(INDEXER_TVRAGE).name,
|
||||
'%s via Trakt' % sickbeard.indexerApi(INDEXER_TVDB).name]
|
||||
map(final_results.extend,
|
||||
([['%s%s' % (id_names[id], helpers.findCertainShow(sickbeard.showList, int(show['id'])) and ' - exists in db' or ''),
|
||||
([['%s%s' % (id_names[id], helpers.findCertainShow(sickbeard.showList, int(show['id'])) and ' - <span class="exists-db">exists in db</span>' or ''),
|
||||
(id, INDEXER_TVDB)[id == 3], sickbeard.indexerApi((id, INDEXER_TVDB)[id == 3]).config['show_url'], int(show['id']),
|
||||
show['seriesname'], show['firstaired']] for show in shows] for id, shows in results.items()))
|
||||
show['seriesname'], self.encode_html(show['seriesname']), show['firstaired'],
|
||||
show.get('network', '') or '', show.get('genres', '') or '',
|
||||
re.sub(r'([,\.!][^,\.!]*?)$', '...',
|
||||
re.sub(r'([!\?\.])(?=\w)', r'\1 ',
|
||||
self.encode_html((show.get('overview', '') or '')[:250:].strip())))
|
||||
] for show in shows] for id, shows in results.items()))
|
||||
|
||||
lang_id = sickbeard.indexerApi().config['langabbv_to_id'][lang]
|
||||
return json.dumps({'results': final_results, 'langid': lang_id})
|
||||
return json.dumps({
|
||||
'results': sorted(final_results, reverse=True, key=lambda x: dateutil.parser.parse(
|
||||
re.match('^(?:19|20)\d\d$', str(x[6])) and ('%s-12-31' % str(x[6])) or (x[6] and str(x[6])) or '1900')),
|
||||
'langid': lang_id})
|
||||
|
||||
def getTrakt(self, url, *args, **kwargs):
|
||||
|
||||
|
|
Loading…
Reference in a new issue