mirror of
https://github.com/mrfluffy-dev/hart-cli.git
synced 2026-01-17 01:40:33 +00:00
Update hart-cli.py
This commit is contained in:
58
hart-cli.py
58
hart-cli.py
@@ -38,6 +38,8 @@ def get_new_urls():
|
||||
global links_preview
|
||||
global links_arr_preview
|
||||
|
||||
os.system("clear")
|
||||
|
||||
links_arr_full.clear
|
||||
links_arr_preview.clear
|
||||
|
||||
@@ -63,6 +65,7 @@ def next():
|
||||
global item
|
||||
global page_num
|
||||
|
||||
os.system("clear")
|
||||
if item != len(links_arr_preview)-1:
|
||||
item += 1
|
||||
else:
|
||||
@@ -75,6 +78,7 @@ def previous():
|
||||
global page_num
|
||||
global links_arr_preview
|
||||
|
||||
os.system("clear")
|
||||
if item != 1:
|
||||
item -= 1
|
||||
else:
|
||||
@@ -93,6 +97,7 @@ def download():
|
||||
name = str(name)+".jpg"
|
||||
command = "curl -s -o " + download_path + "/" + name + " " + links_arr_full[item]
|
||||
os.system(command)
|
||||
os.system("clear")
|
||||
|
||||
get_new_urls()
|
||||
|
||||
@@ -112,7 +117,7 @@ while True:
|
||||
if choice == "n":
|
||||
next()
|
||||
elif choice == "p":
|
||||
previus()
|
||||
previous()
|
||||
elif choice == "d":
|
||||
download()
|
||||
elif choice == "c":
|
||||
@@ -125,54 +130,3 @@ while True:
|
||||
print("invaled awnser")
|
||||
exit(0)
|
||||
|
||||
|
||||
if item != 1:
|
||||
item-=1
|
||||
os.system('clear')
|
||||
else:
|
||||
page_num-=1
|
||||
get_new_urls()
|
||||
item= len(links_arr_preview)-1
|
||||
os.system('clear')
|
||||
|
||||
def download():
|
||||
global item
|
||||
global links_arr_full
|
||||
global download_path
|
||||
command = 'echo ' + links_arr_full[item] + ' | cut -d "%" -f 2 |cut -b 3-8'
|
||||
name = subprocess.check_output(command, shell=True, text=True, encoding='utf_8')
|
||||
name = name.strip('\n')
|
||||
name = str(name)+".jpg"
|
||||
command = "curl -s -o " + download_path + "/" + name + " " + links_arr_full[item]
|
||||
os.system(command)
|
||||
os.system('clear')
|
||||
|
||||
get_new_urls()
|
||||
|
||||
while True:
|
||||
command = "curl -s -o /tmp/hart-preview.jpg " + links_arr_preview[item]
|
||||
os.system(command)
|
||||
command = "convert /tmp/hart-preview.jpg -resize 500x500 /tmp/hart-preview.jpg"
|
||||
os.system(command)
|
||||
command = "kitty +icat --place 100x100@0x0 /tmp/hart-preview.jpg"
|
||||
os.system(command)
|
||||
print("next:\t\tn")
|
||||
print("previous:\tp")
|
||||
print("download:\td")
|
||||
print("copy URL:\tc")
|
||||
print("quit:\t\tq")
|
||||
choice= input()
|
||||
if choice == "n":
|
||||
next()
|
||||
elif choice == "p":
|
||||
previus()
|
||||
elif choice == "d":
|
||||
download()
|
||||
elif choice == "c":
|
||||
clip.copy(links_arr_full[item])
|
||||
os.system('clear')
|
||||
elif choice == "q":
|
||||
os.system('clear')
|
||||
exit()
|
||||
else:
|
||||
print("invaled awnser")
|
||||
|
||||
Reference in New Issue
Block a user