Commit 92235b02 authored by echel0n's avatar echel0n
Browse files

Merge branch 'release/9.1.39'

parents 9bced265 6384aabf
# Changelog
- * 8536c01 - 2017-10-16: Release v9.1.38
- * fc1af8b - 2017-10-17: Release v9.1.39
- * f50a313 - 2017-10-17: Fixed issue with gettext underscore being replaced when using underscore as throwaway variable
- * 1da0430 - 2017-10-17: Fixed issue #90 - iptorrents provider needs update
- * 8a3d08a - 2017-10-16: Release v9.1.38
- * 8b8eab5 - 2017-10-16: Fixed issue with JS gettext and using system default language selection
- * 372b24e - 2017-10-16: Fixed 'No Content' error and added more translated languages
- * 73cd8ca - 2017-10-16: Restart clears current user but does NOT clear cookies, prevents issues with restart page
......
......@@ -4,5 +4,5 @@ base_url: https://api.crowdin.com
base_path: .
files:
-
source: sickrage/locale/messages.pot
translation: sickrage/locale/%locale_with_underscore%/LC_MESSAGES/messages.po
source: /sickrage/locale/messages.pot
translation: /sickrage/locale/%locale_with_underscore%/LC_MESSAGES/messages.po
......@@ -929,6 +929,7 @@ def create_https_certificates(ssl_cert, ssl_key):
return True
def md5_for_file(filename):
"""
Generate an md5 hash for a file
......@@ -1242,7 +1243,7 @@ def get_size(start_path='.'):
total_size = 0
try:
for dirpath, _, filenames in os.walk(start_path):
for dirpath, __, filenames in os.walk(start_path):
for f in filenames:
fp = os.path.join(dirpath, f)
try:
......@@ -1324,7 +1325,7 @@ def verify_freespace(src, dest, oldfile=None):
import sys
def disk_usage(path):
_, total, free = ctypes.c_ulonglong(), ctypes.c_ulonglong(), ctypes.c_ulonglong()
__, total, free = ctypes.c_ulonglong(), ctypes.c_ulonglong(), ctypes.c_ulonglong()
if sys.version_info >= (3,) or isinstance(path, unicode):
fun = ctypes.windll.kernel32.GetDiskFreeSpaceExW
else:
......@@ -1451,18 +1452,20 @@ def getFreeSpace(directories):
size = None
if os.path.isdir(folder):
if os.name == 'nt':
_, total, free = ctypes.c_ulonglong(), ctypes.c_ulonglong(), \
ctypes.c_ulonglong()
__, total, free = ctypes.c_ulonglong(), ctypes.c_ulonglong(), ctypes.c_ulonglong()
if sys.version_info >= (3,) or isinstance(folder, unicode):
fun = ctypes.windll.kernel32.GetDiskFreeSpaceExW # @UndefinedVariable
fun = ctypes.windll.kernel32.GetDiskFreeSpaceExW
else:
fun = ctypes.windll.kernel32.GetDiskFreeSpaceExA # @UndefinedVariable
ret = fun(folder, ctypes.byref(_), ctypes.byref(total), ctypes.byref(free))
if ret == 0:
raise ctypes.WinError()
fun = ctypes.windll.kernel32.GetDiskFreeSpaceExA
ret = fun(folder, ctypes.byref(__), ctypes.byref(total), ctypes.byref(free))
if ret == 0: raise ctypes.WinError()
return [total.value, free.value]
else:
s = os.statvfs(folder)
size = [s.f_blocks * s.f_frsize / (1024 * 1024), (s.f_bavail * s.f_frsize) / (1024 * 1024)]
if single: return size
......@@ -1483,7 +1486,7 @@ def restoreVersionedFile(backup_file, version):
numTries = 0
new_file, _ = os.path.splitext(backup_file)
new_file, __ = os.path.splitext(backup_file)
restore_file = '{}.v{}'.format(new_file, version)
if not os.path.isfile(new_file):
......@@ -1838,4 +1841,4 @@ def clean_hosts(hosts, default_port=None):
else:
cleaned_hosts = ''
return cleaned_hosts
\ No newline at end of file
return cleaned_hosts
......@@ -232,7 +232,7 @@ def processDir(dirName, nzbName=None, process_method=None, force=False, is_prior
result.result = True
for processPath, _, fileList in os.walk(os.path.join(path, curDir), topdown=False):
for processPath, __, fileList in os.walk(os.path.join(path, curDir), topdown=False):
if not validateDir(path, processPath, nzbNameOriginal, failed, result):
continue
......@@ -355,7 +355,7 @@ def validateDir(path, dirName, nzbNameOriginal, failed, result):
# Get the videofile list for the next checks
allFiles = []
allDirs = []
for _, processdir, fileList in os.walk(os.path.join(path, dirName), topdown=False):
for __, processdir, fileList in os.walk(os.path.join(path, dirName), topdown=False):
allDirs += processdir
allFiles += fileList
......
......@@ -171,7 +171,7 @@ class PostProcessor(object):
def recursive_glob(treeroot, pattern):
results = []
for base, _, files in os.walk(treeroot):
for base, __, files in os.walk(treeroot):
goodfiles = fnmatch.filter(files, pattern)
results.extend(os.path.join(base, f) for f in goodfiles)
return results
......@@ -775,7 +775,7 @@ class PostProcessor(object):
# if there is a quality available in the status then we don't need to bother guessing from the filename
if ep_obj.status in Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.SNATCHED_BEST:
_, ep_quality = Quality.splitCompositeStatus(ep_obj.status)
__, ep_quality = Quality.splitCompositeStatus(ep_obj.status)
if ep_quality != Quality.UNKNOWN:
self._log(
"The old status had a quality in it, using that: " + Quality.qualityStrings[ep_quality],
......@@ -805,7 +805,7 @@ class PostProcessor(object):
# Try getting quality from the episode (snatched) status
if ep_obj.status in Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.SNATCHED_BEST:
_, ep_quality = Quality.splitCompositeStatus(ep_obj.status)
__, ep_quality = Quality.splitCompositeStatus(ep_obj.status)
if ep_quality != Quality.UNKNOWN:
self._log(
"The old status had a quality in it, using that: " + Quality.qualityStrings[ep_quality],
......@@ -845,7 +845,7 @@ class PostProcessor(object):
try:
p = subprocess.Popen(script_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, cwd=sickrage.PROG_DIR)
out, _ = p.communicate()
out, __ = p.communicate()
self._log("Script result: " + str(out), sickrage.srCore.srLogger.DEBUG)
except OSError as e:
......@@ -867,7 +867,7 @@ class PostProcessor(object):
if self.is_priority:
return True
_, old_ep_quality = Quality.splitCompositeStatus(ep_obj.status)
__, old_ep_quality = Quality.splitCompositeStatus(ep_obj.status)
# if SR downloaded this on purpose we likely have a priority download
if self.in_history or ep_obj.status in Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.SNATCHED_BEST:
......@@ -945,7 +945,7 @@ class PostProcessor(object):
# retrieve/create the corresponding TVEpisode objects
ep_obj = self._get_ep_obj(show, season, episodes)
_, old_ep_quality = Quality.splitCompositeStatus(ep_obj.status)
__, old_ep_quality = Quality.splitCompositeStatus(ep_obj.status)
# get the quality of the episode we're processing
if quality and not Quality.qualityStrings[quality] == 'Unknown':
......
......@@ -77,7 +77,7 @@ class srQueue(threading.Thread):
return self._queue.queue
def get(self, *args, **kwargs):
_, _, item = self._queue.get(*args, **kwargs)
__, __, item = self._queue.get(*args, **kwargs)
return item
def put(self, item, *args, **kwargs):
......
......@@ -53,14 +53,14 @@ class srPostProcessorQueue(srQueue):
:param proc_type: processing type, auto/manual
:return: instance of PostProcessorItem or None
"""
for _, _, cur_item in self.queue + [(None, None, self.currentItem)]:
for __, __, cur_item in self.queue + [(None, None, self.currentItem)]:
if isinstance(cur_item, PostProcessorItem) and cur_item.directory == dirName and cur_item.mode == proc_type:
return cur_item
return None
@property
def is_in_progress(self):
for _, _, cur_item in self.queue + [(None, None, self.currentItem)]:
for __, __, cur_item in self.queue + [(None, None, self.currentItem)]:
if isinstance(cur_item, PostProcessorItem):
return True
return False
......@@ -93,7 +93,7 @@ class srPostProcessorQueue(srQueue):
"""
length = {'auto': 0, 'manual': 0}
for _, _, cur_item in self.queue + [(None, None, self.currentItem)]:
for __, __, cur_item in self.queue + [(None, None, self.currentItem)]:
if isinstance(cur_item, PostProcessorItem):
if cur_item.proc_type == 'auto':
length['auto'] += 1
......
......@@ -51,26 +51,26 @@ class srSearchQueue(srQueue):
srQueue.__init__(self, "SEARCHQUEUE")
def is_in_queue(self, show, segment):
for _, _, cur_item in self.queue:
for __, __, cur_item in self.queue:
if isinstance(cur_item, BacklogQueueItem) and cur_item.show == show and cur_item.segment == segment:
return True
return False
def is_ep_in_queue(self, segment):
for _, _, cur_item in self.queue:
for __, __, cur_item in self.queue:
if isinstance(cur_item, (ManualSearchQueueItem, FailedQueueItem)) and cur_item.segment == segment:
return True
return False
def is_show_in_queue(self, show):
for _, _, cur_item in self.queue:
for __, __, cur_item in self.queue:
if isinstance(cur_item, (ManualSearchQueueItem, FailedQueueItem)) and cur_item.show.indexerid == show:
return True
return False
def get_all_ep_from_queue(self, show):
ep_obj_list = []
for _, _, cur_item in self.queue:
for __, __, cur_item in self.queue:
if isinstance(cur_item, (ManualSearchQueueItem, FailedQueueItem)) and str(cur_item.show.indexerid) == show:
ep_obj_list.append(cur_item)
return ep_obj_list
......@@ -95,14 +95,14 @@ class srSearchQueue(srQueue):
return False
def is_backlog_in_progress(self):
for _, _, cur_item in self.queue + [(None, None, self.currentItem)]:
for __, __, cur_item in self.queue + [(None, None, self.currentItem)]:
if isinstance(cur_item, BacklogQueueItem):
return True
return False
def is_dailysearch_in_progress(self):
for _, _, cur_item in self.queue + [(None, None, self.currentItem)]:
for __, __, cur_item in self.queue + [(None, None, self.currentItem)]:
if isinstance(cur_item, DailySearchQueueItem):
return True
......@@ -110,7 +110,7 @@ class srSearchQueue(srQueue):
def queue_length(self):
length = {'backlog': 0, 'daily': 0, 'manual': 0, 'failed': 0}
for _, _, cur_item in self.queue + [(None, None, self.currentItem)]:
for __, __, cur_item in self.queue + [(None, None, self.currentItem)]:
if isinstance(cur_item, DailySearchQueueItem):
length['daily'] += 1
elif isinstance(cur_item, BacklogQueueItem):
......
......@@ -51,7 +51,7 @@ class srShowQueue(srQueue):
if not show:
return False
return show.indexerid in [x.show.indexerid if x.show else 0 for _, _, x in self.queue if x.action_id in actions]
return show.indexerid in [x.show.indexerid if x.show else 0 for __, __, x in self.queue if x.action_id in actions]
def _isBeing(self, show, actions):
return self.currentItem is not None and show == self.currentItem.show and self.currentItem.action_id in actions
......@@ -84,7 +84,7 @@ class srShowQueue(srQueue):
return self._isBeing(show, (ShowQueueActions.SUBTITLE,))
def _getLoadingShowList(self):
return [x for _, _, x in self.queue + [(None, None, self.currentItem)] if x and x.isLoading]
return [x for __, __, x in self.queue + [(None, None, self.currentItem)] if x and x.isLoading]
def updateShow(self, show, force=False):
......@@ -153,7 +153,7 @@ class srShowQueue(srQueue):
raise CantRemoveShowException("{} is already queued to be removed".format(show))
# remove other queued actions for this show.
for _, _, x in self.queue:
for __, __, x in self.queue:
if x and x.show and x != self.currentItem and show.indexerid == x.show.indexerid:
self.queue.remove(x)
......
......@@ -95,7 +95,7 @@ def retrieve_exceptions(get_xem=True, get_anidb=True):
# each exception is on one line with the format indexer_id: 'show name 1', 'show name 2', etc
cur_line = None
for cur_line in sickrage.srCore.srWebSession.get(loc).text.splitlines():
indexer_id, _, aliases = cur_line.partition(':')
indexer_id, __, aliases = cur_line.partition(':')
if not aliases:
continue
......
......@@ -128,7 +128,7 @@ class srTraktSearcher(object):
sickrage.srCore.srLogger.debug("No shows found in your library, aborting library update")
return
traktShow = [x for _, x in library.items() if
traktShow = [x for __, x in library.items() if
int(indexerid) == int(x.ids[srIndexerApi(indexer).trakt_id])]
except Exception as e:
sickrage.srCore.srLogger.warning(
......
......@@ -1057,7 +1057,7 @@ class TVEpisode(object):
return ''
return parse_result.release_group
_, epQual = Quality.splitCompositeStatus(self.status)
__, epQual = Quality.splitCompositeStatus(self.status)
if sickrage.srCore.srConfig.NAMING_STRIP_YEAR:
show_name = re.sub(r"\(\d+\)$", "", self.show.name).rstrip()
......
......@@ -1241,7 +1241,7 @@ class TVShow(object):
if curEp.location and curEp.status in Quality.DOWNLOADED:
if sickrage.srCore.srConfig.EP_DEFAULT_DELETED_STATUS == ARCHIVED:
_, oldQuality = Quality.splitCompositeStatus(curEp.status)
__, oldQuality = Quality.splitCompositeStatus(curEp.status)
new_status = Quality.compositeStatus(ARCHIVED, oldQuality)
else:
new_status = sickrage.srCore.srConfig.EP_DEFAULT_DELETED_STATUS
......@@ -1467,7 +1467,7 @@ class TVShow(object):
return Overview.GOOD
elif epStatus in Quality.DOWNLOADED + Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.FAILED + Quality.SNATCHED_BEST:
_, bestQualities = Quality.splitQuality(self.quality)
__, bestQualities = Quality.splitQuality(self.quality)
if bestQualities:
maxBestQuality = max(bestQualities)
minBestQuality = min(bestQualities)
......
......@@ -197,7 +197,7 @@ class UpdateManager(object):
main_git = sickrage.srCore.srConfig.GIT_PATH or 'git'
sickrage.srCore.srLogger.debug("Checking if we can use git commands: " + main_git + ' ' + test_cmd)
_, _, exit_status = self._git_cmd(main_git, test_cmd)
__, __, exit_status = self._git_cmd(main_git, test_cmd)
if exit_status == 0:
sickrage.srCore.srLogger.debug("Using: " + main_git)
......@@ -221,7 +221,7 @@ class UpdateManager(object):
for cur_git in alternative_git:
sickrage.srCore.srLogger.debug("Checking if we can use git commands: " + cur_git + ' ' + test_cmd)
_, _, exit_status = self._git_cmd(cur_git, test_cmd)
__, __, exit_status = self._git_cmd(cur_git, test_cmd)
if exit_status == 0:
sickrage.srCore.srLogger.debug("Using: " + cur_git)
......@@ -244,7 +244,7 @@ class UpdateManager(object):
main_pip = sickrage.srCore.srConfig.PIP_PATH or 'pip'
sickrage.srCore.srLogger.debug("Checking if we can use pip commands: " + main_pip + ' ' + test_cmd)
_, _, exit_status = self._pip_cmd(main_pip, test_cmd)
__, __, exit_status = self._pip_cmd(main_pip, test_cmd)
if exit_status == 0:
sickrage.srCore.srLogger.debug("Using: " + main_pip)
......@@ -268,7 +268,7 @@ class UpdateManager(object):
for cur_pip in alternative_pip:
sickrage.srCore.srLogger.debug("Checking if we can use pip commands: " + cur_pip + ' ' + test_cmd)
_, _, exit_status = self._pip_cmd(cur_pip, test_cmd)
__, __, exit_status = self._pip_cmd(cur_pip, test_cmd)
if exit_status == 0:
sickrage.srCore.srLogger.debug("Using: " + cur_pip)
......@@ -379,7 +379,7 @@ class UpdateManager(object):
return github.Github(user_agent="SiCKRAGE")
def install_requirements(self):
_, _, exit_status = self._pip_cmd(self._pip_path,
__, __, exit_status = self._pip_cmd(self._pip_path,
'install --no-cache-dir --user -r {}'.format(sickrage.REQS_FILE))
if not exit_status == 0:
sickrage.srCore.srLogger.warning(
......@@ -415,7 +415,7 @@ class GitUpdateManager(UpdateManager):
Returns: True for success or False for failure
"""
output, _, exit_status = self._git_cmd(self._git_path, 'rev-parse HEAD')
output, __, exit_status = self._git_cmd(self._git_path, 'rev-parse HEAD')
if exit_status == 0 and output:
cur_commit_hash = output.strip()
if not re.match('^[a-z0-9]+$', cur_commit_hash):
......@@ -430,13 +430,13 @@ class GitUpdateManager(UpdateManager):
"""
# get all new info from server
output, _, exit_status = self._git_cmd(self._git_path, 'remote update')
output, __, exit_status = self._git_cmd(self._git_path, 'remote update')
if not exit_status == 0:
sickrage.srCore.srLogger.warning("Unable to contact server, can't check for update")
return
# get latest commit_hash from remote
output, _, exit_status = self._git_cmd(self._git_path, 'rev-parse --verify --quiet "@{upstream}"')
output, __, exit_status = self._git_cmd(self._git_path, 'rev-parse --verify --quiet "@{upstream}"')
if exit_status == 0 and output:
return output.strip()
......@@ -470,7 +470,7 @@ class GitUpdateManager(UpdateManager):
# self.clean() # This is removing user data and backups
self.reset()
_, _, exit_status = self._git_cmd(self._git_path, 'pull -f {} {}'.format(sickrage.srCore.srConfig.GIT_REMOTE,
__, __, exit_status = self._git_cmd(self._git_path, 'pull -f {} {}'.format(sickrage.srCore.srConfig.GIT_REMOTE,
self.current_branch))
if exit_status == 0:
sickrage.srCore.srLogger.info("Updating SiCKRAGE from GIT servers")
......@@ -485,7 +485,7 @@ class GitUpdateManager(UpdateManager):
Calls git clean to remove all untracked files. Returns a bool depending
on the call's success.
"""
_, _, exit_status = self._git_cmd(self._git_path, 'clean -df ""')
__, __, exit_status = self._git_cmd(self._git_path, 'clean -df ""')
return (False, True)[exit_status == 0]
def reset(self):
......@@ -493,7 +493,7 @@ class GitUpdateManager(UpdateManager):
Calls git reset --hard to perform a hard reset. Returns a bool depending
on the call's success.
"""
_, _, exit_status = self._git_cmd(self._git_path, 'reset --hard')
__, __, exit_status = self._git_cmd(self._git_path, 'reset --hard')
return (False, True)[exit_status == 0]
def fetch(self):
......@@ -501,10 +501,10 @@ class GitUpdateManager(UpdateManager):
Calls git fetch to fetch all remote branches
on the call's success.
"""
_, _, exit_status = self._git_cmd(self._git_path,
__, __, exit_status = self._git_cmd(self._git_path,
'config remote.origin.fetch %s' % '+refs/heads/*:refs/remotes/origin/*')
if exit_status == 0:
_, _, exit_status = self._git_cmd(self._git_path, 'fetch --all')
__, __, exit_status = self._git_cmd(self._git_path, 'fetch --all')
return (False, True)[exit_status == 0]
def checkout_branch(self, branch):
......@@ -518,7 +518,7 @@ class GitUpdateManager(UpdateManager):
# fetch all branches
self.fetch()
_, _, exit_status = self._git_cmd(self._git_path, 'checkout -f ' + branch)
__, __, exit_status = self._git_cmd(self._git_path, 'checkout -f ' + branch)
if exit_status == 0:
self.install_requirements()
return True
......@@ -526,7 +526,7 @@ class GitUpdateManager(UpdateManager):
return False
def get_remote_url(self):
url, _, exit_status = self._git_cmd(self._git_path,
url, __, exit_status = self._git_cmd(self._git_path,
'remote get-url {}'.format(sickrage.srCore.srConfig.GIT_REMOTE))
return ("", url)[exit_status == 0 and url is not None]
......@@ -537,12 +537,12 @@ class GitUpdateManager(UpdateManager):
@property
def current_branch(self):
branch, _, exit_status = self._git_cmd(self._git_path, 'rev-parse --abbrev-ref HEAD')
branch, __, exit_status = self._git_cmd(self._git_path, 'rev-parse --abbrev-ref HEAD')
return ("", branch)[exit_status == 0 and branch is not None]
@property
def remote_branches(self):
branches, _, exit_status = self._git_cmd(self._git_path,
branches, __, exit_status = self._git_cmd(self._git_path,
'ls-remote --heads {}'.format(sickrage.srCore.srConfig.GIT_REMOTE))
if exit_status == 0 and branches:
return re.findall(r'refs/heads/(.*)', branches)
......@@ -651,7 +651,7 @@ class SourceUpdateManager(UpdateManager):
# walk temp folder and move files to main folder
sickrage.srCore.srLogger.info("Moving files from " + content_dir + " to " + sickrage.PROG_DIR)
for dirname, _, filenames in os.walk(content_dir):
for dirname, __, filenames in os.walk(content_dir):
dirname = dirname[len(content_dir) + 1:]
for curfile in filenames:
old_path = os.path.join(content_dir, dirname, curfile)
......@@ -706,7 +706,7 @@ class PipUpdateManager(UpdateManager):
sickrage.srCore.NEWEST_VERSION_STRING = error_message
def _find_installed_version(self):
out, _, exit_status = self._pip_cmd(self._pip_path, 'show sickrage')
out, __, exit_status = self._pip_cmd(self._pip_path, 'show sickrage')
if exit_status == 0:
return out.split('\n')[1].split()[1]
return ""
......@@ -753,7 +753,7 @@ class PipUpdateManager(UpdateManager):
"""
Performs pip upgrade
"""
_, _, exit_status = self._pip_cmd(self._pip_path, 'install -U --no-cache-dir sickrage')
__, __, exit_status = self._pip_cmd(self._pip_path, 'install -U --no-cache-dir sickrage')
if exit_status == 0:
sickrage.srCore.srLogger.info("Updating SiCKRAGE from PyPi servers")
srNotifiers.notify_version_update(self.get_newest_version)
......
......@@ -60,7 +60,7 @@ class srWebServer(threading.Thread):
def run(self):
self.started = True
# load languages for tornado web server
# load languages
tornado.locale.load_gettext_translations(sickrage.LOCALE_DIR, 'messages')
# clear mako cache folder
......
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