Commit be1528e5 authored by Dustyn Gibson's avatar Dustyn Gibson
Browse files

Remove eztv and ezrss due to general scene skepticism about the shady nature of their takeover

parent 6d87090d
......@@ -36,9 +36,9 @@ from github import Github
from sickbeard import providers, metadata, config, webserveInit
from sickbeard.providers.generic import GenericProvider
from providers import ezrss, btn, newznab, womble, thepiratebay, oldpiratebay, torrentleech, kat, iptorrents, \
from providers import btn, newznab, womble, thepiratebay, oldpiratebay, torrentleech, kat, iptorrents, \
omgwtfnzbs, scc, hdtorrents, torrentday, hdbits, hounddawgs, nextgen, speedcd, nyaatorrents, animenzb, torrentbytes, animezb, \
freshontv, morethantv, bitsoup, t411, tokyotoshokan, shazbat, rarbg, alpharatio, tntvillage, binsearch, eztv, scenetime
freshontv, morethantv, bitsoup, t411, tokyotoshokan, shazbat, rarbg, alpharatio, tntvillage, binsearch, scenetime
from sickbeard.config import CheckSection, check_setting_int, check_setting_str, check_setting_float, ConfigMigrator, \
naming_ep_type
from sickbeard import searchBacklog, showUpdater, versionChecker, properFinder, autoPostProcesser, \
......
......@@ -698,41 +698,34 @@ def get_all_episodes_from_absolute_number(show, absolute_numbers, indexer_id=Non
return (season, episodes)
def sanitizeSceneName(name, ezrss=False, anime=False):
def sanitizeSceneName(name, anime=False):
"""
Takes a show name and returns the "scenified" version of it.
ezrss: If true the scenified version will follow EZRSS's cracksmoker rules as best as possible
anime: Some show have a ' in their name(Kuroko's Basketball) and is needed for search.
Returns: A string containing the scene version of the show name given.
"""
if name:
# anime: removed ' for Kuroko's Basketball
if anime:
bad_chars = u",:()!?\u2019"
# ezrss leaves : and ! in their show names as far as I can tell
elif ezrss:
bad_chars = u",()'?\u2019"
else:
bad_chars = u",:()'!?\u2019"
if not name:
return u''
# strip out any bad chars
for x in bad_chars:
name = name.replace(x, "")
bad_chars = u',:()!?\u2019'
if not anime:
bad_chars += u"'"
# tidy up stuff that doesn't belong in scene names
name = name.replace("- ", ".").replace(" ", ".").replace("&", "and").replace('/', '.')
name = re.sub("\.\.*", ".", name)
# strip out any bad chars
for x in bad_chars:
name = u'' + name.replace(x, "")
if name.endswith('.'):
name = name[:-1]
# tidy up stuff that doesn't belong in scene names
name = name.replace("- ", ".").replace(" ", ".").replace("&", "and").replace('/', '.')
name = re.sub("\.\.*", ".", name)
return name
else:
return ''
if name.endswith('.'):
name = name[:-1]
return name
_binOps = {
......
......@@ -16,8 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
__all__ = ['ezrss',
'womble',
__all__ = ['womble',
'btn',
'thepiratebay',
'oldpiratebay',
......@@ -27,7 +26,7 @@ __all__ = ['ezrss',
'hdtorrents',
'torrentday',
'hdbits',
'hounddawgs',
'hounddawgs',
'iptorrents',
'omgwtfnzbs',
'nextgen',
......@@ -46,7 +45,6 @@ __all__ = ['ezrss',
'rarbg',
'tntvillage',
'binsearch',
'eztv',
'scenetime',
]
......
File mode changed from 100755 to 100644
# Author: Nic Wolfe <[email protected]>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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.
#
# SickRage 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 SickRage. If not, see <http://www.gnu.org/licenses/>.
import urllib
import re
try:
import xml.etree.cElementTree as etree
except ImportError:
import elementtree.ElementTree as etree
import sickbeard
import generic
from sickbeard.common import Quality
from sickbeard import logger
from sickbeard import tvcache
from sickbeard import helpers
class EZRSSProvider(generic.TorrentProvider):
def __init__(self):
self.urls = {'base_url': 'https://www.ezrss.it/'}
self.url = self.urls['base_url']
generic.TorrentProvider.__init__(self, "EZRSS")
self.supportsBacklog = True
self.enabled = False
self.ratio = None
self.cache = EZRSSCache(self)
def isEnabled(self):
return self.enabled
def imageName(self):
return 'ezrss.png'
def getQuality(self, item, anime=False):
try:
quality = Quality.sceneQuality(item.filename, anime)
except:
quality = Quality.UNKNOWN
return quality
def findSearchResults(self, show, episodes, search_mode, manualSearch=False, downCurQuality=False):
self.show = show
results = {}
if show.air_by_date or show.sports:
logger.log(self.name + u" doesn't support air-by-date or sports backloging because of limitations on their RSS search.",
logger.WARNING)
return results
results = generic.TorrentProvider.findSearchResults(self, show, episodes, search_mode, manualSearch, downCurQuality)
return results
def _get_season_search_strings(self, ep_obj):
params = {}
params['show_name'] = helpers.sanitizeSceneName(self.show.name, ezrss=True).replace('.', ' ').encode('utf-8')
if ep_obj.show.air_by_date or ep_obj.show.sports:
params['season'] = str(ep_obj.airdate).split('-')[0]
elif ep_obj.show.anime:
params['season'] = "%d" % ep_obj.scene_absolute_number
else:
params['season'] = ep_obj.scene_season
return [params]
def _get_episode_search_strings(self, ep_obj, add_string=''):
params = {}
if not ep_obj:
return params
params['show_name'] = helpers.sanitizeSceneName(self.show.name, ezrss=True).replace('.', ' ').encode('utf-8')
if self.show.air_by_date or self.show.sports:
params['date'] = str(ep_obj.airdate)
elif self.show.anime:
params['episode'] = "%i" % int(ep_obj.scene_absolute_number)
else:
params['season'] = ep_obj.scene_season
params['episode'] = ep_obj.scene_episode
return [params]
def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0, epObj=None):
params = {"mode": "rss"}
if search_params:
params.update(search_params)
search_url = self.url + 'search/index.php?' + urllib.urlencode(params)
logger.log(u"Search string: " + search_url, logger.DEBUG)
results = []
for curItem in self.cache.getRSSFeed(search_url, items=['entries'])['entries'] or []:
(title, url) = self._get_title_and_url(curItem)
if title and url:
logger.log(u"RSS Feed provider: [" + self.name + "] Attempting to add item to cache: " + title, logger.DEBUG)
results.append(curItem)
return results
def _get_title_and_url(self, item):
(title, url) = generic.TorrentProvider._get_title_and_url(self, item)
try:
new_title = self._extract_name_from_filename(item.filename)
except:
new_title = None
if new_title:
title = new_title
logger.log(u"Extracted the name " + title + " from the torrent link", logger.DEBUG)
return (title, url)
def _extract_name_from_filename(self, filename):
name_regex = '(.*?)\.?(\[.*]|\d+\.TPB)\.torrent$'
logger.log(u"Comparing " + name_regex + " against " + filename, logger.DEBUG)
match = re.match(name_regex, filename, re.I)
if match:
return match.group(1)
return None
def seedRatio(self):
return self.ratio
class EZRSSCache(tvcache.TVCache):
def __init__(self, provider):
tvcache.TVCache.__init__(self, provider)
# only poll EZRSS every 15 minutes max
self.minTime = 15
def _getRSSData(self):
rss_url = self.provider.url + 'feed/'
logger.log(self.provider.name + " cache update URL: " + rss_url, logger.DEBUG)
return self.getRSSFeed(rss_url)
provider = EZRSSProvider()
# coding=utf-8
# Author: Nicolas Martinelli <[email protected]>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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.
#
# Sick Beard 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 Sick Beard. If not, see <http://www.gnu.org/licenses/>.
import traceback
import re, datetime
import generic
import sickbeard
from sickbeard import classes
from sickbeard import helpers
from sickbeard import logger, tvcache, db
from sickbeard.common import Quality
from sickbeard.bs4_parser import BS4Parser
class EZTVProvider(generic.TorrentProvider):
def __init__(self):
generic.TorrentProvider.__init__(self, "EZTV")
self.supportsBacklog = False
self.enabled = False
self.ratio = None
self.cache = EZTVCache(self)
self.urls = {
'base_url': 'https://eztv.ch/',
'rss': 'https://eztv.ch/',
'episode': 'http://eztvapi.re/show/%s',
}
self.url = self.urls['base_url']
def isEnabled(self):
return self.enabled
def seedRatio(self):
return self.ratio
def imageName(self):
return 'eztv_bt_chat.png'
def _get_episode_search_strings(self, ep_obj, add_string=''):
search_string = {'Episode': []}
search_string['Episode'].append({
'imdb_id': self.show.imdbid,
'season': int(ep_obj.scene_season),
'episode': int(ep_obj.scene_episode),
'add_string': add_string,
})
return [search_string]
def getQuality(self, item, anime=False):
if 'quality' in item:
if item.get('quality') == "480p":
return Quality.SDTV
elif item.get('quality') == "720p":
return Quality.HDWEBDL
elif item.get('quality') == "1080p":
return Quality.FULLHDWEBDL
else:
return Quality.sceneQuality(item.get('title'), anime)
else:
return Quality.sceneQuality(item.get('title'), anime)
def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0, epObj=None):
results = []
items = {'Season': [], 'Episode': [], 'RSS': []}
for mode in search_params.keys():
if mode == 'RSS':
for search_string in search_params[mode]:
searchURL = self.urls['rss']
logger.log(u"" + self.name + " search page URL: " + searchURL, logger.DEBUG)
HTML = self.getURL(searchURL)
if not HTML:
logger.log(u"" + self.name + " could not retrieve page URL:" + searchURL, logger.DEBUG)
return results
try:
with BS4Parser(HTML, features=["html5lib", "permissive"]) as parsedHTML:
resultsTable = parsedHTML.find_all('tr', attrs={'name': 'hover', 'class': 'forum_header_border'})
if not resultsTable:
logger.log(u"The Data returned from " + self.name + " do not contains any torrent",
logger.DEBUG)
continue
for entries in resultsTable:
title = entries.find('a', attrs={'class': 'epinfo'}).contents[0]
for link_type in ('magnet', 'download_1', 'download_3'):
link = entries.find('a', attrs={'class': link_type})
if link:
link = link.get('href')
else:
continue
item = {
'title': title,
'link': link,
}
items[mode].append(item)
continue
except Exception, e:
logger.log(u"Failed parsing " + self.name + " Traceback: " + traceback.format_exc(),
logger.ERROR)
elif mode == 'Episode':
for search_string in search_params[mode]:
searchURL = self.urls['episode'] % (search_string['imdb_id'])
logger.log(u"" + self.name + " search page URL: " + searchURL, logger.DEBUG)
try:
parsedJSON = self.getURL(searchURL, json=True)
except ValueError as e:
parsedJSON = None
if not parsedJSON:
logger.log(u"" + self.name + " could not retrieve page URL:" + searchURL, logger.DEBUG)
return results
try:
for episode in parsedJSON['episodes']:
if int(episode.get('season')) == search_string.get('season') and \
int(episode.get('episode')) == search_string.get('episode'):
for quality in episode['torrents'].keys():
link = episode['torrents'][quality]['url']
if not re.match('magnet', link) and not re.match('http', link):
continue
# Get title from link:
# 1) try magnet link
# 2) try rarbg link
# 3) try extratorrent link
# 4) try '([^/]+$)' : everything after last slash character (not accurate)
# 5) fallback, title is equal to link
if re.match('.*&dn=(.*?)&', link):
title = re.match('.*&dn=(.*?)&', link).group(1)
elif re.match('http://rarbg.to', link):
title = re.search('([^=]+$)', link).group(0)
elif re.match('http://extratorrent.cc', link):
title = re.search('([^/]+$)', link).group(0)
elif re.search('([^/]+$)', link):
title = re.search('([^/]+$)', link).group(0)
else:
title = link
title = title.replace('+', '.').replace('%20', '.').replace('%5B', '[').replace('%5D', ']')
item = {
'title': title,
'link': link,
'quality': quality
}
# re.search in case of PROPER|REPACK. In other cases
# add_string is empty, so condition is met.
if 'add_string' in search_string and re.search(search_string.get('add_string'), title):
items[mode].append(item)
break
except Exception, e:
logger.log(u"Failed parsing " + self.name + " Traceback: " + traceback.format_exc(),
logger.ERROR)
else:
logger.log(u"" + self.name + " does not accept " + mode + " mode", logger.DEBUG)
return results
results += items[mode]
return results
def findPropers(self, search_date=datetime.datetime.today()):
results = []
myDB = db.DBConnection()
sqlResults = myDB.select(
'SELECT s.show_name, e.showid, e.season, e.episode, e.status, e.airdate FROM tv_episodes AS e' +
' INNER JOIN tv_shows AS s ON (e.showid = s.indexer_id)' +
' WHERE e.airdate >= ' + str(search_date.toordinal()) +
' AND (e.status IN (' + ','.join([str(x) for x in Quality.DOWNLOADED]) + ')' +
' OR (e.status IN (' + ','.join([str(x) for x in Quality.SNATCHED]) + ')))'
)
if not sqlResults:
return []
for sqlshow in sqlResults:
self.show = helpers.findCertainShow(sickbeard.showList, int(sqlshow["showid"]))
if self.show:
curEp = self.show.getEpisode(int(sqlshow["season"]), int(sqlshow["episode"]))
searchString = self._get_episode_search_strings(curEp, add_string='PROPER|REPACK')
for item in self._doSearch(searchString[0]):
title, url = self._get_title_and_url(item)
results.append(classes.Proper(title, url, datetime.datetime.today(), self.show))
return results
class EZTVCache(tvcache.TVCache):
def __init__(self, provider):
tvcache.TVCache.__init__(self, provider)
# Only poll EZTV every 5 minutes max
self.minTime = 5
def _getRSSData(self):
search_params = {'RSS': ['']}
return {'entries': self.provider._doSearch(search_params)}
provider = EZTVProvider()
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -199,18 +199,10 @@ def pickBestResult(results, show, quality_list=None):
if show and cur_result.show is not show:
continue
# filter out possible bad torrents from providers such as ezrss
if isinstance(cur_result, sickbeard.classes.SearchResult):
if cur_result.resultType == "torrent" and sickbeard.TORRENT_METHOD != "blackhole":
if not cur_result.url.startswith('magnet'):
cur_result.content = cur_result.provider.getURL(cur_result.url)
if not cur_result.content:
continue
else:
if not cur_result.url.startswith('magnet'):
cur_result.content = cur_result.provider.getURL(cur_result.url)
if not cur_result.content:
continue
if not cur_result.url.startswith('magnet'):
cur_result.content = cur_result.provider.getURL(cur_result.url)
if not cur_result.content:
continue
# build the black And white list
if show.is_anime:
......
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