pump
This commit is contained in:
parent
75fe25f530
commit
d6d3b65fe4
|
@ -59,6 +59,8 @@ while working on the reencoding portions its operating as a viewer, pumper, basi
|
|||
```
|
||||
## notes
|
||||
```
|
||||
in order to use the pump feature, you need a fifo setup in something like weechat/irsii/etc..
|
||||
PUMPQUEUE: using the q key you can queue up a bunch of ansis to pump, then just press p to fire
|
||||
them off. if there is nothing in the queue then whatever is on the screen will be pumped
|
||||
FIFO: in order to use the pump feature, you need a fifo setup in something like weechat/irsii/etc..
|
||||
if you have one setup, adjust the FIFO_PATH at the top of dr1p4ns1.py
|
||||
```
|
43
dr1p4ns1.py
43
dr1p4ns1.py
|
@ -567,6 +567,7 @@ class dr1p4ns1:
|
|||
class UI:
|
||||
def __init__(self,files=""):
|
||||
self.REMOVED=False
|
||||
self.QUEUE=[]
|
||||
self.files=files
|
||||
self.uis_menu()
|
||||
################################################################################### HUMAN INTERFACE * * * * * * * * * * *
|
||||
|
@ -606,10 +607,10 @@ class UI:
|
|||
#######################################
|
||||
try:
|
||||
while True:
|
||||
B='\x1b[1;94m'; C='\x1b[1;94m'; S='\x1b[1;36m'; M='\x1b[1;92m'; E='\x1b[0m'; R='\x1b[31m'
|
||||
msg=f"{B}[ {C}DR1P {B}] {S}- {B}[ {C}q{S}: {M}quit{S}, {C}c{S}: {M}copy{S}, {C}R{S}: {M}remove{S}, {C}p{S}: {M}pump{S}, "
|
||||
msg+=f"{C}left{S}: {M}previous{S}, {C}right{S}: {M}next {B}] {S}- "
|
||||
msg+=f"{C}filename{S}: {M}{d.filename} {S}- {B}[{C}{index+1}{S}/{C}{len(self.files)}{B}]{E}"
|
||||
B='\x1b[1;94m'; C='\x1b[1;95m'; S='\x1b[1;36m'; M='\x1b[1;92m'; E='\x1b[0m'; R='\x1b[31m'
|
||||
msg=f"{B}[ {C}DR1P {B}] {B}- {B}[ {M}x{B}: {M}exit{B}, {M}c{B}: {M}copy{B}, {M}R{B}: {M}remove{B}, {M}q{B}: {M}pumpqueue{B}, {M}p{B}: {M}pump{B}, "
|
||||
msg+=f"{M}left{B}/{M}right{B}: {M}browse {B}] {B}- "
|
||||
msg+=f"{B}[ {S}pumpqueue{B}: {C}{len(self.QUEUE)} {B}- {S}index{B}: {C}{index+1}{B}/{C}{len(self.files)} {B}- {S}filename{B}: {C}{d.filename} {B}]{E}"
|
||||
if self.REMOVED==True: msg+=f'{R} - FILE REMOVED'
|
||||
print(msg)
|
||||
k = self.getkey()
|
||||
|
@ -625,6 +626,7 @@ class UI:
|
|||
print(f'{C}loading{B}: {S}{self.files[index]}')
|
||||
d=dr1p4ns1(ansifile=self.files[index],width=80,debug=False)
|
||||
decoder=ANSIDecoder(self.files[index],d.width)
|
||||
print('\x1bc')
|
||||
decoder.as_terminal()
|
||||
except:
|
||||
pass
|
||||
|
@ -640,10 +642,11 @@ class UI:
|
|||
print(f'{C}loading{B}: {S}{self.files[index]}')
|
||||
d=dr1p4ns1(ansifile=self.files[index],width=80,debug=False)
|
||||
decoder=ANSIDecoder(self.files[index],d.width)
|
||||
print('\x1bc')
|
||||
decoder.as_terminal()
|
||||
except:
|
||||
pass
|
||||
elif k == 'esc' or k == 'q' or k == 'x':
|
||||
elif k == 'esc' or k == 'x':
|
||||
quit()
|
||||
elif k == 'c':
|
||||
try:
|
||||
|
@ -658,19 +661,37 @@ class UI:
|
|||
except:
|
||||
print(f'{C}{self.files[index]} {M}was not copied')
|
||||
sleep(1)
|
||||
print('\x1bc')
|
||||
decoder.as_terminal()
|
||||
elif k == 'q':
|
||||
self.QUEUE.append(self.files[index])
|
||||
print(f'{C}{self.files[index]} {B}added to pumpqueue')
|
||||
sleep(1)
|
||||
print('\x1bc')
|
||||
decoder.as_terminal()
|
||||
elif k == 'p':
|
||||
PMSG=""
|
||||
try:
|
||||
if FIFO_ENABLED:
|
||||
decoder=ANSIDecoder(self.files[index],d.width)
|
||||
if len(self.QUEUE) > 0:
|
||||
self.QUEUE.reverse()
|
||||
buffer=self.QUEUE[-1]
|
||||
self.QUEUE.pop()
|
||||
self.QUEUE.reverse()
|
||||
decoder=ANSIDecoder(buffer,d.width)
|
||||
PMSG=f'{M}pump: pumped from pumpqueue {C}{self.files[index]} {M}to fifo - {C}{FIFO_PATH}'
|
||||
else:
|
||||
decoder=ANSIDecoder(self.files[index],d.width)
|
||||
PMSG=f'{M}pump: nothing in pumpqueue, pumping from screen {C}{self.files[index]} {M}to fifo - {C}{FIFO_PATH}'
|
||||
decoder.as_irc()
|
||||
print(f'{M}pumping: pumping {C}{self.files[index]} {M}to fifo - {C}{FIFO_PATH}')
|
||||
else:
|
||||
print(f'{M}pumping disabled - fifo not detected in path: {C}{FIFO_PATH}')
|
||||
PMSG=f'{M}pumping disabled - fifo not detected in path: {C}{FIFO_PATH}'
|
||||
except Exception as e:
|
||||
print(f'{M}pumping failed - {e}')
|
||||
sleep(3)
|
||||
PMSG=f'{M}pumping failed - {e}'
|
||||
print('\x1bc')
|
||||
decoder.as_terminal()
|
||||
print(PMSG)
|
||||
|
||||
elif k == 'R':
|
||||
try:
|
||||
if not self.files[index].find('/') == -1:
|
||||
|
@ -687,6 +708,7 @@ class UI:
|
|||
except:
|
||||
print(f'{C}{self.files[index]} {M}was not removed')
|
||||
sleep(3)
|
||||
print('\x1bc')
|
||||
decoder.as_terminal()
|
||||
|
||||
else:
|
||||
|
@ -700,6 +722,7 @@ class UI:
|
|||
break
|
||||
d=dr1p4ns1(ansifile=self.files[index],width=80,debug=False)
|
||||
decoder=ANSIDecoder(self.files[index],d.width)
|
||||
print('\x1bc')
|
||||
decoder.as_terminal()
|
||||
except:
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue