3.9 python finally removed unescape

This commit is contained in:
q
2021-10-16 20:59:30 +03:00
parent 94baa22650
commit 47211f84dc

View File

@@ -19,7 +19,7 @@ import sys,os
import re import re
import urllib import urllib
import urllib.parse import urllib.parse
from html.parser import HTMLParser from html import unescape
import shutil import shutil
import csv import csv
import subprocess import subprocess
@@ -184,15 +184,14 @@ def getpathlist(path,options=False):
def pathscript(path,list): def pathscript(path,list):
''' Returns the javascript string of pathlist and pathimage arrays ''' ''' Returns the javascript string of pathlist and pathimage arrays '''
scrstr = '<script language="javascript">var pathlist=[' scrstr = '<script language="javascript">var pathlist=['
parser = HTMLParser()
elements = [] elements = []
for p in list: for p in list:
imglist = getimagelist(os.path.join(path,p)) imglist = getimagelist(os.path.join(path,p))
pathlist = getpathlist(os.path.join(path,p)) pathlist = getpathlist(os.path.join(path,p))
this_str = '{ name:"'+ parser.unescape(p) + '", ' this_str = '{ name:"'+ unescape(p) + '", '
this_str += 'size:' + str(len(imglist) + len(pathlist)) + ', ' this_str += 'size:' + str(len(imglist) + len(pathlist)) + ', '
if len(imglist) > 0: if len(imglist) > 0:
this_str += 'image:"'+parser.unescape(p) + '/.tn/'+parser.unescape(imglist[0]) + '.jpg"}' this_str += 'image:"'+unescape(p) + '/.tn/'+unescape(imglist[0]) + '.jpg"}'
else: else:
this_str += 'image:"" }' this_str += 'image:"" }'
elements.append(this_str) elements.append(this_str)
@@ -456,9 +455,6 @@ def sizestring(size):
size /= 1024.0 size /= 1024.0
def unescape(s):
return HTMLParser().unescape(s)
def natural_sort_key(s, _nsre=re.compile('([0-9]+)')): def natural_sort_key(s, _nsre=re.compile('([0-9]+)')):
''' Natural sort / Claudiu@Stackoverflow ''' ''' Natural sort / Claudiu@Stackoverflow '''