better progress bar in wrapper
This commit is contained in:
parent
c74faba092
commit
3e00bf9a05
15
URLs.py
15
URLs.py
|
@ -91,30 +91,17 @@ def wrapper():
|
|||
"""
|
||||
Example wrapper
|
||||
"""
|
||||
from alive_progress import alive_bar
|
||||
with alive_bar(4) as bar:
|
||||
bar.text("Reading provider file...")
|
||||
try:
|
||||
with open("provider") as file:
|
||||
prov = file.read()
|
||||
except Exception:
|
||||
prov = "tiny.cc"
|
||||
bar()
|
||||
bar.text("Setting up instance...")
|
||||
datums = URL(provider=prov) #create instance
|
||||
time.sleep(0.1)
|
||||
bar()
|
||||
bar.text("Getting URL...")
|
||||
datums.GetURL((1,25)) #get a random url with a length from 1 to 6
|
||||
time.sleep(0.1)
|
||||
bar()
|
||||
bar.text("Getting redirect...")
|
||||
print(f"Pinging URL {datums.url}") #you can also modify datums.url, you can use that for tracker stuff (just make a wrapper that changes this variable as necessary instead of running GetURL())
|
||||
datums.GetDownload() #download the url
|
||||
bar()
|
||||
bar.text("Writing to file...")
|
||||
datums.WriteFile() #write to json file
|
||||
time.sleep(0.1)
|
||||
|
||||
main = wrapper
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import subprocess, URLs
|
||||
from alive_progress import alive_bar
|
||||
import subprocess, URLs, sys
|
||||
print("Infinitely running the file. (To stop this, add a file called \"sotp\" in the working directory.)")
|
||||
with alive_bar() as bar:
|
||||
while True:
|
||||
try:
|
||||
open("sotp")
|
||||
|
@ -14,3 +16,4 @@ while True:
|
|||
print("NonexistentUrl - %s"%ename)
|
||||
except Exception as ename:
|
||||
print(f"Error - {ename}")
|
||||
bar()
|
||||
|
|
Loading…
Reference in New Issue