Commit 46637409 authored by echel0n's avatar echel0n
Browse files

Merge branch 'release/9.3.79'

parents 793d44df 5bf995bb
# Changelog
- * a26801c - 2018-09-14: Release v9.3.78
- * 7cbaa2e - 2018-09-18: Release v9.3.79
- * dbb7543 - 2018-09-18: Fixed issue with custom webroot and too many redirects
- * a7d0209 - 2018-09-17: Pre-Release v9.3.79.dev10
- * 09b1857 - 2018-09-17: Pre-Release v9.3.79.dev9
- * 3419702 - 2018-09-16: Pre-Release v9.3.79.dev8
- * a4a4814 - 2018-09-16: Pre-Release v9.3.79.dev7
- * 605f75c - 2018-09-16: Pre-Release v9.3.79.dev6
- * 8780b59 - 2018-09-16: Zooqle torrent provider RSS feed English only results
- * bd67a69 - 2018-09-16: Pre-Release v9.3.79.dev5
- * f39ab1c - 2018-09-16: Refactored Zooqle torrent provider to handling paging results
- * 31a9c17 - 2018-09-16: Pre-Release v9.3.79.dev4
- * 69668c7 - 2018-09-16: Hardcoded Zooqle torrent provider to search for english torrents
- * 2868350 - 2018-09-16: Pre-Release v9.3.79.dev3
- * f40c471 - 2018-09-16: Refactored Zooqle torrent provider to use RSS Fixed Attribute error for name parser
- * 7bb2095 - 2018-09-16: Fixed performance issues with TheTVDB indexer
- * e8445dd - 2018-09-16: Fixed issue when displaying multiple modals same page, 2nd modal wasn't removing scrollbar.
- * 15f9781 - 2018-09-16: Pre-Release v9.3.79.dev2
- * f87f0b0 - 2018-09-16: Fixed search issue with Zooqle torrent provider.
- * e6fab35 - 2018-09-15: Pre-Release v9.3.79.dev1
- * 60a435c - 2018-09-15: Added Zooqle torrent provider
- * 90f31c5 - 2018-09-14: Release v9.3.78
- * a413ab3 - 2018-09-14: Fixed AttributeError list_entry_points for subtitles
- * d6195df - 2018-09-13: Release v9.3.77
- * 23d3379 - 2018-09-09: Release v9.3.76
......
......@@ -101,12 +101,14 @@ class Core(object):
self.naming_ep_type = ("%(seasonnumber)dx%(episodenumber)02d",
"s%(seasonnumber)02de%(episodenumber)02d",
"S%(seasonnumber)02dE%(episodenumber)02d",
"%(seasonnumber)02dx%(episodenumber)02d")
"%(seasonnumber)02dx%(episodenumber)02d",
"S%(seasonnumber)02d E%(episodenumber)02d")
self.sports_ep_type = ("%(seasonnumber)dx%(episodenumber)02d",
"s%(seasonnumber)02de%(episodenumber)02d",
"S%(seasonnumber)02dE%(episodenumber)02d",
"%(seasonnumber)02dx%(episodenumber)02d")
self.naming_ep_type_text = ("1x02", "s01e02", "S01E02", "01x02")
"%(seasonnumber)02dx%(episodenumber)02d",
"S%(seasonnumber)02 dE%(episodenumber)02d")
self.naming_ep_type_text = ("1x02", "s01e02", "S01E02", "01x02", "S01 E02",)
self.naming_multi_ep_type = {0: ["-%(episodenumber)02d"] * len(self.naming_ep_type),
1: [" - " + x for x in self.naming_ep_type],
2: [x + "%(episodenumber)02d" for x in ("x", "e", "E", "x")]}
......
......@@ -90,7 +90,7 @@ class TVCache(object):
return True
def getRSSFeed(self, url, params=None):
def get_rss_feed(self, url, params=None):
try:
if self.provider.login():
resp = WebSession().get(url, params=params).text
......
......@@ -511,8 +511,7 @@ class NameParser(object):
# if there's no useful info in it then raise an exception
if final_result.season_number is None and not final_result.episode_numbers and final_result.air_date is None and not final_result.ab_episode_numbers and not final_result.series_name:
raise InvalidNameException("Unable to parse {} to a valid episode of {}. Parser result: {}".format(
name, final_result.show.name, final_result))
raise InvalidNameException("Unable to parse {} to a valid episode. Parser result: {}".format(name, final_result))
if cache_result and final_result.show:
name_parser_cache.add(name, final_result)
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -300,10 +300,11 @@ class LoginHandler(BaseHandler):
except Exception as e:
return self.redirect('/logout')
redirect_page = self.get_argument('next', "/{}/".format(sickrage.app.config.default_page))
return self.redirect("{}".format(redirect_page))
redirect_uri = self.get_argument('next', "/{}/".format(sickrage.app.config.default_page))
return self.redirect("{}".format(redirect_uri))
else:
self.redirect(sickrage.app.oidc_client.authorization_url(redirect_uri=redirect_uri))
authorization_url = sickrage.app.oidc_client.authorization_url(redirect_uri=redirect_uri)
return super(BaseHandler, self).redirect(authorization_url)
class LogoutHandler(BaseHandler):
......@@ -311,11 +312,15 @@ class LogoutHandler(BaseHandler):
super(LogoutHandler, self).__init__(*args, **kwargs)
def prepare(self, *args, **kwargs):
logout_uri = sickrage.app.oidc_client.get_url('end_session_endpoint')
redirect_uri = "{}://{}{}/login".format(self.request.protocol, self.request.host, sickrage.app.config.web_root)
if self.get_secure_cookie('sr_refresh_token'):
sickrage.app.oidc_client.logout(self.get_secure_cookie('sr_refresh_token'))
self.clear_all_cookies()
return self.redirect('/login/')
return super(BaseHandler, self).redirect('{}?redirect_uri={}'.format(logout_uri, redirect_uri))
class CalendarHandler(BaseHandler):
......
......@@ -47,7 +47,7 @@
<!-- displayShow Modals -->
<%def name="displayShowModals()">
<div id="manualSearchModalFailed" class="modal fade" data-backdrop="false" data-keyboard="false">
<div id="manualSearchModalFailed" class="modal fade" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content bg-dark">
<div class="modal-header bg-secondary">
......@@ -61,14 +61,14 @@
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">${_('No')}</button>
<button type="button" class="btn btn-success" data-dismiss="modal">${_('Yes')}</button>
<button type="button" class="btn btn-danger" data-dismiss="modal" data-toggle="modal" href="#manualSearchModalQuality">${_('No')}</button>
<button type="button" class="btn btn-success" data-dismiss="modal" data-toggle="modal" href="#manualSearchModalQuality">${_('Yes')}</button>
</div>
</div>
</div>
</div>
<div id="manualSearchModalQuality" class="modal fade" data-backdrop="false" data-keyboard="false">
<div id="manualSearchModalQuality" class="modal fade" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content bg-dark">
<div class="modal-header bg-secondary">
......
......@@ -31,7 +31,8 @@ class IndexerApi(object):
self.module = indexerConfig[self.indexerID]['module']
def indexer(self, *args, **kwargs):
return self.module(*args, **kwargs)
self.module.settings(*args, **kwargs)
return self.module
@property
def config(self):
......
......@@ -27,10 +27,11 @@ indexerConfig = {
INDEXER_TVDB: {
'id': INDEXER_TVDB,
'name': 'theTVDB',
'module': Tvdb,
'api_params': {'apikey': 'F9C450E78D99172E',
'language': 'en'
},
'module': Tvdb(),
'api_params': {
'apikey': 'F9C450E78D99172E',
'language': 'en'
},
'trakt_id': 'tvdb',
'xem_origin': 'tvdb',
'icon': 'thetvdb16.png',
......
......@@ -19,10 +19,7 @@
from __future__ import print_function, unicode_literals
import functools
import io
import json
import os
import pickle
import re
import time
import urlparse
......@@ -298,7 +295,37 @@ class Tvdb:
"""Create easy-to-use interface to name of season/episode name
"""
def __init__(self,
def __init__(self):
self.config = {
'api': {
'lang': 'en',
'base': "https://api.thetvdb.com",
'login': '/login',
'refresh': '/refresh_token',
'languages': '/languages',
'getSeries': "/search/series?name={name}",
'getSeriesIMDB': "/search/series?imdbId={id}",
'getSeriesZap2It': "/search/series?zap2itId={id}",
'series': "/series/{id}",
'episodes': "/series/{id}/episodes",
'episode_info': "/episodes/{id}",
'actors': "/series/{id}/actors",
'updated': "/updated/query?fromTime={time}",
'images': {
'fanart': "/series/{id}/images/query?keyType=fanart&subKey=graphical",
'banner': "/series/{id}/images/query?keyType=fanart&subKey=text",
'poster': "/series/{id}/images/query?keyType=poster",
'series': "/series/{id}/images/query?keyType=series",
'season': "/series/{id}/images/query?keyType=season&subKey={season}",
'seasonwide': "/series/{id}/images/query?keyType=seasonwide&subKey={season}",
'prefix': "https://thetvdb.com/banners/{value}"
}
}
}
self.shows = ShowCache()
def settings(self,
debug=False,
cache=True,
custom_ui=None,
......@@ -308,52 +335,9 @@ class Tvdb:
proxy=None,
headers=None):
if headers is None:
headers = {}
self.shows = ShowCache()
if os.path.isfile(os.path.join(sickrage.app.data_dir, 'thetvdb.db')):
with io.open(os.path.join(sickrage.app.data_dir, 'thetvdb.db'), 'rb') as fp:
try:
self.shows = ShowCache(pickle.load(fp))
except:
pass
self.config = dict(apikey=apikey, debug_enabled=debug, custom_ui=custom_ui, cache_enabled=cache,
dvdorder=dvdorder, proxy=proxy, api={}, headers=headers)
# api base url
self.config['api']['base'] = "https://api.thetvdb.com"
# api-v2 urls
self.config['api']['login'] = '/login'
self.config['api']['refresh'] = '/refresh_token'
self.config['api']['languages'] = '/languages'
self.config['api']['getSeries'] = "/search/series?name={name}"
self.config['api']['getSeriesIMDB'] = "/search/series?imdbId={id}"
self.config['api']['getSeriesZap2It'] = "/search/series?zap2itId={id}"
self.config['api']['series'] = "/series/{id}"
self.config['api']['episodes'] = "/series/{id}/episodes"
self.config['api']['episode_info'] = "/episodes/{id}"
self.config['api']['actors'] = "/series/{id}/actors"
self.config['api']['updated'] = "/updated/query?fromTime={time}"
self.config['api']['images'] = {}
self.config['api']['images']['fanart'] = "/series/{id}/images/query?keyType=fanart&subKey=graphical"
self.config['api']['images']['banner'] = "/series/{id}/images/query?keyType=fanart&subKey=text"
self.config['api']['images']['poster'] = "/series/{id}/images/query?keyType=poster"
self.config['api']['images']['series'] = "/series/{id}/images/query?keyType=series"
self.config['api']['images']['season'] = "/series/{id}/images/query?keyType=season&subKey={season}"
self.config['api']['images']['seasonwide'] = "/series/{id}/images/query?keyType=seasonwide&subKey={season}"
self.config['api']['images']['prefix'] = "https://thetvdb.com/banners/{value}"
# api-v2 language
self.config['api']['lang'] = 'en'
# language to translate into
self.config['language'] = language
if language not in self.languages:
self.config['language'] = None
self.config.update({'apikey': apikey, 'debug_enabled': debug, 'custom_ui': custom_ui, 'cache_enabled': cache,
'dvdorder': dvdorder, 'proxy': proxy, 'headers': headers or {},
'language': language if language in self.languages else None})
@property
def jwt_token(self):
......@@ -654,10 +638,6 @@ class Tvdb:
# set last updated
self._setShowData(sid, 'last_updated', int(time.mktime(datetime.now().timetuple())))
# save show cache
with io.open(os.path.join(sickrage.app.data_dir, 'thetvdb.db'), 'wb') as fp:
pickle.dump(self.shows, fp)
return self.shows[int(sid)]
@login_required
......@@ -721,8 +701,7 @@ class Tvdb:
if key in self.shows:
if self.config['cache_enabled']:
return self.shows[key]
else:
del self.shows[key]
del self.shows[key]
return self._getShowData(key)
return self._getSeries(key)
......
Supports Markdown
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