Commit 8384e29e authored by echel0n's avatar echel0n

FIX: Fixed a bug that was causing anime settings page to detour to subtitles instead

FIX: Corrected a bug that was causing history to not view.
FIX: UnicodeEncode error when attempting to add existing shows fixed, corrects others as well that experianced the same unicodeencode issue.
ADD: Added improved error handling for mako template engine.
FIX: Mako templates now confined to use unicode_literals.
FIX: Fixed a issue preventing episodestatus from being able to be set properly due to improper variable context handling
FIX: Fixed missing buttons in episode status manager.
FIX: Fixed bugs in backlog overviewer.
FIX: Fixed bugs with subtitle manager.
FIX: Fixed config post-processing issues.
FIX: Fixed config subtitle issues.
FIX: Censoring of log files and console corrected.
FIX: Corrected variable check bug in schedule viewer.
FIX: Corrected method not allowed bug affecting people that were using a username/password within the app.
FIX: Logging filter now properly masks sensitive data.
FIX: Removed *MIIGOTU* bug and resolved remaining issues ;)
parent 22b003d0
......@@ -29,7 +29,5 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-bower-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['bower_concat', 'uglify']);
};
......@@ -12,7 +12,7 @@
"url": "git+https://github.com/SiCKRAGETV/SiCKRAGE.git"
},
"bugs": {
"url": "https://github.com/SiCKRAGETV/SiCKRAGE/issues"
"url": "https://www.sickrage.tv/forums/"
},
"homepage": "https://github.com/SiCKRAGETV/SiCKRAGE#readme"
}
# SR Travis-CI Files #
######################
/.travis.yml
# SR Markdown Files #
######################
/contributing.md
/readme.md
# SR User Related #
######################
/cache/
......
......@@ -67,7 +67,6 @@ class SickRage(object):
self.PIDFILE = ''
# webserver constants
self.webserver = None
self.forcedPort = None
self.noLaunch = False
......@@ -281,7 +280,7 @@ class SickRage(object):
self.webhost = '0.0.0.0'
# start tornado web server
self.webserver = SRWebServer({
sickbeard.WEB_SERVER = SRWebServer({
'port': int(self.startPort),
'host': self.webhost,
'data_root': ek(os.path.join, sickbeard.PROG_DIR, 'gui', sickbeard.GUI_NAME),
......@@ -448,12 +447,12 @@ class SickRage(object):
sickbeard.saveAll()
# shutdown web server
if self.webserver:
if sickbeard.WEB_SERVER:
logging.info("Shutting down Tornado")
self.webserver.shutDown()
sickbeard.WEB_SERVER.shutDown()
try:
self.webserver.join(10)
sickbeard.WEB_SERVER.join(10)
except Exception:
pass
......
......@@ -126,9 +126,9 @@
</div>
<div class="panel-collapse collapse" id="command-${command_id}">
<div class="panel-body">
<blockquote>${help['message']}</blockquote>
<blockquote>${help[b'message']}</blockquote>
% if help['data']['optionalParameters'] or help['data']['requiredParameters']:
% if help[b'data'][b'optionalParameters'] or help[b'data'][b'requiredParameters']:
<h4>Parameters</h4>
<table class="tablesorter">
......@@ -142,8 +142,8 @@
<th>Allowed values</th>
</tr>
</thead>
${display_parameters_doc(help['data']['requiredParameters'], True)}
${display_parameters_doc(help['data']['optionalParameters'], False)}
${display_parameters_doc(help[b'data'][b'requiredParameters'], True)}
${display_parameters_doc(help[b'data'][b'optionalParameters'], False)}
</table>
% endif
......@@ -151,12 +151,12 @@
URL: <kbd id="command-${command_id}-base-url">/api/${apikey}/?cmd=${command}</kbd><br>
% if help['data']['requiredParameters']:
Required parameters: ${display_parameters_playground(help['data']['requiredParameters'], True, command_id)}<br>
% if help[b'data'][b'requiredParameters']:
Required parameters: ${display_parameters_playground(help[b'data'][b'requiredParameters'], True, command_id)}<br>
% endif
% if help['data']['optionalParameters']:
Optional parameters: ${display_parameters_playground(help['data']['optionalParameters'], False, command_id)}<br>
% if help[b'data'][b'optionalParameters']:
Optional parameters: ${display_parameters_playground(help[b'data'][b'optionalParameters'], False, command_id)}<br>
% endif
<button class="btn btn-primary" data-action="api-call" data-command-name="${command_id}" data-base-url="command-${command_id}-base-url" data-target="#command-${command_id}-response" data-time="#command-${command_id}-time" data-url="#command-${command_id}-url">Call API</button><br>
......@@ -211,10 +211,10 @@ var episodes = ${episodes};
<span class="glyphicon glyphicon-remove text-muted" title="No"></span>
% endif
</td>
<td>${parameter_help['desc'] if 'desc' in parameter_help else ''}</td>
<td>${parameter_help['type'] if 'type' in parameter_help else ''}</td>
<td>${parameter_help['defaultValue'] if 'defaultValue' in parameter_help else ''}</td>
<td>${parameter_help['allowedValues'] if 'allowedValues' in parameter_help else ''}</td>
<td>${parameter_help[b'desc'] if 'desc' in parameter_help else ''}</td>
<td>${parameter_help[b'type'] if 'type' in parameter_help else ''}</td>
<td>${parameter_help[b'defaultValue'] if 'defaultValue' in parameter_help else ''}</td>
<td>${parameter_help[b'allowedValues'] if 'allowedValues' in parameter_help else ''}</td>
</tr>
% endfor
</tbody>
......@@ -225,8 +225,8 @@ var episodes = ${episodes};
% for parameter in parameters:
<%
parameter_help = parameters[parameter]
allowed_values = parameter_help['allowedValues'] if 'allowedValues' in parameter_help else ''
type = parameter_help['type'] if 'type' in parameter_help else ''
allowed_values = parameter_help[b'allowedValues'] if 'allowedValues' in parameter_help else ''
type = parameter_help[b'type'] if 'type' in parameter_help else ''
%>
% if isinstance(allowed_values, list):
......
......@@ -56,7 +56,7 @@
<label for="indexerDefaultLang">
<span class="component-title">Default Indexer Language</span>
<span class="component-desc">
<select name="indexerDefaultLang" id="indexerDefaultLang" class="form-control form-control-inline input-sm bfh-languages" data-language=${sickbeard.INDEXER_DEFAULT_LANGUAGE} data-available="${','.join(sickbeard.indexerApi().config['valid_languages'])}"></select>
<select name="indexerDefaultLang" id="indexerDefaultLang" class="form-control form-control-inline input-sm bfh-languages" data-language=${sickbeard.INDEXER_DEFAULT_LANGUAGE} data-available="${','.join(sickbeard.indexerApi().config[b'valid_languages'])}"></select>
<span>for adding shows and metadata providers</span>
</span>
</label>
......
<%inherit file="/layouts/main.mako"/>
<%!
import sickbeard
import re
import sickbeard
from sickbeard.helpers import anon_url
from sickbeard.common import SKIPPED, WANTED, UNAIRED, ARCHIVED, IGNORED, SNATCHED, SNATCHED_PROPER, SNATCHED_BEST, FAILED
from sickbeard.common import Quality, qualityPresets, statusStrings, qualityPresetStrings, cpu_presets, multiEpStrings
......
......@@ -257,7 +257,7 @@
% if cur_preset == sickbeard.NAMING_PATTERN:
<% is_custom = False %>
% endif
<option id="${cur_preset}" ${('', 'selected="selected"')[sickbeard.NAMING_PATTERN == cur_preset]}>${os.path.join(tmp['dir'], tmp['name'])}</option>
<option id="${cur_preset}" ${('', 'selected="selected"')[sickbeard.NAMING_PATTERN == cur_preset]}>${os.path.join(tmp[b'dir'], tmp[b'name'])}</option>
% endfor
<option id="${sickbeard.NAMING_PATTERN}" ${('', 'selected="selected"')[bool(is_custom)]}>Custom...</option>
</select>
......@@ -479,7 +479,7 @@
% if cur_preset == sickbeard.NAMING_ABD_PATTERN:
<% is_abd_custom = False %>
% endif
<option id="${cur_preset}" ${('', 'selected="selected"')[sickbeard.NAMING_ABD_PATTERN == cur_preset]}>${os.path.join(tmp['dir'], tmp['name'])}</option>
<option id="${cur_preset}" ${('', 'selected="selected"')[sickbeard.NAMING_ABD_PATTERN == cur_preset]}>${os.path.join(tmp[b'dir'], tmp[b'name'])}</option>
% endfor
<option id="${sickbeard.NAMING_ABD_PATTERN}" ${('', 'selected="selected"')[bool(is_abd_custom)]}>Custom...</option>
</select>
......@@ -656,7 +656,7 @@
% if cur_preset == sickbeard.NAMING_SPORTS_PATTERN:
<% is_sports_custom = False %>
% endif
<option id="${cur_preset}" ${('', 'selected="selected"')[NAMING_SPORTS_PATTERN == cur_preset]}>${os.path.join(tmp['dir'], tmp['name'])}</option>
<option id="${cur_preset}" ${('', 'selected="selected"')[sickbeard.NAMING_SPORTS_PATTERN == cur_preset]}>${os.path.join(tmp[b'dir'], tmp[b'name'])}</option>
% endfor
<option id="${sickbeard.NAMING_SPORTS_PATTERN}" ${('', 'selected="selected"')[bool(is_sports_custom)]}>Custom...</option>
</select>
......@@ -834,7 +834,7 @@
% if cur_preset == sickbeard.NAMING_ANIME_PATTERN:
<% is_anime_custom = False %>
% endif
<option id="${cur_preset}" ${('', 'selected="selected"')[cur_preset == sickbeard.NAMING_ANIME_PATTERN]}>${os.path.join(tmp['dir'], tmp['name'])}</option>
<option id="${cur_preset}" ${('', 'selected="selected"')[cur_preset == sickbeard.NAMING_ANIME_PATTERN]}>${os.path.join(tmp[b'dir'], tmp[b'name'])}</option>
% endfor
<option id="${sickbeard.NAMING_ANIME_PATTERN}" ${('', 'selected="selected"')[bool(is_anime_custom)]}>Custom...</option>
</select>
......
......@@ -123,7 +123,7 @@ $('#subtitles_dir').fileBrowser({ title: 'Select Subtitles Download Directory' }
<div class="field-pair">
<label class="nocheck">
<span class="component-title">Extra Scripts</span>
<input type="text" name="subtitles_extra_scripts" value="<%'|'.join(sickbeard.SUBTITLES_EXTRA_SCRIPTS)%>" class="form-control input-sm input350" autocapitalize="off" />
<input type="text" name="subtitles_extra_scripts" value="%'|'.join(sickbeard.SUBTITLES_EXTRA_SCRIPTS)%>" class="form-control input-sm input350" autocapitalize="off" />
</label>
<label class="nocheck">
<span class="component-title">&nbsp;</span>
......@@ -163,17 +163,17 @@ $('#subtitles_dir').fileBrowser({ title: 'Select Subtitles Download Directory' }
<fieldset class="component-group-list" style="margin-left: 50px; margin-top:36px">
<ul id="service_order_list">
% for curService in sickbeard.subtitles.sortedServiceList():
<li class="ui-state-default" id="${curService['name']}">
<input type="checkbox" id="enable_${curService['name']}" class="service_enabler" ${('', 'checked="checked"')[curService['enabled'] == True]}/>
<a href="${anon_url(curService['url'])}" class="imgLink" target="_new">
<img src="${srRoot}/images/subtitles/${curService['image']}" alt="${curService['url']}" title="${curService['url']}" width="16" height="16" style="vertical-align:middle;"/>
<li class="ui-state-default" id="${curService[b'name']}">
<input type="checkbox" id="enable_${curService[b'name']}" class="service_enabler" ${('', 'checked="checked"')[curService[b'enabled'] == True]}/>
<a href="${anon_url(curService[b'url'])}" class="imgLink" target="_new">
<img src="${srRoot}/images/subtitles/${curService[b'image']}" alt="${curService[b'url']}" title="${curService[b'url']}" width="16" height="16" style="vertical-align:middle;"/>
</a>
<span style="vertical-align:middle;">${curService['name'].capitalize()}</span>
<span style="vertical-align:middle;">${curService[b'name'].capitalize()}</span>
<span class="ui-icon ui-icon-arrowthick-2-n-s pull-right" style="vertical-align:middle;"></span>
</li>
% endfor
</ul>
<input type="hidden" name="service_order" id="service_order" value="<%" ".join(['%s:%d' % (x['name'], x['enabled']) for x in sickbeard.subtitles.sortedServiceList()])%>"/>
<input type="hidden" name="service_order" id="service_order" value="<% ''.join(['%s:%d' % (x[b'name'], x[b'enabled']) for x in sickbeard.subtitles.sortedServiceList()])%>"/>
<br><input type="submit" class="btn config_submitter" value="Save Changes" /><br>
</fieldset>
......@@ -192,21 +192,23 @@ $('#subtitles_dir').fileBrowser({ title: 'Select Subtitles Download Directory' }
'opensubtitles': {'user': sickbeard.OPENSUBTITLES_USER, 'pass': sickbeard.OPENSUBTITLES_PASS}}
%>
% for curService in sickbeard.subtitles.sortedServiceList():
% if curService['name'] not in providerLoginDict.keys():
<% continue %>
% endif
##<div class="field-pair${(' hidden', '')[curService['enabled']]}"> ## Need js to show/hide on save
<%
if curService[b'name'] not in providerLoginDict.keys():
continue
%>
##<div class="field-pair${(' hidden', '')[curService[b'enabled']}"> ## Need js to show/hide on save
<div class="field-pair">
<label class="nocheck" for="${curService['name']}_user">
<span class="component-title">${curService['name'].capitalize()} User Name</span>
<label class="nocheck" for="${curService[b'name']}_user">
<span class="component-title">${curService[b'name'].capitalize()} User Name</span>
<span class="component-desc">
<input type="text" name="${curService['name']}_user" id="${curService['name']}_user" value="${providerLoginDict[curService['name']]['user']}" class="form-control input-sm input300" autocapitalize="off" />
<input type="text" name="${curService[b'name']}_user" id="${curService[b'name']}_user" value="${providerLoginDict[curService[b'name']][b'user']}" class="form-control input-sm input300" autocapitalize="off" />
</span>
</label>
<label class="nocheck" for="${curService['name']}_pass">
<span class="component-title">${curService['name'].capitalize()} Password</span>
<label class="nocheck" for="${curService[b'name']}_pass">
<span class="component-title">${curService[b'name'].capitalize()} Password</span>
<span class="component-desc">
<input type="password" name="${curService['name']}_pass" id="${curService['name']}_pass" value="${providerLoginDict[curService['name']]['pass']}" class="form-control input-sm input300" autocapitalize="off" />
<input type="password" name="${curService[b'name']}_pass" id="${curService[b'name']}_pass" value="${providerLoginDict[curService[b'name']][b'pass']}" class="form-control input-sm input300" autocapitalize="off" />
</span>
</label>
</div>
......@@ -221,4 +223,4 @@ $('#subtitles_dir').fileBrowser({ title: 'Select Subtitles Download Directory' }
</div>
<div class="clearfix"></div>
</%block>
</%block>
\ No newline at end of file
This diff is collapsed.
......@@ -97,7 +97,7 @@
<label for="indexerLangSelect">
<span class="component-title">Info Language</span>
<span class="component-desc">
<select name="indexerLang" id="indexerLangSelect" class="form-control form-control-inline input-sm bfh-languages" data-language="${show.lang}" data-available="${','.join(sickbeard.indexerApi().config['valid_languages'])}"></select>
<select name="indexerLang" id="indexerLangSelect" class="form-control form-control-inline input-sm bfh-languages" data-language="${show.lang}" data-available="${','.join(sickbeard.indexerApi().config[b'valid_languages']])}"></select>
<div class="clear-left"><p>This only applies to episode filenames and the contents of metadata files.</p></div>
</span>
</label>
......
<%inherit file="/layouts/main.mako"/>
<%!
import sickbeard
from sickbeard.logger import SRLogger
from sickbeard import classes
%>
<%block name="css">
......@@ -17,7 +18,7 @@ pre {
</%block>
<%block name="content">
<%
if logLevel == sickbeard.SRLOGGER.logLevels['WARNING']:
if logLevel == SRLogger.logLevels[b'WARNING']:
errors = classes.WarningViewer.errors
title = 'WARNING logs'
else:
......
......@@ -71,15 +71,15 @@
<tr>
<td align="center">
<% airDate = sbdatetime.sbdatetime.sbfdatetime(datetime.datetime.strptime(str(hItem["date"]), History.date_format), show_seconds=True) %>
<% isoDate = datetime.datetime.strptime(str(hItem["date"]), History.date_format).isoformat('T') %>
<% isoDate = datetime.datetime.strptime(str(hItem["date"]), History.date_format).isoformat() %>
<time datetime="${isoDate}" class="date">${airDate}</time>
</td>
<td class="tvShow" width="35%"><a href="${srRoot}/home/displayShow?show=${hItem["show_id"]}#S${hItem["season"]}E${hItem["episode"]}">${hItem["show_name"]} - ${"S%02i" % int(hItem["season"])}${"E%02i" % int(hItem["episode"])} ${('', '<span class="quality Proper">Proper</span>')["proper" in hItem["resource"].lower() or "repack" in hItem["resource"].lower()]}</a></td>
<td align="center" ${('', 'class="subtitles_column"')[curStatus == SUBTITLED]}>
% if curStatus == SUBTITLED:
<img width="16" height="11" style="vertical-align:middle;" src="${srRoot}/images/subtitles/flags/${hItem['resource']}.png" onError="this.onerror=null;this.src='${srRoot}/images/flags/unknown.png';">
<img width="16" height="11" style="vertical-align:middle;" src="${srRoot}/images/subtitles/flags/${hItem[b'resource']}.png" onError="this.onerror=null;this.src='${srRoot}/images/flags/unknown.png';">
% endif
<span style="cursor: help; vertical-align:middle;" title="${os.path.basename(hItem['resource'])}">${statusStrings[curStatus]}</span>
<span style="cursor: help; vertical-align:middle;" title="${os.path.basename(hItem[b'resource'])}">${statusStrings[curStatus]}</span>
</td>
<td align="center">
% if curStatus in [DOWNLOADED, ARCHIVED]:
......@@ -96,7 +96,7 @@
<img src="${srRoot}/images/providers/missing.png" width="16" height="16" style="vertical-align:middle;" title="missing provider"/> <span style="vertical-align:middle;">Missing Provider</span>
% endif
% else:
<img src="${srRoot}/images/subtitles/${hItem['provider']}.png" width="16" height="16" style="vertical-align:middle;" /> <span style="vertical-align:middle;">${hItem["provider"].capitalize()}</span>
<img src="${srRoot}/images/subtitles/${hItem[b'provider']}.png" width="16" height="16" style="vertical-align:middle;" /> <span style="vertical-align:middle;">${hItem["provider"].capitalize()}</span>
% endif
% endif
% endif
......@@ -134,7 +134,7 @@
<tr>
<td align="center">
<% airDate = sbdatetime.sbdatetime.sbfdatetime(datetime.datetime.strptime(str(hItem["actions"][0]["time"]), History.date_format), show_seconds=True) %>
<% isoDate = datetime.datetime.strptime(str(hItem["actions"][0]["time"]), History.date_format).isoformat('T') %>
<% isoDate = datetime.datetime.strptime(str(hItem["actions"][0]["time"]), History.date_format).isoformat() %>
<time datetime="${isoDate}" class="date">${airDate}</time>
</td>
<td class="tvShow" width="25%">
......@@ -170,9 +170,9 @@
% for action in sorted(hItem["actions"]):
<% curStatus, curQuality = Quality.splitCompositeStatus(int(action["action"])) %>
% if curStatus == SUBTITLED:
<img src="${srRoot}/images/subtitles/${action['provider']}.png" width="16" height="16" style="vertical-align:middle;" alt="${action["provider"]}" title="${action["provider"].capitalize()}: ${os.path.basename(action["resource"])}"/>
<img src="${srRoot}/images/subtitles/${action[b'provider']}.png" width="16" height="16" style="vertical-align:middle;" alt="${action["provider"]}" title="${action["provider"].capitalize()}: ${os.path.basename(action["resource"])}"/>
<span style="vertical-align:middle;"> / </span>
<img width="16" height="11" style="vertical-align:middle;" src="${srRoot}/images/subtitles/flags/${action['resource']}.png" onError="this.onerror=null;this.src='${srRoot}/images/flags/unknown.png';" style="vertical-align: middle !important;">
<img width="16" height="11" style="vertical-align:middle;" src="${srRoot}/images/subtitles/flags/${action[b'resource']}.png" onError="this.onerror=null;this.src='${srRoot}/images/flags/unknown.png';" style="vertical-align: middle !important;">
&nbsp;
% endif
% endfor
......
......@@ -99,17 +99,17 @@
display_status = 'Ended'
if curShow.indexerid in show_stat:
cur_airs_next = show_stat[curShow.indexerid]['ep_airs_next']
cur_airs_next = show_stat[curShow.indexerid][b'ep_airs_next']
cur_snatched = show_stat[curShow.indexerid]['ep_snatched']
cur_snatched = show_stat[curShow.indexerid][b'ep_snatched']
if not cur_snatched:
cur_snatched = 0
cur_downloaded = show_stat[curShow.indexerid]['ep_downloaded']
cur_downloaded = show_stat[curShow.indexerid][b'ep_downloaded']
if not cur_downloaded:
cur_downloaded = 0
cur_total = show_stat[curShow.indexerid]['ep_total']
cur_total = show_stat[curShow.indexerid][b'ep_total']
if not cur_total:
cur_total = 0
......@@ -282,18 +282,18 @@
download_stat_tip = ''
if curShow.indexerid in show_stat:
cur_airs_next = show_stat[curShow.indexerid]['ep_airs_next']
cur_airs_prev = show_stat[curShow.indexerid]['ep_airs_prev']
cur_airs_next = show_stat[curShow.indexerid][b'ep_airs_next']
cur_airs_prev = show_stat[curShow.indexerid][b'ep_airs_prev']
cur_snatched = show_stat[curShow.indexerid]['ep_snatched']
cur_snatched = show_stat[curShow.indexerid][b'ep_snatched']
if not cur_snatched:
cur_snatched = 0
cur_downloaded = show_stat[curShow.indexerid]['ep_downloaded']
cur_downloaded = show_stat[curShow.indexerid][b'ep_downloaded']
if not cur_downloaded:
cur_downloaded = 0
cur_total = show_stat[curShow.indexerid]['ep_total']
cur_total = show_stat[curShow.indexerid][b'ep_total']
if not cur_total:
cur_total = 0
......@@ -322,7 +322,7 @@
<% airDate = sbdatetime.sbdatetime.convert_to_setting(network_timezones.parse_date_time(cur_airs_next, curShow.airs, curShow.network)) %>
% try:
<td align="center" class="nowrap">
<time datetime="${airDate.isoformat('T')}" class="date">${sbdatetime.sbdatetime.sbfdate(airDate)}</time>
<time datetime="${airDate.isoformat()}" class="date">${sbdatetime.sbdatetime.sbfdate(airDate)}</time>
</td>
% except ValueError:
<td align="center" class="nowrap"></td>
......@@ -335,7 +335,7 @@
<% airDate = sbdatetime.sbdatetime.convert_to_setting(network_timezones.parse_date_time(cur_airs_prev, curShow.airs, curShow.network)) %>
% try:
<td align="center" class="nowrap">
<time datetime="${airDate.isoformat('T')}" class="date">${sbdatetime.sbdatetime.sbfdate(airDate)}</time>
<time datetime="${airDate.isoformat()}" class="date">${sbdatetime.sbdatetime.sbfdate(airDate)}</time>
</td>
% except ValueError:
<td align="center" class="nowrap"></td>
......
......@@ -6,27 +6,29 @@
<table id="addRootDirTable" class="sickbeardTable tablesorter">
<thead><tr><th class="col-checkbox"><input type="checkbox" id="checkAll" checked=checked></th><th>Directory</th><th width="20%">Show Name (tvshow.nfo)<th width="20%">Indexer</td></tr></thead>
<tbody>
% for curDir in dirList:
<%
if curDir['added_already']:
if curDir[b'added_already']:
continue
show_id = curDir['dir']
if curDir['existing_info'][0]:
show_id = show_id + '|' + str(curDir['existing_info'][0]) + '|' + str(curDir['existing_info'][1])
indexer = curDir['existing_info'][2]
show_id = curDir[b'dir']
if curDir[b'existing_info'][0]:
show_id = "{}|{}|{}".format(show_id, curDir[b'existing_info'][0], curDir[b'existing_info'][1])
indexer = curDir[b'existing_info'][2]
indexer = 0
if curDir['existing_info'][0]:
indexer = curDir['existing_info'][2]
if curDir[b'existing_info'][0]:
indexer = curDir[b'existing_info'][2]
elif sickbeard.INDEXER_DEFAULT > 0:
indexer = sickbeard.INDEXER_DEFAULT
%>
<tr>
<td class="col-checkbox"><input type="checkbox" id="${show_id}" class="dirCheck" checked=checked></td>
<td><label for="${show_id}">${curDir['display_dir']}</label></td>
% if curDir['existing_info'][1] and indexer > 0:
<td><a href="${anon_url(sickbeard.indexerApi(indexer).config['show_url'], curDir['existing_info'][0])}">${curDir['existing_info'][1]}</a></td>
<td><label for="${show_id}">${curDir[b'display_dir']}</label></td>
% if curDir[b'existing_info'][1] and indexer > 0:
<td><a href="${anon_url(sickbeard.indexerApi(indexer).config[b'show_url'], curDir[b'existing_info'][0])}">${curDir[b'existing_info'][1]}</a></td>
% else:
<td>?</td>
% endif
......
......@@ -38,7 +38,7 @@
<input type="hidden" id="indexer_timeout" value="${sickbeard.INDEXER_TIMEOUT}" />
% if use_provided_info:
Show retrieved from existing metadata: <a href="${anon_url(sickbeard.indexerApi(provided_indexer).config['show_url'], provided_indexer_id)}">${provided_indexer_name}</a>
Show retrieved from existing metadata: <a href="${anon_url(sickbeard.indexerApi(provided_indexer).config[b'show_url'], provided_indexer_id)}">${provided_indexer_name}</a>
<input type="hidden" id="indexerLang" name="indexerLang" value="en" />
<input type="hidden" id="whichSeries" name="whichSeries" value="${provided_indexer_id}" />
<input type="hidden" id="providedIndexer" name="providedIndexer" value="${provided_indexer}" />
......@@ -46,7 +46,7 @@
% else:
<input type="text" id="nameToSearch" value="${default_show_name}" class="form-control form-control-inline input-sm input350" />
&nbsp;&nbsp;
<select name="indexerLang" id="indexerLangSelect" class="form-control form-control-inline input-sm bfh-languages" data-language="${sickbeard.INDEXER_DEFAULT_LANGUAGE}" data-available="${','.join(sickbeard.indexerApi().config['valid_languages'])}">
<select name="indexerLang" id="indexerLangSelect" class="form-control form-control-inline input-sm bfh-languages" data-language="${sickbeard.INDEXER_DEFAULT_LANGUAGE}" data-available="${','.join(sickbeard.indexerApi().config[b'valid_languages'])}">
</select><b>*</b>
&nbsp;
<select name="providedIndexer" id="providedIndexer" class="form-control form-control-inline input-sm">
......
......@@ -18,19 +18,19 @@
% for cur_result in popular_shows:
<div class="popularShow">
<div class="left">
<img class="coverImage" src="${srRoot}/cache/${cur_result['image_path']}" />
<img class="coverImage" src="${srRoot}/cache/${cur_result[b'image_path']}" />
</div>
<div class="right">
<h3>${cur_result['name']}</h3>
<h3>${cur_result[b'name']}</h3>
% if 'rating' in cur_result and cur_result['rating']:
<span class="rating">${cur_result['rating']}/10 (${cur_result['votes']})</span>
% if 'rating' in cur_result and cur_result[b'rating']:
<span class="rating">${cur_result[b'rating']}/10 (${cur_result[b'votes']})</span>
% endif
<p>${cur_result['outline']}<span class="year"> - Released ${cur_result['year']}<span></p>
<span class="imdb_url"><a href="${anon_url(cur_result['imdb_url'])}">View on IMDB</a></span>&nbsp;&nbsp;|&nbsp;&nbsp;
% if cur_result['imdb_tt'] not in imdb_tt:
<span class="imdb_sickrage_search"><a href="${srRoot}/home/addShows/newShow/?search_string=${cur_result['name']}">
<p>${cur_result[b'outline']}<span class="year"> - Released ${cur_result[b'year']}<span></p>
<span class="imdb_url"><a href="${anon_url(cur_result[b'imdb_url'])}">View on IMDB</a></span>&nbsp;&nbsp;|&nbsp;&nbsp;
% if cur_result[b'imdb_tt'] not in imdb_tt:
<span class="imdb_sickrage_search"><a href="${srRoot}/home/addShows/newShow/?search_string=${cur_result[b'name']}">
Add Show</a></span>
% else:
<span> Already added </span>
......
......@@ -28,8 +28,8 @@
<span><h4>Available Groups</h4></span>
<select id="pool" multiple="multiple" size="12">
% for group in groups:
% if group not in whitelist and group['name'] not in blacklist:
<option value="${group['name']}">${group['name']} | ${group['rating']} | ${group['range']}</option>
% if group not in whitelist and group[b'name'] not in blacklist:
<option value="${group[b'name']}">${group[b'name']} | ${group[b'rating']} | ${group[b'range']}</option>
% endif
% endfor
</select>
......
......@@ -117,7 +117,7 @@
% if sickbeard.SHOWS_RECENT:
<li role="separator" class="divider"></li>
% for recentShow in sickbeard.SHOWS_RECENT:
<li><a href="${srRoot}/home/displayShow/?show=${recentShow['indexerid']}"><i class="menu-icon-addshow"></i>&nbsp;${recentShow['name']|trim,h}</a></li>
<li><a href="${srRoot}/home/displayShow/?show=${recentShow[b'indexerid']}"><i class="menu-icon-addshow"></i>&nbsp;${recentShow[b'name']|trim,h}</a></li>
% endfor
% endif
</ul>
......@@ -208,7 +208,7 @@
<li><a href="${srRoot}/news/"><i class="menu-icon-help"></i>&nbsp;News${newsBadge}</a></li>
<li><a href="${srRoot}/IRC/"><i class="menu-icon-help"></i>&nbsp;IRC</a></li>
<li><a href="${srRoot}/changes/"><i class="menu-icon-help"></i>&nbsp;Changelog</a></li>
<li><a href="https://github.com/SiCKRAGETV/SiCKRAGE/wiki/Donations" rel="noreferrer" onclick="window.open('${sickbeard.ANON_REDIRECT}' + this.href); return false;"><i class="menu-icon-help"></i>&nbsp;Support SickRage</a></li>
<li><a href="http://sickragetv.herokuapp.com/donate" rel="noreferrer" onclick="window.open('${sickbeard.ANON_REDIRECT}' + this.href); return false;"><i class="menu-icon-help"></i>&nbsp;Support SickRage</a></li>
<li role="separator" class="divider"></li>
%if numErrors:
<li><a href="${srRoot}/errorlogs/"><i class="menu-icon-viewlog-errors"></i>&nbsp;View Errors <span class="badge btn-danger">${numErrors}</span></a></li>
......@@ -240,20 +240,20 @@
<span>
<% first = True %>
% for menuItem in submenu:
% if 'requires' not in menuItem or menuItem['requires']:
<% icon_class = '' if 'icon' not in menuItem else ' ' + menuItem['icon'] %>
% if type(menuItem['path']) == dict:
${("</span><span>", "")[bool(first)]}<b>${menuItem['title']}</b>
% if 'requires' not in menuItem or menuItem[b'requires']:
<% icon_class = '' if 'icon' not in menuItem else ' ' + menuItem[b'icon'] %>
% if type(menuItem[b'path']) == dict:
${("</span><span>", "")[bool(first)]}<b>${menuItem[b'title']}</b>
<%
first = False
inner_first = True
%>
% for cur_link in menuItem['path']:
${("&middot; ", "")[bool(inner_first)]}<a class="inner" href="${srRoot}/${menuItem['path'][cur_link]}">${cur_link}</a>
% for cur_link in menuItem[b'path']:
${("&middot; ", "")[bool(inner_first)]}<a class="inner" href="${srRoot}/${menuItem[b'path'][cur_link]}">${cur_link}</a>
<% inner_first = False %>
% endfor
% else:
<a href="${srRoot}/${menuItem['path']}" class="btn${('', (' confirm ' + menuItem.get('class', '')))['confirm' in menuItem]}">${('', '<span class="pull-left ' + icon_class + '"></span> ')[bool(icon_class)]}${menuItem['title']}</a>
<a href="${srRoot}/${menuItem[b'path']}" class="btn${('', (' confirm ' + menuItem.get('class', '')))['confirm' in menuItem]}">${('', '<span class="pull-left ' + icon_class + '"></span> ')[bool(icon_class)]}${menuItem[b'title']}</a>
<% first = False %>
% endif
% endif
......@@ -278,12 +278,12 @@
<div class="footer clearfix">
<%
stats = Show.overall_stats()
ep_downloaded = stats['episodes']['downloaded']
ep_snatched = stats['episodes']['snatched']
ep_total = stats['episodes']['total']
ep_downloaded = stats[b'episodes'][b'downloaded']
ep_snatched = stats[b'episodes'][b'snatched']
ep_total = stats[b'episodes'][b'total']
ep_percentage = '' if ep_total == 0 else '(<span class="footerhighlight">%s%%</span>)' % re.sub(r'(\d+)(\.\d)\d+', r'\1\2', str((float(ep_downloaded)/float(ep_total))*100))
%>
<span class="footerhighlight">${stats['shows']['total']}</span> Shows (<span class="footerhighlight">${stats['shows']['active']}</span> Active)
<span class="footerhighlight">${stats[b'shows'][b'total']}</span> Shows (<span class="footerhighlight">${stats[b'shows'][b'active']}</span> Active)
| <span class="footerhighlight">${ep_downloaded}</span>
% if ep_snatched:
......
......@@ -7,18 +7,16 @@
from sickbeard import sbdatetime, network_timezones
%>
<%block name="scripts">
<script type="text/javascript">
</script>
<script type="text/javascript" src="${srRoot}/js/new/manage_backlogOverview.js"></script>
</%block>
<%block name="content">
<div id="content960">
% if not header is UNDEFINED:
<h1 class="header">${header}</h1>
% else:
<h1 class="title">${title}</h1>
% endif
<div id="content960">
<% totalWanted = 0 %>
<% totalQual = 0 %>
......@@ -63,7 +61,7 @@ Jump to Show
<tr class="seasoncols"><th>Episode</th><th>Name</th><th class="nowrap">Airdate</th></tr>
% for curResult in showSQLResults[curShow.indexerid]:
<% whichStr = str(curResult['season']) + 'x' + str(curResult['episode']) %>
<% whichStr = str(curResult[b'season']) + 'x' + str(curResult[b'episode']) %>
% try:
<% overview = showCats[curShow.indexerid][whichStr] %>
% except Exception:
......@@ -77,12 +75,12 @@ Jump to Show
<tr class="seasonstyle ${Overview.overviewStrings[showCats[curShow.indexerid][whichStr]]}">
<td class="tableleft" align="center">${whichStr}</td>
<td class="tableright" align="center" class="nowrap">
${curResult["name"]}
${curResult[b"name"]}
</td>
<td>
<% airDate = sbdatetime.sbdatetime.convert_to_setting(network_timezones.parse_date_time(curResult['airdate'], curShow.airs, curShow.network)) %>
% if int(curResult['airdate']) != 1:
<time datetime="${airDate.isoformat('T')}" class="date">${sbdatetime.sbdatetime.sbfdatetime(airDate)}</time>
<% airDate = sbdatetime.sbdatetime.convert_to_setting(network_timezones.parse_date_time(curResult[b'airdate'], curShow.airs, curShow.network)) %>
% if int(curResult[b'airdate']) != 1:
<time datetime="${airDate.isoformat()}" class="date">${sbdatetime.sbdatetime.sbfdatetime(airDate)}</time>
% else:
Never
% endif
......
......@@ -5,8 +5,8 @@
%>
<%block name="scripts">
% if whichStatus or (whichStatus and ep_counts):
<script type="text/javascript" src="${srRoot}/js/manageEpisodeStatuses.js?${sbPID}"></script>
% endif:
<script type="text/javascript" src="${srRoot}/js/manageEpisodeStatuses.js?${sbPID}"></script>
% endif
</%block>
<%block name="content">
<div id="content960">
......@@ -26,7 +26,7 @@
<form action="${srRoot}/manage/episodeStatuses" method="get">
Manage episodes with status <select name="whichStatus" class="form-control form-control-inline input-sm">
% for curStatus in [common.SKIPPED, common.SNATCHED, common.WANTED, common.IGNORED] + common.Quality.DOWNLOADED + common.Quality.ARCHIVED:
%if surStatus not in [common.ARCHIVED, common.DOWNLOADED]:
%if curStatus not in [common.ARCHIVED, common.DOWNLOADED]:
<option value="${curStatus}">${common.statusStrings[curStatus]}</option>
%endif
% endfor
......@@ -74,8 +74,8 @@ Set checked shows/episodes to <select name="newStatus" class="form-control form-
<input class="btn btn-inline" type="submit" value="Go" />
<div>
<button type="button" class="btn btn-xs selectAllShows">Select all</a></button>
<button type="button" class="btn btn-xs unselectAllShows">Clear all</a></button>
<button class="btn btn-xs selectAllShows">Select All</button>
<button class="btn btn-xs unselectAllShows">Clear All</button>
</div>
<br>
......@@ -92,4 +92,4 @@ Set checked shows/episodes to <select name="newStatus" class="form-control form-
% endif
</div>
</%block>
</%block>
\ No newline at end of file
......@@ -45,10 +45,10 @@ ${('Not in progress', 'In Progress')[dailySearchStatus]}<br>
<br>
<h3>Search Queue:</h3>
Backlog: <i>${queueLength['backlog']} pending items</i></br>
Daily: <i>${queueLength['daily']} pending items</i></br>
Manual: <i>${queueLength['manual']} pending items</i></br>
Failed: <i>${queueLength['failed']} pending items</i></br>
Backlog: <i>${queueLength[b'backlog']} pending items</i></br>
Daily: <i>${queueLength[b'daily']} pending items</i></br>
Manual: <i>${queueLength[b'manual']} pending items</i></br>
Failed: <i>${queueLength[b'failed']} pending items</i></br>
</div>
</div>
</%block>
This diff is collapsed.
......@@ -22,25 +22,25 @@
</div>
% else:
% for cur_show in trending_shows:
<% show_url = 'http://www.trakt.tv/shows/%s' % cur_show['show']['ids']['slug'] %>
<% show_url = 'http://www.trakt.tv/shows/%s' % cur_show[b'show'][b'ids'][b'slug'] %>
<div class="trakt_show" data-name="${cur_show['show']['title']}" data-rating="${cur_show['show']['rating']}" data-votes="${cur_show['show']['votes']}">
<div class="trakt_show" data-name="${cur_show[b'show'][b'title']}" data-rating="${cur_show[b'show'][b'rating']}" data-votes="${cur_show[b'show'][b'votes']}">
<div class="traktContainer">
<div class="trakt-image">
<a class="trakt-image" href="${anon_url(show_url)}" target="_blank"><img alt="" class="trakt-image" src="${cur_show['show']['images']['poster']['thumb']}" /></a>
<a class="trakt-image" href="${anon_url(show_url)}" target="_blank"><img alt="" class="trakt-image" src="${cur_show[b'show'][b'images'][b'poster'][b'thumb']}" /></a>
</div>
<div class="show-title">
${(cur_show['show']['title'], '<span>&nbsp;</span>')['' == cur_show['show']['title']]}
${(cur_show[b'show'][b'title'], '<span>&nbsp;</span>')['' == cur_show[b'show'][b'title']]}
</div>
<div class="clearfix">
<p>${int(cur_show['show']['rating']*10)}% <img src="${srRoot}/images/heart.png"></p>
<i>${cur_show['show']['votes']} votes</i>
<p>${int(cur_show[b'show'][b'rating']*10)}% <img src="${srRoot}/images/heart.png"></p>
<i>${cur_show[b'show'][b'votes']} votes</i>
<div class="traktShowTitleIcons">
<a href="${srRoot}/home/addShows/addTraktShow?indexer_id=${cur_show['show']['ids']['tvdb']}&amp;showName=${cur_show['show']['title']}" class="btn btn-xs">Add Show</a>
<a href="${srRoot}/home/addShows/addTraktShow?indexer_id=${cur_show[b'show'][b'ids'][b'tvdb']}&amp;showName=${cur_show[b'show'][b'title']}" class="btn btn-xs">Add Show</a>
% if blacklist:
<a href="${srRoot}/home/addShows/addShowToBlacklist?indexer_id=${cur_show['show']['ids']['tvdb'] or cur_show['show']['ids']['tvrage']}" class="btn btn-xs">Remove Show</a>
<a href="${srRoot}/home/addShows/addShowToBlacklist?indexer_id=${cur_show[b'show'][b'ids'][b'tvdb'] or cur_show[b'show'][b'ids'][b'tvrage']}" class="btn btn-xs">Remove Show</a>
% endif
</div>
</div>
......
......@@ -364,10 +364,10 @@ def upgradeDatabase(connection, schema):
"""
def _processUpgrade(connection, upgradeClass):
while (True):
while(True):
version = connection.checkDBVersion()
logging.debug("Checking database structure..." + connection.filename)
logging.debug("Checking database structure... {}".format(connection.filename))
try:
instance = upgradeClass(connection)
......
......@@ -25,12 +25,12 @@ import os
import re
import sys
import locale
import logging
import logging.handlers
import platform
import threading
import traceback
import logging
import logging.handlers
from logging import INFO, WARNING, ERROR, DEBUG, NOTSET, NullHandler
import sickbeard
......@@ -110,16 +110,16 @@ class CustomFilter(logging.Filter):
def filter(self, record):
self.allowedLoggers = ['root', 'tornado.general', 'tornado.application']
if record.name in self.allowedLoggers:
for _, v in self.name.items():
record.msg.replace(v, len(v) * '*')
# needed because Newznab apikey isn't stored as key=value in a section.
record.msg = re.sub(r'([&?]r|[&?]apikey|[&?]api_key)=[^&]*([&\w]?)', r'\1=**********\2', record.msg)
try:
# mask sensitive info
record.msg = re.sub(r"(.*)\b({})\b(.*)".format('|'.join([x for x in self.name.values() if len(x)])), r"\1\3", record.msg)
# append thread name to record msg
#record.msg = "{}::{}".format(threading.currentThread().getName(), record.msg)
# needed because Newznab apikey isn't stored as key=value in a section.
record.msg = re.sub(r"([&?]r|[&?]apikey|[&?]api_key)=[^&]*([&\w]?)", r"\1=**********\2", record.msg)
return super(CustomFilter, self).filter(record)
return record
except Exception as e:
pass
class CustomLogger(SRLogger):
def __init__(self, *args