Change improve searching torrent provider BTScene.

Change improve text for abandoned show IDs.
Change DRY refactor provider result creation.
Change catch failures to shutdown Emby socket.
This commit is contained in:
JackDandy 2018-04-18 13:52:01 +01:00
parent d52024eabe
commit d9e03aa1fb
9 changed files with 45 additions and 36 deletions

View file

@ -1,4 +1,10 @@
### 0.15.12 (2018-04-17 14:10:00 UTC)
### 0.15.13 (2018-04-18 13:50:00 UTC)
* Fix API endpoints for sg.exceptions and exceptions
* Change improve searching torrent provider BTScene
### 0.15.12 (2018-04-17 14:10:00 UTC)
* Fix ETTV torrent provider

View file

@ -462,7 +462,7 @@
<ol>
<li>Install the SickGear repo to access its Kodi Add-on
<ul>
<li>in <b class="boldest">Filemanager</b>, add a source for SickGear with <span class="grey-text">&lt;ip&gt;:&lt;port&gt;/kodi/</span> (e.g. <span class="grey-text">192.168.0.10:$sg_port/kodi/</span>)<br>
<li>in <b class="boldest">Filemanager</b>, add a source with <span class="grey-text">&lt;ip&gt;:&lt;port&gt;/kodi/</span> (e.g. <span class="grey-text">http://192.168.0.10:$sg_port/kodi/</span>)<br>
and name it for example, <span class="grey-text">SickGear</span>. <em>You will need to allow <span class="highlight-text">Unknown Sources</span> if not already</em> </li>
<li>in <b class="boldest">System/Add-ons</b>, "<span class="grey-text">Install from zip file</span>", in the folder list, select the <span class="grey-text">SickGear</span> source</li>
<li>select the <span class="grey-text">repository.sickgear</span> in the folder listing, and install the repository zip<br>

View file

@ -103,7 +103,10 @@ class EmbyNotifier(Notifier):
except (StandardError, Exception):
pass
if not sock_issue:
cs.shutdown(SHUT_RDWR)
try:
cs.shutdown(SHUT_RDWR)
except (StandardError, Exception):
pass
return result
def _check_config(self, hosts=None, apikeys=None):

View file

@ -65,7 +65,7 @@ class BTSceneProvider(generic.TorrentProvider):
'mPblqN2ctQnY', 'vlWduM2 YPtU', 'nYoRXahZPm L', '15PSZuV2 YzR', 'WYrN 2PbsJmb',
'==wZ y9mL sx']],
]]]
self.url_vars = {'search': '?q=%s&category=series&order=1', 'browse': 'lastdaycat/type/Series/',
self.url_vars = {'search': '?q=%s&order=1', 'browse': 'lastdaycat/type/Series/',
'get': 'torrentdownload.php?id=%s'}
self.url_tmpl = {'config_provider_home_uri': '%(home)s', 'search': '%(vars)s',
'browse': '%(home)s%(vars)s', 'get': '%(home)s%(vars)s'}
@ -165,5 +165,19 @@ class BTSceneProvider(generic.TorrentProvider):
def _episode_strings(self, ep_obj, **kwargs):
return super(BTSceneProvider, self)._episode_strings(ep_obj, sep_date='.', **kwargs)
def get_data(self, url):
result = None
resp = self.get_url(url, timeout=90)
if self.should_skip():
return result
try:
result = resp
if re.search('(?i)\s+html', resp[0:30]):
result = re.findall('(?i)"(magnet:[^"]+?)"', resp)[0]
except IndexError:
pass
return result
provider = BTSceneProvider()

View file

@ -134,19 +134,10 @@ class ETTVProvider(generic.TorrentProvider):
return result
try:
result = re.findall('(?i)"(magnet:[^"]+?)">', html)[0]
result = re.findall('(?i)"(magnet:[^"]+?)"', html)[0]
except IndexError:
logger.log('Failed no magnet in response', logger.DEBUG)
return result
def get_result(self, episodes, url):
result = None
if url:
result = super(ETTVProvider, self).get_result(episodes, url)
result.get_data_func = self.get_data
return result
provider = ETTVProvider()

View file

@ -668,7 +668,7 @@ class GenericProvider(object):
cache_file = ek.ek(os.path.join, cache_dir, base_name)
self.session.headers['Referer'] = url
if cached or helpers.download_file(url, cache_file, session=self.session):
if cached or helpers.download_file(url, cache_file, session=self.session, allow_redirects='/it' not in url):
if self._verify_download(cache_file):
logger.log(u'Downloaded %s result from %s' % (self.name, url))
@ -1675,3 +1675,13 @@ class TorrentProvider(GenericProvider):
self.ping_skip = ((60*60)/self.ping_freq, None)[self._authorised()]
self._sleep_with_stop(self.ping_freq)
def get_result(self, episodes, url):
result = None
if url:
result = super(TorrentProvider, self).get_result(episodes, url)
if hasattr(self, 'get_data'):
result.get_data_func = self.get_data
return result

View file

@ -121,14 +121,5 @@ class PiSexyProvider(generic.TorrentProvider):
logger.log('Failed no torrent in response', logger.DEBUG)
return result
def get_result(self, episodes, url):
result = None
if url:
result = super(PiSexyProvider, self).get_result(episodes, url)
result.get_data_func = self.get_data
return result
provider = PiSexyProvider()

View file

@ -146,15 +146,6 @@ class PotUKProvider(generic.TorrentProvider):
logger.log('Failed no torrent in response', logger.DEBUG)
return result
def get_result(self, episodes, url):
result = None
if url:
result = super(PotUKProvider, self).get_result(episodes, url)
result.get_data_func = self.get_data
return result
def ui_string(self, key):
return ('%s_digest' % self.get_id()) == key and 'use... \'bbuserid=xx; bbpassword=yy\'' or ''

View file

@ -1732,7 +1732,8 @@ class Home(MainHandler):
last_found = ('', ' since %s' % sbdatetime.sbdatetime.fromordinal(
showObj.last_found_on_indexer).sbfdate())[1 < showObj.last_found_on_indexer]
show_message = (
'The master ID of this show has been abandoned%s, ' % last_found
'The master ID of this show has been <span class="addQTip" title="many reasons exist, including: '
+ '<br>show flagged as a duplicate, removed completely... etc">abandoned</span>%s, ' % last_found
+ '<a href="%s/home/editShow?show=%s&tvsrc=0&srcid=%s#core-component-group3">replace it here</a>' % (
sickbeard.WEB_ROOT, show, show)
+ ('', '<br>%s' % show_message)[0 < len(show_message)])
@ -2206,8 +2207,10 @@ class Home(MainHandler):
# noinspection PyUnresolvedReferences
last_found = ('', ' since %s' % sbdatetime.sbdatetime.fromordinal(
showObj.last_found_on_indexer).sbfdate())[1 < showObj.last_found_on_indexer]
show_message = 'The master ID of this show has been abandoned%s<br>search for ' % last_found + \
'a replacement in the "<b>Related show IDs</b>" section of the "<b>Other</b>" tab'
show_message = (
'The master ID of this show has been <span class="addQTip" title="many reasons exist, including: '
+ '\nshow flagged as a duplicate, removed completely... etc">abandoned</span>%s' % last_found
+ '<br>search for a replacement in the "<b>Related show IDs</b>" section of the "<b>Other</b>" tab')
t.show_message = show_message