Browse Source

Remove AlphaReign torrent provider.

Change minimise library update calls to Kodi and Plex.
tags/release_0.18.2^2
JackDandy 7 years ago
parent
commit
62a0de0f56
  1. 8
      CHANGES.md
  2. BIN
      gui/slick/images/providers/alphareign.png
  3. 2
      sickbeard/__init__.py
  4. 39
      sickbeard/notifiers/__init__.py
  5. 4
      sickbeard/notifiers/plex.py
  6. 4
      sickbeard/processTV.py
  7. 4
      sickbeard/providers/__init__.py
  8. 102
      sickbeard/providers/alphareign.py

8
CHANGES.md

@ -1,4 +1,10 @@
### 0.18.1 (2018-11-28 15:35:00 UTC)
### 0.18.2 (2018-11-30 21:15:00 UTC)
* Remove AlphaReign torrent provider
* Change minimise library update calls to Kodi and Plex
### 0.18.1 (2018-11-28 15:35:00 UTC)
* Fix manual search button on Daily Schedule

BIN
gui/slick/images/providers/alphareign.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 B

2
sickbeard/__init__.py

@ -333,6 +333,8 @@ XBMC_HOST = ''
XBMC_USERNAME = None
XBMC_PASSWORD = None
QUEUE_UPDATE_LIBRARY = []
USE_NMJ = False
NMJ_HOST = None
NMJ_DATABASE = None

39
sickbeard/notifiers/__init__.py

@ -16,6 +16,9 @@
# You should have received a copy of the GNU General Public License
# along with SickGear. If not, see <http://www.gnu.org/licenses/>.
import os
import re
import emby
import kodi
import plex
@ -43,6 +46,7 @@ import tweet
import emailnotify
import sickbeard
from sickbeard import encodingKludge as ek
class NotifierFactory(object):
@ -151,6 +155,35 @@ def notify_git_update(new_version=''):
n.notify_git_update(new_version)
def notify_update_library(ep_obj):
for n in NotifierFactory().get_enabled('library'):
n.update_library(show=ep_obj.show, show_name=ep_obj.show.name, ep_obj=ep_obj)
def notify_update_library(ep_obj, flush_q=None):
if not flush_q or sickbeard.QUEUE_UPDATE_LIBRARY:
for n in NotifierFactory().get_enabled('library'):
if isinstance(n, (plex.PLEXNotifier, kodi.KodiNotifier)):
if not flush_q:
sickbeard.QUEUE_UPDATE_LIBRARY += [(ep_obj.show.name, ep_obj.location)]
else:
shows = set()
locations = set()
for show_name, location in sickbeard.QUEUE_UPDATE_LIBRARY:
if isinstance(n, kodi.KodiNotifier):
if show_name in shows:
continue
shows.add(show_name)
else:
parent_dir = re.sub(r'[/\\]+%s.*' % show_name, '', ek.ek(os.path.dirname, location))
parent_dir = re.sub(r'^(.{,2})[/\\]', '', parent_dir)
if parent_dir in locations:
continue
locations.add(parent_dir)
n.update_library(show_name=show_name, location=location)
elif not flush_q:
n.update_library(show=ep_obj.show, show_name=ep_obj.show.name, ep_obj=ep_obj)
if flush_q:
sickbeard.QUEUE_UPDATE_LIBRARY = []

4
sickbeard/notifiers/plex.py

@ -142,7 +142,7 @@ class PLEXNotifier(Notifier):
return (('Test result for', 'Successful test of')['Fail' not in result]
+ ' Plex server(s) ... %s<br>\n' % result)
def update_library(self, ep_obj=None, host=None, username=None, password=None, **kwargs):
def update_library(self, ep_obj=None, host=None, username=None, password=None, location=None, **kwargs):
"""Handles updating the Plex Media Server host via HTTP API
Plex Media Server currently only supports updating the whole video library and not a specific path.
@ -186,7 +186,7 @@ class PLEXNotifier(Notifier):
except (ValueError, IndexError) as e:
self._log(u'Error parsing plex.tv response: ' + ex(e))
file_location = '' if None is ep_obj else ep_obj.location
file_location = location if None is not location else '' if None is ep_obj else ep_obj.location
host_validate = self._get_host_list(host, all([token_arg]))
hosts_all = {}
hosts_match = {}

4
sickbeard/processTV.py

@ -28,7 +28,7 @@ import sys
import time
import sickbeard
from sickbeard import postProcessor
from sickbeard import postProcessor, notifiers
from sickbeard import db, helpers, exceptions
from sickbeard import encodingKludge as ek
from sickbeard.exceptions import ex
@ -416,6 +416,8 @@ class ProcessTVShow(object):
self._buffer('-' * len(text))
self._log_helper(text, log_level)
notifiers.notify_update_library(ep_obj=None, flush_q=True)
if self.any_vid_processed:
if not self.files_failed:
_bottom_line(u'Successfully processed.', logger.MESSAGE)

4
sickbeard/providers/__init__.py

@ -30,7 +30,7 @@ __all__ = [
# usenet
'omgwtfnzbs',
# torrent
'alpharatio', 'alphareign', 'bb', 'beyondhd', 'bithdtv', 'blutopia', 'btn',
'alpharatio', 'bb', 'beyondhd', 'bithdtv', 'blutopia', 'btn',
'custom01', 'custom11', 'dh', 'ettv', 'eztv', 'fano', 'filelist', 'funfile', 'grabtheinfo',
'hdbits', 'hdme', 'hdspace', 'hdtorrents', 'horriblesubs',
'immortalseed', 'iptorrents', 'limetorrents', 'magnetdl', 'morethan', 'nebulance', 'ncore', 'nyaa',
@ -73,7 +73,7 @@ def sortedProviderList():
def makeProviderList():
providers = [x.provider for x in [getProviderModule(y) for y in __all__] if x]
import browser_ua, zlib
headers = [1449593765]
headers = [1449593765, 1597250020]
for p in providers:
if abs(zlib.crc32(p.name)) + 40000400 in headers:
p.headers.update({'User-Agent': browser_ua.get_ua()})

102
sickbeard/providers/alphareign.py

@ -1,102 +0,0 @@
# coding=utf-8
#
# Author: SickGear
#
# This file is part of SickGear.
#
# SickGear is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# SickGear is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SickGear. If not, see <http://www.gnu.org/licenses/>.
import re
import traceback
from . import generic
from sickbeard import logger
from sickbeard.bs4_parser import BS4Parser
from sickbeard.helpers import tryInt
from lib.unidecode import unidecode
class AlphaReignProvider(generic.TorrentProvider):
def __init__(self):
generic.TorrentProvider.__init__(self, 'AlphaReign')
self.url_base = 'https://alphareign.lol/'
self.urls = {'config_provider_home_uri': self.url_base,
'search': self.url_base + '?category=show&sort=created&query=%s&page=%s'}
self.minseed, self.minleech = 2 * [None]
def _search_provider(self, search_params, **kwargs):
results = []
items = {'Cache': [], 'Season': [], 'Episode': [], 'Propers': []}
rc = dict((k, re.compile('(?i)' + v)) for (k, v) in {'get': 'magnet:'}.items())
for mode in search_params.keys():
for search_string in search_params[mode]:
search_string = isinstance(search_string, unicode) and unidecode(search_string) or search_string
if 'Cache' == mode:
search_url = self.urls['search'] % tuple(search_string.split(','))
else:
search_url = self.urls['search'] % (search_string.replace('.', ' '), '')
html = self.get_url(search_url)
if self.should_skip():
return results
cnt = len(items[mode])
try:
if not html or self._has_no_results(html) or re.search('<h3>Result.*?&quot;.*?&quot;</h3>', html):
raise generic.HaltParseException
with BS4Parser(html, features=['html5lib', 'permissive']) as soup:
torrent_table = soup.find(id='results')
torrent_rows = [] if not torrent_table else torrent_table.find_all('div', class_='result')
for tr in torrent_rows:
try:
seeders, leechers, size = [tryInt(n, n) for n in [
tr['data-%s' % x].strip() for x in 'seeders', 'leechers', 'size']]
if self._reject_item(seeders, leechers):
continue
title = tr['data-name'].strip()
download_url = self._link(tr.find('a', href=rc['get'])['href'])
except (AttributeError, TypeError, ValueError):
continue
if title and download_url:
items[mode].append((title, download_url, seeders, self._bytesizer(size)))
except generic.HaltParseException:
pass
except (StandardError, Exception):
logger.log(u'Failed to parse. Traceback: %s' % traceback.format_exc(), logger.ERROR)
self._log_search(mode, len(items[mode]) - cnt, search_url)
results = self._sort_seeding(mode, results + items[mode])
return results
def _cache_data(self, **kwargs):
return self._search_provider({'Cache': [',', ',2', ',3', ',4', ',5']})
provider = AlphaReignProvider()
Loading…
Cancel
Save