Change position of parsed qualities to the start of log lines and add log detail to providers that POST.

This commit is contained in:
JackDandy 2015-12-02 15:19:28 +00:00
parent 5f5b3ba5ee
commit 052a1a9c38
5 changed files with 18 additions and 14 deletions

View file

@ -93,6 +93,7 @@
* Add list shows with custom ignore and require words under the global counterparts on the Search Settings page
* Fix failure to search for more than one selected wanted episode
* Add notice for users with Python 2.7.8 or below to update to latest Python
* Change position of parsed qualities to the start of log lines
[develop changelog]
* Enable Alpha Ratio again now that the secure login page over https is fixed

View file

@ -126,7 +126,8 @@ class BTNProvider(generic.TorrentProvider):
if title and url:
results.append(torrent_info)
self._log_search(mode, len(results) - cnt, self.name)
self._log_search(mode, len(results) - cnt,
('search_param: ' + str(search_param), self.name)['Cache' == mode])
return results

View file

@ -60,7 +60,7 @@ class HDBitsProvider(generic.TorrentProvider):
def _season_strings(self, ep_obj, **kwargs):
params = super(HDBitsProvider, self)._season_strings(ep_obj)
params = super(HDBitsProvider, self)._season_strings(ep_obj, scene=False)
show = ep_obj.show
if indexer_config.INDEXER_TVDB == show.indexer and show.indexerid:
@ -74,7 +74,7 @@ class HDBitsProvider(generic.TorrentProvider):
def _episode_strings(self, ep_obj, **kwargs):
params = super(HDBitsProvider, self)._episode_strings(ep_obj, sep_date='|')
params = super(HDBitsProvider, self)._episode_strings(ep_obj, scene=False, sep_date='|')
show = ep_obj.show
if indexer_config.INDEXER_TVDB == show.indexer and show.indexerid:
@ -100,20 +100,21 @@ class HDBitsProvider(generic.TorrentProvider):
items = {'Cache': [], 'Season': [], 'Episode': [], 'Propers': []}
for mode in search_params.keys():
for search_string in search_params[mode]:
for search_param in search_params[mode]:
post_data = api_data.copy()
if isinstance(search_string, dict):
post_data.update(search_string)
if isinstance(search_param, dict):
post_data.update(search_param)
id_search = True
else:
post_data['search'] = search_string
post_data['search'] = search_param
id_search = False
post_data = json.dumps(post_data)
search_url = self.urls['search']
json_resp = self.get_url(search_url, post_data=post_data, json=True)
if not (json_resp and 'data' in json_resp and self.check_auth_from_data(json_resp)):
logger.log(u'Response from %s does not contain any json data, abort' % self.name, logger.ERROR)
return results
@ -121,7 +122,7 @@ class HDBitsProvider(generic.TorrentProvider):
cnt = len(items[mode])
for item in json_resp['data']:
try:
seeders, leechers, size = [tryInt(n, n) for n in [item.get(x) for x in 'seed', 'leech', 'size']]
seeders, leechers, size = [tryInt(n, n) for n in [item.get(x) for x in 'seeders', 'leechers', 'size']]
if self._peers_fail(mode, seeders, leechers)\
or self.freeleech and re.search('(?i)no', item.get('freeleech', 'no')):
continue
@ -135,7 +136,7 @@ class HDBitsProvider(generic.TorrentProvider):
items[mode].append((title, download_url, item.get('seeders', 0), self._bytesizer(size)))
self._log_search(mode, len(items[mode]) - cnt,
('search_string: ' + search_string, self.name)['Cache' == mode])
('search_param: ' + str(search_param), self.name)['Cache' == mode])
self._sort_seeders(mode, items)

View file

@ -68,7 +68,8 @@ class SceneTimeProvider(generic.TorrentProvider):
post_data = self.urls['params'].copy()
post_data.update(ast.literal_eval('{%s}' % self._categories_string(template='"c%s": "1"', delimiter=',')))
if 'Cache' != mode:
post_data['search'] = '+'.join(search_string.split())
search_string = '+'.join(search_string.split())
post_data['search'] = search_string
if self.freeleech:
post_data.update({'freeleech': 'on'})

View file

@ -186,7 +186,7 @@ def pick_best_result(results, show, quality_list=None):
best_result = None
for cur_result in results:
logger.log(u'Quality of %s is %s' % (cur_result.name, Quality.qualityStrings[cur_result.quality]))
logger.log(u'Quality is %s for %s' % (Quality.qualityStrings[cur_result.quality], cur_result.name))
if show.is_anime and not show.release_groups.is_valid(cur_result):
continue
@ -515,15 +515,15 @@ def search_providers(show, episodes, manual_search=False):
for cur_result in found_results[provider_id][cur_episode]:
if Quality.UNKNOWN != cur_result.quality and highest_quality_overall < cur_result.quality:
highest_quality_overall = cur_result.quality
logger.log(u'The highest quality of any match is %s' % Quality.qualityStrings[highest_quality_overall],
logger.log(u'%s is the highest quality of any match' % Quality.qualityStrings[highest_quality_overall],
logger.DEBUG)
# see if every episode is wanted
if best_season_result:
# get the quality of the season nzb
season_qual = best_season_result.quality
logger.log(u'The quality of the season %s is %s' % (best_season_result.provider.providerType,
Quality.qualityStrings[season_qual]), logger.DEBUG)
logger.log(u'%s is the quality of the season %s' % (Quality.qualityStrings[season_qual],
best_season_result.provider.providerType), logger.DEBUG)
my_db = db.DBConnection()
sql = 'SELECT episode FROM tv_episodes WHERE showid = %s AND (season IN (%s))' %\