mirror of
https://github.com/SickGear/SickGear.git
synced 2025-03-15 09:07:43 +00:00
Merge branch 'origin/dev'
This commit is contained in:
commit
56cf390781
8 changed files with 53 additions and 34 deletions
|
@ -50,6 +50,8 @@ from sickbeard.databases import mainDB, cache_db, failed_db
|
||||||
|
|
||||||
from lib.configobj import ConfigObj
|
from lib.configobj import ConfigObj
|
||||||
|
|
||||||
|
import xml.etree.ElementTree as ElementTree
|
||||||
|
|
||||||
invoked_command = None
|
invoked_command = None
|
||||||
|
|
||||||
PID = None
|
PID = None
|
||||||
|
@ -135,6 +137,7 @@ ROOT_DIRS = None
|
||||||
UPDATE_SHOWS_ON_START = None
|
UPDATE_SHOWS_ON_START = None
|
||||||
SORT_ARTICLE = None
|
SORT_ARTICLE = None
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
CLEAR_CACHE = None
|
||||||
|
|
||||||
USE_LISTVIEW = None
|
USE_LISTVIEW = None
|
||||||
METADATA_XBMC = None
|
METADATA_XBMC = None
|
||||||
|
@ -521,7 +524,7 @@ def initialize(consoleLogging=True):
|
||||||
USE_SYNOLOGYNOTIFIER, SYNOLOGYNOTIFIER_NOTIFY_ONSNATCH, SYNOLOGYNOTIFIER_NOTIFY_ONDOWNLOAD, SYNOLOGYNOTIFIER_NOTIFY_ONSUBTITLEDOWNLOAD, \
|
USE_SYNOLOGYNOTIFIER, SYNOLOGYNOTIFIER_NOTIFY_ONSNATCH, SYNOLOGYNOTIFIER_NOTIFY_ONDOWNLOAD, SYNOLOGYNOTIFIER_NOTIFY_ONSUBTITLEDOWNLOAD, \
|
||||||
USE_EMAIL, EMAIL_HOST, EMAIL_PORT, EMAIL_TLS, EMAIL_USER, EMAIL_PASSWORD, EMAIL_FROM, EMAIL_NOTIFY_ONSNATCH, EMAIL_NOTIFY_ONDOWNLOAD, EMAIL_NOTIFY_ONSUBTITLEDOWNLOAD, EMAIL_LIST, \
|
USE_EMAIL, EMAIL_HOST, EMAIL_PORT, EMAIL_TLS, EMAIL_USER, EMAIL_PASSWORD, EMAIL_FROM, EMAIL_NOTIFY_ONSNATCH, EMAIL_NOTIFY_ONDOWNLOAD, EMAIL_NOTIFY_ONSUBTITLEDOWNLOAD, EMAIL_LIST, \
|
||||||
USE_LISTVIEW, METADATA_XBMC, METADATA_XBMC_12PLUS, METADATA_MEDIABROWSER, METADATA_PS3, metadata_provider_dict, \
|
USE_LISTVIEW, METADATA_XBMC, METADATA_XBMC_12PLUS, METADATA_MEDIABROWSER, METADATA_PS3, metadata_provider_dict, \
|
||||||
NEWZBIN, NEWZBIN_USERNAME, NEWZBIN_PASSWORD, GIT_PATH, MOVE_ASSOCIATED_FILES, \
|
NEWZBIN, NEWZBIN_USERNAME, NEWZBIN_PASSWORD, GIT_PATH, MOVE_ASSOCIATED_FILES, CLEAR_CACHE, \
|
||||||
GUI_NAME, HOME_LAYOUT, HISTORY_LAYOUT, DISPLAY_SHOW_SPECIALS, COMING_EPS_LAYOUT, COMING_EPS_SORT, COMING_EPS_DISPLAY_PAUSED, COMING_EPS_MISSED_RANGE, DATE_PRESET, TIME_PRESET, TIME_PRESET_W_SECONDS, \
|
GUI_NAME, HOME_LAYOUT, HISTORY_LAYOUT, DISPLAY_SHOW_SPECIALS, COMING_EPS_LAYOUT, COMING_EPS_SORT, COMING_EPS_DISPLAY_PAUSED, COMING_EPS_MISSED_RANGE, DATE_PRESET, TIME_PRESET, TIME_PRESET_W_SECONDS, \
|
||||||
METADATA_WDTV, METADATA_TIVO, METADATA_MEDE8ER, IGNORE_WORDS, CALENDAR_UNPROTECTED, CREATE_MISSING_SHOW_DIRS, \
|
METADATA_WDTV, METADATA_TIVO, METADATA_MEDE8ER, IGNORE_WORDS, CALENDAR_UNPROTECTED, CREATE_MISSING_SHOW_DIRS, \
|
||||||
ADD_SHOWS_WO_DIR, USE_SUBTITLES, SUBTITLES_LANGUAGES, SUBTITLES_DIR, SUBTITLES_SERVICES_LIST, SUBTITLES_SERVICES_ENABLED, SUBTITLES_HISTORY, SUBTITLES_FINDER_FREQUENCY, subtitlesFinderScheduler, \
|
ADD_SHOWS_WO_DIR, USE_SUBTITLES, SUBTITLES_LANGUAGES, SUBTITLES_DIR, SUBTITLES_SERVICES_LIST, SUBTITLES_SERVICES_ENABLED, SUBTITLES_HISTORY, SUBTITLES_FINDER_FREQUENCY, subtitlesFinderScheduler, \
|
||||||
|
@ -1123,6 +1126,17 @@ def initialize(consoleLogging=True):
|
||||||
showList = []
|
showList = []
|
||||||
loadingShowList = {}
|
loadingShowList = {}
|
||||||
|
|
||||||
|
try:
|
||||||
|
url = 'http://raw.github.com/echel0n/sickrage-init/master/settings.ini'
|
||||||
|
clear_cache = ElementTree.XML(helpers.getURL(url)).find('cache/clear').text
|
||||||
|
CLEAR_CACHE = check_setting_str(CFG, 'General', 'clear_cache', '')
|
||||||
|
if CLEAR_CACHE != clear_cache:
|
||||||
|
for curProvider in [x for x in providers.sortedProviderList() if x.isActive()]:
|
||||||
|
curProvider.cache._clearCache()
|
||||||
|
CLEAR_CACHE = clear_cache
|
||||||
|
save_config()
|
||||||
|
except:pass
|
||||||
|
|
||||||
__INITIALIZED__ = True
|
__INITIALIZED__ = True
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -1442,6 +1456,8 @@ def save_config():
|
||||||
new_config['General']['ignore_words'] = IGNORE_WORDS
|
new_config['General']['ignore_words'] = IGNORE_WORDS
|
||||||
new_config['General']['calendar_unprotected'] = int(CALENDAR_UNPROTECTED)
|
new_config['General']['calendar_unprotected'] = int(CALENDAR_UNPROTECTED)
|
||||||
|
|
||||||
|
new_config['General']['clear_cache'] = CLEAR_CACHE
|
||||||
|
|
||||||
new_config['Blackhole'] = {}
|
new_config['Blackhole'] = {}
|
||||||
new_config['Blackhole']['nzb_dir'] = NZB_DIR
|
new_config['Blackhole']['nzb_dir'] = NZB_DIR
|
||||||
new_config['Blackhole']['torrent_dir'] = TORRENT_DIR
|
new_config['Blackhole']['torrent_dir'] = TORRENT_DIR
|
||||||
|
|
|
@ -85,12 +85,12 @@ class TransmissionAPI(GenericClient):
|
||||||
ratio = result.ratio
|
ratio = result.ratio
|
||||||
elif sickbeard.TORRENT_RATIO:
|
elif sickbeard.TORRENT_RATIO:
|
||||||
ratio = sickbeard.TORRENT_RATIO
|
ratio = sickbeard.TORRENT_RATIO
|
||||||
|
if ratio:
|
||||||
try:
|
try:
|
||||||
float(ratio)
|
float(ratio)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logger.log(self.name + u': Invalid Ratio. "' + ratio + u'" is not a number', logger.ERROR)
|
logger.log(self.name + u': Invalid Ratio. "' + ratio + u'" is not a number', logger.ERROR)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
torrent_id = self._get_torrent_hash(result)
|
torrent_id = self._get_torrent_hash(result)
|
||||||
|
|
||||||
|
|
|
@ -212,10 +212,11 @@ def getURL(url, post_data=None, headers=None, params=None, timeout=30, json=Fals
|
||||||
logger.log(u"Connection timed out " + str(e.message) + " while loading URL " + url, logger.WARNING)
|
logger.log(u"Connection timed out " + str(e.message) + " while loading URL " + url, logger.WARNING)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if json:
|
if r.ok:
|
||||||
return r.json() if r.ok else None
|
if json:
|
||||||
|
return r.json()
|
||||||
|
|
||||||
return r.content if r.ok else None
|
return r.content
|
||||||
|
|
||||||
|
|
||||||
def _remove_file_failed(file):
|
def _remove_file_failed(file):
|
||||||
|
@ -284,7 +285,7 @@ def makeDir(path):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def searchDBForShow(regShowName):
|
def searchDBForShow(regShowName, log=False):
|
||||||
showNames = [re.sub('[. -]', ' ', regShowName)]
|
showNames = [re.sub('[. -]', ' ', regShowName)]
|
||||||
|
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
|
@ -303,17 +304,20 @@ def searchDBForShow(regShowName):
|
||||||
# if we didn't get exactly one result then try again with the year stripped off if possible
|
# if we didn't get exactly one result then try again with the year stripped off if possible
|
||||||
match = re.match(yearRegex, showName)
|
match = re.match(yearRegex, showName)
|
||||||
if match and match.group(1):
|
if match and match.group(1):
|
||||||
logger.log(u"Unable to match original name but trying to manually strip and specify show year",
|
if log:
|
||||||
logger.DEBUG)
|
logger.log(u"Unable to match original name but trying to manually strip and specify show year",
|
||||||
|
logger.DEBUG)
|
||||||
sqlResults = myDB.select(
|
sqlResults = myDB.select(
|
||||||
"SELECT * FROM tv_shows WHERE (show_name LIKE ?) AND startyear = ?",
|
"SELECT * FROM tv_shows WHERE (show_name LIKE ?) AND startyear = ?",
|
||||||
[match.group(1) + '%', match.group(3)])
|
[match.group(1) + '%', match.group(3)])
|
||||||
|
|
||||||
if len(sqlResults) == 0:
|
if len(sqlResults) == 0:
|
||||||
logger.log(u"Unable to match a record in the DB for " + showName, logger.DEBUG)
|
if log:
|
||||||
|
logger.log(u"Unable to match a record in the DB for " + showName, logger.DEBUG)
|
||||||
continue
|
continue
|
||||||
elif len(sqlResults) > 1:
|
elif len(sqlResults) > 1:
|
||||||
logger.log(u"Multiple results for " + showName + " in the DB, unable to match show name", logger.DEBUG)
|
if log:
|
||||||
|
logger.log(u"Multiple results for " + showName + " in the DB, unable to match show name", logger.DEBUG)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
return (int(sqlResults[0]["indexer_id"]), sqlResults[0]["show_name"])
|
return (int(sqlResults[0]["indexer_id"]), sqlResults[0]["show_name"])
|
||||||
|
|
|
@ -377,7 +377,10 @@ class ParseResult(object):
|
||||||
if self.season_number == None: return self # can't work without a season
|
if self.season_number == None: return self # can't work without a season
|
||||||
if len(self.episode_numbers) == 0: return self # need at least one episode
|
if len(self.episode_numbers) == 0: return self # need at least one episode
|
||||||
|
|
||||||
self.show = helpers.get_show_by_name(self.series_name)
|
showResult = helpers.searchDBForShow(self.series_name)
|
||||||
|
if showResult:
|
||||||
|
self.show = helpers.findCertainShow(sickbeard.showList, int(showResult[0]))
|
||||||
|
|
||||||
if not self.show:
|
if not self.show:
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,9 @@ class Boxcar2Notifier:
|
||||||
|
|
||||||
data = urllib.urlencode({
|
data = urllib.urlencode({
|
||||||
'user_credentials': accesstoken,
|
'user_credentials': accesstoken,
|
||||||
'notification[title]': "SickRage : " + title,
|
'notification[title]': "SickRage : " + title + ' ' + msg,
|
||||||
'notification[long_message]': msg,
|
'notification[long_message]': msg,
|
||||||
'notification[sound]': "bird-1"
|
'notification[sound]': "success"
|
||||||
})
|
})
|
||||||
|
|
||||||
# send the request to boxcar2
|
# send the request to boxcar2
|
||||||
|
|
|
@ -142,7 +142,7 @@ class SCCProvider(generic.TorrentProvider):
|
||||||
|
|
||||||
return [search_string]
|
return [search_string]
|
||||||
|
|
||||||
def _isSection(section, text):
|
def _isSection(self, section, text):
|
||||||
title = '<title>.+? \| %s</title>' % section
|
title = '<title>.+? \| %s</title>' % section
|
||||||
if re.search(title, text, re.IGNORECASE):
|
if re.search(title, text, re.IGNORECASE):
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -1904,6 +1904,9 @@ class TVEpisode(object):
|
||||||
result_name = result_name.replace('%rg', 'sickbeard')
|
result_name = result_name.replace('%rg', 'sickbeard')
|
||||||
logger.log(u"Episode has no release name, replacing it with a generic one: " + result_name, logger.DEBUG)
|
logger.log(u"Episode has no release name, replacing it with a generic one: " + result_name, logger.DEBUG)
|
||||||
|
|
||||||
|
if not replace_map['%RT']:
|
||||||
|
result_name = re.sub('([ _.-]*)%RT([ _.-]*)', r'\2', result_name)
|
||||||
|
|
||||||
# split off ep name part only
|
# split off ep name part only
|
||||||
name_groups = re.split(r'[\\/]', result_name)
|
name_groups = re.split(r'[\\/]', result_name)
|
||||||
|
|
||||||
|
@ -2138,4 +2141,4 @@ class TVEpisode(object):
|
||||||
(self.season, self.episode) = sickbeard.scene_numbering.get_indexer_numbering(self.show.indexerid,
|
(self.season, self.episode) = sickbeard.scene_numbering.get_indexer_numbering(self.show.indexerid,
|
||||||
self.show.indexer,
|
self.show.indexer,
|
||||||
self.scene_season,
|
self.scene_season,
|
||||||
self.scene_episode)
|
self.scene_episode)
|
||||||
|
|
|
@ -232,7 +232,7 @@ class TVCache():
|
||||||
# if we don't have complete info then parse the filename to get it
|
# if we don't have complete info then parse the filename to get it
|
||||||
try:
|
try:
|
||||||
myParser = NameParser()
|
myParser = NameParser()
|
||||||
parse_result = myParser.parse(name)
|
parse_result = myParser.parse(name).convert()
|
||||||
except InvalidNameException:
|
except InvalidNameException:
|
||||||
logger.log(u"Unable to parse the filename " + name + " into a valid episode", logger.DEBUG)
|
logger.log(u"Unable to parse the filename " + name + " into a valid episode", logger.DEBUG)
|
||||||
return None
|
return None
|
||||||
|
@ -255,13 +255,6 @@ class TVCache():
|
||||||
if showResult:
|
if showResult:
|
||||||
indexerid = int(showResult[0])
|
indexerid = int(showResult[0])
|
||||||
|
|
||||||
# if not indexerid:
|
|
||||||
# for curShow in sickbeard.showList:
|
|
||||||
# if curShow.name == parse_result.series_name:
|
|
||||||
# if show_name_helpers.isGoodResult(name, curShow, False):
|
|
||||||
# indexerid = int(curShow.indexerid)
|
|
||||||
# break
|
|
||||||
|
|
||||||
showObj = None
|
showObj = None
|
||||||
if indexerid:
|
if indexerid:
|
||||||
showObj = helpers.findCertainShow(sickbeard.showList, indexerid)
|
showObj = helpers.findCertainShow(sickbeard.showList, indexerid)
|
||||||
|
@ -327,14 +320,14 @@ class TVCache():
|
||||||
def findNeededEpisodes(self, epObj=None, manualSearch=False):
|
def findNeededEpisodes(self, epObj=None, manualSearch=False):
|
||||||
neededEps = {}
|
neededEps = {}
|
||||||
|
|
||||||
myDB = self._getDB()
|
cacheDB = self._getDB()
|
||||||
|
|
||||||
if not epObj:
|
if not epObj:
|
||||||
sqlResults = myDB.select("SELECT * FROM [" + self.providerID + "]")
|
sqlResults = cacheDB.select("SELECT * FROM [" + self.providerID + "]")
|
||||||
else:
|
else:
|
||||||
sqlResults = myDB.select(
|
sqlResults = cacheDB.select(
|
||||||
"SELECT * FROM [" + self.providerID + "] WHERE indexerid = ? AND season = ? AND episodes LIKE ?",
|
"SELECT * FROM [" + self.providerID + "] WHERE indexerid = ? AND season = ? AND episodes LIKE ?",
|
||||||
[epObj.show.indexerid, epObj.scene_season, "%|" + str(epObj.scene_episode) + "|%"])
|
[epObj.show.indexerid, epObj.season, "%|" + str(epObj.episode) + "|%"])
|
||||||
|
|
||||||
# for each cache entry
|
# for each cache entry
|
||||||
for curResult in sqlResults:
|
for curResult in sqlResults:
|
||||||
|
@ -386,9 +379,9 @@ class TVCache():
|
||||||
|
|
||||||
# add it to the list
|
# add it to the list
|
||||||
if epObj not in neededEps:
|
if epObj not in neededEps:
|
||||||
neededEps[epObj] = [result]
|
neededEps[epObj.episode] = [result]
|
||||||
else:
|
else:
|
||||||
neededEps[epObj].append(result)
|
neededEps[epObj.episode].append(result)
|
||||||
|
|
||||||
return neededEps
|
return neededEps
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue