From eb43dc10d839bf569da593583e8ae84cd48394a3 Mon Sep 17 00:00:00 2001 From: decoded Date: Sun, 26 Mar 2023 23:05:43 -0500 Subject: [PATCH] update --- README.md | 9 +++++++++ dr1p4ns1.py | 24 +++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 4c3eb08..8639784 100644 --- a/README.md +++ b/README.md @@ -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. - **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 +## 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 ``` - ! fixed two autopump bugs diff --git a/dr1p4ns1.py b/dr1p4ns1.py index d94ad34..0978856 100644 --- a/dr1p4ns1.py +++ b/dr1p4ns1.py @@ -1,5 +1,6 @@ -########################################################################################### dr1p4ns1 version 2.668 ##### SOF +########################################################################################### dr1p4ns1 version 2.700 ##### SOF #################################################################################################### ####################### + import os import random import shutil @@ -57,7 +58,7 @@ DELETE_PATH = "/tmp" FLOODRATE_INTERVAL_SECONDS = 0.125 ##### global SHOW_FILENAME ##### 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 for r in ((' ',''),('\_',' ')): 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 asc2uni=dict(zip([i for i in range(128,256)],[ord(c) for c in asc_table])) ############################################################################################################ LOOKUP TABLE @@ -736,7 +739,7 @@ class UI: flag_done=False if len(self.QUEUE)==0: 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) else: print(f'{R} autopumping from pump queue') @@ -744,18 +747,21 @@ class UI: while not flag_done: if len(self.QUEUE) > 0: print('\x1bc') - d=dr1p4ns1(ansifile=self.QUEUE[0][0],width=self.QUEUE[-1][1],debug=False) - decoder=ANSIDecoder(self.QUEUE[0][0],d.width) + dr1p4ns1.filename=self.QUEUE[-1]; + dr1p4ns1.getsauce(dr1p4ns1) + d=dr1p4ns1(ansifile=self.QUEUE[0],width=dr1p4ns1.width,debug=False) + decoder=ANSIDecoder(self.QUEUE[0],d.width) decoder.as_terminal() self.QUEUE.reverse() - buffer_filename, buffer_width=self.QUEUE[-1] + buffer_filename=self.QUEUE[-1] + buffer_width=dr1p4ns1.width self.QUEUE.pop() self.QUEUE.reverse() decoder=ANSIDecoder(buffer_filename,buffer_width) decoder.as_irc() N=random.randint(5,10) 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: break sleep(N) @@ -1233,7 +1239,7 @@ class ANSIDecoder: ######################################################################################################################### def getkeythreaded(self): 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() if len(b) == 3: k = ord(b[2]) @@ -1254,7 +1260,7 @@ class ANSIDecoder: DID_I_ABORT=True break 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: x._stop() except: