mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 08:53:37 +00:00
commit
6eccffc7be
7 changed files with 37 additions and 21 deletions
|
@ -102,6 +102,7 @@ AUTO_UPDATE = False
|
|||
NOTIFY_ON_UPDATE = False
|
||||
CUR_COMMIT_HASH = None
|
||||
BRANCH = ''
|
||||
CUR_COMMIT_BRANCH = ''
|
||||
|
||||
INIT_LOCK = Lock()
|
||||
started = False
|
||||
|
@ -444,7 +445,7 @@ __INITIALIZED__ = False
|
|||
def initialize(consoleLogging=True):
|
||||
with INIT_LOCK:
|
||||
|
||||
global BRANCH, CUR_COMMIT_HASH, ACTUAL_LOG_DIR, LOG_DIR, WEB_PORT, WEB_LOG, ENCRYPTION_VERSION, WEB_ROOT, WEB_USERNAME, WEB_PASSWORD, WEB_HOST, WEB_IPV6, USE_API, API_KEY, ENABLE_HTTPS, HTTPS_CERT, HTTPS_KEY, \
|
||||
global BRANCH, CUR_COMMIT_HASH, CUR_COMMIT_BRANCH, ACTUAL_LOG_DIR, LOG_DIR, WEB_PORT, WEB_LOG, ENCRYPTION_VERSION, WEB_ROOT, WEB_USERNAME, WEB_PASSWORD, WEB_HOST, WEB_IPV6, USE_API, API_KEY, ENABLE_HTTPS, HTTPS_CERT, HTTPS_KEY, \
|
||||
HANDLE_REVERSE_PROXY, USE_NZBS, USE_TORRENTS, NZB_METHOD, NZB_DIR, DOWNLOAD_PROPERS, CHECK_PROPERS_INTERVAL, ALLOW_HIGH_PRIORITY, TORRENT_METHOD, \
|
||||
SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, SAB_HOST, \
|
||||
NZBGET_USERNAME, NZBGET_PASSWORD, NZBGET_CATEGORY, NZBGET_PRIORITY, NZBGET_HOST, NZBGET_USE_HTTPS, backlogSearchScheduler, \
|
||||
|
@ -511,13 +512,17 @@ def initialize(consoleLogging=True):
|
|||
CheckSection(CFG, 'Pushbullet')
|
||||
CheckSection(CFG, 'Subtitles')
|
||||
|
||||
# branch
|
||||
# wanted branch
|
||||
BRANCH = check_setting_str(CFG, 'General', 'branch', '')
|
||||
|
||||
# current commit hash
|
||||
CUR_COMMIT_HASH = check_setting_str(CFG, 'General', 'cur_commit_hash', '')
|
||||
|
||||
# current commit branch
|
||||
CUR_COMMIT_BRANCH = check_setting_str(CFG, 'General', 'cur_commit_branch', '')
|
||||
|
||||
ACTUAL_CACHE_DIR = check_setting_str(CFG, 'General', 'cache_dir', 'cache')
|
||||
|
||||
# fix bad configs due to buggy code
|
||||
if ACTUAL_CACHE_DIR == 'None':
|
||||
ACTUAL_CACHE_DIR = 'cache'
|
||||
|
@ -615,7 +620,7 @@ def initialize(consoleLogging=True):
|
|||
NAMING_SPORTS_PATTERN = check_setting_str(CFG, 'General', 'naming_sports_pattern', '%SN - %A-D - %EN')
|
||||
NAMING_ANIME = check_setting_int(CFG, 'General', 'naming_anime', 3)
|
||||
NAMING_CUSTOM_SPORTS = bool(check_setting_int(CFG, 'General', 'naming_custom_sports', 0))
|
||||
NAMING_MULTI_EP = bool(check_setting_int(CFG, 'General', 'naming_multi_ep', 1))
|
||||
NAMING_MULTI_EP = check_setting_int(CFG, 'General', 'naming_multi_ep', 1)
|
||||
NAMING_FORCE_FOLDERS = naming.check_force_season_folders()
|
||||
NAMING_STRIP_YEAR = bool(check_setting_int(CFG, 'General', 'naming_strip_year', 0))
|
||||
|
||||
|
@ -1310,6 +1315,7 @@ def save_config():
|
|||
new_config['General'] = {}
|
||||
new_config['General']['branch'] = BRANCH
|
||||
new_config['General']['cur_commit_hash'] = CUR_COMMIT_HASH
|
||||
new_config['General']['cur_commit_branch'] = CUR_COMMIT_BRANCH
|
||||
new_config['General']['config_version'] = CONFIG_VERSION
|
||||
new_config['General']['encryption_version'] = int(ENCRYPTION_VERSION)
|
||||
new_config['General']['log_dir'] = ACTUAL_LOG_DIR if ACTUAL_LOG_DIR else 'Logs'
|
||||
|
|
|
@ -102,7 +102,9 @@ class SearchResult:
|
|||
# release group
|
||||
self.release_group = ""
|
||||
|
||||
|
||||
# version
|
||||
self.version = -1
|
||||
|
||||
def __str__(self):
|
||||
|
||||
if self.provider == None:
|
||||
|
@ -218,7 +220,9 @@ class Proper:
|
|||
self.date = date
|
||||
self.provider = None
|
||||
self.quality = Quality.UNKNOWN
|
||||
|
||||
self.release_group = None
|
||||
self.version = -1
|
||||
|
||||
self.show = show
|
||||
self.indexer = None
|
||||
self.indexerid = -1
|
||||
|
|
|
@ -256,11 +256,17 @@ def update_scene_exceptions(indexer_id, scene_exceptions, season=-1):
|
|||
"""
|
||||
Given a indexer_id, and a list of all show scene exceptions, update the db.
|
||||
"""
|
||||
|
||||
global exceptionsCache
|
||||
myDB = db.DBConnection('cache.db')
|
||||
myDB.action('DELETE FROM scene_exceptions WHERE indexer_id=?', [indexer_id])
|
||||
|
||||
logger.log(u"Updating scene exceptions", logger.MESSAGE)
|
||||
|
||||
# A change has been made to the scene exception list. Let's clear the cache, to make this visible
|
||||
if indexer_id in exceptionsCache:
|
||||
exceptionsCache[indexer_id] = {}
|
||||
exceptionsCache[indexer_id][season] = scene_exceptions
|
||||
|
||||
for cur_exception in scene_exceptions:
|
||||
|
||||
if not isinstance(cur_exception, unicode):
|
||||
|
@ -316,7 +322,7 @@ def _xem_exceptions_fetcher():
|
|||
|
||||
|
||||
def getSceneSeasons(indexer_id):
|
||||
"""get a list of season numbers that have scene excpetions
|
||||
"""get a list of season numbers that have scene exceptions
|
||||
"""
|
||||
myDB = db.DBConnection('cache.db')
|
||||
seasons = myDB.select("SELECT DISTINCT season FROM scene_exceptions WHERE indexer_id = ?", [indexer_id])
|
||||
|
|
|
@ -586,9 +586,8 @@ def searchProviders(show, season, episodes, manualSearch=False):
|
|||
u"Single-ep check result is neededEps: " + str(neededEps) + ", notNeededEps: " + str(notNeededEps),
|
||||
logger.DEBUG)
|
||||
|
||||
if not neededEps:
|
||||
logger.log(u"All of these episodes were covered by single nzbs, ignoring this multi-ep result",
|
||||
logger.DEBUG)
|
||||
if not notNeededEps:
|
||||
logger.log(u"All of these episodes were covered by single episode results, ignoring this multi-episode result", logger.DEBUG)
|
||||
continue
|
||||
|
||||
# check if these eps are already covered by another multi-result
|
||||
|
|
|
@ -259,10 +259,10 @@ def allPossibleShowNames(show, season=-1):
|
|||
Returns: a list of all the possible show names
|
||||
"""
|
||||
|
||||
showNames = get_scene_exceptions(show.indexerid, season=season)
|
||||
showNames = get_scene_exceptions(show.indexerid, season=season)[:]
|
||||
if not showNames: # if we dont have any season specific exceptions fallback to generic exceptions
|
||||
season = -1
|
||||
showNames = get_scene_exceptions(show.indexerid, season=season)
|
||||
showNames = get_scene_exceptions(show.indexerid, season=season)[:]
|
||||
|
||||
if season in [-1, 1]:
|
||||
showNames.append(show.name)
|
||||
|
|
|
@ -571,23 +571,23 @@ class SourceUpdateManager(UpdateManager):
|
|||
self._num_commits_behind = 0
|
||||
|
||||
def _find_installed_branch(self):
|
||||
if sickbeard.BRANCH == "":
|
||||
if sickbeard.CUR_COMMIT_BRANCH == "":
|
||||
return "master"
|
||||
|
||||
return ""
|
||||
else:
|
||||
return sickbeard.CUR_COMMIT_BRANCH
|
||||
|
||||
def need_update(self):
|
||||
|
||||
if self.branch != self._find_installed_branch():
|
||||
logger.log(u"Branch checkout: " + self._find_installed_branch() + "->" + self.branch, logger.DEBUG)
|
||||
return True
|
||||
|
||||
# need this to run first to set self._newest_commit_hash
|
||||
try:
|
||||
self._check_github_for_update()
|
||||
except Exception, e:
|
||||
logger.log(u"Unable to contact github, can't check for update: " + repr(e), logger.ERROR)
|
||||
return False
|
||||
|
||||
if self.branch != self._find_installed_branch():
|
||||
logger.log(u"Branch checkout: " + self._find_installed_branch() + "->" + self.branch, logger.DEBUG)
|
||||
return True
|
||||
|
||||
if not self._cur_commit_hash or self._num_commits_behind > 0:
|
||||
return True
|
||||
|
||||
|
@ -738,6 +738,7 @@ class SourceUpdateManager(UpdateManager):
|
|||
os.renames(old_path, new_path)
|
||||
|
||||
sickbeard.CUR_COMMIT_HASH = self._newest_commit_hash
|
||||
sickbeard.CUR_COMMIT_BRANCH = self.branch
|
||||
|
||||
except Exception, e:
|
||||
logger.log(u"Error while trying to update: " + ex(e), logger.ERROR)
|
||||
|
|
|
@ -556,7 +556,7 @@ def _getEpisode(show, season=None, episode=None, absolute=None):
|
|||
return "Invalid show paramaters"
|
||||
|
||||
if absolute:
|
||||
epObj = showObj.getEpisode(absolute=int(absolute))
|
||||
epObj = showObj.getEpisode(absolute_number=int(absolute))
|
||||
elif season and episode:
|
||||
epObj = showObj.getEpisode(int(season), int(episode))
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue