').text(sortedList[sortedListKey].name).html() + '';
}
}
@@ -1728,8 +1728,8 @@ const SICKCHILL = {
});
$.fn.refreshMetadataConfig = function (first) {
- let curMost = 0;
- let curMostProvider = '';
+ let currentMost = 0;
+ let currentMostProvider = '';
$('.metadataDiv').each(function () { // eslint-disable-line complexity
const generatorName = $(this).attr('id');
@@ -1759,14 +1759,14 @@ const SICKCHILL = {
seasonAllBanner ? '1' : '0',
);
- let curNumber = 0;
+ let currentNumber = 0;
for (const element of configArray) {
- curNumber += Number.parseInt(element, 10);
+ currentNumber += Number.parseInt(element, 10);
}
- if (curNumber > curMost) {
- curMost = curNumber;
- curMostProvider = generatorName;
+ if (currentNumber > currentMost) {
+ currentMost = currentNumber;
+ currentMostProvider = generatorName;
}
$('#' + generatorName + '_eg_show_metadata').attr('class', showMetadata ? 'enabled' : 'disabled');
@@ -1782,8 +1782,8 @@ const SICKCHILL = {
$('#' + generatorName + '_data').val(configArray.join('|'));
});
- if (curMostProvider !== '' && first) {
- $('#metadataType option[value=' + curMostProvider + ']').attr('selected', 'selected');
+ if (currentMostProvider !== '' && first) {
+ $('#metadataType option[value=' + currentMostProvider + ']').attr('selected', 'selected');
$(this).showHideMetadata();
}
};
@@ -2734,7 +2734,9 @@ const SICKCHILL = {
subtitlesTd.empty();
$.each(subtitles, (index, language) => {
if (language !== '') {
- subtitlesTd.append($('
![]()
', {src: scRoot + '/images/subtitles/flags/' + language + '.png', alt: language, width: 16, height: 11}));
+ subtitlesTd.append($('
![]()
', {
+ src: scRoot + '/images/subtitles/flags/' + language + '.png', alt: language, width: 16, height: 11,
+ }));
}
});
icon.prop('class', 'displayshow-icon-sub');
@@ -2797,8 +2799,8 @@ const SICKCHILL = {
$(this).val('jump');
});
- $('#seasonJumpLinks a').on('click', ev => {
- const season = $(ev.target).data('season');
+ $('#seasonJumpLinks a').on('click', event_ => {
+ const season = $(event_.target).data('season');
$('html,body').animate({scrollTop: $('#' + season).offset().top - 50}, 'slow');
$('#collapseSeason-' + season).collapse('show');
location.hash = season;
@@ -3280,7 +3282,7 @@ const SICKCHILL = {
row += '
';
subtitles = subtitles.split(',');
for (const i in subtitles) {
- if (Object.prototype.hasOwnProperty.call(subtitles, i)) {
+ if (Object.hasOwn(subtitles, i)) {
row += ' ';
}
}
@@ -3477,31 +3479,31 @@ const SICKCHILL = {
}
},
massEdit() {
- function findDirIndex(which) {
- const dirParts = which.split('_');
- return dirParts.at(-1);
+ function findDirectoryIndex(which) {
+ const directoryParts = which.split('_');
+ return directoryParts.at(-1);
}
- function editRootDir(path, options) {
+ function editRootDirectory(path, options) {
$('#new_root_dir_' + options.whichId).val(path);
$('#new_root_dir_' + options.whichId).change();
}
$('.new_root_dir').on('change', function () {
- const curIndex = findDirIndex($(this).attr('id'));
- $('#display_new_root_dir_' + curIndex).html('' + $(this).val() + '');
+ const currentIndex = findDirectoryIndex($(this).attr('id'));
+ $('#display_new_root_dir_' + currentIndex).html('' + $(this).val() + '');
});
$('.edit_root_dir').on('click', function () {
- const curIndex = findDirIndex($(this).attr('id'));
- const initialDir = $('#new_root_dir_' + curIndex).val();
- $(this).nFileBrowser(editRootDir, {initialDir, whichId: curIndex});
+ const currentIndex = findDirectoryIndex($(this).attr('id'));
+ const initialDirectory = $('#new_root_dir_' + currentIndex).val();
+ $(this).nFileBrowser(editRootDirectory, {initialDirectory, whichId: currentIndex});
});
$('.delete_root_dir').on('click', function () {
- const curIndex = findDirIndex($(this).attr('id'));
- $('#new_root_dir_' + curIndex).val(null);
- $('#display_new_root_dir_' + curIndex).html('' + _('DELETED') + '');
+ const currentIndex = findDirectoryIndex($(this).attr('id'));
+ $('#new_root_dir_' + currentIndex).val(null);
+ $('#display_new_root_dir_' + currentIndex).html('' + _('DELETED') + '');
});
SICKCHILL.common.QualityChooser.init();
@@ -3513,30 +3515,30 @@ const SICKCHILL = {
});
$('.get_more_eps').on('click', function () {
- const curIndexerId = $(this).attr('id');
- const checked = $('#allCheck-' + curIndexerId).is(':checked');
- const lastRow = $('tr#' + curIndexerId);
+ const currentIndexerId = $(this).attr('id');
+ const checked = $('#allCheck-' + currentIndexerId).is(':checked');
+ const lastRow = $('tr#' + currentIndexerId);
const clicked = $(this).attr('data-clicked');
const action = $(this).attr('value');
if (!clicked) {
$.getJSON(scRoot + '/manage/showEpisodeStatuses', {
- indexer_id: curIndexerId, // eslint-disable-line camelcase
+ indexer_id: currentIndexerId, // eslint-disable-line camelcase
whichStatus: $('#oldStatus').val(),
}, data => {
$.each(data, (season, eps) => {
$.each(eps, (episode, name) => {
- lastRow.after($.makeEpisodeRow(curIndexerId, season, episode, name, checked));
+ lastRow.after($.makeEpisodeRow(currentIndexerId, season, episode, name, checked));
});
});
});
$(this).attr('data-clicked', 1);
$(this).prop('value', 'Collapse');
} else if (action.toLowerCase() === 'collapse') {
- $('.show-' + curIndexerId).hide();
+ $('.show-' + currentIndexerId).hide();
$(this).prop('value', 'Expand');
} else if (action.toLowerCase() === 'expand') {
- $('.show-' + curIndexerId).show();
+ $('.show-' + currentIndexerId).show();
$(this).prop('value', 'Collapse');
}
});
@@ -3860,8 +3862,8 @@ const SICKCHILL = {
$('.ep_summary').hide();
$('.ep_summaryTrigger').on('click', function () {
$(this).next('.ep_summary').slideToggle('normal', function () {
- $(this).prev('.ep_summaryTrigger').attr('src', function (i, src) {
- return $(this).next('.ep_summary').is(':visible') ? src.replace('plus', 'minus') : src.replace('minus', 'plus');
+ $(this).prev('.ep_summaryTrigger').attr('src', function (i, source) {
+ return $(this).next('.ep_summary').is(':visible') ? source.replace('plus', 'minus') : source.replace('minus', 'plus');
});
});
});
@@ -4348,7 +4350,7 @@ const SICKCHILL = {
let lastTxt = '';
// @TODO This fixes the issue of the page not loading at all,
// before I added this I couldn't get the directories to show in the table.
- const rootDirsWorkaround = function () {
+ const rootDirectoriesWorkaround = function () {
if (lastTxt === $('#rootDirText').val()) {
return false;
}
@@ -4362,9 +4364,9 @@ const SICKCHILL = {
loadContent();
};
- rootDirsWorkaround();
+ rootDirectoriesWorkaround();
- $('#rootDirText').on('change', rootDirsWorkaround);
+ $('#rootDirText').on('change', rootDirectoriesWorkaround);
$('#rootDirStaticList').on('click', '.dir_check', loadContent);
},
diff --git a/sickchill/gui/slick/js/imageSelector.js b/sickchill/gui/slick/js/imageSelector.js
index 6bd7a54306..495fc8536b 100644
--- a/sickchill/gui/slick/js/imageSelector.js
+++ b/sickchill/gui/slick/js/imageSelector.js
@@ -66,23 +66,23 @@
imagesContainer.height(scrollableHeight).css('maxHeight', scrollableHeight);
}
- function createImage(imageSrc, thumbSrc) {
+ function createImage(imageSource, thumbSource) {
const image = $(' ')
.attr('data-image-type', imageSelectorDialog.data('image-type'))
- .addClass('image-selector-item').on('click', ev => {
+ .addClass('image-selector-item').on('click', event_ => {
$('.image-selector-item-selected').removeClass('image-selector-item-selected');
- $(ev.target).addClass('image-selector-item-selected');
+ $(event_.target).addClass('image-selector-item-selected');
});
const wrapUrl = new URL(scRoot + '/imageSelector/url_wrap/', location.href);
- if (thumbSrc) {
- wrapUrl.searchParams.append('url', thumbSrc);
- image.attr('data-thumb', thumbSrc);
+ if (thumbSource) {
+ wrapUrl.searchParams.append('url', thumbSource);
+ image.attr('data-thumb', thumbSource);
} else {
- wrapUrl.searchParams.append('url', imageSrc);
+ wrapUrl.searchParams.append('url', imageSource);
}
- image.attr('src', wrapUrl.href).attr('data-image', imageSrc);
+ image.attr('src', wrapUrl.href).attr('data-image', imageSource);
image.appendTo(imagesContainer);
}
@@ -117,9 +117,9 @@
if (selectedImage.length > 0) {
const image = selectedImage.data('image');
const thumb = selectedImage.data('thumb');
- const src = selectedImage.attr('src');
+ const source = selectedImage.attr('src');
$('[name=' + imageType + ']').val((image ? image + '|' : '') + thumb);
- field.attr('src', src).addClass('modified');
+ field.attr('src', source).addClass('modified');
}
$(this).dialog('close');
@@ -165,7 +165,7 @@
imageSelectorElement.children('.error').hide();
if (this.files) {
- const loadFunction = ev => {
+ const loadFunction = event_ => {
const img = new Image();
img.addEventListener('load', () => {
if (imageTypeSizes[imageType].validate(img)) {
@@ -175,7 +175,7 @@
imageSelectorElement.children('.error').show();
}
});
- img.src = ev.target.result;
+ img.src = event_.target.result;
};
for (const file of this.files) {
diff --git a/sickchill/gui/slick/js/rootDirs.js b/sickchill/gui/slick/js/rootDirs.js
index a58ccda1f8..65ebee46fb 100644
--- a/sickchill/gui/slick/js/rootDirs.js
+++ b/sickchill/gui/slick/js/rootDirs.js
@@ -27,15 +27,14 @@
'warn',
];
let length = methods.length;
- const console = (window.console = window.console || {}); // eslint-disable-line no-multi-assign
+ const console = window.console || {};
- while (length--) {
+ while (length > 0) {
+ length--;
method = methods[length];
// Only stub undefined methods.
- if (!console[method]) {
- console[method] = noop;
- }
+ console[method] ||= noop;
}
})();
@@ -69,11 +68,12 @@ $(document).ready(() => {
// Re-sync option ids
let i = 0;
$('#rootDirs option').each(function () {
- $(this).attr('id', 'rd-' + (i++));
+ i++;
+ $(this).attr('id', 'rd-' + i);
});
}
- function refreshRootDirs() {
+ function refreshRootDirectories() {
if ($('#rootDirs').length === 0) {
return;
}
@@ -99,32 +99,31 @@ $(document).ready(() => {
$('#editRootDir').prop('disabled', doDisable);
let logString = '';
- let dirString = '';
+ let directoryString = '';
if ($('#whichDefaultRootDir').val().length >= 4) {
- dirString = $('#whichDefaultRootDir').val().slice(3);
+ directoryString = $('#whichDefaultRootDir').val().slice(3);
}
$('#rootDirs option').each(function () {
logString += $(this).val() + '=' + $(this).text() + '->' + $(this).attr('id') + '\n';
- if (dirString.length > 0) {
- dirString += '|' + $(this).val();
+ if (directoryString.length > 0) {
+ directoryString += '|' + $(this).val();
}
});
logString += 'def: ' + $('#whichDefaultRootDir').val();
console.log(logString);
- $('#rootDirText').val(dirString);
+ $('#rootDirText').val(directoryString);
$('#rootDirText').change();
console.log('rootDirText: ' + $('#rootDirText').val());
}
- function postRootDirs() {
- refreshRootDirs();
- $.post(scRoot + '/config/general/saveRootDirs', {
- rootDirString: $('#rootDirText').val()});
+ function postRootDirectories() {
+ refreshRootDirectories();
+ $.post(scRoot + '/config/general/saveRootDirs', {rootDirString: $('#rootDirText').val()});
}
- function addRootDir(path) {
+ function addRootDirectory(path) {
if (path.length === 0) {
return;
}
@@ -143,10 +142,10 @@ $(document).ready(() => {
setDefault($('#rootDirs option').attr('id'));
}
- postRootDirs();
+ postRootDirectories();
}
- function editRootDir(path) {
+ function editRootDirectory(path) {
if (path.length === 0) {
return;
}
@@ -163,14 +162,14 @@ $(document).ready(() => {
$('#rootDirs option:selected').val(path);
}
- postRootDirs();
+ postRootDirectories();
}
$('#addRootDir').on('click', function () {
- $(this).nFileBrowser(addRootDir);
+ $(this).nFileBrowser(addRootDirectory);
});
$('#editRootDir').on('click', function () {
- $(this).nFileBrowser(editRootDir, {
+ $(this).nFileBrowser(editRootDirectory, {
initialDir: $('#rootDirs option:selected').val(),
});
});
@@ -202,7 +201,7 @@ $(document).ready(() => {
}
}
- refreshRootDirs();
+ refreshRootDirectories();
$.post(scRoot + '/config/general/saveRootDirs', {
rootDirString: $('#rootDirText').val(),
});
@@ -213,15 +212,15 @@ $(document).ready(() => {
setDefault($('#rootDirs option:selected').attr('id'));
}
- refreshRootDirs();
+ refreshRootDirectories();
$.post(scRoot + '/config/general/saveRootDirs', {
rootDirString: $('#rootDirText').val(),
});
});
- $('#rootDirs').click(refreshRootDirs);
+ $('#rootDirs').click(refreshRootDirectories);
// Set up buttons on page load
syncOptionIDs();
setDefault($('#whichDefaultRootDir').val(), true);
- refreshRootDirs();
+ refreshRootDirectories();
});
diff --git a/sickchill/gui/slick/views/displayShow.mako b/sickchill/gui/slick/views/displayShow.mako
index 2196d022b5..01fa33875a 100644
--- a/sickchill/gui/slick/views/displayShow.mako
+++ b/sickchill/gui/slick/views/displayShow.mako
@@ -192,7 +192,7 @@
% if show.network and show.airs:
|
${_('Originally Airs')}: |
- ${show.airs} ${("(invalid Timeformat) ", "")[network_timezones.test_timeformat(show.airs)]} on ${show.network} |
+ ${show.airs} ${("(invalid time format) ", "")[network_timezones.test_time_format(show.airs)]} on ${show.network} |
% elif show.network:
@@ -202,7 +202,7 @@
% elif show.airs:
${_('Originally Airs')}: |
- ${show.airs} ${("(invalid Timeformat)", "")[network_timezones.test_timeformat(show.airs)]} |
+ ${show.airs} ${("(invalid time format)", "")[network_timezones.test_time_format(show.airs)]} |
% endif
diff --git a/sickchill/oldbeard/network_timezones.py b/sickchill/oldbeard/network_timezones.py
index d726daf858..78728c9611 100644
--- a/sickchill/oldbeard/network_timezones.py
+++ b/sickchill/oldbeard/network_timezones.py
@@ -8,7 +8,7 @@
from .. import logger
from . import db, helpers
-# regex to parse time (12/24 hour format)
+# regex to parse time (12/24-hour format)
time_regex = re.compile(r"(?P\d{1,2})(?:[:.](?P\d{2})?)? ?(?P[PA]\.? ?M?)?\b", re.I)
network_dict = {}
@@ -16,6 +16,14 @@
sc_timezone = tz.tzlocal()
+class NetworkTimezoneLoadException(Exception):
+ """"Error loading network timezones"""
+
+
+class GetNetworkTimezoneException(Exception):
+ """"Error getting network timezone"""
+
+
def update_network_dict():
"""Update timezone information from SC repositories"""
@@ -78,7 +86,7 @@ def load_network_dict():
network_dict.clear()
network_dict.update(dict(cur_network_list))
- except Exception:
+ except NetworkTimezoneLoadException:
pass
@@ -97,7 +105,7 @@ def get_network_timezone(network):
try:
network_tz = (tz.gettz(network_tz_name) or sc_timezone) if network_tz_name else sc_timezone
- except Exception:
+ except GetNetworkTimezoneException:
return sc_timezone
return network_tz
@@ -141,5 +149,5 @@ def parse_date_time(d, t, network):
return result.replace(hour=hr, minute=m, tzinfo=network_tz)
-def test_timeformat(time_string):
+def test_time_format(time_string):
return time_regex.search(time_string) is not None