-
Notifications
You must be signed in to change notification settings - Fork 0
/
tools.py
47 lines (35 loc) · 894 Bytes
/
tools.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# __author__ = 'ames0k0'
import sys
from os import system
from time import sleep
from wget import download
from subprocess import Popen
from multiprocessing import Pool
from docs.config import DEFAULT_IMAGE_VIEWER
def fastprint(string):
"""Print chars
"""
for char in string + '\n':
sys.stdout.write(char)
sys.stdout.flush()
sleep(1./30)
def multi(photo):
"""multiprocessing
"""
pool = Pool()
pool.map(download, photo)
pool.close()
pool.join()
def termin(sec, photo):
"""Open and Close pictures
"""
viewer = Popen([DEFAULT_IMAGE_VIEWER, photo])
sleep(sec)
viewer.terminate()
viewer.kill()
def reset_terminal():
# https://stackoverflow.com/questions/
# 17682934/linux-terminal-typing-feedback-gone-line-breaks-not-displayed
system('reset')