From 69a128bed130f83aadcbdebb4b5d9446686d588a Mon Sep 17 00:00:00 2001 From: Boyuan Yang <073plan@gmail.com> Date: Fri, 11 May 2018 10:54:52 +0800 Subject: Fix typo found by codespell --- res/script/download.py | 36 ++++++++++++++++++------------------ res/script/system.py | 4 ++-- 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'res/script') diff --git a/res/script/download.py b/res/script/download.py index d274cc5..8a5a815 100644 --- a/res/script/download.py +++ b/res/script/download.py @@ -4,9 +4,9 @@ download the directory 13/09/04 kingson * add this changelog - + Notes: - 1. make sure the path is empty, otherwise mkdir complain and stoped + 1. make sure the path is empty, otherwise mkdir complain and stopped 2. the time for sleep() varies dependent on sites 3. tested for FireBird BBS only Bugs: @@ -27,7 +27,7 @@ wait_time = 2.0 def txt2html(txt): txt=string.replace(txt,"\n","\n
") return string.replace(txt," "," ") - + def upper_dir(path): if(sys.platform=="win32"): # '\' for win32 i=path.rfind("\\",0,-1) @@ -49,16 +49,16 @@ def write_html_header(hfile, num): """) hfile.write("") hfile.write("

FQTerm Article Downloader

") - txt="""

Prevoius - Index + txt="""

Prevoius + Index Next

""" % (num-1,num+1) hfile.write(txt) hfile.write("

\n") def write_html_ender(hfile,num): hfile.write("

") - txt="""

Prevoius - Index + txt="""

Prevoius + Index Next

""" % (num-1,num+1) hfile.write(txt) hfile.write("

FQTerm --- BBS client based on Qt library

") @@ -97,7 +97,7 @@ def get_list_num(str_line): # wrong format return None else: - return str_line[matchobj.start():matchobj.end()] + return str_line[matchobj.start():matchobj.end()] def get_list_categary(str_line): # get the categary @@ -121,9 +121,9 @@ def down_folder(): global path first_num = -1 while(1): - line=fqterm.caretY(lp) + line=fqterm.caretY(lp) str_line=fqterm.getText(lp,line) - + article_num = get_list_num(str_line) if (first_num == -1): first_num = article_num @@ -133,15 +133,15 @@ def down_folder(): f=open(path+"index.html","a+") write_index_ender(f) f.close() - # wrong formated list, leave out + # wrong formatted list, leave out print "leave %s" % path fqterm.sendString(lp,'q') path=upper_dir(path) time.sleep(wait_time) - return + return article_categary = get_list_categary(str_line) - article_title = get_list_title(str_line) + article_title = get_list_title(str_line) # download if its file if article_categary == '[文件]': @@ -188,12 +188,12 @@ def down_folder(): f=open(path+"index.html","a+") write_index_ender(f) f.close() - # wrong formated list, leave out + # wrong formatted list, leave out print "leave %s" % path fqterm.sendString(lp,'q') path=upper_dir(path) time.sleep(wait_time) - return + return str_next=fqterm.getText(lp,line+1) # move cursor down and get the num fqterm.sendString(lp,'j') @@ -206,12 +206,12 @@ def down_folder(): f=open(path+"index.html","a+") write_index_ender(f) f.close() - # wrong formated list, leave out + # wrong formatted list, leave out print "leave %s" % path fqterm.sendString(lp,'q') path=upper_dir(path) time.sleep(wait_time) - return + return # exit current dir when the number of the next one equals or small then last # this may cause problem when the server is extra slow if(int(article_num_next) <= int(article_num)): @@ -237,7 +237,7 @@ path_dir=path="/home/dp2/temp/test/" os.makedirs(path) # enter -fqterm.sendString(lp,'x') +fqterm.sendString(lp,'x') time.sleep(wait_time) # create index.html and write the header f=open(path+"index.html","w") diff --git a/res/script/system.py b/res/script/system.py index 5305995..70f9c51 100644 --- a/res/script/system.py +++ b/res/script/system.py @@ -23,8 +23,8 @@ def previewYTHT(lp): return if re.search('http://ytht.net/Ytht.Net' \ '(\S+)/con\?B=(\d+)&F=M\.(\d+)\.A', URL) != None: - # ytht artical URL - print 'Analizing ytht artical URL' + # ytht article URL + print 'Analizing ytht article URL' f_con = urllib.urlopen(URL) con = f_con.read() f_con.close() -- cgit v1.2.3