This commit is contained in:
decoded
2023-03-26 23:05:43 -05:00
parent 5d04f02627
commit eb43dc10d8
2 changed files with 24 additions and 9 deletions

View File

@@ -60,6 +60,15 @@ ansi files can be queued so that when you pump they are being sent in a sequenti
them off. if there is nothing in the queue then whatever is on the screen will be pumped to fifo. them off. if there is nothing in the queue then whatever is on the screen will be pumped to fifo.
- **FIFO:** in order to use the pump feature, you need a fifo setup in something like weechat/irsii/etc.. - **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 if you have one setup, adjust the FIFO_PATH at the top of dr1p4ns1.py
## changelog - v2.700
```
- ! fixed autopump of full directory index if no files are in pumpqueue
- ? added more subtle coloring for prompts showing filename, abort pump locally and filename at the end of pump if enabled
```
## changelog - v2.669
```
- ! fixed auto-width and autopump queue filename bugs
```
## changelog - v2.668 ## changelog - v2.668
``` ```
- ! fixed two autopump bugs - ! fixed two autopump bugs

View File

@@ -1,5 +1,6 @@
########################################################################################### dr1p4ns1 version 2.668 ##### SOF ########################################################################################### dr1p4ns1 version 2.700 ##### SOF
#################################################################################################### ####################### #################################################################################################### #######################
import os import os
import random import random
import shutil import shutil
@@ -57,7 +58,7 @@ DELETE_PATH = "/tmp"
FLOODRATE_INTERVAL_SECONDS = 0.125 ##### FLOODRATE_INTERVAL_SECONDS = 0.125 #####
global SHOW_FILENAME ##### global SHOW_FILENAME #####
SHOW_FILENAME=True ##### SHOW_FILENAME=True #####
DR1P_VERSION="2.668 - 03/26/23 - https://git.tcp.direct/decoded/dr1p4ns1" ##### DR1P_VERSION="2.700 - last updated: 03/26/23 - https://git.tcp.direct/decoded/dr1p4ns1" #####
#################################################################################################### ####################### #################################################################################################### #######################
#################################################################################################### ####################### #################################################################################################### #######################
##### #####
@@ -151,6 +152,8 @@ class dr1p4ns1:
##################################################################################################### ASCII TABLE CLEANUP ##################################################################################################### ASCII TABLE CLEANUP
for r in ((' ',''),('\_',' ')): for r in ((' ',''),('\_',' ')):
asc_table_full=asc_table_full.replace(*r) asc_table_full=asc_table_full.replace(*r)
########################################################################################## RGB TERMINAL ESCAPE COLORCODES
def _rgb(r=0,g=0,b=0):return f"\033[38;2;{r};{g};{b}m"
############################################################################################################ LOOKUP TABLE ############################################################################################################ LOOKUP TABLE
asc2uni=dict(zip([i for i in range(128,256)],[ord(c) for c in asc_table])) asc2uni=dict(zip([i for i in range(128,256)],[ord(c) for c in asc_table]))
############################################################################################################ LOOKUP TABLE ############################################################################################################ LOOKUP TABLE
@@ -736,7 +739,7 @@ class UI:
flag_done=False flag_done=False
if len(self.QUEUE)==0: if len(self.QUEUE)==0:
self.QUEUE=self.files self.QUEUE=self.files
print(f'{R} pumpqueue empty: autopumping from directory index') print(f'\n{dr1p4ns1._rgb(55,55,55)}pumpqueue empty{dr1p4ns1._rgb(155,155,155)}:{dr1p4ns1._rgb(55,55,55)} autopumping from directory index{dr1p4ns1._rgb(155,155,155)}: {dr1p4ns1._rgb(55,55,55)}{sys.argv[1]}')
sleep(1) sleep(1)
else: else:
print(f'{R} autopumping from pump queue') print(f'{R} autopumping from pump queue')
@@ -744,18 +747,21 @@ class UI:
while not flag_done: while not flag_done:
if len(self.QUEUE) > 0: if len(self.QUEUE) > 0:
print('\x1bc') print('\x1bc')
d=dr1p4ns1(ansifile=self.QUEUE[0][0],width=self.QUEUE[-1][1],debug=False) dr1p4ns1.filename=self.QUEUE[-1];
decoder=ANSIDecoder(self.QUEUE[0][0],d.width) dr1p4ns1.getsauce(dr1p4ns1)
d=dr1p4ns1(ansifile=self.QUEUE[0],width=dr1p4ns1.width,debug=False)
decoder=ANSIDecoder(self.QUEUE[0],d.width)
decoder.as_terminal() decoder.as_terminal()
self.QUEUE.reverse() self.QUEUE.reverse()
buffer_filename, buffer_width=self.QUEUE[-1] buffer_filename=self.QUEUE[-1]
buffer_width=dr1p4ns1.width
self.QUEUE.pop() self.QUEUE.pop()
self.QUEUE.reverse() self.QUEUE.reverse()
decoder=ANSIDecoder(buffer_filename,buffer_width) decoder=ANSIDecoder(buffer_filename,buffer_width)
decoder.as_irc() decoder.as_irc()
N=random.randint(5,10) N=random.randint(5,10)
try: try:
print(f'{C}SLEEPING {M}{N}{C} SECONDS BEFORE NEXT AUTOPUMP: {self.QUEUE[0][0]}') print(f'{dr1p4ns1._rgb(155,155,155)}<<<{dr1p4ns1._rgb(55,55,55)} sleeping {dr1p4ns1._rgb(155,155,155)}{N}{dr1p4ns1._rgb(55,55,55)} seconds before next autopump {dr1p4ns1._rgb(155,155,155)}>>> {dr1p4ns1._rgb(200,200,200)} {self.QUEUE[0]}')
except: except:
break break
sleep(N) sleep(N)
@@ -1233,7 +1239,7 @@ class ANSIDecoder:
######################################################################################################################### #########################################################################################################################
def getkeythreaded(self): def getkeythreaded(self):
tty.setcbreak(sys.stdin.fileno()) tty.setcbreak(sys.stdin.fileno())
print('\x1b[31m<<< PRESS ANY KEY TO ABORT PUMP >>>') print(f'{dr1p4ns1._rgb(55,55,55)}<<<{dr1p4ns1._rgb(155,155,155)} press any key to abort pump {dr1p4ns1._rgb(55,55,55)}>>> {dr1p4ns1._rgb(155,155,155)}-{dr1p4ns1._rgb(200,200,200)} {self.filename}')
b = os.read(sys.stdin.fileno(), 3).decode() b = os.read(sys.stdin.fileno(), 3).decode()
if len(b) == 3: if len(b) == 3:
k = ord(b[2]) k = ord(b[2])
@@ -1254,7 +1260,7 @@ class ANSIDecoder:
DID_I_ABORT=True DID_I_ABORT=True
break break
if SHOW_FILENAME: if SHOW_FILENAME:
self.fifo(f"\x035FILENAME\x034: \x035{self.filename.split('/')[-1]} \x034- \x035DR1P4NS1\x034:\x035 {DR1P_VERSION}") self.fifo(f"\x0315FILENAME\x0314: \x0315{self.filename.split('/')[-1]} \x0314- \x0315DR1P4NS1\x0314:\x0315 {DR1P_VERSION}")
try: try:
x._stop() x._stop()
except: except: