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