This commit is contained in:
decoded
2023-03-28 20:22:01 -05:00
parent b2b8f7381c
commit 803f642315
2 changed files with 38 additions and 18 deletions

File diff suppressed because one or more lines are too long

View File

@@ -206,7 +206,10 @@ class dr1p4ns1:
f=open('log','w')
f.write(f'{s}\n')
f.close()
f=open(s,'rb')
try:
f=open(s,'rb')
except:
f=open(s[0],'rb')
self.ansifile=f.read().decode('cp437')
f.close()
############################################################################################################### DEBUGGING
@@ -516,16 +519,19 @@ class dr1p4ns1:
print("ERROR: sauce.width has 0 value, defaulting to 80 width")
self.width=80
offset=len("SAUCE")
self.sauce_version=str(int(self.sauce[offset:offset+2].strip()))
offset+=2
self.sauce_title=self.sauce[offset:offset+35].strip()
offset+=35
self.sauce_title=self.sauce[offset:offset+20].strip()
offset+=20
self.sauce_group=self.sauce[offset:offset+20].strip()
offset+=20
self.sauce_date=self.sauce[offset:offset+8].strip()
offset+=8
try:
self.sauce_version=str(int(self.sauce[offset:offset+2].strip()))
offset+=2
self.sauce_title=self.sauce[offset:offset+35].strip()
offset+=35
self.sauce_title=self.sauce[offset:offset+20].strip()
offset+=20
self.sauce_group=self.sauce[offset:offset+20].strip()
offset+=20
self.sauce_date=self.sauce[offset:offset+8].strip()
offset+=8
except:
pass
#################################################################################################################### TOOL
def findall(self,s,w):
return [i for i in range(len(s)) if s.startswith(w, i)]
@@ -658,6 +664,10 @@ class UI:
try:
self.REMOVED=False
if len(self.files) == 0:
try:
del(dr1p4ns1.AUTOQUEUE)
except:
pass
print(f'{B}NO FILES LEFT IN QUEUE - {R} EXITING')
sleep(1)
break
@@ -771,9 +781,12 @@ class UI:
try:
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[-1]}')
except:
break
pass
sleep(N)
dr1p4ns1.AUTOQUEUE[0]+=1
try:
dr1p4ns1.AUTOQUEUE[0]+=1
except:
pass
else:
flag_done=True
print(f'{B}NO FILES LEFT IN QUEUE - {R} EXITING')
@@ -792,6 +805,10 @@ class UI:
decoder=ANSIDecoder(buffer_filename,buffer_width)
PMSG=f'{M}pump: pumped from pumpqueue {C}{self.files[index]} {M}to fifo - {C}{FIFO_PATH}'
else:
try:
del(dr1p4ns1.AUTOQUEUE)
except:
pass
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()
@@ -895,6 +912,8 @@ class ANSIDecoder:
self.width = width
self.strict = False
self.filename=files
if not type(self.filename)==str:
self.filename=self.filename[0]
print(self.filename)
try:
stream=open(self.filename,'rt',encoding='cp437')
@@ -1249,7 +1268,7 @@ class ANSIDecoder:
def getkeythreaded(self):
tty.setcbreak(sys.stdin.fileno())
try:
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)} {dr1p4ns1.AUTOQUEUE[0]+1}{dr1p4ns1._rgb(155,155,155)}/{dr1p4ns1._rgb(200,200,200)}{dr1p4ns1.AUTOQUEUE[1]+1}{dr1p4ns1._rgb(155,155,155)}')
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)} {dr1p4ns1.AUTOQUEUE[0]+1}{dr1p4ns1._rgb(155,155,155)}/{dr1p4ns1._rgb(200,200,200)}{dr1p4ns1.AUTOQUEUE[1]}{dr1p4ns1._rgb(155,155,155)}')
except:
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)}')
b = os.read(sys.stdin.fileno(), 3).decode()
@@ -1273,9 +1292,12 @@ class ANSIDecoder:
break
if SHOW_FILENAME:
try:
self.fifo(f"\x0315FILENAME\x0314: \x0315{self.filename.split('/')[-1]} \x0314- \x0315DR1P4NS1\x0314:\x0315 {DR1P_VERSION}\x0314 - \x0315{dr1p4ns1.AUTOQUEUE[0]+1}\x0314/\x0315{dr1p4ns1.AUTOQUEUE[1]+1}")
self.fifo(f"\x0315FILENAME\x0314: \x0315{self.filename.split('/')[-1]} \x0314- \x0315DR1P4NS1\x0314:\x0315 {DR1P_VERSION}\x0314 - \x0315{dr1p4ns1.AUTOQUEUE[0]+1}\x0314/\x0315{dr1p4ns1.AUTOQUEUE[1]}")
except:
self.fifo(f"\x0315FILENAME\x0314: \x0315{self.filename.split('/')[-1]} \x0314- \x0315DR1P4NS1\x0314:\x0315 {DR1P_VERSION}\x0314")
try:
self.fifo(f"\x0315FILENAME\x0314: \x0315{self.filename.split('/')[-1]} \x0314- \x0315DR1P4NS1\x0314:\x0315 {DR1P_VERSION}\x0314")
except:
self.fifo(f"\x0315FILENAME\x0314: \x0315{self.filename[0].split('/')[-1]} \x0314- \x0315DR1P4NS1\x0314:\x0315 {DR1P_VERSION}\x0314")
try:
x._stop()
except: