Commit 2ebd7fc5 authored by echel0n's avatar echel0n

Merge branch '9.4.118'

parents 1db69f77 63354dce
# Changelog
- * f472dcac4 - 2019-07-10: Resolved issues with BTN Torrent provider.
- * f6fce2766 - 2019-07-10: Places search result from indexer into list object if returned as dict.
- * 9c3a3c04f - 2019-07-10: Resolved sqlite3.IntegrityError: NOT NULL constraint failed: history.release_group
- * ef9a6cb96 - 2019-07-10: Resolved KeyError in sickrage.core.webserver.handlers.api in run error 'indexer_id'
- * 7ad8c0b06 - 2019-07-10: Resolves error `can't concat str to bytes` in `sickrage.providers in _get_episode_search_strings` Fixes SICKRAGE-APP-PY3-M4
- * 8a423fd15 - 2019-07-10: Resolved unsupported operand type(s) for +=: 'dict' and 'list'
- * 1ee3cdb90 - 2019-07-09: Release v9.4.117
- * edd628975 - 2019-07-09: Fixed issue with post-processing and logging downloads to history when unable to determine provider result came from.
- * 134fcfe23 - 2019-07-09: Fixed typo in container name
- * 8aa49580f - 2019-07-08: Turned on tagging for develop branch to assist gitlab ci/cd builds.
......
......@@ -123,7 +123,7 @@ class History:
'resource': resource,
'provider': provider,
'version': version,
'release_group': release_group
'release_group': release_group or ''
}))
@staticmethod
......@@ -160,7 +160,7 @@ class History:
:param version: Version of file (defaults to -1)
"""
provider = 'unknown'
provider = ''
dbData = session.query(MainDB.History).filter(MainDB.History.resource.contains(os.path.basename(filename).rpartition(".")[0])).first()
if dbData:
......
......@@ -878,7 +878,7 @@ class CMD_EpisodeSetStatus(ApiCall):
ep_results = []
failure = False
start_backlog = False
wanted = {}
wanted = []
for epObj in ep_list:
if self.status == WANTED:
......@@ -1051,7 +1051,7 @@ class CMD_History(ApiCall):
row["resource"] = os.path.basename(row["resource"])
# Add tvdbid for backward compatibility
row['tvdbid'] = row['indexer_id']
row['tvdbid'] = row['indexerid']
results.append(row)
return await _responds(RESULT_SUCCESS, results)
......
......@@ -97,6 +97,9 @@ class SearchIndexersForShowNameHandler(BaseHandler, ABC):
try:
# search via series name
result = await self.run_task(lambda: t[search_term])
if isinstance(result, dict):
result = [result]
results.setdefault(indexer, []).extend(result)
except Exception:
continue
......
......@@ -185,7 +185,7 @@ class GenericProvider(object):
episode_object = show_object.get_episode(season, episode)
for show_name in all_possible_show_names(show_id, episode_object.scene_season):
episode_string = show_name + self.search_separator
episode_string = "{}{}".format(show_name, self.search_separator)
episode_string_fallback = None
if show_object.air_by_date:
......
......@@ -15,12 +15,8 @@
#
# You should have received a copy of the GNU General Public License
# along with SiCKRAGE. If not, see <http://www.gnu.org/licenses/>.
import socket
import time
import xmlrpc.client
import json
import random
import sickrage
from sickrage.core import scene_exceptions, MainDB
......@@ -195,21 +191,24 @@ class BTNProvider(TorrentProvider):
return searches
def _api_call(self, params=None, results_per_page=300, offset=0):
parsed_json = {}
def _api_call(self, params=None, results_per_page=1000, offset=0):
response = {}
json_rpc = json.dumps({
"jsonrpc": "2.0",
"id": ''.join(random.sample('abcdefghijklmnopqrstuvwxyz0123456789', 8)),
"method": "getTorrents",
"params": [str(self.api_key), params or {}, str(results_per_page), str(offset)]
})
try:
api = xmlrpc.client.Server(self.urls['api'])
parsed_json = api.getTorrents(self.api_key, params or {}, int(results_per_page), int(offset))
time.sleep(5)
except xmlrpc.client.ProtocolError as e:
if e.errmsg == 'Call Limit Exceeded':
sickrage.app.log.warning("You have exceeded the limit of 150 calls per hour.")
elif e.errmsg == 'Invalid API Key':
sickrage.app.log.warning("Incorrect authentication credentials.")
else:
sickrage.app.log.error("JSON-RPC protocol error while accessing provider. Error: {}".format(e))
except (socket.error, socket.timeout, ValueError) as e:
response = self.session.post(self.urls['api'], data=json_rpc, headers={'Content-Type': 'application/json-rpc'}).json()
if 'error' in response:
error = response["error"]
message = error["message"]
code = error["code"]
sickrage.app.log.warning("Error Code: {} :: Error Message: {}".format(code, message))
except Exception as e:
sickrage.app.log.warning("Error while accessing provider. Error: {}".format(e))
return parsed_json
return response
9.4.117
\ No newline at end of file
9.4.118
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment