[git fast commit] 03. Jul 2018 - 06:28:52

This commit is contained in:
Sheppy
2018-07-03 06:28:52 +02:00
parent 77352a2d18
commit 78fadd8df6
3 changed files with 38 additions and 31 deletions

View File

@@ -35,12 +35,15 @@ def vpn():
return tmp; return tmp;
def ip(): def ip():
with open(hl_utils.hlpath(IP_LOG)) as f: try:
tmp = f.read() with open(hl_utils.hlpath(IP_LOG)) as f:
if len(tmp) > 20: tmp = f.read()
tmp = hl_utils.color_panel("Public IP: IP6 ",GREEN) if "[" in tmp:
tmp = ' '+tmp tmp = hl_utils.color_panel("Public IP: IP6 ",GREEN)
return tmp; tmp = ' '+tmp
return tmp;
except Exception:
return hl_utils.color_panel("Public IP: No Data",YELLOW)
def battery(): def battery():
if hl_utils.is_laptop(): if hl_utils.is_laptop():
@@ -68,8 +71,8 @@ def bcw():
try: try:
with open(hl_utils.hlpath(BC_WORD_LOG),'r') as f: with open(hl_utils.hlpath(BC_WORD_LOG),'r') as f:
tmp = int(f.read()) tmp = int(f.read())
string = "{} of 6000 words".format(tmp) string = "{} words".format(tmp)
return hl_utils.color_panel(string,hl_utils.get_color(tmp,0,6000,reverse=False)) return hl_utils.color_panel(string,hl_utils.get_color(tmp,0,12000,reverse=False))
except: except:
return "" return ""
def bwp(): def bwp():

View File

@@ -172,30 +172,34 @@ def pr_acct_status():
f.write(out) f.write(out)
def bc_words(): def bc_words():
try:
with open(hl_utils.hlpath(BC_WORD_LOG),'w') as g: with open(hl_utils.hlpath(BC_WORD_LOG),'w') as g:
tmp = hl_utils.shexec("wc -w {}".format(hl_utils.hlpath(".bctext",use_hostname=False))) tmp = len(hl_utils.shexec("pdftotext {} -".format(\
tmp = tmp.split()[0] hl_utils.hlpath(".bcpdf",use_hostname=False))).split(" "))
g.write(tmp) g.write(str(tmp))
except subprocess.CalledProcessError:
pass
def bc_pages(): def bc_pages():
hl_utils.shexec("pandoc {} -o {}".format(\ try:
hl_utils.hlpath(".bctext",use_hostname=False),\ arr = hl_utils.shexec("pdftk {} dump_data".format(\
hl_utils.hlpath("test.pdf",use_hostname=False))) hl_utils.hlpath(".bcpdf",use_hostname=False)))
arr = hl_utils.shexec("pdftk {} dump_data".format(\ arr = arr.split("\n")
hl_utils.hlpath("test.pdf",use_hostname=False))) lol = "lolcannon"
arr = arr.split("\n") for el in arr:
lol = "lolcannon" if "NumberOfPages" in el:
for el in arr: try:
if "NumberOfPages" in el: with open(hl_utils.hlpath(BC_PAGE_LOG),'r') as f:
try: if int(f.read()) == int(el):
with open(hl_utils.hlpath(BC_PAGE_LOG),'r') as f: break
if int(f.read()) == int(el): except:
break pass
except: lol = el
pass break
lol = el with open(hl_utils.hlpath(BC_PAGE_LOG),"w") as g:
break g.write(el.split()[1])
with open(hl_utils.hlpath(BC_PAGE_LOG),"w") as g: except subprocess.CalledProcessError:
g.write(el.split()[1]) pass
def vpn_status(): def vpn_status():
if not hl_utils.is_cip(): if not hl_utils.is_cip():

View File

@@ -12,7 +12,7 @@ show_program_path=1
highlight_base_name=0 highlight_base_name=0
highlight_megabytes=1 highlight_megabytes=1
highlight_threads=1 highlight_threads=1
tree_view=0 tree_view=1
header_margin=1 header_margin=1
detailed_cpu_time=0 detailed_cpu_time=0
cpu_count_from_zero=0 cpu_count_from_zero=0