mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-05 17:43:37 +00:00
Fixed blackAndWhitelist for anime release groups.
This commit is contained in:
parent
9428dfadf6
commit
a3a3777d33
4 changed files with 22 additions and 4 deletions
|
@ -258,6 +258,13 @@ class DBConnection(object):
|
|||
def hasTable(self, tableName):
|
||||
return len(self.select("SELECT 1 FROM sqlite_master WHERE name = ?;", (tableName, ))) > 0
|
||||
|
||||
def hasColumn(self, tableName, column):
|
||||
return column in self.tableInfo(tableName)
|
||||
|
||||
def addColumn(self, table, column, type="NUMERIC", default=0):
|
||||
self.action("ALTER TABLE %s ADD %s %s" % (table, column, type))
|
||||
self.action("UPDATE %s SET %s = ?" % (table, column), (default,))
|
||||
|
||||
def close(self):
|
||||
"""Close database connection"""
|
||||
if getattr(self, "connection", None) is not None:
|
||||
|
|
|
@ -285,6 +285,7 @@ class GenericProvider:
|
|||
continue
|
||||
|
||||
quality = parse_result.quality
|
||||
release_group = parse_result.release_group
|
||||
|
||||
if not (self.show.air_by_date or self.show.sports):
|
||||
if search_mode == 'sponly' and len(parse_result.episode_numbers):
|
||||
|
@ -362,6 +363,7 @@ class GenericProvider:
|
|||
result.url = url
|
||||
result.name = title
|
||||
result.quality = quality
|
||||
result.release_group = release_group
|
||||
result.provider = self
|
||||
result.content = None
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class CacheDBConnection(db.DBConnection):
|
|||
try:
|
||||
if not self.hasTable(providerName):
|
||||
self.action(
|
||||
"CREATE TABLE [" + providerName + "] (name TEXT, season NUMERIC, episodes TEXT, indexerid NUMERIC, url TEXT, time NUMERIC, quality TEXT)")
|
||||
"CREATE TABLE [" + providerName + "] (name TEXT, season NUMERIC, episodes TEXT, indexerid NUMERIC, url TEXT, time NUMERIC, quality TEXT, release_group TEXT)")
|
||||
else:
|
||||
sqlResults = self.select(
|
||||
"SELECT url, COUNT(url) as count FROM [" + providerName + "] GROUP BY url HAVING count > 1")
|
||||
|
@ -56,6 +56,10 @@ class CacheDBConnection(db.DBConnection):
|
|||
|
||||
# add unique index to prevent further dupes from happening if one does not exist
|
||||
self.action("CREATE UNIQUE INDEX IF NOT EXISTS idx_url ON " + providerName + " (url)")
|
||||
|
||||
# add release_group column to table if missing
|
||||
if not self.hasColumn(providerName, 'release_group'):
|
||||
self.addColumn(providerName, 'release_group', "TEXT", "")
|
||||
except Exception, e:
|
||||
if str(e) != "table [" + providerName + "] already exists":
|
||||
raise
|
||||
|
@ -279,11 +283,14 @@ class TVCache():
|
|||
if not isinstance(name, unicode):
|
||||
name = unicode(name, 'utf-8')
|
||||
|
||||
# get release group
|
||||
release_group = parse_result.release_group
|
||||
|
||||
logger.log(u"Added RSS item: [" + name + "] to cache: [" + self.providerID + "]", logger.DEBUG)
|
||||
|
||||
return [
|
||||
"INSERT OR IGNORE INTO [" + self.providerID + "] (name, season, episodes, indexerid, url, time, quality) VALUES (?,?,?,?,?,?,?)",
|
||||
[name, season, episodeText, parse_result.show.indexerid, url, curTimestamp, quality]]
|
||||
"INSERT OR IGNORE INTO [" + self.providerID + "] (name, season, episodes, indexerid, url, time, quality, release_group) VALUES (?,?,?,?,?,?,?,?)",
|
||||
[name, season, episodeText, parse_result.show.indexerid, url, curTimestamp, quality, release_group]]
|
||||
|
||||
|
||||
def searchCache(self, episodes, manualSearch=False):
|
||||
|
@ -334,6 +341,7 @@ class TVCache():
|
|||
continue
|
||||
curEp = int(curEp)
|
||||
curQuality = int(curResult["quality"])
|
||||
curReleaseGroup = curResult["release_group"]
|
||||
|
||||
# if the show says we want that episode then add it to the list
|
||||
if not showObj.wantEpisode(curSeason, curEp, curQuality, manualSearch):
|
||||
|
@ -354,6 +362,7 @@ class TVCache():
|
|||
result.url = url
|
||||
result.name = title
|
||||
result.quality = curQuality
|
||||
result.release_group = curReleaseGroup
|
||||
result.content = self.provider.getURL(url) \
|
||||
if self.provider.providerType == sickbeard.providers.generic.GenericProvider.TORRENT \
|
||||
and not url.startswith('magnet') else None
|
||||
|
|
|
@ -80,6 +80,7 @@ except ImportError:
|
|||
from lib import adba
|
||||
|
||||
from Cheetah.Template import Template
|
||||
|
||||
from tornado.web import RequestHandler, HTTPError
|
||||
|
||||
|
||||
|
@ -539,7 +540,6 @@ class IndexerWebUI(MainHandler):
|
|||
def _munge(string):
|
||||
return unicode(string).encode('utf-8', 'xmlcharrefreplace')
|
||||
|
||||
|
||||
def _getEpisode(show, season=None, episode=None, absolute=None):
|
||||
if show is None:
|
||||
return "Invalid show parameters"
|
||||
|
|
Loading…
Reference in a new issue