From 052a1a9c386c82becbab2714255ea96d4c4f432e Mon Sep 17 00:00:00 2001 From: JackDandy Date: Wed, 2 Dec 2015 15:19:28 +0000 Subject: [PATCH] Change position of parsed qualities to the start of log lines and add log detail to providers that POST. --- CHANGES.md | 1 + sickbeard/providers/btn.py | 3 ++- sickbeard/providers/hdbits.py | 17 +++++++++-------- sickbeard/providers/scenetime.py | 3 ++- sickbeard/search.py | 8 ++++---- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 9882a4fa..39d29dbf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/sickbeard/providers/btn.py b/sickbeard/providers/btn.py index dd1e10f1..58949db9 100644 --- a/sickbeard/providers/btn.py +++ b/sickbeard/providers/btn.py @@ -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 diff --git a/sickbeard/providers/hdbits.py b/sickbeard/providers/hdbits.py index b5bc9763..308a830b 100644 --- a/sickbeard/providers/hdbits.py +++ b/sickbeard/providers/hdbits.py @@ -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) diff --git a/sickbeard/providers/scenetime.py b/sickbeard/providers/scenetime.py index 0e58faaa..0af4552d 100644 --- a/sickbeard/providers/scenetime.py +++ b/sickbeard/providers/scenetime.py @@ -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'}) diff --git a/sickbeard/search.py b/sickbeard/search.py index f808908a..61d9ba4d 100644 --- a/sickbeard/search.py +++ b/sickbeard/search.py @@ -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))' %\