Change min required Python version to 3.9

Change add support for  Python 3.9.20, 3.10.15, 3.11.10, 3.12.7
Update zoneinfo to 2024b.
Change improve config.ini save failure messages.
Change add '-f' to copy_file command for 'posix' systems.
Change add '.avif' extensions as valid image type (used by tvc cards)
Change hide lazy load animation when loading fails (unsupported image format)
This commit is contained in:
Prinz23 2024-08-18 05:43:52 +01:00 committed by JackDandy
parent fcf5ccf236
commit f2f39568dd
7 changed files with 36 additions and 20 deletions

View file

@ -1,14 +1,17 @@
function initLazyload(){
$.ll = new LazyLoad({elements_selector:'img[data-original]', callback_load:function(element){
if (element.id) {
var el = document.getElementById('loading-' + element.id), className = 'hide';
if (!!document.body.classList) {
el.classList.add(className);
} else {
el.className += (el.className ? ' ' : '') + className;
}
function hide_lazy_ani (element){
if (element.id) {
var el = document.getElementById('loading-' + element.id), className = 'hide';
if (!!document.body.classList) {
el.classList.add(className);
} else {
el.className += (el.className ? ' ' : '') + className;
}
}});
}
}
function initLazyload(){
$.ll = new LazyLoad({elements_selector:'img[data-original]', callback_load: hide_lazy_ani,
callback_error: hide_lazy_ani});
$.ll.handleScroll();
return !0;
}

View file

@ -1148,7 +1148,7 @@ def scantree(path, # type: AnyStr
def copy_file(src_file, dest_file):
if os.name.startswith('posix'):
subprocess.call(['cp', src_file, dest_file])
subprocess.call(['cp', '-f', src_file, dest_file])
else:
shutil.copyfile(src_file, dest_file)

View file

@ -36,9 +36,8 @@ warnings.filterwarnings('ignore', module=r'.*ssl_.*', message='.*SSLContext obje
warnings.filterwarnings('ignore', module=r'.*zoneinfo.*', message='.*file or directory.*')
warnings.filterwarnings('ignore', message='.*deprecated in cryptography.*')
versions = [((3, 8, 2), (3, 8, 19)),
((3, 9, 0), (3, 9, 2)), ((3, 9, 4), (3, 9, 19)),
((3, 10, 0), (3, 12, 5))] # inclusive version ranges
versions = [((3, 9, 0), (3, 9, 2)), ((3, 9, 4), (3, 9, 20)),
((3, 10, 0), (3, 12, 7))] # inclusive version ranges
if not any(list(map(lambda v: v[0] <= sys.version_info[:3] <= v[1], versions))) and not int(os.environ.get('PYT', 0)):
major, minor, micro = sys.version_info[:3]
print('Python %s.%s.%s detected.' % (major, minor, micro))

View file

@ -2475,22 +2475,36 @@ def _save_config(force=False, **kwargs):
backup_config = re.sub(r'\.ini$', '.bak', CONFIG_FILE)
from .config import check_valid_config
try:
if check_valid_config(CONFIG_FILE):
for _t in range(0, 3):
copy_file(CONFIG_FILE, backup_config)
if not check_valid_config(backup_config):
logger.error('config file seams to be invalid, not backing up.')
if 2 > _t:
logger.debug('backup config file seems to be invalid, retrying...')
else:
logger.warning('backup config file seems to be invalid, not backing up.')
backup_config = None
remove_file_perm(backup_config)
2 > _t and time.sleep(3)
else:
break
else:
logger.warning('existing config file is invalid, not backing it up')
backup_config = None
except (BaseException, Exception):
backup_config = None
for _ in range(0, 3):
for _t in range(0, 3):
new_config.write()
if check_valid_config(CONFIG_FILE):
CONFIG_OLD = copy.deepcopy(new_config)
return
logger.warning('saving config file failed, retrying...')
if 2 > _t:
logger.debug('saving config file failed, retrying...')
else:
logger.warning('saving config file failed.')
remove_file_perm(CONFIG_FILE)
time.sleep(3)
2 > _t and time.sleep(3)
# we only get here if the config saving failed multiple times
if None is not backup_config and os.path.isfile(backup_config):

View file

@ -171,7 +171,7 @@ def has_image_ext(filename):
:rtype: bool
"""
try:
if os.path.splitext(filename)[1].lower() in ['.bmp', '.gif', '.jpeg', '.jpg', '.png', '.webp']:
if os.path.splitext(filename)[1].lower() in ['.avif', '.bmp', '.gif', '.jpeg', '.jpg', '.png', '.webp']:
return True
except (BaseException, Exception):
pass

View file

@ -1 +1 @@
3.8.2
3.9.0